Home | History | Annotate | Line # | Download | only in net80211
ieee80211_ioctl.h revision 1.18.62.1
      1 /*	$NetBSD: ieee80211_ioctl.h,v 1.18.62.1 2008/02/22 16:50:25 skrll Exp $	*/
      2 /*-
      3  * Copyright (c) 2001 Atsushi Onoe
      4  * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  *
     27  * $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.26 2007/11/02 05:22:24 sam Exp $
     28  */
     29 #ifndef _NET80211_IEEE80211_IOCTL_H_
     30 #define _NET80211_IEEE80211_IOCTL_H_
     31 
     32 /*
     33  * IEEE 802.11 ioctls.
     34  */
     35 #include <net80211/_ieee80211.h>
     36 #include <net80211/ieee80211.h>
     37 #include <net80211/ieee80211_crypto.h>
     38 
     39 /*
     40  * Per/node (station) statistics.
     41  */
     42 struct ieee80211_nodestats {
     43 	uint32_t	ns_rx_data;		/* rx data frames */
     44 	uint32_t	ns_rx_mgmt;		/* rx management frames */
     45 	uint32_t	ns_rx_ctrl;		/* rx control frames */
     46 	uint32_t	ns_rx_ucast;		/* rx unicast frames */
     47 	uint32_t	ns_rx_mcast;		/* rx multi/broadcast frames */
     48 	uint64_t	ns_rx_bytes;		/* rx data count (bytes) */
     49 	uint64_t	ns_rx_beacons;		/* rx beacon frames */
     50 	uint32_t	ns_rx_proberesp;	/* rx probe response frames */
     51 
     52 	uint32_t	ns_rx_dup;		/* rx discard 'cuz dup */
     53 	uint32_t	ns_rx_noprivacy;	/* rx w/ wep but privacy off */
     54 	uint32_t	ns_rx_wepfail;		/* rx wep processing failed */
     55 	uint32_t	ns_rx_demicfail;	/* rx demic failed */
     56 	uint32_t	ns_rx_decap;		/* rx decapsulation failed */
     57 	uint32_t	ns_rx_defrag;		/* rx defragmentation failed */
     58 	uint32_t	ns_rx_disassoc;		/* rx disassociation */
     59 	uint32_t	ns_rx_deauth;		/* rx deauthentication */
     60 	uint32_t	ns_rx_action;		/* rx action */
     61 	uint32_t	ns_rx_decryptcrc;	/* rx decrypt failed on crc */
     62 	uint32_t	ns_rx_unauth;		/* rx on unauthorized port */
     63 	uint32_t	ns_rx_unencrypted;	/* rx unecrypted w/ privacy */
     64 	uint32_t	ns_rx_drop;		/* rx discard other reason */
     65 
     66 	uint32_t	ns_tx_data;		/* tx data frames */
     67 	uint32_t	ns_tx_mgmt;		/* tx management frames */
     68 	uint32_t	ns_tx_ucast;		/* tx unicast frames */
     69 	uint32_t	ns_tx_mcast;		/* tx multi/broadcast frames */
     70 	uint64_t	ns_tx_bytes;		/* tx data count (bytes) */
     71 	uint32_t	ns_tx_probereq;		/* tx probe request frames */
     72 
     73 	uint32_t	ns_tx_novlantag;	/* tx discard 'cuz no tag */
     74 	uint32_t	ns_tx_vlanmismatch;	/* tx discard 'cuz bad tag */
     75 
     76 	uint32_t	ns_ps_discard;		/* ps discard 'cuz of age */
     77 
     78 	/* MIB-related state */
     79 	uint32_t	ns_tx_assoc;		/* [re]associations */
     80 	uint32_t	ns_tx_assoc_fail;	/* [re]association failures */
     81 	uint32_t	ns_tx_auth;		/* [re]authentications */
     82 	uint32_t	ns_tx_auth_fail;	/* [re]authentication failures*/
     83 	uint32_t	ns_tx_deauth;		/* deauthentications */
     84 	uint32_t	ns_tx_deauth_code;	/* last deauth reason */
     85 	uint32_t	ns_tx_disassoc;		/* disassociations */
     86 	uint32_t	ns_tx_disassoc_code;	/* last disassociation reason */
     87 };
     88 
     89 #ifdef COMPAT_20
     90 struct ieee80211_ostats {
     91 	u_int32_t	is_rx_badversion;	/* rx frame with bad version */
     92 	u_int32_t	is_rx_tooshort;		/* rx frame too short */
     93 	u_int32_t	is_rx_wrongbss;		/* rx from wrong bssid */
     94 	u_int32_t	is_rx_dup;		/* rx discard 'cuz dup */
     95 	u_int32_t	is_rx_wrongdir;		/* rx w/ wrong direction */
     96 	u_int32_t	is_rx_mcastecho;	/* rx discard 'cuz mcast echo */
     97 	u_int32_t	is_rx_notassoc;		/* rx discard 'cuz sta !assoc */
     98 	u_int32_t	is_rx_nowep;		/* rx w/ wep but wep !config */
     99 	u_int32_t	is_rx_wepfail;		/* rx wep processing failed */
    100 	u_int32_t	is_rx_decap;		/* rx decapsulation failed */
    101 	u_int32_t	is_rx_mgtdiscard;	/* rx discard mgt frames */
    102 	u_int32_t	is_rx_ctl;		/* rx discard ctrl frames */
    103 	u_int32_t	is_rx_rstoobig;		/* rx rate set truncated */
    104 	u_int32_t	is_rx_elem_missing;	/* rx required element missing*/
    105 	u_int32_t	is_rx_elem_toobig;	/* rx element too big */
    106 	u_int32_t	is_rx_elem_toosmall;	/* rx element too small */
    107 	u_int32_t	is_rx_elem_unknown;	/* rx element unknown */
    108 	u_int32_t	is_rx_badchan;		/* rx frame w/ invalid chan */
    109 	u_int32_t	is_rx_chanmismatch;	/* rx frame chan mismatch */
    110 	u_int32_t	is_rx_nodealloc;	/* rx frame dropped */
    111 	u_int32_t	is_rx_ssidmismatch;	/* rx frame ssid mismatch  */
    112 	u_int32_t	is_rx_auth_unsupported;	/* rx w/ unsupported auth alg */
    113 	u_int32_t	is_rx_auth_fail;	/* rx sta auth failure */
    114 	u_int32_t	is_rx_assoc_bss;	/* rx assoc from wrong bssid */
    115 	u_int32_t	is_rx_assoc_notauth;	/* rx assoc w/o auth */
    116 	u_int32_t	is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
    117 	u_int32_t	is_rx_assoc_norate;	/* rx assoc w/ no rate match */
    118 	u_int32_t	is_rx_deauth;		/* rx deauthentication */
    119 	u_int32_t	is_rx_disassoc;		/* rx disassociation */
    120 	u_int32_t	is_rx_badsubtype;	/* rx frame w/ unknown subtype*/
    121 	u_int32_t	is_rx_nombuf;		/* rx failed for lack of mbuf */
    122 	u_int32_t	is_rx_decryptcrc;	/* rx decrypt failed on crc */
    123 	u_int32_t	is_rx_ahdemo_mgt;	/* rx discard ahdemo mgt frame*/
    124 	u_int32_t	is_rx_bad_auth;		/* rx bad auth request */
    125 	u_int32_t	is_tx_nombuf;		/* tx failed for lack of mbuf */
    126 	u_int32_t	is_tx_nonode;		/* tx failed for no node */
    127 	u_int32_t	is_tx_unknownmgt;	/* tx of unknown mgt frame */
    128 	u_int32_t	is_scan_active;		/* active scans started */
    129 	u_int32_t	is_scan_passive;	/* passive scans started */
    130 	u_int32_t	is_node_timeout;	/* nodes timed out inactivity */
    131 	u_int32_t	is_crypto_nomem;	/* no memory for crypto ctx */
    132 };
    133 #endif /* COMPAT_20 */
    134 
    135 /*
    136  * Summary statistics.
    137  */
    138 struct ieee80211_stats {
    139 	uint32_t	is_rx_badversion;	/* rx frame with bad version */
    140 	uint32_t	is_rx_tooshort;		/* rx frame too short */
    141 	uint32_t	is_rx_wrongbss;		/* rx from wrong bssid */
    142 	uint32_t	is_rx_dup;		/* rx discard 'cuz dup */
    143 	uint32_t	is_rx_wrongdir;		/* rx w/ wrong direction */
    144 	uint32_t	is_rx_mcastecho;	/* rx discard 'cuz mcast echo */
    145 	uint32_t	is_rx_notassoc;		/* rx discard 'cuz sta !assoc */
    146 	uint32_t	is_rx_noprivacy;	/* rx w/ wep but privacy off */
    147 	uint32_t	is_rx_unencrypted;	/* rx w/o wep and privacy on */
    148 	uint32_t	is_rx_wepfail;		/* rx wep processing failed */
    149 	uint32_t	is_rx_decap;		/* rx decapsulation failed */
    150 	uint32_t	is_rx_mgtdiscard;	/* rx discard mgt frames */
    151 	uint32_t	is_rx_ctl;		/* rx discard ctrl frames */
    152 	uint32_t	is_rx_beacon;		/* rx beacon frames */
    153 	uint32_t	is_rx_rstoobig;		/* rx rate set truncated */
    154 	uint32_t	is_rx_elem_missing;	/* rx required element missing*/
    155 	uint32_t	is_rx_elem_toobig;	/* rx element too big */
    156 	uint32_t	is_rx_elem_toosmall;	/* rx element too small */
    157 	uint32_t	is_rx_elem_unknown;	/* rx element unknown */
    158 	uint32_t	is_rx_badchan;		/* rx frame w/ invalid chan */
    159 	uint32_t	is_rx_chanmismatch;	/* rx frame chan mismatch */
    160 	uint32_t	is_rx_nodealloc;	/* rx frame dropped */
    161 	uint32_t	is_rx_ssidmismatch;	/* rx frame ssid mismatch  */
    162 	uint32_t	is_rx_auth_unsupported;	/* rx w/ unsupported auth alg */
    163 	uint32_t	is_rx_auth_fail;	/* rx sta auth failure */
    164 	uint32_t	is_rx_auth_countermeasures;/* rx auth discard 'cuz CM */
    165 	uint32_t	is_rx_assoc_bss;	/* rx assoc from wrong bssid */
    166 	uint32_t	is_rx_assoc_notauth;	/* rx assoc w/o auth */
    167 	uint32_t	is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
    168 	uint32_t	is_rx_assoc_norate;	/* rx assoc w/ no rate match */
    169 	uint32_t	is_rx_assoc_badwpaie;	/* rx assoc w/ bad WPA IE */
    170 	uint32_t	is_rx_deauth;		/* rx deauthentication */
    171 	uint32_t	is_rx_disassoc;		/* rx disassociation */
    172 	uint32_t	is_rx_badsubtype;	/* rx frame w/ unknown subtype*/
    173 	uint32_t	is_rx_nobuf;		/* rx failed for lack of buf */
    174 	uint32_t	is_rx_decryptcrc;	/* rx decrypt failed on crc */
    175 	uint32_t	is_rx_ahdemo_mgt;	/* rx discard ahdemo mgt frame*/
    176 	uint32_t	is_rx_bad_auth;		/* rx bad auth request */
    177 	uint32_t	is_rx_unauth;		/* rx on unauthorized port */
    178 	uint32_t	is_rx_badkeyid;		/* rx w/ incorrect keyid */
    179 	uint32_t	is_rx_ccmpreplay;	/* rx seq# violation (CCMP) */
    180 	uint32_t	is_rx_ccmpformat;	/* rx format bad (CCMP) */
    181 	uint32_t	is_rx_ccmpmic;		/* rx MIC check failed (CCMP) */
    182 	uint32_t	is_rx_tkipreplay;	/* rx seq# violation (TKIP) */
    183 	uint32_t	is_rx_tkipformat;	/* rx format bad (TKIP) */
    184 	uint32_t	is_rx_tkipmic;		/* rx MIC check failed (TKIP) */
    185 	uint32_t	is_rx_tkipicv;		/* rx ICV check failed (TKIP) */
    186 	uint32_t	is_rx_badcipher;	/* rx failed 'cuz key type */
    187 	uint32_t	is_rx_nocipherctx;	/* rx failed 'cuz key !setup */
    188 	uint32_t	is_rx_acl;		/* rx discard 'cuz acl policy */
    189 	uint32_t	is_tx_nobuf;		/* tx failed for lack of buf */
    190 	uint32_t	is_tx_nonode;		/* tx failed for no node */
    191 	uint32_t	is_tx_unknownmgt;	/* tx of unknown mgt frame */
    192 	uint32_t	is_tx_badcipher;	/* tx failed 'cuz key type */
    193 	uint32_t	is_tx_nodefkey;		/* tx failed 'cuz no defkey */
    194 	uint32_t	is_tx_noheadroom;	/* tx failed 'cuz no space */
    195 	uint32_t	is_tx_fragframes;	/* tx frames fragmented */
    196 	uint32_t	is_tx_frags;		/* tx fragments created */
    197 	uint32_t	is_scan_active;		/* active scans started */
    198 	uint32_t	is_scan_passive;	/* passive scans started */
    199 	uint32_t	is_node_timeout;	/* nodes timed out inactivity */
    200 	uint32_t	is_crypto_nomem;	/* no memory for crypto ctx */
    201 	uint32_t	is_crypto_tkip;		/* tkip crypto done in s/w */
    202 	uint32_t	is_crypto_tkipenmic;	/* tkip en-MIC done in s/w */
    203 	uint32_t	is_crypto_tkipdemic;	/* tkip de-MIC done in s/w */
    204 	uint32_t	is_crypto_tkipcm;	/* tkip counter measures */
    205 	uint32_t	is_crypto_ccmp;		/* ccmp crypto done in s/w */
    206 	uint32_t	is_crypto_wep;		/* wep crypto done in s/w */
    207 	uint32_t	is_crypto_setkey_cipher;/* cipher rejected key */
    208 	uint32_t	is_crypto_setkey_nokey;	/* no key index for setkey */
    209 	uint32_t	is_crypto_delkey;	/* driver key delete failed */
    210 	uint32_t	is_crypto_badcipher;	/* unknown cipher */
    211 	uint32_t	is_crypto_nocipher;	/* cipher not available */
    212 	uint32_t	is_crypto_attachfail;	/* cipher attach failed */
    213 	uint32_t	is_crypto_swfallback;	/* cipher fallback to s/w */
    214 	uint32_t	is_crypto_keyfail;	/* driver key alloc failed */
    215 	uint32_t	is_crypto_enmicfail;	/* en-MIC failed */
    216 	uint32_t	is_ibss_capmismatch;	/* merge failed-cap mismatch */
    217 	uint32_t	is_ibss_norate;		/* merge failed-rate mismatch */
    218 	uint32_t	is_ps_unassoc;		/* ps-poll for unassoc. sta */
    219 	uint32_t	is_ps_badaid;		/* ps-poll w/ incorrect aid */
    220 	uint32_t	is_ps_qempty;		/* ps-poll w/ nothing to send */
    221 	uint32_t	is_ff_badhdr;		/* fast frame rx'd w/ bad hdr */
    222 	uint32_t	is_ff_tooshort;		/* fast frame rx decap error */
    223 	uint32_t	is_ff_split;		/* fast frame rx split error */
    224 	uint32_t	is_ff_decap;		/* fast frames decap'd */
    225 	uint32_t	is_ff_encap;		/* fast frames encap'd for tx */
    226 	uint32_t	is_rx_badbintval;	/* rx frame w/ bogus bintval */
    227 	uint32_t	is_rx_demicfail;	/* rx demic failed */
    228 	uint32_t	is_rx_defrag;		/* rx defragmentation failed */
    229 	uint32_t	is_rx_mgmt;		/* rx management frames */
    230 	uint32_t	is_rx_action;		/* rx action mgt frames */
    231 	uint32_t	is_amsdu_tooshort;	/* A-MSDU rx decap error */
    232 	uint32_t	is_amsdu_split;		/* A-MSDU rx split error */
    233 	uint32_t	is_amsdu_decap;		/* A-MSDU decap'd */
    234 	uint32_t	is_amsdu_encap;		/* A-MSDU encap'd for tx */
    235 	uint32_t	is_ampdu_bar_bad;	/* A-MPDU BAR out of window */
    236 	uint32_t	is_ampdu_bar_oow;	/* A-MPDU BAR before ADDBA */
    237 	uint32_t	is_ampdu_bar_move;	/* A-MPDU BAR moved window */
    238 	uint32_t	is_ampdu_bar_rx;	/* A-MPDU BAR frames handled */
    239 	uint32_t	is_ampdu_rx_flush;	/* A-MPDU frames flushed */
    240 	uint32_t	is_ampdu_rx_oor;	/* A-MPDU frames out-of-order */
    241 	uint32_t	is_ampdu_rx_copy;	/* A-MPDU frames copied down */
    242 	uint32_t	is_ampdu_rx_drop;	/* A-MPDU frames dropped */
    243 	uint32_t	is_tx_badstate;		/* tx discard state != RUN */
    244 	uint32_t	is_tx_notassoc;		/* tx failed, sta not assoc */
    245 	uint32_t	is_tx_classify;		/* tx classification failed */
    246 	uint32_t	is_ht_assoc_nohtcap;	/* non-HT sta rejected */
    247 	uint32_t	is_ht_assoc_downgrade;	/* HT sta forced to legacy */
    248 	uint32_t	is_ht_assoc_norate;	/* HT assoc w/ rate mismatch */
    249 	uint32_t	is_ampdu_rx_age;	/* A-MPDU sent up 'cuz of age */
    250 	uint32_t	is_ampdu_rx_move;	/* A-MPDU MSDU moved window */
    251 	uint32_t	is_addba_reject;	/* ADDBA reject 'cuz disabled */
    252 	uint32_t	is_addba_norequest;	/* ADDBA response w/o ADDBA */
    253 	uint32_t	is_addba_badtoken;	/* ADDBA response w/ wrong
    254 						   dialogtoken */
    255 	uint32_t	is_ampdu_stop;		/* A-MPDU stream stopped */
    256 	uint32_t	is_ampdu_stop_failed;	/* A-MPDU stream not running */
    257 	uint32_t	is_ampdu_rx_reorder;	/* A-MPDU held for rx reorder */
    258 	uint32_t	is_spare[16];
    259 };
    260 
    261 /*
    262  * Max size of optional information elements.  We artificially
    263  * constrain this; it's limited only by the max frame size (and
    264  * the max parameter size of the wireless extensions).
    265  */
    266 #define	IEEE80211_MAX_OPT_IE	256
    267 
    268 /*
    269  * WPA/RSN get/set key request.  Specify the key/cipher
    270  * type and whether the key is to be used for sending and/or
    271  * receiving.  The key index should be set only when working
    272  * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
    273  * Otherwise a unicast/pairwise key is specified by the bssid
    274  * (on a station) or mac address (on an ap).  They key length
    275  * must include any MIC key data; otherwise it should be no
    276  * more than IEEE80211_KEYBUF_SIZE.
    277  */
    278 struct ieee80211req_key {
    279 	uint8_t		ik_type;	/* key/cipher type */
    280 	uint8_t		ik_pad;
    281 	uint16_t	ik_keyix;	/* key index */
    282 	uint8_t		ik_keylen;	/* key length in bytes */
    283 	uint8_t		ik_flags;
    284 /* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */
    285 #define	IEEE80211_KEY_DEFAULT	0x80	/* default xmit key */
    286 	uint8_t		ik_macaddr[IEEE80211_ADDR_LEN];
    287 	uint64_t	ik_keyrsc;	/* key receive sequence counter */
    288 	uint64_t	ik_keytsc;	/* key transmit sequence counter */
    289 	uint8_t		ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
    290 };
    291 
    292 /*
    293  * Delete a key either by index or address.  Set the index
    294  * to IEEE80211_KEYIX_NONE when deleting a unicast key.
    295  */
    296 struct ieee80211req_del_key {
    297 	uint8_t		idk_keyix;	/* key index */
    298 	uint8_t		idk_macaddr[IEEE80211_ADDR_LEN];
    299 };
    300 
    301 /*
    302  * MLME state manipulation request.  IEEE80211_MLME_ASSOC
    303  * only makes sense when operating as a station.  The other
    304  * requests can be used when operating as a station or an
    305  * ap (to effect a station).
    306  */
    307 struct ieee80211req_mlme {
    308 	uint8_t		im_op;		/* operation to perform */
    309 #define	IEEE80211_MLME_ASSOC		1	/* associate station */
    310 #define	IEEE80211_MLME_DISASSOC		2	/* disassociate station */
    311 #define	IEEE80211_MLME_DEAUTH		3	/* deauthenticate station */
    312 #define	IEEE80211_MLME_AUTHORIZE	4	/* authorize station */
    313 #define	IEEE80211_MLME_UNAUTHORIZE	5	/* unauthorize station */
    314 	uint8_t		im_ssid_len;	/* length of optional ssid */
    315 	uint16_t	im_reason;	/* 802.11 reason code */
    316 	uint8_t		im_macaddr[IEEE80211_ADDR_LEN];
    317 	uint8_t		im_ssid[IEEE80211_NWID_LEN];
    318 };
    319 
    320 /*
    321  * MAC ACL operations.
    322  */
    323 enum {
    324 	IEEE80211_MACCMD_POLICY_OPEN	= 0,	/* set policy: no ACL's */
    325 	IEEE80211_MACCMD_POLICY_ALLOW	= 1,	/* set policy: allow traffic */
    326 	IEEE80211_MACCMD_POLICY_DENY	= 2,	/* set policy: deny traffic */
    327 	IEEE80211_MACCMD_FLUSH		= 3,	/* flush ACL database */
    328 	IEEE80211_MACCMD_DETACH		= 4,	/* detach ACL policy */
    329 	IEEE80211_MACCMD_POLICY		= 5,	/* get ACL policy */
    330 	IEEE80211_MACCMD_LIST		= 6,	/* get ACL database */
    331 };
    332 
    333 struct ieee80211req_maclist {
    334 	uint8_t		ml_macaddr[IEEE80211_ADDR_LEN];
    335 };
    336 
    337 /*
    338  * Set the active channel list.  Note this list is
    339  * intersected with the available channel list in
    340  * calculating the set of channels actually used in
    341  * scanning.
    342  */
    343 struct ieee80211req_chanlist {
    344 	uint8_t		ic_channels[IEEE80211_CHAN_BYTES];
    345 };
    346 
    347 /*
    348  * Get the active channel list info.
    349  */
    350 struct ieee80211req_chaninfo {
    351 	u_int	ic_nchans;
    352 	struct ieee80211_channel ic_chans[IEEE80211_CHAN_MAX];
    353 };
    354 
    355 /*
    356  * Retrieve the WPA/RSN information element for an associated station.
    357  */
    358 struct ieee80211req_wpaie {	/* old version w/ only one ie */
    359 	uint8_t		wpa_macaddr[IEEE80211_ADDR_LEN];
    360 	uint8_t		wpa_ie[IEEE80211_MAX_OPT_IE];
    361 };
    362 struct ieee80211req_wpaie2 {
    363 	uint8_t		wpa_macaddr[IEEE80211_ADDR_LEN];
    364 	uint8_t		wpa_ie[IEEE80211_MAX_OPT_IE];
    365 	uint8_t		rsn_ie[IEEE80211_MAX_OPT_IE];
    366 };
    367 
    368 /*
    369  * Retrieve per-node statistics.
    370  */
    371 struct ieee80211req_sta_stats {
    372 	union {
    373 		/* NB: explicitly force 64-bit alignment */
    374 		uint8_t		macaddr[IEEE80211_ADDR_LEN];
    375 		uint64_t	pad;
    376 	} is_u;
    377 	struct ieee80211_nodestats is_stats;
    378 };
    379 
    380 /*
    381  * Station information block; the mac address is used
    382  * to retrieve other data like stats, unicast key, etc.
    383  */
    384 struct ieee80211req_sta_info {
    385 	uint16_t	isi_len;		/* length (mult of 4) */
    386 	uint16_t	isi_ie_off;		/* offset to IE data */
    387 	uint16_t	isi_ie_len;		/* IE length */
    388 	uint16_t	isi_freq;		/* MHz */
    389 	uint32_t	isi_flags;		/* channel flags */
    390 	uint16_t	isi_state;		/* state flags */
    391 	uint8_t		isi_authmode;		/* authentication algorithm */
    392 	int8_t		isi_rssi;		/* receive signal strength */
    393 	int8_t		isi_noise;		/* noise floor */
    394 	uint8_t		isi_capinfo;		/* capabilities */
    395 	uint8_t		isi_erp;		/* ERP element */
    396 	uint8_t		isi_macaddr[IEEE80211_ADDR_LEN];
    397 	uint8_t		isi_nrates;
    398 						/* negotiated rates */
    399 	uint8_t		isi_rates[IEEE80211_RATE_MAXSIZE];
    400 	uint8_t		isi_txrate;		/* index to isi_rates[] */
    401 	uint16_t	isi_associd;		/* assoc response */
    402 	uint16_t	isi_txpower;		/* current tx power */
    403 	uint16_t	isi_vlan;		/* vlan tag */
    404 	/* NB: [IEEE80211_NONQOS_TID] holds seq#'s for non-QoS stations */
    405 	uint16_t	isi_txseqs[IEEE80211_TID_SIZE];/* tx seq #/TID */
    406 	uint16_t	isi_rxseqs[IEEE80211_TID_SIZE];/* rx seq#/TID */
    407 	uint16_t	isi_inact;		/* inactivity timer */
    408 	/* XXX frag state? */
    409 	/* variable length IE data */
    410 };
    411 
    412 /*
    413  * Retrieve per-station information; to retrieve all
    414  * specify a mac address of ff:ff:ff:ff:ff:ff.
    415  */
    416 struct ieee80211req_sta_req {
    417 	union {
    418 		/* NB: explicitly force 64-bit alignment */
    419 		uint8_t		macaddr[IEEE80211_ADDR_LEN];
    420 		uint64_t	pad;
    421 	} is_u;
    422 	struct ieee80211req_sta_info info[1];	/* variable length */
    423 };
    424 
    425 /*
    426  * Get/set per-station tx power cap.
    427  */
    428 struct ieee80211req_sta_txpow {
    429 	uint8_t		it_macaddr[IEEE80211_ADDR_LEN];
    430 	uint8_t		it_txpow;
    431 };
    432 
    433 /*
    434  * WME parameters are set and return using i_val and i_len.
    435  * i_val holds the value itself.  i_len specifies the AC
    436  * and, as appropriate, then high bit specifies whether the
    437  * operation is to be applied to the BSS or ourself.
    438  */
    439 #define	IEEE80211_WMEPARAM_SELF	0x0000		/* parameter applies to self */
    440 #define	IEEE80211_WMEPARAM_BSS	0x8000		/* parameter applies to BSS */
    441 #define	IEEE80211_WMEPARAM_VAL	0x7fff		/* parameter value */
    442 
    443 /*
    444  * FreeBSD-style ioctls.
    445  */
    446 /* the first member must be matched with struct ifreq */
    447 struct ieee80211req {
    448 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
    449 	uint16_t	i_type;			/* req type */
    450 	int16_t		i_val;			/* Index or simple value */
    451 	int16_t		i_len;			/* Index or simple value */
    452 	void		*i_data;		/* Extra data */
    453 };
    454 
    455 #ifdef __FreeBSD__
    456 #define	SIOCS80211		 _IOW('i', 234, struct ieee80211req)
    457 #define	SIOCG80211		_IOWR('i', 235, struct ieee80211req)
    458 #define	SIOCG80211STATS		_IOWR('i', 236, struct ifreq)
    459 #endif /* __FreeBSD__ */
    460 
    461 #ifdef __NetBSD__
    462 #define	SIOCS80211		 _IOW('i', 244, struct ieee80211req)
    463 #define	SIOCG80211		_IOWR('i', 245, struct ieee80211req)
    464 #define	SIOCG80211STATS		_IOWR('i', 246, struct ifreq)
    465 #define	SIOCG80211ZSTATS	_IOWR('i', 247, struct ifreq)
    466 #ifdef COMPAT_20
    467 #define	OSIOCG80211STATS	_IOWR('i', 242, struct ifreq)
    468 #define	OSIOCG80211ZSTATS	_IOWR('i', 243, struct ifreq)
    469 #endif /* COMPAT_20 */
    470 #endif /* __NetBSD__ */
    471 
    472 #if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
    473 #define IEEE80211_IOC_SSID		1
    474 #endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
    475 #define IEEE80211_IOC_NUMSSIDS		2
    476 #define IEEE80211_IOC_WEP		3
    477 #define 	IEEE80211_WEP_NOSUP	-1
    478 #define 	IEEE80211_WEP_OFF	0
    479 #define 	IEEE80211_WEP_ON	1
    480 #define 	IEEE80211_WEP_MIXED	2
    481 #if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
    482 #define IEEE80211_IOC_WEPKEY		4
    483 #endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
    484 #define IEEE80211_IOC_NUMWEPKEYS	5
    485 #if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
    486 #define IEEE80211_IOC_WEPTXKEY		6
    487 #endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
    488 #define IEEE80211_IOC_AUTHMODE		7
    489 #define IEEE80211_IOC_STATIONNAME	8
    490 #if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
    491 #define IEEE80211_IOC_CHANNEL		9
    492 #endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
    493 #define IEEE80211_IOC_POWERSAVE		10
    494 #define 	IEEE80211_POWERSAVE_NOSUP	-1
    495 #define 	IEEE80211_POWERSAVE_OFF		0
    496 #define 	IEEE80211_POWERSAVE_CAM		1
    497 #define 	IEEE80211_POWERSAVE_PSP		2
    498 #define 	IEEE80211_POWERSAVE_PSP_CAM	3
    499 #define 	IEEE80211_POWERSAVE_ON		IEEE80211_POWERSAVE_CAM
    500 #define IEEE80211_IOC_POWERSAVESLEEP	11
    501 #define	IEEE80211_IOC_RTSTHRESHOLD	12
    502 #define IEEE80211_IOC_PROTMODE		13
    503 #define 	IEEE80211_PROTMODE_OFF		0
    504 #define 	IEEE80211_PROTMODE_CTS		1
    505 #define 	IEEE80211_PROTMODE_RTSCTS	2
    506 #define	IEEE80211_IOC_TXPOWER		14	/* global tx power limit */
    507 #if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
    508 #define	IEEE80211_IOC_BSSID		15
    509 #endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
    510 #define	IEEE80211_IOC_ROAMING		16	/* roaming mode */
    511 #define	IEEE80211_IOC_PRIVACY		17	/* privacy invoked */
    512 #define	IEEE80211_IOC_DROPUNENCRYPTED	18	/* discard unencrypted frames */
    513 #define	IEEE80211_IOC_WPAKEY		19
    514 #define	IEEE80211_IOC_DELKEY		20
    515 #define	IEEE80211_IOC_MLME		21
    516 #define	IEEE80211_IOC_OPTIE		22	/* optional info. element */
    517 #define	IEEE80211_IOC_SCAN_REQ		23
    518 /* 24 was IEEE80211_IOC_SCAN_RESULTS */
    519 #define	IEEE80211_IOC_COUNTERMEASURES	25	/* WPA/TKIP countermeasures */
    520 #define	IEEE80211_IOC_WPA		26	/* WPA mode (0,1,2) */
    521 #define	IEEE80211_IOC_CHANLIST		27	/* channel list */
    522 #define	IEEE80211_IOC_WME		28	/* WME mode (on, off) */
    523 #define	IEEE80211_IOC_HIDESSID		29	/* hide SSID mode (on, off) */
    524 #define	IEEE80211_IOC_APBRIDGE		30	/* AP inter-sta bridging */
    525 #define	IEEE80211_IOC_MCASTCIPHER	31	/* multicast/default cipher */
    526 #define	IEEE80211_IOC_MCASTKEYLEN	32	/* multicast key length */
    527 #define	IEEE80211_IOC_UCASTCIPHERS	33	/* unicast cipher suites */
    528 #define	IEEE80211_IOC_UCASTCIPHER	34	/* unicast cipher */
    529 #define	IEEE80211_IOC_UCASTKEYLEN	35	/* unicast key length */
    530 #define	IEEE80211_IOC_DRIVER_CAPS	36	/* driver capabilities */
    531 #define	IEEE80211_IOC_KEYMGTALGS	37	/* key management algorithms */
    532 #define	IEEE80211_IOC_RSNCAPS		38	/* RSN capabilities */
    533 #define	IEEE80211_IOC_WPAIE		39	/* WPA information element */
    534 #define	IEEE80211_IOC_STA_STATS		40	/* per-station statistics */
    535 #define	IEEE80211_IOC_MACCMD		41	/* MAC ACL operation */
    536 #define	IEEE80211_IOC_CHANINFO		42	/* channel info list */
    537 #define	IEEE80211_IOC_TXPOWMAX		43	/* max tx power for channel */
    538 #define	IEEE80211_IOC_STA_TXPOW		44	/* per-station tx power limit */
    539 /* 45 was IEEE80211_IOC_STA_INFO */
    540 #define	IEEE80211_IOC_WME_CWMIN		46	/* WME: ECWmin */
    541 #define	IEEE80211_IOC_WME_CWMAX		47	/* WME: ECWmax */
    542 #define	IEEE80211_IOC_WME_AIFS		48	/* WME: AIFSN */
    543 #define	IEEE80211_IOC_WME_TXOPLIMIT	49	/* WME: txops limit */
    544 #define	IEEE80211_IOC_WME_ACM		50	/* WME: ACM (bss only) */
    545 #define	IEEE80211_IOC_WME_ACKPOLICY	51	/* WME: ACK policy (!bss only)*/
    546 #define	IEEE80211_IOC_DTIM_PERIOD	52	/* DTIM period (beacons) */
    547 #define	IEEE80211_IOC_BEACON_INTERVAL	53	/* beacon interval (ms) */
    548 #define	IEEE80211_IOC_ADDMAC		54	/* add sta to MAC ACL table */
    549 #define	IEEE80211_IOC_DELMAC		55	/* del sta from MAC ACL table */
    550 #define	IEEE80211_IOC_PUREG		56	/* pure 11g (no 11b stations) */
    551 #define	IEEE80211_IOC_FF		57	/* ATH fast frames (on, off) */
    552 #define	IEEE80211_IOC_TURBOP		58	/* ATH turbo' (on, off) */
    553 #define	IEEE80211_IOC_BGSCAN		59	/* bg scanning (on, off) */
    554 #define	IEEE80211_IOC_BGSCAN_IDLE	60	/* bg scan idle threshold */
    555 #define	IEEE80211_IOC_BGSCAN_INTERVAL	61	/* bg scan interval */
    556 #define	IEEE80211_IOC_SCANVALID		65	/* scan cache valid threshold */
    557 #define	IEEE80211_IOC_ROAM_RSSI_11A	66	/* rssi threshold in 11a */
    558 #define	IEEE80211_IOC_ROAM_RSSI_11B	67	/* rssi threshold in 11b */
    559 #define	IEEE80211_IOC_ROAM_RSSI_11G	68	/* rssi threshold in 11g */
    560 #define	IEEE80211_IOC_ROAM_RATE_11A	69	/* tx rate threshold in 11a */
    561 #define	IEEE80211_IOC_ROAM_RATE_11B	70	/* tx rate threshold in 11b */
    562 #define	IEEE80211_IOC_ROAM_RATE_11G	71	/* tx rate threshold in 11g */
    563 #define	IEEE80211_IOC_MCAST_RATE	72	/* tx rate for mcast frames */
    564 #define	IEEE80211_IOC_MCAST_RATE	72	/* tx rate for mcast frames */
    565 #define	IEEE80211_IOC_FRAGTHRESHOLD	73	/* tx fragmentation threshold */
    566 #define	IEEE80211_IOC_BURST		75	/* packet bursting */
    567 #define	IEEE80211_IOC_SCAN_RESULTS	76	/* get scan results */
    568 #define	IEEE80211_IOC_BMISSTHRESHOLD	77	/* beacon miss threshold */
    569 #define	IEEE80211_IOC_STA_INFO		78	/* station/neighbor info */
    570 #define	IEEE80211_IOC_WPAIE2		79	/* WPA+RSN info elements */
    571 #define	IEEE80211_IOC_CURCHAN		80	/* current channel */
    572 #define	IEEE80211_IOC_SHORTGI		81	/* 802.11n half GI */
    573 #define	IEEE80211_IOC_AMPDU		82	/* 802.11n A-MPDU (on, off) */
    574 #define	IEEE80211_IOC_AMPDU_LIMIT	83	/* A-MPDU length limit */
    575 #define	IEEE80211_IOC_AMPDU_DENSITY	84	/* A-MPDU density */
    576 #define	IEEE80211_IOC_AMSDU		85	/* 802.11n A-MSDU (on, off) */
    577 #define	IEEE80211_IOC_AMSDU_LIMIT	86	/* A-MSDU length limit */
    578 #define	IEEE80211_IOC_PUREN		87	/* pure 11n (no legacy sta's) */
    579 #define	IEEE80211_IOC_DOTH		88	/* 802.11h (on, off) */
    580 #define	IEEE80211_IOC_REGDOMAIN		89	/* regulatory domain */
    581 #define	IEEE80211_IOC_COUNTRYCODE	90	/* ISO country code */
    582 #define	IEEE80211_IOC_LOCATION		91	/* indoor/outdoor/anywhere */
    583 #define	IEEE80211_IOC_HTCOMPAT		92	/* support pre-D1.10 HT ie's */
    584 #define	IEEE80211_IOC_INACTIVITY	94	/* sta inactivity handling */
    585 #define IEEE80211_IOC_HTPROTMODE	102	/* HT protection (off, rts) */
    586 #define	IEEE80211_IOC_HTCONF		105	/* HT config (off, HT20, HT40)*/
    587 
    588 /*
    589  * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.
    590  * Each result is a fixed size structure followed by a variable
    591  * length SSID and one or more variable length information elements.
    592  * The size of each variable length item is found in the fixed
    593  * size structure and the entire length of the record is specified
    594  * in isr_len.  Result records are rounded to a multiple of 4 bytes.
    595  */
    596 struct ieee80211req_scan_result {
    597 	uint16_t	isr_len;		/* length (mult of 4) */
    598 	uint16_t	isr_ie_off;		/* offset to IE data */
    599 	uint16_t	isr_ie_len;		/* IE length */
    600 	uint16_t	isr_freq;		/* MHz */
    601 	uint16_t	isr_flags;		/* channel flags */
    602 	int8_t		isr_noise;
    603 	int8_t		isr_rssi;
    604 	uint8_t		isr_intval;		/* beacon interval */
    605 	uint8_t		isr_capinfo;		/* capabilities */
    606 	uint8_t		isr_erp;		/* ERP element */
    607 	uint8_t		isr_bssid[IEEE80211_ADDR_LEN];
    608 	uint8_t		isr_nrates;
    609 	uint8_t		isr_rates[IEEE80211_RATE_MAXSIZE];
    610 	uint8_t		isr_ssid_len;		/* SSID length */
    611 	/* variable length SSID followed by IE data */
    612 };
    613 
    614 #ifdef __NetBSD__
    615 /* nwid is pointed at by ifr.ifr_data */
    616 struct ieee80211_nwid {
    617 	u_int8_t	i_len;
    618 	u_int8_t	i_nwid[IEEE80211_NWID_LEN];
    619 };
    620 
    621 #define	SIOCS80211NWID		_IOWR('i', 230, struct ifreq)
    622 #define	SIOCG80211NWID		_IOWR('i', 231, struct ifreq)
    623 
    624 /* the first member must be matched with struct ifreq */
    625 struct ieee80211_nwkey {
    626 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
    627 	int		i_wepon;		/* wep enabled flag */
    628 	int		i_defkid;		/* default encrypt key id */
    629 	struct {
    630 		int		i_keylen;
    631 		u_int8_t	*i_keydat;
    632 	}		i_key[IEEE80211_WEP_NKID];
    633 };
    634 #define	SIOCS80211NWKEY		 _IOW('i', 232, struct ieee80211_nwkey)
    635 #define	SIOCG80211NWKEY		_IOWR('i', 233, struct ieee80211_nwkey)
    636 /* i_wepon */
    637 #define	IEEE80211_NWKEY_OPEN	0		/* No privacy */
    638 #define	IEEE80211_NWKEY_WEP	1		/* WEP enabled */
    639 #define	IEEE80211_NWKEY_EAP	2		/* EAP enabled */
    640 #define	IEEE80211_NWKEY_PERSIST	0x100		/* designate persist keyset */
    641 
    642 /* power management parameters */
    643 struct ieee80211_power {
    644 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
    645 	int		i_enabled;		/* 1 == on, 0 == off */
    646 	int		i_maxsleep;		/* max sleep in ms */
    647 };
    648 #define	SIOCS80211POWER		 _IOW('i', 234, struct ieee80211_power)
    649 #define	SIOCG80211POWER		_IOWR('i', 235, struct ieee80211_power)
    650 
    651 struct ieee80211_auth {
    652 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
    653 	int		i_authtype;
    654 };
    655 
    656 #define	IEEE80211_AUTH_NONE	0
    657 #define	IEEE80211_AUTH_OPEN	1
    658 #define	IEEE80211_AUTH_SHARED	2
    659 
    660 #define	SIOCS80211AUTH		 _IOW('i', 236, struct ieee80211_auth)
    661 #define	SIOCG80211AUTH		_IOWR('i', 237, struct ieee80211_auth)
    662 
    663 struct ieee80211chanreq {
    664 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
    665 	u_int16_t	i_channel;
    666 };
    667 
    668 #ifndef IEEE80211_CHAN_ANY
    669 #define	IEEE80211_CHAN_ANY	0xffff
    670 #endif
    671 
    672 #define	SIOCS80211CHANNEL	 _IOW('i', 238, struct ieee80211chanreq)
    673 #define	SIOCG80211CHANNEL	_IOWR('i', 239, struct ieee80211chanreq)
    674 
    675 struct ieee80211_bssid {
    676 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
    677 	u_int8_t	i_bssid[IEEE80211_ADDR_LEN];
    678 };
    679 
    680 #define	SIOCS80211BSSID		 _IOW('i', 240, struct ieee80211_bssid)
    681 #define	SIOCG80211BSSID		_IOWR('i', 241, struct ieee80211_bssid)
    682 
    683 #endif
    684 
    685 #if defined(__FreeBSD__) || defined(COMPAT_FREEBSD_NET80211)
    686 struct ieee80211_clone_params {
    687 	char	icp_parent[IFNAMSIZ];		/* parent device */
    688 	int	icp_opmode;			/* operating mode */
    689 };
    690 #endif /* __FreeBSD__ || COMPAT_FREEBSD_NET80211 */
    691 
    692 #endif /* !_NET80211_IEEE80211_IOCTL_H_ */
    693