hostapd: include the madwifi headers in the package directory to avoid compile breaka...
[openwrt.git] / package / network / services / hostapd / madwifi / net80211 / ieee80211_ioctl.h
1 /*-
2  * Copyright (c) 2001 Atsushi Onoe
3  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission.
16  *
17  * Alternatively, this software may be distributed under the terms of the
18  * GNU General Public License ("GPL") version 2 as published by the Free
19  * Software Foundation.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * $Id: ieee80211_ioctl.h 3314 2008-01-30 23:50:16Z mtaylor $
33  */
34 #ifndef _NET80211_IEEE80211_IOCTL_H_
35 #define _NET80211_IEEE80211_IOCTL_H_
36
37 /*
38  * IEEE 802.11 ioctls.
39  */
40 #include <net80211/_ieee80211.h>
41 #include <net80211/ieee80211.h>
42 #include <net80211/ieee80211_crypto.h>
43
44 /*
45  * Per/node (station) statistics available when operating as an AP.
46  */
47 struct ieee80211_nodestats {
48         u_int32_t ns_rx_data;           /* rx data frames */
49         u_int32_t ns_rx_mgmt;           /* rx management frames */
50         u_int32_t ns_rx_ctrl;           /* rx control frames */
51         u_int32_t ns_rx_ucast;          /* rx unicast frames */
52         u_int32_t ns_rx_mcast;          /* rx multi/broadcast frames */
53         u_int64_t ns_rx_bytes;          /* rx data count (bytes) */
54         u_int64_t ns_rx_beacons;                /* rx beacon frames */
55         u_int32_t ns_rx_proberesp;      /* rx probe response frames */
56
57         u_int32_t ns_rx_dup;            /* rx discard because it's a dup */
58         u_int32_t ns_rx_noprivacy;      /* rx w/ wep but privacy off */
59         u_int32_t ns_rx_wepfail;                /* rx wep processing failed */
60         u_int32_t ns_rx_demicfail;      /* rx demic failed */
61         u_int32_t ns_rx_decap;          /* rx decapsulation failed */
62         u_int32_t ns_rx_defrag;         /* rx defragmentation failed */
63         u_int32_t ns_rx_disassoc;       /* rx disassociation */
64         u_int32_t ns_rx_deauth;         /* rx deauthentication */
65         u_int32_t ns_rx_decryptcrc;     /* rx decrypt failed on crc */
66         u_int32_t ns_rx_unauth;         /* rx on unauthorized port */
67         u_int32_t ns_rx_unencrypted;    /* rx unecrypted w/ privacy */
68
69         u_int32_t ns_tx_data;           /* tx data frames */
70         u_int32_t ns_tx_mgmt;           /* tx management frames */
71         u_int32_t ns_tx_ucast;          /* tx unicast frames */
72         u_int32_t ns_tx_mcast;          /* tx multi/broadcast frames */
73         u_int64_t ns_tx_bytes;          /* tx data count (bytes) */
74         u_int32_t ns_tx_probereq;       /* tx probe request frames */
75         u_int32_t ns_tx_uapsd;          /* tx on uapsd queue */
76
77         u_int32_t ns_tx_novlantag;      /* tx discard due to no tag */
78         u_int32_t ns_tx_vlanmismatch;   /* tx discard due to of bad tag */
79
80         u_int32_t ns_tx_eosplost;       /* uapsd EOSP retried out */
81
82         u_int32_t ns_ps_discard;                /* ps discard due to of age */
83
84         u_int32_t ns_uapsd_triggers;    /* uapsd triggers */
85
86         /* MIB-related state */
87         u_int32_t ns_tx_assoc;          /* [re]associations */
88         u_int32_t ns_tx_assoc_fail;     /* [re]association failures */
89         u_int32_t ns_tx_auth;           /* [re]authentications */
90         u_int32_t ns_tx_auth_fail;      /* [re]authentication failures*/
91         u_int32_t ns_tx_deauth;         /* deauthentications */
92         u_int32_t ns_tx_deauth_code;    /* last deauth reason */
93         u_int32_t ns_tx_disassoc;       /* disassociations */
94         u_int32_t ns_tx_disassoc_code;  /* last disassociation reason */
95         u_int32_t ns_psq_drops;         /* power save queue drops */
96 };
97
98 /*
99  * Summary statistics.
100  */
101 struct ieee80211_stats {
102         u_int32_t is_rx_badversion;     /* rx frame with bad version */
103         u_int32_t is_rx_tooshort;       /* rx frame too short */
104         u_int32_t is_rx_wrongbss;       /* rx from wrong bssid */
105         u_int32_t is_rx_dup;            /* rx discard due to it's a dup */
106         u_int32_t is_rx_wrongdir;       /* rx w/ wrong direction */
107         u_int32_t is_rx_mcastecho;      /* rx discard due to of mcast echo */
108         u_int32_t is_rx_mcastdisabled;  /* rx discard due to of mcast disabled */
109         u_int32_t is_rx_notassoc;       /* rx discard due to sta !assoc */
110         u_int32_t is_rx_noprivacy;      /* rx w/ wep but privacy off */
111         u_int32_t is_rx_unencrypted;    /* rx w/o wep and privacy on */
112         u_int32_t is_rx_wepfail;                /* rx wep processing failed */
113         u_int32_t is_rx_decap;          /* rx decapsulation failed */
114         u_int32_t is_rx_mgtdiscard;     /* rx discard mgt frames */
115         u_int32_t is_rx_ctl;            /* rx discard ctrl frames */
116         u_int32_t is_rx_beacon;         /* rx beacon frames */
117         u_int32_t is_rx_rstoobig;       /* rx rate set truncated */
118         u_int32_t is_rx_elem_missing;   /* rx required element missing*/
119         u_int32_t is_rx_elem_toobig;    /* rx element too big */
120         u_int32_t is_rx_elem_toosmall;  /* rx element too small */
121         u_int32_t is_rx_elem_unknown;   /* rx element unknown */
122         u_int32_t is_rx_badchan;                /* rx frame w/ invalid chan */
123         u_int32_t is_rx_chanmismatch;   /* rx frame chan mismatch */
124         u_int32_t is_rx_nodealloc;      /* rx frame dropped */
125         u_int32_t is_rx_ssidmismatch;   /* rx frame ssid mismatch  */
126         u_int32_t is_rx_auth_unsupported;/* rx w/ unsupported auth alg */
127         u_int32_t is_rx_auth_fail;      /* rx sta auth failure */
128         u_int32_t is_rx_auth_countermeasures;/* rx auth discard due to CM */
129         u_int32_t is_rx_assoc_bss;      /* rx assoc from wrong bssid */
130         u_int32_t is_rx_assoc_notauth;  /* rx assoc w/o auth */
131         u_int32_t is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
132         u_int32_t is_rx_assoc_norate;   /* rx assoc w/ no rate match */
133         u_int32_t is_rx_assoc_badwpaie; /* rx assoc w/ bad WPA IE */
134         u_int32_t is_rx_assoc_badscie;  /* rx assoc w/ bad SC IE */
135         u_int32_t is_rx_deauth;         /* rx deauthentication */
136         u_int32_t is_rx_disassoc;       /* rx disassociation */
137         u_int32_t is_rx_badsubtype;     /* rx frame w/ unknown subtype*/
138         u_int32_t is_rx_nobuf;          /* rx failed for lack of buf */
139         u_int32_t is_rx_decryptcrc;     /* rx decrypt failed on crc */
140         u_int32_t is_rx_ahdemo_mgt;     /* rx discard ahdemo mgt frame*/
141         u_int32_t is_rx_bad_auth;       /* rx bad auth request */
142         u_int32_t is_rx_unauth;         /* rx on unauthorized port */
143         u_int32_t is_rx_badkeyid;       /* rx w/ incorrect keyid */
144         u_int32_t is_rx_ccmpreplay;     /* rx seq# violation (CCMP) */
145         u_int32_t is_rx_ccmpformat;     /* rx format bad (CCMP) */
146         u_int32_t is_rx_ccmpmic;                /* rx MIC check failed (CCMP) */
147         u_int32_t is_rx_tkipreplay;     /* rx seq# violation (TKIP) */
148         u_int32_t is_rx_tkipformat;     /* rx format bad (TKIP) */
149         u_int32_t is_rx_tkipmic;                /* rx MIC check failed (TKIP) */
150         u_int32_t is_rx_tkipicv;                /* rx ICV check failed (TKIP) */
151         u_int32_t is_rx_badcipher;      /* rx failed due to of key type */
152         u_int32_t is_rx_nocipherctx;    /* rx failed due to key !setup */
153         u_int32_t is_rx_acl;            /* rx discard due to of acl policy */
154         u_int32_t is_rx_ffcnt;          /* rx fast frames */
155         u_int32_t is_rx_badathtnl;      /* driver key alloc failed */
156         u_int32_t is_tx_nobuf;          /* tx failed for lack of buf */
157         u_int32_t is_tx_nonode;         /* tx failed for no node */
158         u_int32_t is_tx_unknownmgt;     /* tx of unknown mgt frame */
159         u_int32_t is_tx_badcipher;      /* tx failed due to of key type */
160         u_int32_t is_tx_nodefkey;       /* tx failed due to no defkey */
161         u_int32_t is_tx_noheadroom;     /* tx failed due to no space */
162         u_int32_t is_tx_ffokcnt;                /* tx fast frames sent success */
163         u_int32_t is_tx_fferrcnt;       /* tx fast frames sent success */
164         u_int32_t is_scan_active;       /* active scans started */
165         u_int32_t is_scan_passive;      /* passive scans started */
166         u_int32_t is_node_timeout;      /* nodes timed out inactivity */
167         u_int32_t is_node_fdisassoc;    /* forced node disassociation */
168         u_int32_t is_crypto_nomem;      /* no memory for crypto ctx */
169         u_int32_t is_crypto_tkip;       /* tkip crypto done in s/w */
170         u_int32_t is_crypto_tkipenmic;  /* tkip en-MIC done in s/w */
171         u_int32_t is_crypto_tkipdemic;  /* tkip de-MIC done in s/w */
172         u_int32_t is_crypto_tkipcm;     /* tkip counter measures */
173         u_int32_t is_crypto_ccmp;       /* ccmp crypto done in s/w */
174         u_int32_t is_crypto_wep;                /* wep crypto done in s/w */
175         u_int32_t is_crypto_setkey_cipher;/* cipher rejected key */
176         u_int32_t is_crypto_setkey_nokey;/* no key index for setkey */
177         u_int32_t is_crypto_delkey;     /* driver key delete failed */
178         u_int32_t is_crypto_badcipher;  /* unknown cipher */
179         u_int32_t is_crypto_nocipher;   /* cipher not available */
180         u_int32_t is_crypto_attachfail; /* cipher attach failed */
181         u_int32_t is_crypto_swfallback; /* cipher fallback to s/w */
182         u_int32_t is_crypto_keyfail;    /* driver key alloc failed */
183         u_int32_t is_crypto_enmicfail;  /* en-MIC failed */
184         u_int32_t is_ibss_capmismatch;  /* merge failed-cap mismatch */
185         u_int32_t is_ibss_norate;       /* merge failed-rate mismatch */
186         u_int32_t is_ps_unassoc;                /* ps-poll for unassoc. sta */
187         u_int32_t is_ps_badaid;         /* ps-poll w/ incorrect aid */
188         u_int32_t is_ps_qempty;         /* ps-poll w/ nothing to send */
189 };
190
191 /*
192  * Max size of optional information elements.  We artificially
193  * constrain this; it's limited only by the max frame size (and
194  * the max parameter size of the wireless extensions).
195  */
196 #define IEEE80211_MAX_OPT_IE    256
197
198 /*
199  * WPA/RSN get/set key request.  Specify the key/cipher
200  * type and whether the key is to be used for sending and/or
201  * receiving.  The key index should be set only when working
202  * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
203  * Otherwise a unicast/pairwise key is specified by the bssid
204  * (on a station) or mac address (on an ap).  They key length
205  * must include any MIC key data; otherwise it should be no
206  more than IEEE80211_KEYBUF_SIZE.
207  */
208 struct ieee80211req_key {
209         u_int8_t ik_type;               /* key/cipher type */
210         u_int8_t ik_pad;
211         ieee80211_keyix_t ik_keyix;     /* key index */
212         u_int8_t ik_keylen;             /* key length in bytes */
213         u_int8_t ik_flags;
214 /* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */
215 #define IEEE80211_KEY_DEFAULT   0x80    /* default xmit key */
216         u_int8_t ik_macaddr[IEEE80211_ADDR_LEN];
217         u_int64_t ik_keyrsc;            /* key receive sequence counter */
218         u_int64_t ik_keytsc;            /* key transmit sequence counter */
219         u_int8_t ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
220 };
221
222 /*
223  * Delete a key either by index or address.  Set the index
224  * to IEEE80211_KEYIX_NONE when deleting a unicast key.
225  */
226 struct ieee80211req_del_key {
227         /* NB: This is different to ieee80211_keyix_t, but this is OK as 
228          * values are unique over the low order bits. */
229         u_int8_t idk_keyix;     /* key index */
230         u_int8_t idk_macaddr[IEEE80211_ADDR_LEN];
231 };
232
233 /*
234  * MLME state manipulation request.  IEEE80211_MLME_ASSOC
235  * only makes sense when operating as a station.  The other
236  * requests can be used when operating as a station or an
237  * ap (to effect a station).
238  */
239 struct ieee80211req_mlme {
240         u_int8_t im_op;                 /* operation to perform */
241 #define IEEE80211_MLME_ASSOC            1       /* associate station */
242 #define IEEE80211_MLME_DISASSOC         2       /* disassociate station */
243 #define IEEE80211_MLME_DEAUTH           3       /* deauthenticate station */
244 #define IEEE80211_MLME_AUTHORIZE        4       /* authorize station */
245 #define IEEE80211_MLME_UNAUTHORIZE      5       /* unauthorize station */
246 #define IEEE80211_MLME_CLEAR_STATS      6       /* clear station statistic */
247         u_int8_t im_ssid_len;           /* length of optional ssid */
248         u_int16_t im_reason;            /* 802.11 reason code */
249         u_int8_t im_macaddr[IEEE80211_ADDR_LEN];
250         u_int8_t im_ssid[IEEE80211_NWID_LEN];
251 };
252
253 /* 
254  * MAC ACL operations.
255  */
256 enum {
257         IEEE80211_MACCMD_POLICY_OPEN    = 0,    /* set policy: no ACLs */
258         IEEE80211_MACCMD_POLICY_ALLOW   = 1,    /* set policy: allow traffic */
259         IEEE80211_MACCMD_POLICY_DENY    = 2,    /* set policy: deny traffic */
260         IEEE80211_MACCMD_FLUSH          = 3,    /* flush ACL database */
261         IEEE80211_MACCMD_DETACH         = 4,    /* detach ACL policy */
262 };
263
264 /*
265  * Set the active channel list.  Note this list is
266  * intersected with the available channel list in
267  * calculating the set of channels actually used in
268  * scanning.
269  */
270 struct ieee80211req_chanlist {
271         u_int8_t ic_channels[IEEE80211_CHAN_BYTES];
272 };
273
274 /*
275  * Get the active channel list info.
276  */
277 struct ieee80211req_chaninfo {
278         u_int ic_nchans;
279         struct ieee80211_channel ic_chans[IEEE80211_CHAN_MAX];
280 };
281
282 /*
283  * Retrieve the WPA/RSN information element for an associated station.
284  */
285 struct ieee80211req_wpaie {
286         u_int8_t        wpa_macaddr[IEEE80211_ADDR_LEN];
287         u_int8_t        wpa_ie[IEEE80211_MAX_OPT_IE];
288         u_int8_t        rsn_ie[IEEE80211_MAX_OPT_IE];
289 };
290
291 /*
292  * Retrieve per-node statistics.
293  */
294 struct ieee80211req_sta_stats {
295         union {
296                 /* NB: explicitly force 64-bit alignment */
297                 u_int8_t macaddr[IEEE80211_ADDR_LEN];
298                 u_int64_t pad;
299         } is_u;
300         struct ieee80211_nodestats is_stats;
301 };
302
303 /*
304  * Station information block; the mac address is used
305  * to retrieve other data like stats, unicast key, etc.
306  */
307 struct ieee80211req_sta_info {
308         u_int16_t isi_len;              /* length (mult of 4) */
309         u_int16_t isi_freq;             /* MHz */
310         u_int16_t isi_flags;            /* channel flags */
311         u_int16_t isi_state;            /* state flags */
312         u_int8_t isi_authmode;          /* authentication algorithm */
313         u_int8_t isi_rssi;
314         int8_t isi_noise;
315         u_int16_t isi_capinfo;          /* capabilities */
316         u_int8_t isi_athflags;          /* Atheros capabilities */
317         u_int8_t isi_erp;               /* ERP element */
318         u_int8_t isi_macaddr[IEEE80211_ADDR_LEN];
319         u_int8_t isi_nrates;            /* negotiated rates */
320         u_int8_t isi_rates[IEEE80211_RATE_MAXSIZE];
321         u_int8_t isi_txrate;            /* index to isi_rates[] */
322         u_int16_t isi_ie_len;           /* IE length */
323         u_int16_t isi_associd;          /* assoc response */
324         u_int16_t isi_txpower;          /* current tx power */
325         u_int16_t isi_vlan;             /* vlan tag */
326         u_int16_t isi_txseqs[17];       /* seq to be transmitted */
327         u_int16_t isi_rxseqs[17];       /* seq previous for qos frames*/
328         u_int16_t isi_inact;            /* inactivity timer */
329         u_int8_t isi_uapsd;             /* UAPSD queues */
330         u_int8_t isi_opmode;            /* sta operating mode */
331
332         /* XXX frag state? */
333         /* variable length IE data */
334 };
335
336 enum {
337         IEEE80211_STA_OPMODE_NORMAL,
338         IEEE80211_STA_OPMODE_XR
339 };
340
341 /*
342  * Retrieve per-station information; to retrieve all
343  * specify a mac address of ff:ff:ff:ff:ff:ff.
344  */
345 struct ieee80211req_sta_req {
346         union {
347                 /* NB: explicitly force 64-bit alignment */
348                 u_int8_t macaddr[IEEE80211_ADDR_LEN];
349                 u_int64_t pad;
350         } is_u;
351         struct ieee80211req_sta_info info[1];   /* variable length */
352 };
353
354 /*
355  * Get/set per-station tx power cap.
356  */
357 struct ieee80211req_sta_txpow {
358         u_int8_t        it_macaddr[IEEE80211_ADDR_LEN];
359         u_int8_t        it_txpow;
360 };
361
362 /*
363  * WME parameters are set and return using i_val and i_len.
364  * i_val holds the value itself.  i_len specifies the AC
365  * and, as appropriate, then high bit specifies whether the
366  * operation is to be applied to the BSS or ourself.
367  */
368 #define IEEE80211_WMEPARAM_SELF 0x0000          /* parameter applies to self */
369 #define IEEE80211_WMEPARAM_BSS  0x8000          /* parameter applies to BSS */
370 #define IEEE80211_WMEPARAM_VAL  0x7fff          /* parameter value */
371
372 /*
373  * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.
374  */
375 struct ieee80211req_scan_result {
376         u_int16_t isr_len;              /* length (mult of 4) */
377         u_int16_t isr_freq;             /* MHz */
378         u_int16_t isr_flags;            /* channel flags */
379         u_int8_t isr_noise;
380         u_int8_t isr_rssi;
381         u_int8_t isr_intval;            /* beacon interval */
382         u_int16_t isr_capinfo;          /* capabilities */
383         u_int8_t isr_erp;               /* ERP element */
384         u_int8_t isr_bssid[IEEE80211_ADDR_LEN];
385         u_int8_t isr_nrates;
386         u_int8_t isr_rates[IEEE80211_RATE_MAXSIZE];
387         u_int8_t isr_ssid_len;          /* SSID length */
388         u_int8_t isr_ie_len;            /* IE length */
389         u_int8_t isr_pad[5];
390         /* variable length SSID followed by IE data */
391 };
392
393 #ifdef __FreeBSD__
394 /*
395  * FreeBSD-style ioctls.
396  */
397 /* the first member must be matched with struct ifreq */
398 struct ieee80211req {
399         char i_name[IFNAMSIZ];  /* if_name, e.g. "wi0" */
400         u_int16_t i_type;       /* req type */
401         int16_t         i_val;          /* Index or simple value */
402         int16_t         i_len;          /* Index or simple value */
403         void *i_data;           /* Extra data */
404 };
405 #define SIOCS80211               _IOW('i', 234, struct ieee80211req)
406 #define SIOCG80211              _IOWR('i', 235, struct ieee80211req)
407 #define SIOCG80211STATS         _IOWR('i', 236, struct ifreq)
408 #define SIOC80211IFCREATE       _IOWR('i', 237, struct ifreq)
409 #define SIOC80211IFDESTROY       _IOW('i', 238, struct ifreq)
410
411 #define IEEE80211_IOC_SSID              1
412 #define IEEE80211_IOC_NUMSSIDS          2
413 #define IEEE80211_IOC_WEP               3
414 #define         IEEE80211_WEP_NOSUP             -1
415 #define         IEEE80211_WEP_OFF               0
416 #define         IEEE80211_WEP_ON                1
417 #define         IEEE80211_WEP_MIXED             2
418 #define IEEE80211_IOC_WEPKEY            4
419 #define IEEE80211_IOC_NUMWEPKEYS        5
420 #define IEEE80211_IOC_WEPTXKEY          6
421 #define IEEE80211_IOC_AUTHMODE          7
422 #define IEEE80211_IOC_STATIONNAME       8
423 #define IEEE80211_IOC_CHANNEL           9
424 #define IEEE80211_IOC_POWERSAVE         10
425 #define         IEEE80211_POWERSAVE_NOSUP       -1
426 #define         IEEE80211_POWERSAVE_OFF         0
427 #define         IEEE80211_POWERSAVE_CAM         1
428 #define         IEEE80211_POWERSAVE_PSP         2
429 #define         IEEE80211_POWERSAVE_PSP_CAM     3
430 #define         IEEE80211_POWERSAVE_ON          IEEE80211_POWERSAVE_CAM
431 #define IEEE80211_IOC_POWERSAVESLEEP    11
432 #define IEEE80211_IOC_RTSTHRESHOLD      12
433 #define IEEE80211_IOC_PROTMODE          13
434 #define         IEEE80211_PROTMODE_OFF          0
435 #define         IEEE80211_PROTMODE_CTS          1
436 #define         IEEE80211_PROTMODE_RTSCTS       2
437 #define IEEE80211_IOC_TXPOWER           14      /* global tx power limit */
438 #define IEEE80211_IOC_BSSID             15
439 #define IEEE80211_IOC_ROAMING           16      /* roaming mode */
440 #define IEEE80211_IOC_PRIVACY           17      /* privacy invoked */
441 #define IEEE80211_IOC_DROPUNENCRYPTED   18      /* discard unencrypted frames */
442 #define IEEE80211_IOC_WPAKEY            19
443 #define IEEE80211_IOC_DELKEY            20
444 #define IEEE80211_IOC_MLME              21
445 #define IEEE80211_IOC_OPTIE             22      /* optional info. element */
446 #define IEEE80211_IOC_SCAN_REQ          23
447 #define IEEE80211_IOC_SCAN_RESULTS      24
448 #define IEEE80211_IOC_COUNTERMEASURES   25      /* WPA/TKIP countermeasures */
449 #define IEEE80211_IOC_WPA               26      /* WPA mode (0,1,2) */
450 #define IEEE80211_IOC_CHANLIST          27      /* channel list */
451 #define IEEE80211_IOC_WME               28      /* WME mode (on, off) */
452 #define IEEE80211_IOC_HIDESSID          29      /* hide SSID mode (on, off) */
453 #define IEEE80211_IOC_APBRIDGE          30      /* AP inter-sta bridging */
454 #define IEEE80211_IOC_MCASTCIPHER       31      /* multicast/default cipher */
455 #define IEEE80211_IOC_MCASTKEYLEN       32      /* multicast key length */
456 #define IEEE80211_IOC_UCASTCIPHERS      33      /* unicast cipher suites */
457 #define IEEE80211_IOC_UCASTCIPHER       34      /* unicast cipher */
458 #define IEEE80211_IOC_UCASTKEYLEN       35      /* unicast key length */
459 #define IEEE80211_IOC_DRIVER_CAPS       36      /* driver capabilities */
460 #define IEEE80211_IOC_KEYMGTALGS        37      /* key management algorithms */
461 #define IEEE80211_IOC_RSNCAPS           38      /* RSN capabilities */
462 #define IEEE80211_IOC_WPAIE             39      /* WPA information element */
463 #define IEEE80211_IOC_STA_STATS         40      /* per-station statistics */
464 #define IEEE80211_IOC_MACCMD            41      /* MAC ACL operation */
465 #define IEEE80211_IOC_TXPOWMAX          43      /* max tx power for channel */
466 #define IEEE80211_IOC_STA_TXPOW         44      /* per-station tx power limit */
467 #define IEEE80211_IOC_STA_INFO          45      /* station/neighbor info */
468 #define IEEE80211_IOC_WME_CWMIN         46      /* WME: ECWmin */
469 #define IEEE80211_IOC_WME_CWMAX         47      /* WME: ECWmax */
470 #define IEEE80211_IOC_WME_AIFS          48      /* WME: AIFSN */
471 #define IEEE80211_IOC_WME_TXOPLIMIT     49      /* WME: txops limit */
472 #define IEEE80211_IOC_WME_ACM           50      /* WME: ACM (bss only) */
473 #define IEEE80211_IOC_WME_ACKPOLICY     51      /* WME: ACK policy (!bss only)*/
474 #define IEEE80211_IOC_DTIM_PERIOD       52      /* DTIM period (beacons) */
475 #define IEEE80211_IOC_BEACON_INTERVAL   53      /* beacon interval (ms) */
476 #define IEEE80211_IOC_ADDMAC            54      /* add sta to MAC ACL table */
477 #define IEEE80211_IOC_SETMAC            55      /* set interface wds mac addr */
478 #define IEEE80211_IOC_FF                56      /* ATH fast frames (on, off) */
479 #define IEEE80211_IOC_TURBOP            57      /* ATH turbo' (on, off) */
480 #define IEEE80211_IOC_APPIEBUF          58      /* IE in the management frame */
481 #define IEEE80211_IOC_FILTERFRAME       59      /* management frame filter */
482
483 /*
484  * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.
485  */
486 struct ieee80211req_scan_result {
487         u_int16_t isr_len;              /* length (mult of 4) */
488         u_int16_t isr_freq;             /* MHz */
489         u_int16_t isr_flags;            /* channel flags */
490         u_int8_t isr_noise;
491         u_int8_t isr_rssi;
492         u_int8_t isr_intval;            /* beacon interval */
493         u_int16_t isr_capinfo;          /* capabilities */
494         u_int8_t isr_erp;               /* ERP element */
495         u_int8_t isr_bssid[IEEE80211_ADDR_LEN];
496         u_int8_t isr_nrates;
497         u_int8_t isr_rates[IEEE80211_RATE_MAXSIZE];
498         u_int8_t isr_ssid_len;          /* SSID length */
499         u_int8_t isr_ie_len;            /* IE length */
500         u_int8_t isr_pad[5];
501         /* variable length SSID followed by IE data */
502 };
503
504 #endif /* __FreeBSD__ */
505
506 #ifdef __linux__
507 /*
508  * Wireless Extensions API, private ioctl interfaces.
509  *
510  * NB: Even-numbered ioctl numbers have set semantics and are privileged!
511  *     (regardless of the incorrect comment in wireless.h!)
512  */
513 #ifdef __KERNEL__
514 #include <linux/if.h>
515 #endif
516 /* The maximum size of a iwpriv structure is IW_PRIV_SIZE_MASK, which was 
517  * exceeded for some time by chaninfo ioctl.  These macros change the size 
518  * encoding for anything larger than IW_PRIV_SIZE_MASK from bytes to 4-byte
519  * multiples so that the padded size fits under IW_PRIV_SIZE_MASK. */
520 #define IW_PRIV_BLOB_LENGTH_ENCODING(_SIZE) \
521         (((_SIZE) == ((_SIZE) & IW_PRIV_SIZE_MASK)) ? \
522                 (_SIZE) : \
523                 (((_SIZE) / sizeof(uint32_t)) + \
524                         (((_SIZE) == (((_SIZE) / sizeof(uint32_t)) * sizeof(int))) ? \
525                                 0 : 1)))
526 #define IW_PRIV_BLOB_TYPE_ENCODING(_SIZE) \
527         (((_SIZE) == ((_SIZE) & IW_PRIV_SIZE_MASK)) ? \
528                 (IW_PRIV_TYPE_BYTE | (_SIZE)) : \
529                 (IW_PRIV_TYPE_INT  | IW_PRIV_BLOB_LENGTH_ENCODING((_SIZE))))
530
531 #define IEEE80211_IOCTL_SETPARAM        (SIOCIWFIRSTPRIV+0)
532 #define IEEE80211_IOCTL_GETPARAM        (SIOCIWFIRSTPRIV+1)
533 #define IEEE80211_IOCTL_SETMODE         (SIOCIWFIRSTPRIV+2)
534 #define IEEE80211_IOCTL_GETMODE         (SIOCIWFIRSTPRIV+3)
535 #define IEEE80211_IOCTL_SETWMMPARAMS    (SIOCIWFIRSTPRIV+4)
536 #define IEEE80211_IOCTL_GETWMMPARAMS    (SIOCIWFIRSTPRIV+5)
537 #define IEEE80211_IOCTL_SETCHANLIST     (SIOCIWFIRSTPRIV+6)
538 #define IEEE80211_IOCTL_GETCHANLIST     (SIOCIWFIRSTPRIV+7)
539 #define IEEE80211_IOCTL_CHANSWITCH      (SIOCIWFIRSTPRIV+8)
540 #define IEEE80211_IOCTL_GET_APPIEBUF    (SIOCIWFIRSTPRIV+9)
541 #define IEEE80211_IOCTL_SET_APPIEBUF    (SIOCIWFIRSTPRIV+10)
542 #define IEEE80211_IOCTL_READREG         (SIOCIWFIRSTPRIV+11)
543 #define IEEE80211_IOCTL_FILTERFRAME     (SIOCIWFIRSTPRIV+12)
544 #define IEEE80211_IOCTL_GETCHANINFO     (SIOCIWFIRSTPRIV+13)
545 #define IEEE80211_IOCTL_SETOPTIE        (SIOCIWFIRSTPRIV+14)
546 #define IEEE80211_IOCTL_GETOPTIE        (SIOCIWFIRSTPRIV+15)
547 #define IEEE80211_IOCTL_SETMLME         (SIOCIWFIRSTPRIV+16)
548 #define IEEE80211_IOCTL_RADAR           (SIOCIWFIRSTPRIV+17)
549 #define IEEE80211_IOCTL_SETKEY          (SIOCIWFIRSTPRIV+18)
550 #define IEEE80211_IOCTL_WRITEREG        (SIOCIWFIRSTPRIV+19)
551 #define IEEE80211_IOCTL_DELKEY          (SIOCIWFIRSTPRIV+20)
552 #define IEEE80211_IOCTL_HALMAP          (SIOCIWFIRSTPRIV+21)
553 #define IEEE80211_IOCTL_ADDMAC          (SIOCIWFIRSTPRIV+22)
554 #define IEEE80211_IOCTL_DELMAC          (SIOCIWFIRSTPRIV+24)
555 #define IEEE80211_IOCTL_WDSADDMAC       (SIOCIWFIRSTPRIV+25)
556 #define IEEE80211_IOCTL_WDSSETMAC       (SIOCIWFIRSTPRIV+26)
557 #define IEEE80211_IOCTL_KICKMAC         (SIOCIWFIRSTPRIV+30)
558 #define IEEE80211_IOCTL_SETSCANLIST     (SIOCIWFIRSTPRIV+31)
559
560 enum {
561         IEEE80211_WMMPARAMS_CWMIN       = 1,
562         IEEE80211_WMMPARAMS_CWMAX       = 2,
563         IEEE80211_WMMPARAMS_AIFS        = 3,
564         IEEE80211_WMMPARAMS_TXOPLIMIT   = 4,
565         IEEE80211_WMMPARAMS_ACM         = 5,
566         IEEE80211_WMMPARAMS_NOACKPOLICY = 6,
567 };
568 enum {
569         IEEE80211_PARAM_TURBO                   = 1,    /* turbo mode */
570         IEEE80211_PARAM_MODE                    = 2,    /* phy mode (11a, 11b, etc.) */
571         IEEE80211_PARAM_AUTHMODE                = 3,    /* authentication mode */
572         IEEE80211_PARAM_PROTMODE                = 4,    /* 802.11g protection */
573         IEEE80211_PARAM_MCASTCIPHER             = 5,    /* multicast/default cipher */
574         IEEE80211_PARAM_MCASTKEYLEN             = 6,    /* multicast key length */
575         IEEE80211_PARAM_UCASTCIPHERS            = 7,    /* unicast cipher suites */
576         IEEE80211_PARAM_UCASTCIPHER             = 8,    /* unicast cipher */
577         IEEE80211_PARAM_UCASTKEYLEN             = 9,    /* unicast key length */
578         IEEE80211_PARAM_WPA                     = 10,   /* WPA mode (0,1,2) */
579         IEEE80211_PARAM_ROAMING                 = 12,   /* roaming mode */
580         IEEE80211_PARAM_PRIVACY                 = 13,   /* privacy invoked */
581         IEEE80211_PARAM_COUNTERMEASURES         = 14,   /* WPA/TKIP countermeasures */
582         IEEE80211_PARAM_DROPUNENCRYPTED         = 15,   /* discard unencrypted frames */
583         IEEE80211_PARAM_DRIVER_CAPS             = 16,   /* driver capabilities */
584         IEEE80211_PARAM_MACCMD                  = 17,   /* MAC ACL operation */
585         IEEE80211_PARAM_WMM                     = 18,   /* WMM mode (on, off) */
586         IEEE80211_PARAM_HIDESSID                = 19,   /* hide SSID mode (on, off) */
587         IEEE80211_PARAM_APBRIDGE                = 20,   /* AP inter-sta bridging */
588         IEEE80211_PARAM_KEYMGTALGS              = 21,   /* key management algorithms */
589         IEEE80211_PARAM_RSNCAPS                 = 22,   /* RSN capabilities */
590         IEEE80211_PARAM_INACT                   = 23,   /* station inactivity timeout */
591         IEEE80211_PARAM_INACT_AUTH              = 24,   /* station auth inact timeout */
592         IEEE80211_PARAM_INACT_INIT              = 25,   /* station init inact timeout */
593         IEEE80211_PARAM_ABOLT                   = 26,   /* Atheros Adv. Capabilities */
594         IEEE80211_PARAM_INACT_TICK              = 27,   /* station inactivity timer tick (seconds) */
595         IEEE80211_PARAM_DTIM_PERIOD             = 28,   /* DTIM period (beacons) */
596         IEEE80211_PARAM_BEACON_INTERVAL         = 29,   /* beacon interval (ms) */
597         IEEE80211_PARAM_DOTH                    = 30,   /* 11.h is on/off */
598         IEEE80211_PARAM_PWRTARGET               = 31,   /* Current Channel Pwr Constraint */
599         IEEE80211_PARAM_GENREASSOC              = 32,   /* Generate a reassociation request */
600         IEEE80211_PARAM_COMPRESSION             = 33,   /* compression */
601         IEEE80211_PARAM_FF                      = 34,   /* fast frames support  */
602         IEEE80211_PARAM_XR                      = 35,   /* XR support */
603         IEEE80211_PARAM_BURST                   = 36,   /* burst mode */
604         IEEE80211_PARAM_PUREG                   = 37,   /* pure 11g (no 11b stations) */
605         IEEE80211_PARAM_AR                      = 38,   /* AR support */
606         IEEE80211_PARAM_WDS                     = 39,   /* Enable 4 address processing */
607         IEEE80211_PARAM_BGSCAN                  = 40,   /* bg scanning (on, off) */
608         IEEE80211_PARAM_BGSCAN_IDLE             = 41,   /* bg scan idle threshold */
609         IEEE80211_PARAM_BGSCAN_INTERVAL         = 42,   /* bg scan interval */
610         IEEE80211_PARAM_MCAST_RATE              = 43,   /* Multicast Tx Rate */
611         IEEE80211_PARAM_COVERAGE_CLASS          = 44,   /* coverage class */
612         IEEE80211_PARAM_COUNTRY_IE              = 45,   /* enable country IE */
613         IEEE80211_PARAM_SCANVALID               = 46,   /* scan cache valid threshold */
614         IEEE80211_PARAM_ROAM_RSSI_11A           = 47,   /* rssi threshold in 11a */
615         IEEE80211_PARAM_ROAM_RSSI_11B           = 48,   /* rssi threshold in 11b */
616         IEEE80211_PARAM_ROAM_RSSI_11G           = 49,   /* rssi threshold in 11g */
617         IEEE80211_PARAM_ROAM_RATE_11A           = 50,   /* tx rate threshold in 11a */
618         IEEE80211_PARAM_ROAM_RATE_11B           = 51,   /* tx rate threshold in 11b */
619         IEEE80211_PARAM_ROAM_RATE_11G           = 52,   /* tx rate threshold in 11g */
620         IEEE80211_PARAM_UAPSDINFO               = 53,   /* value for qos info field */
621         IEEE80211_PARAM_SLEEP                   = 54,   /* force sleep/wake */
622         IEEE80211_PARAM_QOSNULL                 = 55,   /* force sleep/wake */
623         IEEE80211_PARAM_PSPOLL                  = 56,   /* force ps-poll generation (sta only) */
624         IEEE80211_PARAM_EOSPDROP                = 57,   /* force uapsd EOSP drop (ap only) */
625         IEEE80211_PARAM_MARKDFS                 = 58,   /* mark a dfs interference channel when found */
626         IEEE80211_PARAM_REGCLASS                = 59,   /* enable regclass ids in country IE */
627         IEEE80211_PARAM_DROPUNENC_EAPOL         = 60,   /* drop unencrypted eapol frames */
628         IEEE80211_PARAM_SHPREAMBLE              = 61,   /* Short Preamble */
629         IEEE80211_PARAM_DUMPREGS                = 62,   /* Pretty printed dump of Atheros hardware registers */
630         IEEE80211_PARAM_DOTH_ALGORITHM          = 63,   /* spectrum management algorithm */
631         IEEE80211_PARAM_DOTH_MINCOM             = 64,   /* minimum number of common channels */
632         IEEE80211_PARAM_DOTH_SLCG               = 65,   /* permil of Stations Lost per Channel Gained */
633         IEEE80211_PARAM_DOTH_SLDG               = 66,   /* permil of Stations Lost per rssi Db Gained */
634         IEEE80211_PARAM_TXCONT                  = 67,   /* continuous transmit mode (boolean) */
635         IEEE80211_PARAM_TXCONT_RATE             = 68,   /* continuous transmit mode data rate (in mbit/sec) - will use closest match from current rate table */
636         IEEE80211_PARAM_TXCONT_POWER            = 69,   /* power level in units of 0.5dBm */
637         IEEE80211_PARAM_DFS_TESTMODE            = 70,   /* do not perform DFS actions (i.e. markng DFS and channel change on interference), just report them via debug. */
638         IEEE80211_PARAM_DFS_CACTIME             = 71,   /* how long do we wait for chan availability
639                                                            scans ?
640                                                            FCC requires 60s, so that is the default. */
641         IEEE80211_PARAM_DFS_EXCLPERIOD          = 72,   /* DFS no-occupancy limit - how long do we stay
642                                                            off a channel once radar is detected?
643                                                            FCC requires 30m, so that is the default. */
644         IEEE80211_PARAM_BEACON_MISS_THRESH      = 73,   /* Beacon miss threshold (in beacons) */
645         IEEE80211_PARAM_BEACON_MISS_THRESH_MS   = 74,   /* Beacon miss threshold (in ms) */
646         IEEE80211_PARAM_MAXRATE                 = 75,   /* Maximum rate (by table index) */
647         IEEE80211_PARAM_MINRATE                 = 76,   /* Minimum rate (by table index) */
648         IEEE80211_PARAM_PROTMODE_RSSI           = 77,   /* RSSI Threshold for enabling protection mode */
649         IEEE80211_PARAM_PROTMODE_TIMEOUT        = 78,   /* Timeout for expiring protection mode */
650         IEEE80211_PARAM_BGSCAN_THRESH           = 79,   /* bg scan rssi threshold */
651         IEEE80211_PARAM_RSSI_DIS_THR    = 80,   /* rssi threshold for disconnection */
652         IEEE80211_PARAM_RSSI_DIS_COUNT  = 81,   /* counter for rssi threshold */
653         IEEE80211_PARAM_WDS_SEP                 = 82,   /* move wds stations into separate interfaces */
654         IEEE80211_PARAM_MAXASSOC                = 83,   /* maximum associated stations */
655         IEEE80211_PARAM_PROBEREQ                = 84,   /* enable handling of probe requests */
656         IEEE80211_PARAM_BEACON_TXP              = 85,   /* set beacon tx power */
657 };
658
659 #define SIOCG80211STATS                 (SIOCDEVPRIVATE+2)
660 /* NB: require in+out parameters so cannot use wireless extensions, yech */
661 #define IEEE80211_IOCTL_GETKEY          (SIOCDEVPRIVATE+3)
662 #define IEEE80211_IOCTL_GETWPAIE        (SIOCDEVPRIVATE+4)
663 #define IEEE80211_IOCTL_STA_STATS       (SIOCDEVPRIVATE+5)
664 #define IEEE80211_IOCTL_STA_INFO        (SIOCDEVPRIVATE+6)
665 #define SIOC80211IFCREATE               (SIOCDEVPRIVATE+7)
666 #define SIOC80211IFDESTROY              (SIOCDEVPRIVATE+8)
667 #define IEEE80211_IOCTL_SCAN_RESULTS    (SIOCDEVPRIVATE+9)
668
669 struct ieee80211_clone_params {
670         char icp_name[IFNAMSIZ];                /* device name */
671         u_int16_t icp_opmode;                   /* operating mode */
672         u_int16_t icp_flags;                    /* see below */
673 #define IEEE80211_CLONE_BSSID   0x0001          /* allocate unique mac/bssid */
674 #define IEEE80211_NO_STABEACONS 0x0002          /* Do not setup the station beacon timers */
675 };
676
677 /* APPIEBUF related definitions */
678
679 /* Management frame type to which application IE is added */
680 enum {
681         IEEE80211_APPIE_FRAME_BEACON            = 0,
682         IEEE80211_APPIE_FRAME_PROBE_REQ         = 1,
683         IEEE80211_APPIE_FRAME_PROBE_RESP        = 2,
684         IEEE80211_APPIE_FRAME_ASSOC_REQ         = 3,
685         IEEE80211_APPIE_FRAME_ASSOC_RESP        = 4,
686         IEEE80211_APPIE_NUM_OF_FRAME            = 5
687 };
688
689 struct ieee80211req_getset_appiebuf {
690         u_int32_t       app_frmtype;            /* management frame type for which buffer is added */
691         u_int32_t       app_buflen;             /* application-supplied buffer length */
692         u_int8_t        app_buf[0];             /* application-supplied IE(s) */
693 };
694
695 /* Flags ORed by application to set filter for receiving management frames */
696 enum {
697         IEEE80211_FILTER_TYPE_BEACON            = 1<<0,
698         IEEE80211_FILTER_TYPE_PROBE_REQ         = 1<<1,
699         IEEE80211_FILTER_TYPE_PROBE_RESP        = 1<<2,
700         IEEE80211_FILTER_TYPE_ASSOC_REQ         = 1<<3,
701         IEEE80211_FILTER_TYPE_ASSOC_RESP        = 1<<4,
702         IEEE80211_FILTER_TYPE_AUTH              = 1<<5,
703         IEEE80211_FILTER_TYPE_DEAUTH            = 1<<6,
704         IEEE80211_FILTER_TYPE_DISASSOC          = 1<<7,
705         IEEE80211_FILTER_TYPE_ALL               = 0xFF  /* used to check the valid filter bits */
706 };
707
708 struct ieee80211req_set_filter {
709         u_int32_t app_filterype;                /* management frame filter type */
710 };
711
712
713 #endif /* __linux__ */
714
715 #endif /* _NET80211_IEEE80211_IOCTL_H_ */