xref: /freebsd/sys/net80211/ieee80211_ioctl.h (revision a43cee7009182f029996c7c7c33c812385e8fe41)
11a1e1d21SSam Leffler /*-
27535e66aSSam Leffler  * Copyright (c) 2001 Atsushi Onoe
310ad9a77SSam Leffler  * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
41a1e1d21SSam Leffler  * All rights reserved.
51a1e1d21SSam Leffler  *
61a1e1d21SSam Leffler  * Redistribution and use in source and binary forms, with or without
71a1e1d21SSam Leffler  * modification, are permitted provided that the following conditions
81a1e1d21SSam Leffler  * are met:
91a1e1d21SSam Leffler  * 1. Redistributions of source code must retain the above copyright
101a1e1d21SSam Leffler  *    notice, this list of conditions and the following disclaimer.
111a1e1d21SSam Leffler  * 2. Redistributions in binary form must reproduce the above copyright
121a1e1d21SSam Leffler  *    notice, this list of conditions and the following disclaimer in the
131a1e1d21SSam Leffler  *    documentation and/or other materials provided with the distribution.
147535e66aSSam Leffler  *
157535e66aSSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
167535e66aSSam Leffler  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
177535e66aSSam Leffler  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
187535e66aSSam Leffler  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
197535e66aSSam Leffler  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
207535e66aSSam Leffler  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
217535e66aSSam Leffler  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
227535e66aSSam Leffler  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
237535e66aSSam Leffler  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
247535e66aSSam Leffler  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
251a1e1d21SSam Leffler  *
261a1e1d21SSam Leffler  * $FreeBSD$
271a1e1d21SSam Leffler  */
281a1e1d21SSam Leffler #ifndef _NET80211_IEEE80211_IOCTL_H_
291a1e1d21SSam Leffler #define _NET80211_IEEE80211_IOCTL_H_
301a1e1d21SSam Leffler 
311a1e1d21SSam Leffler /*
321a1e1d21SSam Leffler  * IEEE 802.11 ioctls.
331a1e1d21SSam Leffler  */
348a1b9b6aSSam Leffler #include <net80211/_ieee80211.h>
358a1b9b6aSSam Leffler #include <net80211/ieee80211.h>
368a1b9b6aSSam Leffler #include <net80211/ieee80211_crypto.h>
371a1e1d21SSam Leffler 
388a1b9b6aSSam Leffler /*
39d1c85daeSSam Leffler  * Per/node (station) statistics.
408a1b9b6aSSam Leffler  */
418a1b9b6aSSam Leffler struct ieee80211_nodestats {
4268e8e04eSSam Leffler 	uint32_t	ns_rx_data;		/* rx data frames */
4368e8e04eSSam Leffler 	uint32_t	ns_rx_mgmt;		/* rx management frames */
4468e8e04eSSam Leffler 	uint32_t	ns_rx_ctrl;		/* rx control frames */
4568e8e04eSSam Leffler 	uint32_t	ns_rx_ucast;		/* rx unicast frames */
4668e8e04eSSam Leffler 	uint32_t	ns_rx_mcast;		/* rx multi/broadcast frames */
4768e8e04eSSam Leffler 	uint64_t	ns_rx_bytes;		/* rx data count (bytes) */
4868e8e04eSSam Leffler 	uint64_t	ns_rx_beacons;		/* rx beacon frames */
4968e8e04eSSam Leffler 	uint32_t	ns_rx_proberesp;	/* rx probe response frames */
508a1b9b6aSSam Leffler 
5168e8e04eSSam Leffler 	uint32_t	ns_rx_dup;		/* rx discard 'cuz dup */
5268e8e04eSSam Leffler 	uint32_t	ns_rx_noprivacy;	/* rx w/ wep but privacy off */
5368e8e04eSSam Leffler 	uint32_t	ns_rx_wepfail;		/* rx wep processing failed */
5468e8e04eSSam Leffler 	uint32_t	ns_rx_demicfail;	/* rx demic failed */
5568e8e04eSSam Leffler 	uint32_t	ns_rx_decap;		/* rx decapsulation failed */
5668e8e04eSSam Leffler 	uint32_t	ns_rx_defrag;		/* rx defragmentation failed */
5768e8e04eSSam Leffler 	uint32_t	ns_rx_disassoc;		/* rx disassociation */
5868e8e04eSSam Leffler 	uint32_t	ns_rx_deauth;		/* rx deauthentication */
5968e8e04eSSam Leffler 	uint32_t	ns_rx_action;		/* rx action */
6068e8e04eSSam Leffler 	uint32_t	ns_rx_decryptcrc;	/* rx decrypt failed on crc */
6168e8e04eSSam Leffler 	uint32_t	ns_rx_unauth;		/* rx on unauthorized port */
6268e8e04eSSam Leffler 	uint32_t	ns_rx_unencrypted;	/* rx unecrypted w/ privacy */
631b6167d2SSam Leffler 	uint32_t	ns_rx_drop;		/* rx discard other reason */
648a1b9b6aSSam Leffler 
6568e8e04eSSam Leffler 	uint32_t	ns_tx_data;		/* tx data frames */
6668e8e04eSSam Leffler 	uint32_t	ns_tx_mgmt;		/* tx management frames */
67a43cee70SSam Leffler 	uint32_t	ns_tx_ctrl;		/* tx control frames */
6868e8e04eSSam Leffler 	uint32_t	ns_tx_ucast;		/* tx unicast frames */
6968e8e04eSSam Leffler 	uint32_t	ns_tx_mcast;		/* tx multi/broadcast frames */
7068e8e04eSSam Leffler 	uint64_t	ns_tx_bytes;		/* tx data count (bytes) */
7168e8e04eSSam Leffler 	uint32_t	ns_tx_probereq;		/* tx probe request frames */
728a1b9b6aSSam Leffler 
7368e8e04eSSam Leffler 	uint32_t	ns_tx_novlantag;	/* tx discard 'cuz no tag */
7468e8e04eSSam Leffler 	uint32_t	ns_tx_vlanmismatch;	/* tx discard 'cuz bad tag */
758a1b9b6aSSam Leffler 
7668e8e04eSSam Leffler 	uint32_t	ns_ps_discard;		/* ps discard 'cuz of age */
778a1b9b6aSSam Leffler 
788a1b9b6aSSam Leffler 	/* MIB-related state */
7968e8e04eSSam Leffler 	uint32_t	ns_tx_assoc;		/* [re]associations */
8068e8e04eSSam Leffler 	uint32_t	ns_tx_assoc_fail;	/* [re]association failures */
8168e8e04eSSam Leffler 	uint32_t	ns_tx_auth;		/* [re]authentications */
8268e8e04eSSam Leffler 	uint32_t	ns_tx_auth_fail;	/* [re]authentication failures*/
8368e8e04eSSam Leffler 	uint32_t	ns_tx_deauth;		/* deauthentications */
8468e8e04eSSam Leffler 	uint32_t	ns_tx_deauth_code;	/* last deauth reason */
8568e8e04eSSam Leffler 	uint32_t	ns_tx_disassoc;		/* disassociations */
8668e8e04eSSam Leffler 	uint32_t	ns_tx_disassoc_code;	/* last disassociation reason */
87a43cee70SSam Leffler 	uint32_t	ns_spare[8];
888a1b9b6aSSam Leffler };
898a1b9b6aSSam Leffler 
908a1b9b6aSSam Leffler /*
918a1b9b6aSSam Leffler  * Summary statistics.
928a1b9b6aSSam Leffler  */
931be50176SSam Leffler struct ieee80211_stats {
9468e8e04eSSam Leffler 	uint32_t	is_rx_badversion;	/* rx frame with bad version */
9568e8e04eSSam Leffler 	uint32_t	is_rx_tooshort;		/* rx frame too short */
9668e8e04eSSam Leffler 	uint32_t	is_rx_wrongbss;		/* rx from wrong bssid */
9768e8e04eSSam Leffler 	uint32_t	is_rx_dup;		/* rx discard 'cuz dup */
9868e8e04eSSam Leffler 	uint32_t	is_rx_wrongdir;		/* rx w/ wrong direction */
9968e8e04eSSam Leffler 	uint32_t	is_rx_mcastecho;	/* rx discard 'cuz mcast echo */
10068e8e04eSSam Leffler 	uint32_t	is_rx_notassoc;		/* rx discard 'cuz sta !assoc */
10168e8e04eSSam Leffler 	uint32_t	is_rx_noprivacy;	/* rx w/ wep but privacy off */
10268e8e04eSSam Leffler 	uint32_t	is_rx_unencrypted;	/* rx w/o wep and privacy on */
10368e8e04eSSam Leffler 	uint32_t	is_rx_wepfail;		/* rx wep processing failed */
10468e8e04eSSam Leffler 	uint32_t	is_rx_decap;		/* rx decapsulation failed */
10568e8e04eSSam Leffler 	uint32_t	is_rx_mgtdiscard;	/* rx discard mgt frames */
106a43cee70SSam Leffler 	uint32_t	is_rx_ctl;		/* rx ctrl frames */
10768e8e04eSSam Leffler 	uint32_t	is_rx_beacon;		/* rx beacon frames */
10868e8e04eSSam Leffler 	uint32_t	is_rx_rstoobig;		/* rx rate set truncated */
10968e8e04eSSam Leffler 	uint32_t	is_rx_elem_missing;	/* rx required element missing*/
11068e8e04eSSam Leffler 	uint32_t	is_rx_elem_toobig;	/* rx element too big */
11168e8e04eSSam Leffler 	uint32_t	is_rx_elem_toosmall;	/* rx element too small */
11268e8e04eSSam Leffler 	uint32_t	is_rx_elem_unknown;	/* rx element unknown */
11368e8e04eSSam Leffler 	uint32_t	is_rx_badchan;		/* rx frame w/ invalid chan */
11468e8e04eSSam Leffler 	uint32_t	is_rx_chanmismatch;	/* rx frame chan mismatch */
11568e8e04eSSam Leffler 	uint32_t	is_rx_nodealloc;	/* rx frame dropped */
11668e8e04eSSam Leffler 	uint32_t	is_rx_ssidmismatch;	/* rx frame ssid mismatch  */
11768e8e04eSSam Leffler 	uint32_t	is_rx_auth_unsupported;	/* rx w/ unsupported auth alg */
11868e8e04eSSam Leffler 	uint32_t	is_rx_auth_fail;	/* rx sta auth failure */
11968e8e04eSSam Leffler 	uint32_t	is_rx_auth_countermeasures;/* rx auth discard 'cuz CM */
12068e8e04eSSam Leffler 	uint32_t	is_rx_assoc_bss;	/* rx assoc from wrong bssid */
12168e8e04eSSam Leffler 	uint32_t	is_rx_assoc_notauth;	/* rx assoc w/o auth */
12268e8e04eSSam Leffler 	uint32_t	is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
12368e8e04eSSam Leffler 	uint32_t	is_rx_assoc_norate;	/* rx assoc w/ no rate match */
12468e8e04eSSam Leffler 	uint32_t	is_rx_assoc_badwpaie;	/* rx assoc w/ bad WPA IE */
12568e8e04eSSam Leffler 	uint32_t	is_rx_deauth;		/* rx deauthentication */
12668e8e04eSSam Leffler 	uint32_t	is_rx_disassoc;		/* rx disassociation */
12768e8e04eSSam Leffler 	uint32_t	is_rx_badsubtype;	/* rx frame w/ unknown subtype*/
12868e8e04eSSam Leffler 	uint32_t	is_rx_nobuf;		/* rx failed for lack of buf */
12968e8e04eSSam Leffler 	uint32_t	is_rx_decryptcrc;	/* rx decrypt failed on crc */
13068e8e04eSSam Leffler 	uint32_t	is_rx_ahdemo_mgt;	/* rx discard ahdemo mgt frame*/
13168e8e04eSSam Leffler 	uint32_t	is_rx_bad_auth;		/* rx bad auth request */
13268e8e04eSSam Leffler 	uint32_t	is_rx_unauth;		/* rx on unauthorized port */
13368e8e04eSSam Leffler 	uint32_t	is_rx_badkeyid;		/* rx w/ incorrect keyid */
13468e8e04eSSam Leffler 	uint32_t	is_rx_ccmpreplay;	/* rx seq# violation (CCMP) */
13568e8e04eSSam Leffler 	uint32_t	is_rx_ccmpformat;	/* rx format bad (CCMP) */
13668e8e04eSSam Leffler 	uint32_t	is_rx_ccmpmic;		/* rx MIC check failed (CCMP) */
13768e8e04eSSam Leffler 	uint32_t	is_rx_tkipreplay;	/* rx seq# violation (TKIP) */
13868e8e04eSSam Leffler 	uint32_t	is_rx_tkipformat;	/* rx format bad (TKIP) */
13968e8e04eSSam Leffler 	uint32_t	is_rx_tkipmic;		/* rx MIC check failed (TKIP) */
14068e8e04eSSam Leffler 	uint32_t	is_rx_tkipicv;		/* rx ICV check failed (TKIP) */
14168e8e04eSSam Leffler 	uint32_t	is_rx_badcipher;	/* rx failed 'cuz key type */
14268e8e04eSSam Leffler 	uint32_t	is_rx_nocipherctx;	/* rx failed 'cuz key !setup */
14368e8e04eSSam Leffler 	uint32_t	is_rx_acl;		/* rx discard 'cuz acl policy */
14468e8e04eSSam Leffler 	uint32_t	is_tx_nobuf;		/* tx failed for lack of buf */
14568e8e04eSSam Leffler 	uint32_t	is_tx_nonode;		/* tx failed for no node */
14668e8e04eSSam Leffler 	uint32_t	is_tx_unknownmgt;	/* tx of unknown mgt frame */
14768e8e04eSSam Leffler 	uint32_t	is_tx_badcipher;	/* tx failed 'cuz key type */
14868e8e04eSSam Leffler 	uint32_t	is_tx_nodefkey;		/* tx failed 'cuz no defkey */
14968e8e04eSSam Leffler 	uint32_t	is_tx_noheadroom;	/* tx failed 'cuz no space */
15068e8e04eSSam Leffler 	uint32_t	is_tx_fragframes;	/* tx frames fragmented */
15168e8e04eSSam Leffler 	uint32_t	is_tx_frags;		/* tx fragments created */
15268e8e04eSSam Leffler 	uint32_t	is_scan_active;		/* active scans started */
15368e8e04eSSam Leffler 	uint32_t	is_scan_passive;	/* passive scans started */
15468e8e04eSSam Leffler 	uint32_t	is_node_timeout;	/* nodes timed out inactivity */
15568e8e04eSSam Leffler 	uint32_t	is_crypto_nomem;	/* no memory for crypto ctx */
15668e8e04eSSam Leffler 	uint32_t	is_crypto_tkip;		/* tkip crypto done in s/w */
15768e8e04eSSam Leffler 	uint32_t	is_crypto_tkipenmic;	/* tkip en-MIC done in s/w */
15868e8e04eSSam Leffler 	uint32_t	is_crypto_tkipdemic;	/* tkip de-MIC done in s/w */
15968e8e04eSSam Leffler 	uint32_t	is_crypto_tkipcm;	/* tkip counter measures */
16068e8e04eSSam Leffler 	uint32_t	is_crypto_ccmp;		/* ccmp crypto done in s/w */
16168e8e04eSSam Leffler 	uint32_t	is_crypto_wep;		/* wep crypto done in s/w */
16268e8e04eSSam Leffler 	uint32_t	is_crypto_setkey_cipher;/* cipher rejected key */
16368e8e04eSSam Leffler 	uint32_t	is_crypto_setkey_nokey;	/* no key index for setkey */
16468e8e04eSSam Leffler 	uint32_t	is_crypto_delkey;	/* driver key delete failed */
16568e8e04eSSam Leffler 	uint32_t	is_crypto_badcipher;	/* unknown cipher */
16668e8e04eSSam Leffler 	uint32_t	is_crypto_nocipher;	/* cipher not available */
16768e8e04eSSam Leffler 	uint32_t	is_crypto_attachfail;	/* cipher attach failed */
16868e8e04eSSam Leffler 	uint32_t	is_crypto_swfallback;	/* cipher fallback to s/w */
16968e8e04eSSam Leffler 	uint32_t	is_crypto_keyfail;	/* driver key alloc failed */
17068e8e04eSSam Leffler 	uint32_t	is_crypto_enmicfail;	/* en-MIC failed */
17168e8e04eSSam Leffler 	uint32_t	is_ibss_capmismatch;	/* merge failed-cap mismatch */
17268e8e04eSSam Leffler 	uint32_t	is_ibss_norate;		/* merge failed-rate mismatch */
17368e8e04eSSam Leffler 	uint32_t	is_ps_unassoc;		/* ps-poll for unassoc. sta */
17468e8e04eSSam Leffler 	uint32_t	is_ps_badaid;		/* ps-poll w/ incorrect aid */
17568e8e04eSSam Leffler 	uint32_t	is_ps_qempty;		/* ps-poll w/ nothing to send */
17668e8e04eSSam Leffler 	uint32_t	is_ff_badhdr;		/* fast frame rx'd w/ bad hdr */
17768e8e04eSSam Leffler 	uint32_t	is_ff_tooshort;		/* fast frame rx decap error */
17868e8e04eSSam Leffler 	uint32_t	is_ff_split;		/* fast frame rx split error */
17968e8e04eSSam Leffler 	uint32_t	is_ff_decap;		/* fast frames decap'd */
18068e8e04eSSam Leffler 	uint32_t	is_ff_encap;		/* fast frames encap'd for tx */
18168e8e04eSSam Leffler 	uint32_t	is_rx_badbintval;	/* rx frame w/ bogus bintval */
18268e8e04eSSam Leffler 	uint32_t	is_rx_demicfail;	/* rx demic failed */
18368e8e04eSSam Leffler 	uint32_t	is_rx_defrag;		/* rx defragmentation failed */
18468e8e04eSSam Leffler 	uint32_t	is_rx_mgmt;		/* rx management frames */
18568e8e04eSSam Leffler 	uint32_t	is_rx_action;		/* rx action mgt frames */
18668e8e04eSSam Leffler 	uint32_t	is_amsdu_tooshort;	/* A-MSDU rx decap error */
18768e8e04eSSam Leffler 	uint32_t	is_amsdu_split;		/* A-MSDU rx split error */
18868e8e04eSSam Leffler 	uint32_t	is_amsdu_decap;		/* A-MSDU decap'd */
18968e8e04eSSam Leffler 	uint32_t	is_amsdu_encap;		/* A-MSDU encap'd for tx */
19068e8e04eSSam Leffler 	uint32_t	is_ampdu_bar_bad;	/* A-MPDU BAR out of window */
19168e8e04eSSam Leffler 	uint32_t	is_ampdu_bar_oow;	/* A-MPDU BAR before ADDBA */
1921b6167d2SSam Leffler 	uint32_t	is_ampdu_bar_move;	/* A-MPDU BAR moved window */
19368e8e04eSSam Leffler 	uint32_t	is_ampdu_bar_rx;	/* A-MPDU BAR frames handled */
19468e8e04eSSam Leffler 	uint32_t	is_ampdu_rx_flush;	/* A-MPDU frames flushed */
19568e8e04eSSam Leffler 	uint32_t	is_ampdu_rx_oor;	/* A-MPDU frames out-of-order */
19668e8e04eSSam Leffler 	uint32_t	is_ampdu_rx_copy;	/* A-MPDU frames copied down */
1971b6167d2SSam Leffler 	uint32_t	is_ampdu_rx_drop;	/* A-MPDU frames dropped */
1981b6167d2SSam Leffler 	uint32_t	is_tx_badstate;		/* tx discard state != RUN */
1991b6167d2SSam Leffler 	uint32_t	is_tx_notassoc;		/* tx failed, sta not assoc */
2001b6167d2SSam Leffler 	uint32_t	is_tx_classify;		/* tx classification failed */
201b032f27cSSam Leffler 	uint32_t	is_dwds_mcast;		/* discard mcast over dwds */
202b032f27cSSam Leffler 	uint32_t	is_dwds_qdrop;		/* dwds pending frame q full */
2031b6167d2SSam Leffler 	uint32_t	is_ht_assoc_nohtcap;	/* non-HT sta rejected */
2041b6167d2SSam Leffler 	uint32_t	is_ht_assoc_downgrade;	/* HT sta forced to legacy */
2051b6167d2SSam Leffler 	uint32_t	is_ht_assoc_norate;	/* HT assoc w/ rate mismatch */
2061b6167d2SSam Leffler 	uint32_t	is_ampdu_rx_age;	/* A-MPDU sent up 'cuz of age */
2071b6167d2SSam Leffler 	uint32_t	is_ampdu_rx_move;	/* A-MPDU MSDU moved window */
2081b6167d2SSam Leffler 	uint32_t	is_addba_reject;	/* ADDBA reject 'cuz disabled */
2091b6167d2SSam Leffler 	uint32_t	is_addba_norequest;	/* ADDBA response w/o ADDBA */
2101b6167d2SSam Leffler 	uint32_t	is_addba_badtoken;	/* ADDBA response w/ wrong
2111b6167d2SSam Leffler 						   dialogtoken */
212eaff8e26SSam Leffler 	uint32_t	is_addba_badpolicy;	/* ADDBA resp w/ wrong policy */
2131b6167d2SSam Leffler 	uint32_t	is_ampdu_stop;		/* A-MPDU stream stopped */
2141b6167d2SSam Leffler 	uint32_t	is_ampdu_stop_failed;	/* A-MPDU stream not running */
2151b6167d2SSam Leffler 	uint32_t	is_ampdu_rx_reorder;	/* A-MPDU held for rx reorder */
216b032f27cSSam Leffler 	uint32_t	is_scan_bg;		/* background scans started */
217b032f27cSSam Leffler 	uint8_t		is_rx_deauth_code;	/* last rx'd deauth reason */
218b032f27cSSam Leffler 	uint8_t		is_rx_disassoc_code;	/* last rx'd disassoc reason */
219b032f27cSSam Leffler 	uint8_t		is_rx_authfail_code;	/* last rx'd auth fail reason */
220b032f27cSSam Leffler 	uint32_t	is_beacon_miss;		/* beacon miss notification */
22110ad9a77SSam Leffler 	uint32_t	is_rx_badstate;		/* rx discard state != RUN */
222339ccfb3SSam Leffler 	uint32_t	is_ff_flush;		/* ff's flush'd from stageq */
223a43cee70SSam Leffler 	uint32_t	is_tx_ctl;		/* tx ctrl frames */
224a43cee70SSam Leffler 	uint32_t	is_ampdu_rexmt;		/* A-MPDU frames rexmt ok */
225a43cee70SSam Leffler 	uint32_t	is_ampdu_rexmt_fail;	/* A-MPDU frames rexmt fail */
226a43cee70SSam Leffler 	uint32_t	is_spare[16];
2271be50176SSam Leffler };
2281be50176SSam Leffler 
2298a1b9b6aSSam Leffler /*
2308a1b9b6aSSam Leffler  * Max size of optional information elements.  We artificially
2318a1b9b6aSSam Leffler  * constrain this; it's limited only by the max frame size (and
2328a1b9b6aSSam Leffler  * the max parameter size of the wireless extensions).
2338a1b9b6aSSam Leffler  */
2348a1b9b6aSSam Leffler #define	IEEE80211_MAX_OPT_IE	256
2358a1b9b6aSSam Leffler 
2368a1b9b6aSSam Leffler /*
2378a1b9b6aSSam Leffler  * WPA/RSN get/set key request.  Specify the key/cipher
2388a1b9b6aSSam Leffler  * type and whether the key is to be used for sending and/or
2398a1b9b6aSSam Leffler  * receiving.  The key index should be set only when working
2408a1b9b6aSSam Leffler  * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
2418a1b9b6aSSam Leffler  * Otherwise a unicast/pairwise key is specified by the bssid
2428a1b9b6aSSam Leffler  * (on a station) or mac address (on an ap).  They key length
2438a1b9b6aSSam Leffler  * must include any MIC key data; otherwise it should be no
2441b6167d2SSam Leffler  * more than IEEE80211_KEYBUF_SIZE.
2458a1b9b6aSSam Leffler  */
2468a1b9b6aSSam Leffler struct ieee80211req_key {
24768e8e04eSSam Leffler 	uint8_t		ik_type;	/* key/cipher type */
24868e8e04eSSam Leffler 	uint8_t		ik_pad;
24968e8e04eSSam Leffler 	uint16_t	ik_keyix;	/* key index */
25068e8e04eSSam Leffler 	uint8_t		ik_keylen;	/* key length in bytes */
25168e8e04eSSam Leffler 	uint8_t		ik_flags;
2528a1b9b6aSSam Leffler /* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */
2538a1b9b6aSSam Leffler #define	IEEE80211_KEY_DEFAULT	0x80	/* default xmit key */
25468e8e04eSSam Leffler 	uint8_t		ik_macaddr[IEEE80211_ADDR_LEN];
25568e8e04eSSam Leffler 	uint64_t	ik_keyrsc;	/* key receive sequence counter */
25668e8e04eSSam Leffler 	uint64_t	ik_keytsc;	/* key transmit sequence counter */
25768e8e04eSSam Leffler 	uint8_t		ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
2588a1b9b6aSSam Leffler };
2598a1b9b6aSSam Leffler 
2608a1b9b6aSSam Leffler /*
2618a1b9b6aSSam Leffler  * Delete a key either by index or address.  Set the index
2628a1b9b6aSSam Leffler  * to IEEE80211_KEYIX_NONE when deleting a unicast key.
2638a1b9b6aSSam Leffler  */
2648a1b9b6aSSam Leffler struct ieee80211req_del_key {
26568e8e04eSSam Leffler 	uint8_t		idk_keyix;	/* key index */
26668e8e04eSSam Leffler 	uint8_t		idk_macaddr[IEEE80211_ADDR_LEN];
2678a1b9b6aSSam Leffler };
2688a1b9b6aSSam Leffler 
2698a1b9b6aSSam Leffler /*
2708a1b9b6aSSam Leffler  * MLME state manipulation request.  IEEE80211_MLME_ASSOC
2718a1b9b6aSSam Leffler  * only makes sense when operating as a station.  The other
2728a1b9b6aSSam Leffler  * requests can be used when operating as a station or an
2738a1b9b6aSSam Leffler  * ap (to effect a station).
2748a1b9b6aSSam Leffler  */
2758a1b9b6aSSam Leffler struct ieee80211req_mlme {
27668e8e04eSSam Leffler 	uint8_t		im_op;		/* operation to perform */
2778a1b9b6aSSam Leffler #define	IEEE80211_MLME_ASSOC		1	/* associate station */
2788a1b9b6aSSam Leffler #define	IEEE80211_MLME_DISASSOC		2	/* disassociate station */
2798a1b9b6aSSam Leffler #define	IEEE80211_MLME_DEAUTH		3	/* deauthenticate station */
2808a1b9b6aSSam Leffler #define	IEEE80211_MLME_AUTHORIZE	4	/* authorize station */
2818a1b9b6aSSam Leffler #define	IEEE80211_MLME_UNAUTHORIZE	5	/* unauthorize station */
282b032f27cSSam Leffler #define	IEEE80211_MLME_AUTH		6	/* authenticate station */
28368e8e04eSSam Leffler 	uint8_t		im_ssid_len;	/* length of optional ssid */
28468e8e04eSSam Leffler 	uint16_t	im_reason;	/* 802.11 reason code */
28568e8e04eSSam Leffler 	uint8_t		im_macaddr[IEEE80211_ADDR_LEN];
28668e8e04eSSam Leffler 	uint8_t		im_ssid[IEEE80211_NWID_LEN];
2878a1b9b6aSSam Leffler };
2888a1b9b6aSSam Leffler 
2898a1b9b6aSSam Leffler /*
2908a1b9b6aSSam Leffler  * MAC ACL operations.
2918a1b9b6aSSam Leffler  */
2928a1b9b6aSSam Leffler enum {
2938a1b9b6aSSam Leffler 	IEEE80211_MACCMD_POLICY_OPEN	= 0,	/* set policy: no ACL's */
2948a1b9b6aSSam Leffler 	IEEE80211_MACCMD_POLICY_ALLOW	= 1,	/* set policy: allow traffic */
2958a1b9b6aSSam Leffler 	IEEE80211_MACCMD_POLICY_DENY	= 2,	/* set policy: deny traffic */
2968a1b9b6aSSam Leffler 	IEEE80211_MACCMD_FLUSH		= 3,	/* flush ACL database */
2978a1b9b6aSSam Leffler 	IEEE80211_MACCMD_DETACH		= 4,	/* detach ACL policy */
298188757f5SSam Leffler 	IEEE80211_MACCMD_POLICY		= 5,	/* get ACL policy */
299188757f5SSam Leffler 	IEEE80211_MACCMD_LIST		= 6,	/* get ACL database */
300b032f27cSSam Leffler 	IEEE80211_MACCMD_POLICY_RADIUS	= 7,	/* set policy: RADIUS managed */
301188757f5SSam Leffler };
302188757f5SSam Leffler 
303188757f5SSam Leffler struct ieee80211req_maclist {
30468e8e04eSSam Leffler 	uint8_t		ml_macaddr[IEEE80211_ADDR_LEN];
3058a1b9b6aSSam Leffler };
3068a1b9b6aSSam Leffler 
3078a1b9b6aSSam Leffler /*
3088658b18bSSam Leffler  * Set the active channel list by IEEE channel #: each channel
3098658b18bSSam Leffler  * to be marked active is set in a bit vector.  Note this list is
3108658b18bSSam Leffler  * intersected with the available channel list in calculating
3118658b18bSSam Leffler  * the set of channels actually used in scanning.
3128a1b9b6aSSam Leffler  */
3138a1b9b6aSSam Leffler struct ieee80211req_chanlist {
3148658b18bSSam Leffler 	uint8_t		ic_channels[32];	/* NB: can be variable length */
3158a1b9b6aSSam Leffler };
3168a1b9b6aSSam Leffler 
3178a1b9b6aSSam Leffler /*
3188a1b9b6aSSam Leffler  * Get the active channel list info.
3198a1b9b6aSSam Leffler  */
3208a1b9b6aSSam Leffler struct ieee80211req_chaninfo {
3218a1b9b6aSSam Leffler 	u_int	ic_nchans;
3228658b18bSSam Leffler 	struct ieee80211_channel ic_chans[1];	/* NB: variable length */
3238a1b9b6aSSam Leffler };
3248658b18bSSam Leffler #define	IEEE80211_CHANINFO_SIZE(_nchan) \
3258658b18bSSam Leffler 	(sizeof(struct ieee80211req_chaninfo) + \
3268658b18bSSam Leffler 	 (((_nchan)-1) * sizeof(struct ieee80211_channel)))
3278658b18bSSam Leffler #define	IEEE80211_CHANINFO_SPACE(_ci) \
3288658b18bSSam Leffler 	IEEE80211_CHANINFO_SIZE((_ci)->ic_nchans)
3298a1b9b6aSSam Leffler 
3308a1b9b6aSSam Leffler /*
3318a1b9b6aSSam Leffler  * Retrieve the WPA/RSN information element for an associated station.
3328a1b9b6aSSam Leffler  */
33368e8e04eSSam Leffler struct ieee80211req_wpaie {	/* old version w/ only one ie */
33468e8e04eSSam Leffler 	uint8_t		wpa_macaddr[IEEE80211_ADDR_LEN];
33568e8e04eSSam Leffler 	uint8_t		wpa_ie[IEEE80211_MAX_OPT_IE];
33668e8e04eSSam Leffler };
33768e8e04eSSam Leffler struct ieee80211req_wpaie2 {
33868e8e04eSSam Leffler 	uint8_t		wpa_macaddr[IEEE80211_ADDR_LEN];
33968e8e04eSSam Leffler 	uint8_t		wpa_ie[IEEE80211_MAX_OPT_IE];
34068e8e04eSSam Leffler 	uint8_t		rsn_ie[IEEE80211_MAX_OPT_IE];
3418a1b9b6aSSam Leffler };
3428a1b9b6aSSam Leffler 
3438a1b9b6aSSam Leffler /*
3448a1b9b6aSSam Leffler  * Retrieve per-node statistics.
3458a1b9b6aSSam Leffler  */
3468a1b9b6aSSam Leffler struct ieee80211req_sta_stats {
3478a1b9b6aSSam Leffler 	union {
3488a1b9b6aSSam Leffler 		/* NB: explicitly force 64-bit alignment */
34968e8e04eSSam Leffler 		uint8_t		macaddr[IEEE80211_ADDR_LEN];
35068e8e04eSSam Leffler 		uint64_t	pad;
3518a1b9b6aSSam Leffler 	} is_u;
3528a1b9b6aSSam Leffler 	struct ieee80211_nodestats is_stats;
3538a1b9b6aSSam Leffler };
3548a1b9b6aSSam Leffler 
3558a1b9b6aSSam Leffler /*
3568a1b9b6aSSam Leffler  * Station information block; the mac address is used
3578a1b9b6aSSam Leffler  * to retrieve other data like stats, unicast key, etc.
3588a1b9b6aSSam Leffler  */
3598a1b9b6aSSam Leffler struct ieee80211req_sta_info {
360b032f27cSSam Leffler 	uint16_t	isi_len;		/* total length (mult of 4) */
36168e8e04eSSam Leffler 	uint16_t	isi_ie_off;		/* offset to IE data */
36268e8e04eSSam Leffler 	uint16_t	isi_ie_len;		/* IE length */
36368e8e04eSSam Leffler 	uint16_t	isi_freq;		/* MHz */
364cd9a2dabSSam Leffler 	uint32_t	isi_flags;		/* channel flags */
36568e8e04eSSam Leffler 	uint16_t	isi_state;		/* state flags */
36668e8e04eSSam Leffler 	uint8_t		isi_authmode;		/* authentication algorithm */
367d1c85daeSSam Leffler 	int8_t		isi_rssi;		/* receive signal strength */
368d1c85daeSSam Leffler 	int8_t		isi_noise;		/* noise floor */
36968e8e04eSSam Leffler 	uint8_t		isi_capinfo;		/* capabilities */
37068e8e04eSSam Leffler 	uint8_t		isi_erp;		/* ERP element */
37168e8e04eSSam Leffler 	uint8_t		isi_macaddr[IEEE80211_ADDR_LEN];
37268e8e04eSSam Leffler 	uint8_t		isi_nrates;
37368e8e04eSSam Leffler 						/* negotiated rates */
37468e8e04eSSam Leffler 	uint8_t		isi_rates[IEEE80211_RATE_MAXSIZE];
375b032f27cSSam Leffler 	uint8_t		isi_txrate;		/* legacy/IEEE rate or MCS */
37668e8e04eSSam Leffler 	uint16_t	isi_associd;		/* assoc response */
37768e8e04eSSam Leffler 	uint16_t	isi_txpower;		/* current tx power */
37868e8e04eSSam Leffler 	uint16_t	isi_vlan;		/* vlan tag */
379b337fbc4SSam Leffler 	/* NB: [IEEE80211_NONQOS_TID] holds seq#'s for non-QoS stations */
380b337fbc4SSam Leffler 	uint16_t	isi_txseqs[IEEE80211_TID_SIZE];/* tx seq #/TID */
381b337fbc4SSam Leffler 	uint16_t	isi_rxseqs[IEEE80211_TID_SIZE];/* rx seq#/TID */
38268e8e04eSSam Leffler 	uint16_t	isi_inact;		/* inactivity timer */
383b032f27cSSam Leffler 	uint16_t	isi_txmbps;		/* current tx rate in .5 Mb/s */
384b032f27cSSam Leffler 	uint32_t	isi_jointime;		/* time of assoc/join */
385b032f27cSSam Leffler 	struct ieee80211_mimo_info isi_mimo;	/* MIMO info for 11n sta's */
3868a1b9b6aSSam Leffler 	/* XXX frag state? */
3878a1b9b6aSSam Leffler 	/* variable length IE data */
3888a1b9b6aSSam Leffler };
3898a1b9b6aSSam Leffler 
3908a1b9b6aSSam Leffler /*
3918a1b9b6aSSam Leffler  * Retrieve per-station information; to retrieve all
3928a1b9b6aSSam Leffler  * specify a mac address of ff:ff:ff:ff:ff:ff.
3938a1b9b6aSSam Leffler  */
3948a1b9b6aSSam Leffler struct ieee80211req_sta_req {
3958a1b9b6aSSam Leffler 	union {
3968a1b9b6aSSam Leffler 		/* NB: explicitly force 64-bit alignment */
39768e8e04eSSam Leffler 		uint8_t		macaddr[IEEE80211_ADDR_LEN];
39868e8e04eSSam Leffler 		uint64_t	pad;
3998a1b9b6aSSam Leffler 	} is_u;
4008a1b9b6aSSam Leffler 	struct ieee80211req_sta_info info[1];	/* variable length */
4018a1b9b6aSSam Leffler };
4028a1b9b6aSSam Leffler 
4038a1b9b6aSSam Leffler /*
4048a1b9b6aSSam Leffler  * Get/set per-station tx power cap.
4058a1b9b6aSSam Leffler  */
4068a1b9b6aSSam Leffler struct ieee80211req_sta_txpow {
40768e8e04eSSam Leffler 	uint8_t		it_macaddr[IEEE80211_ADDR_LEN];
40868e8e04eSSam Leffler 	uint8_t		it_txpow;
4098a1b9b6aSSam Leffler };
4108a1b9b6aSSam Leffler 
4118a1b9b6aSSam Leffler /*
412b032f27cSSam Leffler  * WME parameters manipulated with IEEE80211_IOC_WME_CWMIN
413b032f27cSSam Leffler  * through IEEE80211_IOC_WME_ACKPOLICY are set and return
414b032f27cSSam Leffler  * using i_val and i_len.  i_val holds the value itself.
415b032f27cSSam Leffler  * i_len specifies the AC and, as appropriate, then high bit
416b032f27cSSam Leffler  * specifies whether the operation is to be applied to the
417b032f27cSSam Leffler  * BSS or ourself.
4188a1b9b6aSSam Leffler  */
4198a1b9b6aSSam Leffler #define	IEEE80211_WMEPARAM_SELF	0x0000		/* parameter applies to self */
4208a1b9b6aSSam Leffler #define	IEEE80211_WMEPARAM_BSS	0x8000		/* parameter applies to BSS */
4218a1b9b6aSSam Leffler #define	IEEE80211_WMEPARAM_VAL	0x7fff		/* parameter value */
4228a1b9b6aSSam Leffler 
423b032f27cSSam Leffler /*
424b032f27cSSam Leffler  * Application Information Elements can be appended to a variety
425b032f27cSSam Leffler  * of frames with the IEE80211_IOC_APPIE request.  This request
426b032f27cSSam Leffler  * piggybacks on a normal ieee80211req; the frame type is passed
427b032f27cSSam Leffler  * in i_val as the 802.11 FC0 bytes and the length of the IE data
428b032f27cSSam Leffler  * is passed in i_len.  The data is referenced in i_data.  If i_len
429b032f27cSSam Leffler  * is zero then any previously configured IE data is removed.  At
430b032f27cSSam Leffler  * most IEEE80211_MAX_APPIE data be appened.  Note that multiple
431b032f27cSSam Leffler  * IE's can be supplied; the data is treated opaquely.
432b032f27cSSam Leffler  */
433b032f27cSSam Leffler #define	IEEE80211_MAX_APPIE	1024		/* max app IE data */
434b032f27cSSam Leffler /*
435b032f27cSSam Leffler  * Hack: the WPA authenticator uses this mechanism to specify WPA
436b032f27cSSam Leffler  * ie's that are used instead of the ones normally constructed using
437b032f27cSSam Leffler  * the cipher state setup with separate ioctls.  This avoids issues
438b032f27cSSam Leffler  * like the authenticator ordering ie data differently than the
439b032f27cSSam Leffler  * net80211 layer and needing to keep separate state for WPA and RSN.
440b032f27cSSam Leffler  */
441b032f27cSSam Leffler #define	IEEE80211_APPIE_WPA \
442b032f27cSSam Leffler 	(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_BEACON | \
443b032f27cSSam Leffler 	 IEEE80211_FC0_SUBTYPE_PROBE_RESP)
444b032f27cSSam Leffler 
445b032f27cSSam Leffler /*
446b032f27cSSam Leffler  * Station mode roaming parameters.  These are maintained
447b032f27cSSam Leffler  * per band/mode and control the roaming algorithm.
448b032f27cSSam Leffler  */
449b032f27cSSam Leffler struct ieee80211_roamparams_req {
450b032f27cSSam Leffler 	struct ieee80211_roamparam params[IEEE80211_MODE_MAX];
451b032f27cSSam Leffler };
452b032f27cSSam Leffler 
453b032f27cSSam Leffler /*
454b032f27cSSam Leffler  * Transmit parameters.  These can be used to set fixed transmit
455b032f27cSSam Leffler  * rate for each operating mode when operating as client or on a
456b032f27cSSam Leffler  * per-client basis according to the capabilities of the client
457b032f27cSSam Leffler  * (e.g. an 11b client associated to an 11g ap) when operating as
458b032f27cSSam Leffler  * an ap.
459b032f27cSSam Leffler  *
460b032f27cSSam Leffler  * MCS are distinguished from legacy rates by or'ing in 0x80.
461b032f27cSSam Leffler  */
462b032f27cSSam Leffler struct ieee80211_txparams_req {
463b032f27cSSam Leffler 	struct ieee80211_txparam params[IEEE80211_MODE_MAX];
464b032f27cSSam Leffler };
465b032f27cSSam Leffler 
466b032f27cSSam Leffler /*
467b032f27cSSam Leffler  * Set regulatory domain state with IEEE80211_IOC_REGDOMAIN.
468b032f27cSSam Leffler  * Note this is both the regulatory description and the channel
469b032f27cSSam Leffler  * list.  The get request for IEEE80211_IOC_REGDOMAIN returns
470b032f27cSSam Leffler  * only the regdomain info; the channel list is obtained
471b032f27cSSam Leffler  * separately with IEEE80211_IOC_CHANINFO.
472b032f27cSSam Leffler  */
473b032f27cSSam Leffler struct ieee80211_regdomain_req {
474b032f27cSSam Leffler 	struct ieee80211_regdomain	rd;
475b032f27cSSam Leffler 	struct ieee80211req_chaninfo	chaninfo;
476b032f27cSSam Leffler };
4778658b18bSSam Leffler #define	IEEE80211_REGDOMAIN_SIZE(_nchan) \
4788658b18bSSam Leffler 	(sizeof(struct ieee80211_regdomain_req) + \
4798658b18bSSam Leffler 	 (((_nchan)-1) * sizeof(struct ieee80211_channel)))
4808658b18bSSam Leffler #define	IEEE80211_REGDOMAIN_SPACE(_req) \
4818658b18bSSam Leffler 	IEEE80211_REGDOMAIN_SIZE((_req)->chaninfo.ic_nchans)
482b032f27cSSam Leffler 
483b032f27cSSam Leffler /*
484b032f27cSSam Leffler  * Get driver capabilities.  Driver, hardware crypto, and
485b032f27cSSam Leffler  * HT/802.11n capabilities, and a table that describes what
486b032f27cSSam Leffler  * the radio can do.
487b032f27cSSam Leffler  */
488b032f27cSSam Leffler struct ieee80211_devcaps_req {
489b032f27cSSam Leffler 	uint32_t	dc_drivercaps;		/* general driver caps */
490b032f27cSSam Leffler 	uint32_t	dc_cryptocaps;		/* hardware crypto support */
491b032f27cSSam Leffler 	uint32_t	dc_htcaps;		/* HT/802.11n support */
492b032f27cSSam Leffler 	struct ieee80211req_chaninfo dc_chaninfo;
493b032f27cSSam Leffler };
4948658b18bSSam Leffler #define	IEEE80211_DEVCAPS_SIZE(_nchan) \
4958658b18bSSam Leffler 	(sizeof(struct ieee80211_devcaps_req) + \
4968658b18bSSam Leffler 	 (((_nchan)-1) * sizeof(struct ieee80211_channel)))
4978658b18bSSam Leffler #define	IEEE80211_DEVCAPS_SPACE(_dc) \
4988658b18bSSam Leffler 	IEEE80211_DEVCAPS_SIZE((_dc)->dc_chaninfo.ic_nchans)
499b032f27cSSam Leffler 
500b032f27cSSam Leffler struct ieee80211_chanswitch_req {
501b032f27cSSam Leffler 	struct ieee80211_channel csa_chan;	/* new channel */
502b032f27cSSam Leffler 	int		csa_mode;		/* CSA mode */
503b032f27cSSam Leffler 	int		csa_count;		/* beacon count to switch */
504b032f27cSSam Leffler };
505b032f27cSSam Leffler 
506b032f27cSSam Leffler /*
507b032f27cSSam Leffler  * Get/set per-station vlan tag.
508b032f27cSSam Leffler  */
509b032f27cSSam Leffler struct ieee80211req_sta_vlan {
510b032f27cSSam Leffler 	uint8_t		sv_macaddr[IEEE80211_ADDR_LEN];
511b032f27cSSam Leffler 	uint16_t	sv_vlan;
512b032f27cSSam Leffler };
513b032f27cSSam Leffler 
5141a1e1d21SSam Leffler #ifdef __FreeBSD__
5151a1e1d21SSam Leffler /*
5161a1e1d21SSam Leffler  * FreeBSD-style ioctls.
5171a1e1d21SSam Leffler  */
5181a1e1d21SSam Leffler /* the first member must be matched with struct ifreq */
5191a1e1d21SSam Leffler struct ieee80211req {
5201a1e1d21SSam Leffler 	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
52168e8e04eSSam Leffler 	uint16_t	i_type;			/* req type */
5221a1e1d21SSam Leffler 	int16_t		i_val;			/* Index or simple value */
5231a1e1d21SSam Leffler 	int16_t		i_len;			/* Index or simple value */
5241a1e1d21SSam Leffler 	void		*i_data;		/* Extra data */
5251a1e1d21SSam Leffler };
5261a1e1d21SSam Leffler #define	SIOCS80211		 _IOW('i', 234, struct ieee80211req)
5271a1e1d21SSam Leffler #define	SIOCG80211		_IOWR('i', 235, struct ieee80211req)
52868e8e04eSSam Leffler #define	SIOCG80211STATS		_IOWR('i', 236, struct ifreq)
5291a1e1d21SSam Leffler 
5301a1e1d21SSam Leffler #define IEEE80211_IOC_SSID		1
5311a1e1d21SSam Leffler #define IEEE80211_IOC_NUMSSIDS		2
5321a1e1d21SSam Leffler #define IEEE80211_IOC_WEP		3
5331a1e1d21SSam Leffler #define 	IEEE80211_WEP_NOSUP	-1
5341a1e1d21SSam Leffler #define 	IEEE80211_WEP_OFF	0
5351a1e1d21SSam Leffler #define 	IEEE80211_WEP_ON	1
5361a1e1d21SSam Leffler #define 	IEEE80211_WEP_MIXED	2
5371a1e1d21SSam Leffler #define IEEE80211_IOC_WEPKEY		4
5381a1e1d21SSam Leffler #define IEEE80211_IOC_NUMWEPKEYS	5
5391a1e1d21SSam Leffler #define IEEE80211_IOC_WEPTXKEY		6
5401a1e1d21SSam Leffler #define IEEE80211_IOC_AUTHMODE		7
5411a1e1d21SSam Leffler #define IEEE80211_IOC_STATIONNAME	8
5421a1e1d21SSam Leffler #define IEEE80211_IOC_CHANNEL		9
5431a1e1d21SSam Leffler #define IEEE80211_IOC_POWERSAVE		10
5441a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_NOSUP	-1
5451a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_OFF		0
5461a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_CAM		1
5471a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_PSP		2
5481a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_PSP_CAM	3
5491a1e1d21SSam Leffler #define 	IEEE80211_POWERSAVE_ON		IEEE80211_POWERSAVE_CAM
5501a1e1d21SSam Leffler #define IEEE80211_IOC_POWERSAVESLEEP	11
55113604e6bSSam Leffler #define	IEEE80211_IOC_RTSTHRESHOLD	12
5522e79ca97SSam Leffler #define IEEE80211_IOC_PROTMODE		13
5532e79ca97SSam Leffler #define 	IEEE80211_PROTMODE_OFF		0
5542e79ca97SSam Leffler #define 	IEEE80211_PROTMODE_CTS		1
5552e79ca97SSam Leffler #define 	IEEE80211_PROTMODE_RTSCTS	2
5568a1b9b6aSSam Leffler #define	IEEE80211_IOC_TXPOWER		14	/* global tx power limit */
5578a1b9b6aSSam Leffler #define	IEEE80211_IOC_BSSID		15
5588a1b9b6aSSam Leffler #define	IEEE80211_IOC_ROAMING		16	/* roaming mode */
5598a1b9b6aSSam Leffler #define	IEEE80211_IOC_PRIVACY		17	/* privacy invoked */
5608a1b9b6aSSam Leffler #define	IEEE80211_IOC_DROPUNENCRYPTED	18	/* discard unencrypted frames */
5618a1b9b6aSSam Leffler #define	IEEE80211_IOC_WPAKEY		19
5628a1b9b6aSSam Leffler #define	IEEE80211_IOC_DELKEY		20
5638a1b9b6aSSam Leffler #define	IEEE80211_IOC_MLME		21
564b032f27cSSam Leffler /* 22 was IEEE80211_IOC_OPTIE, replaced by IEEE80211_IOC_APPIE */
565b032f27cSSam Leffler /* 23 was IEEE80211_IOC_SCAN_REQ */
566239cc3b6SSam Leffler /* 24 was IEEE80211_IOC_SCAN_RESULTS */
5678a1b9b6aSSam Leffler #define	IEEE80211_IOC_COUNTERMEASURES	25	/* WPA/TKIP countermeasures */
5688a1b9b6aSSam Leffler #define	IEEE80211_IOC_WPA		26	/* WPA mode (0,1,2) */
5698a1b9b6aSSam Leffler #define	IEEE80211_IOC_CHANLIST		27	/* channel list */
5708a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME		28	/* WME mode (on, off) */
5718a1b9b6aSSam Leffler #define	IEEE80211_IOC_HIDESSID		29	/* hide SSID mode (on, off) */
5728a1b9b6aSSam Leffler #define	IEEE80211_IOC_APBRIDGE		30	/* AP inter-sta bridging */
573b032f27cSSam Leffler /* 31-35,37-38 were for WPA authenticator settings */
574b032f27cSSam Leffler /* 36 was IEEE80211_IOC_DRIVER_CAPS */
5758a1b9b6aSSam Leffler #define	IEEE80211_IOC_WPAIE		39	/* WPA information element */
5768a1b9b6aSSam Leffler #define	IEEE80211_IOC_STA_STATS		40	/* per-station statistics */
5778a1b9b6aSSam Leffler #define	IEEE80211_IOC_MACCMD		41	/* MAC ACL operation */
5788a1b9b6aSSam Leffler #define	IEEE80211_IOC_CHANINFO		42	/* channel info list */
5798a1b9b6aSSam Leffler #define	IEEE80211_IOC_TXPOWMAX		43	/* max tx power for channel */
5808a1b9b6aSSam Leffler #define	IEEE80211_IOC_STA_TXPOW		44	/* per-station tx power limit */
581d1c85daeSSam Leffler /* 45 was IEEE80211_IOC_STA_INFO */
5828a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_CWMIN		46	/* WME: ECWmin */
5838a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_CWMAX		47	/* WME: ECWmax */
5848a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_AIFS		48	/* WME: AIFSN */
5858a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_TXOPLIMIT	49	/* WME: txops limit */
5868a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_ACM		50	/* WME: ACM (bss only) */
5878a1b9b6aSSam Leffler #define	IEEE80211_IOC_WME_ACKPOLICY	51	/* WME: ACK policy (!bss only)*/
5888a1b9b6aSSam Leffler #define	IEEE80211_IOC_DTIM_PERIOD	52	/* DTIM period (beacons) */
5898a1b9b6aSSam Leffler #define	IEEE80211_IOC_BEACON_INTERVAL	53	/* beacon interval (ms) */
5908a1b9b6aSSam Leffler #define	IEEE80211_IOC_ADDMAC		54	/* add sta to MAC ACL table */
5918a1b9b6aSSam Leffler #define	IEEE80211_IOC_DELMAC		55	/* del sta from MAC ACL table */
592c4f040c3SSam Leffler #define	IEEE80211_IOC_PUREG		56	/* pure 11g (no 11b stations) */
59368e8e04eSSam Leffler #define	IEEE80211_IOC_FF		57	/* ATH fast frames (on, off) */
59468e8e04eSSam Leffler #define	IEEE80211_IOC_TURBOP		58	/* ATH turbo' (on, off) */
59568e8e04eSSam Leffler #define	IEEE80211_IOC_BGSCAN		59	/* bg scanning (on, off) */
59668e8e04eSSam Leffler #define	IEEE80211_IOC_BGSCAN_IDLE	60	/* bg scan idle threshold */
59768e8e04eSSam Leffler #define	IEEE80211_IOC_BGSCAN_INTERVAL	61	/* bg scan interval */
59868e8e04eSSam Leffler #define	IEEE80211_IOC_SCANVALID		65	/* scan cache valid threshold */
599b032f27cSSam Leffler /* 66-72 were IEEE80211_IOC_ROAM_* and IEEE80211_IOC_MCAST_RATE */
60070231e3dSSam Leffler #define	IEEE80211_IOC_FRAGTHRESHOLD	73	/* tx fragmentation threshold */
601c27e4e31SSam Leffler #define	IEEE80211_IOC_BURST		75	/* packet bursting */
602239cc3b6SSam Leffler #define	IEEE80211_IOC_SCAN_RESULTS	76	/* get scan results */
603546786c9SSam Leffler #define	IEEE80211_IOC_BMISSTHRESHOLD	77	/* beacon miss threshold */
604d1c85daeSSam Leffler #define	IEEE80211_IOC_STA_INFO		78	/* station/neighbor info */
60568e8e04eSSam Leffler #define	IEEE80211_IOC_WPAIE2		79	/* WPA+RSN info elements */
60668e8e04eSSam Leffler #define	IEEE80211_IOC_CURCHAN		80	/* current channel */
60768e8e04eSSam Leffler #define	IEEE80211_IOC_SHORTGI		81	/* 802.11n half GI */
60868e8e04eSSam Leffler #define	IEEE80211_IOC_AMPDU		82	/* 802.11n A-MPDU (on, off) */
60968e8e04eSSam Leffler #define	IEEE80211_IOC_AMPDU_LIMIT	83	/* A-MPDU length limit */
61068e8e04eSSam Leffler #define	IEEE80211_IOC_AMPDU_DENSITY	84	/* A-MPDU density */
61168e8e04eSSam Leffler #define	IEEE80211_IOC_AMSDU		85	/* 802.11n A-MSDU (on, off) */
61268e8e04eSSam Leffler #define	IEEE80211_IOC_AMSDU_LIMIT	86	/* A-MSDU length limit */
61368e8e04eSSam Leffler #define	IEEE80211_IOC_PUREN		87	/* pure 11n (no legacy sta's) */
61468e8e04eSSam Leffler #define	IEEE80211_IOC_DOTH		88	/* 802.11h (on, off) */
615b032f27cSSam Leffler /* 89-91 were regulatory items */
61668e8e04eSSam Leffler #define	IEEE80211_IOC_HTCOMPAT		92	/* support pre-D1.10 HT ie's */
617b032f27cSSam Leffler #define	IEEE80211_IOC_DWDS		93	/* DWDS/4-address handling */
618c066143cSSam Leffler #define	IEEE80211_IOC_INACTIVITY	94	/* sta inactivity handling */
619b032f27cSSam Leffler #define	IEEE80211_IOC_APPIE		95	/* application IE's */
620b032f27cSSam Leffler #define	IEEE80211_IOC_WPS		96	/* WPS operation */
621b032f27cSSam Leffler #define	IEEE80211_IOC_TSN		97	/* TSN operation */
622b032f27cSSam Leffler #define	IEEE80211_IOC_DEVCAPS		98	/* driver+device capabilities */
623b032f27cSSam Leffler #define	IEEE80211_IOC_CHANSWITCH	99	/* start 11h channel switch */
624b032f27cSSam Leffler #define	IEEE80211_IOC_DFS		100	/* DFS (on, off) */
625b032f27cSSam Leffler #define	IEEE80211_IOC_DOTD		101	/* 802.11d (on, off) */
6261b6167d2SSam Leffler #define IEEE80211_IOC_HTPROTMODE	102	/* HT protection (off, rts) */
627b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_REQ		103	/* scan w/ specified params */
628b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_CANCEL	104	/* cancel ongoing scan */
6291b6167d2SSam Leffler #define	IEEE80211_IOC_HTCONF		105	/* HT config (off, HT20, HT40)*/
630b032f27cSSam Leffler #define	IEEE80211_IOC_REGDOMAIN		106	/* regulatory domain info */
631b032f27cSSam Leffler #define	IEEE80211_IOC_ROAM		107	/* roaming params en masse */
632b032f27cSSam Leffler #define	IEEE80211_IOC_TXPARAMS		108	/* tx parameters */
633b032f27cSSam Leffler #define	IEEE80211_IOC_STA_VLAN		109	/* per-station vlan tag */
6348c070d69SSam Leffler #define	IEEE80211_IOC_SMPS		110	/* MIMO power save */
63544f7a6edSSam Leffler #define	IEEE80211_IOC_RIFS		111	/* RIFS config (on, off) */
636b032f27cSSam Leffler 
63710ad9a77SSam Leffler #define	IEEE80211_IOC_TDMA_SLOT		201	/* TDMA: assigned slot */
63810ad9a77SSam Leffler #define	IEEE80211_IOC_TDMA_SLOTCNT	202	/* TDMA: slots in bss */
63910ad9a77SSam Leffler #define	IEEE80211_IOC_TDMA_SLOTLEN	203	/* TDMA: slot length (usecs) */
64010ad9a77SSam Leffler #define	IEEE80211_IOC_TDMA_BINTERVAL	204	/* TDMA: beacon intvl (slots) */
64110ad9a77SSam Leffler 
642b032f27cSSam Leffler /*
643b032f27cSSam Leffler  * Parameters for controlling a scan requested with
644b032f27cSSam Leffler  * IEEE80211_IOC_SCAN_REQ.
645b032f27cSSam Leffler  *
646b032f27cSSam Leffler  * Active scans cause ProbeRequest frames to be issued for each
647b032f27cSSam Leffler  * specified ssid and, by default, a broadcast ProbeRequest frame.
648b032f27cSSam Leffler  * The set of ssid's is specified in the request.
649b032f27cSSam Leffler  *
650b032f27cSSam Leffler  * By default the scan will cause a BSS to be joined (in station/adhoc
651b032f27cSSam Leffler  * mode) or a channel to be selected for operation (hostap mode).
652b032f27cSSam Leffler  * To disable that specify IEEE80211_IOC_SCAN_NOPICK and if the
653b032f27cSSam Leffler  *
654b032f27cSSam Leffler  * If the station is currently associated to an AP then a scan request
655b032f27cSSam Leffler  * will cause the station to leave the current channel and potentially
656b032f27cSSam Leffler  * miss frames from the AP.  Alternatively the station may notify the
657b032f27cSSam Leffler  * AP that it is going into power save mode before it leaves the channel.
658b032f27cSSam Leffler  * This ensures frames for the station are buffered by the AP.  This is
659b032f27cSSam Leffler  * termed a ``bg scan'' and is requested with the IEEE80211_IOC_SCAN_BGSCAN
660b032f27cSSam Leffler  * flag.  Background scans may take longer than foreground scans and may
661b032f27cSSam Leffler  * be preempted by traffic.  If a station is not associated to an AP
662b032f27cSSam Leffler  * then a request for a background scan is automatically done in the
663b032f27cSSam Leffler  * foreground.
664b032f27cSSam Leffler  *
665b032f27cSSam Leffler  * The results of the scan request are cached by the system.  This
666b032f27cSSam Leffler  * information is aged out and/or invalidated based on events like not
667b032f27cSSam Leffler  * being able to associated to an AP.  To flush the current cache
668b032f27cSSam Leffler  * contents before doing a scan the IEEE80211_IOC_SCAN_FLUSH flag may
669b032f27cSSam Leffler  * be specified.
670b032f27cSSam Leffler  *
671b032f27cSSam Leffler  * By default the scan will be done until a suitable AP is located
672b032f27cSSam Leffler  * or a channel is found for use.  A scan can also be constrained
673b032f27cSSam Leffler  * to be done once (IEEE80211_IOC_SCAN_ONCE) or to last for no more
674b032f27cSSam Leffler  * than a specified duration.
675b032f27cSSam Leffler  */
676b032f27cSSam Leffler struct ieee80211_scan_req {
677b032f27cSSam Leffler 	int		sr_flags;
678b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_NOPICK	0x00001	/* scan only, no selection */
679b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_ACTIVE	0x00002	/* active scan (probe req) */
680b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_PICK1ST	0x00004	/* ``hey sailor'' mode */
681b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_BGSCAN	0x00008	/* bg scan, exit ps at end */
682b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_ONCE		0x00010	/* do one complete pass */
683b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_NOBCAST	0x00020	/* don't send bcast probe req */
684b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_NOJOIN	0x00040	/* no auto-sequencing */
685b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_FLUSH	0x10000	/* flush scan cache first */
686b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_CHECK	0x20000	/* check scan cache first */
687b032f27cSSam Leffler 	u_int		sr_duration;		/* duration (ms) */
688b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_DURATION_MIN	1
689b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_DURATION_MAX	0x7fffffff
690b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_FOREVER	IEEE80211_IOC_SCAN_DURATION_MAX
691b032f27cSSam Leffler 	u_int		sr_mindwell;		/* min channel dwelltime (ms) */
692b032f27cSSam Leffler 	u_int		sr_maxdwell;		/* max channel dwelltime (ms) */
693b032f27cSSam Leffler 	int		sr_nssid;
694b032f27cSSam Leffler #define	IEEE80211_IOC_SCAN_MAX_SSID	3
695b032f27cSSam Leffler 	struct {
696b032f27cSSam Leffler 		int	 len;				/* length in bytes */
697b032f27cSSam Leffler 		uint8_t ssid[IEEE80211_NWID_LEN];	/* ssid contents */
698b032f27cSSam Leffler 	} sr_ssid[IEEE80211_IOC_SCAN_MAX_SSID];
699b032f27cSSam Leffler };
7001a1e1d21SSam Leffler 
7018a1b9b6aSSam Leffler /*
7028a1b9b6aSSam Leffler  * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.
703239cc3b6SSam Leffler  * Each result is a fixed size structure followed by a variable
704239cc3b6SSam Leffler  * length SSID and one or more variable length information elements.
705239cc3b6SSam Leffler  * The size of each variable length item is found in the fixed
706239cc3b6SSam Leffler  * size structure and the entire length of the record is specified
707239cc3b6SSam Leffler  * in isr_len.  Result records are rounded to a multiple of 4 bytes.
7088a1b9b6aSSam Leffler  */
7098a1b9b6aSSam Leffler struct ieee80211req_scan_result {
710b032f27cSSam Leffler 	uint16_t	isr_len;		/* total length (mult of 4) */
711b032f27cSSam Leffler 	uint16_t	isr_ie_off;		/* offset to SSID+IE data */
71268e8e04eSSam Leffler 	uint16_t	isr_ie_len;		/* IE length */
71368e8e04eSSam Leffler 	uint16_t	isr_freq;		/* MHz */
71468e8e04eSSam Leffler 	uint16_t	isr_flags;		/* channel flags */
715239cc3b6SSam Leffler 	int8_t		isr_noise;
716239cc3b6SSam Leffler 	int8_t		isr_rssi;
71768e8e04eSSam Leffler 	uint8_t		isr_intval;		/* beacon interval */
71868e8e04eSSam Leffler 	uint8_t		isr_capinfo;		/* capabilities */
71968e8e04eSSam Leffler 	uint8_t		isr_erp;		/* ERP element */
72068e8e04eSSam Leffler 	uint8_t		isr_bssid[IEEE80211_ADDR_LEN];
72168e8e04eSSam Leffler 	uint8_t		isr_nrates;
72268e8e04eSSam Leffler 	uint8_t		isr_rates[IEEE80211_RATE_MAXSIZE];
72368e8e04eSSam Leffler 	uint8_t		isr_ssid_len;		/* SSID length */
7248a1b9b6aSSam Leffler 	/* variable length SSID followed by IE data */
7258a1b9b6aSSam Leffler };
7261be50176SSam Leffler 
727b032f27cSSam Leffler /*
728b032f27cSSam Leffler  * Virtual AP cloning parameters.  The parent device must
729b032f27cSSam Leffler  * be a vap-capable device.  All parameters specified with
730b032f27cSSam Leffler  * the clone request are fixed for the lifetime of the vap.
731b032f27cSSam Leffler  *
732b032f27cSSam Leffler  * There are two flavors of WDS vaps: legacy and dynamic.
733b032f27cSSam Leffler  * Legacy WDS operation implements a static binding between
734b032f27cSSam Leffler  * two stations encapsulating traffic in 4-address frames.
735b032f27cSSam Leffler  * Dynamic WDS vaps are created when a station associates to
736b032f27cSSam Leffler  * an AP and sends a 4-address frame.  If the AP vap is
737b032f27cSSam Leffler  * configured to support WDS then this will generate an
738b032f27cSSam Leffler  * event to user programs listening on the routing socket
739b032f27cSSam Leffler  * and a Dynamic WDS vap will be created to handle traffic
740b032f27cSSam Leffler  * to/from that station.  In both cases the bssid of the
741b032f27cSSam Leffler  * peer must be specified when creating the vap.
742b032f27cSSam Leffler  *
743b032f27cSSam Leffler  * By default a vap will inherit the mac address/bssid of
744b032f27cSSam Leffler  * the underlying device.  To request a unique address the
745b032f27cSSam Leffler  * IEEE80211_CLONE_BSSID flag should be supplied.  This is
746b032f27cSSam Leffler  * meaningless for WDS vaps as they share the bssid of an
747b032f27cSSam Leffler  * AP vap that must otherwise exist.  Note that some devices
748b032f27cSSam Leffler  * may not be able to support multiple addresses.
749b032f27cSSam Leffler  *
750b032f27cSSam Leffler  * Station mode vap's normally depend on the device to notice
751b032f27cSSam Leffler  * when the AP stops sending beacon frames.  If IEEE80211_CLONE_NOBEACONS
752b032f27cSSam Leffler  * is specified the net80211 layer will do this in s/w.  This
753b032f27cSSam Leffler  * is mostly useful when setting up a WDS repeater/extender where
754b032f27cSSam Leffler  * an AP vap is combined with a sta vap and the device isn't able
755b032f27cSSam Leffler  * to track beacon frames in hardware.
756b032f27cSSam Leffler  */
75768e8e04eSSam Leffler struct ieee80211_clone_params {
75868e8e04eSSam Leffler 	char	icp_parent[IFNAMSIZ];		/* parent device */
759b032f27cSSam Leffler 	uint16_t icp_opmode;			/* operating mode */
760b032f27cSSam Leffler 	uint16_t icp_flags;			/* see below */
761b032f27cSSam Leffler 	uint8_t	icp_bssid[IEEE80211_ADDR_LEN];	/* for WDS links */
762b032f27cSSam Leffler 	uint8_t	icp_macaddr[IEEE80211_ADDR_LEN];/* local address */
76368e8e04eSSam Leffler };
764b032f27cSSam Leffler #define	IEEE80211_CLONE_BSSID		0x0001	/* allocate unique mac/bssid */
765b032f27cSSam Leffler #define	IEEE80211_CLONE_NOBEACONS	0x0002	/* don't setup beacon timers */
766b032f27cSSam Leffler #define	IEEE80211_CLONE_WDSLEGACY	0x0004	/* legacy WDS processing */
767b032f27cSSam Leffler #define	IEEE80211_CLONE_MACADDR		0x0008	/* use specified mac addr */
76810ad9a77SSam Leffler #define	IEEE80211_CLONE_TDMA		0x0010	/* operate in TDMA mode */
7691a1e1d21SSam Leffler #endif /* __FreeBSD__ */
7701a1e1d21SSam Leffler 
7711a1e1d21SSam Leffler #endif /* _NET80211_IEEE80211_IOCTL_H_ */
772