1116742Ssam/*-
2116904Ssam * Copyright (c) 2001 Atsushi Onoe
3186904Ssam * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
4116742Ssam * All rights reserved.
5116742Ssam *
6116742Ssam * Redistribution and use in source and binary forms, with or without
7116742Ssam * modification, are permitted provided that the following conditions
8116742Ssam * are met:
9116742Ssam * 1. Redistributions of source code must retain the above copyright
10116742Ssam *    notice, this list of conditions and the following disclaimer.
11116742Ssam * 2. Redistributions in binary form must reproduce the above copyright
12116742Ssam *    notice, this list of conditions and the following disclaimer in the
13116742Ssam *    documentation and/or other materials provided with the distribution.
14116742Ssam *
15116904Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16116904Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17116904Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18116904Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19116904Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20116904Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21116904Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22116904Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23116904Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24116904Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25116904Ssam *
26116742Ssam * $FreeBSD: releng/10.3/sys/net80211/ieee80211_ioctl.h 246501 2013-02-07 21:20:28Z monthadar $
27116742Ssam */
28116742Ssam#ifndef _NET80211_IEEE80211_IOCTL_H_
29116742Ssam#define _NET80211_IEEE80211_IOCTL_H_
30116742Ssam
31116742Ssam/*
32116742Ssam * IEEE 802.11 ioctls.
33116742Ssam */
34138568Ssam#include <net80211/_ieee80211.h>
35138568Ssam#include <net80211/ieee80211.h>
36138568Ssam#include <net80211/ieee80211_crypto.h>
37116742Ssam
38138568Ssam/*
39161146Ssam * Per/node (station) statistics.
40138568Ssam */
41138568Ssamstruct ieee80211_nodestats {
42170530Ssam	uint32_t	ns_rx_data;		/* rx data frames */
43170530Ssam	uint32_t	ns_rx_mgmt;		/* rx management frames */
44170530Ssam	uint32_t	ns_rx_ctrl;		/* rx control frames */
45170530Ssam	uint32_t	ns_rx_ucast;		/* rx unicast frames */
46170530Ssam	uint32_t	ns_rx_mcast;		/* rx multi/broadcast frames */
47170530Ssam	uint64_t	ns_rx_bytes;		/* rx data count (bytes) */
48170530Ssam	uint64_t	ns_rx_beacons;		/* rx beacon frames */
49170530Ssam	uint32_t	ns_rx_proberesp;	/* rx probe response frames */
50138568Ssam
51170530Ssam	uint32_t	ns_rx_dup;		/* rx discard 'cuz dup */
52170530Ssam	uint32_t	ns_rx_noprivacy;	/* rx w/ wep but privacy off */
53170530Ssam	uint32_t	ns_rx_wepfail;		/* rx wep processing failed */
54170530Ssam	uint32_t	ns_rx_demicfail;	/* rx demic failed */
55170530Ssam	uint32_t	ns_rx_decap;		/* rx decapsulation failed */
56170530Ssam	uint32_t	ns_rx_defrag;		/* rx defragmentation failed */
57170530Ssam	uint32_t	ns_rx_disassoc;		/* rx disassociation */
58170530Ssam	uint32_t	ns_rx_deauth;		/* rx deauthentication */
59170530Ssam	uint32_t	ns_rx_action;		/* rx action */
60170530Ssam	uint32_t	ns_rx_decryptcrc;	/* rx decrypt failed on crc */
61170530Ssam	uint32_t	ns_rx_unauth;		/* rx on unauthorized port */
62170530Ssam	uint32_t	ns_rx_unencrypted;	/* rx unecrypted w/ privacy */
63173273Ssam	uint32_t	ns_rx_drop;		/* rx discard other reason */
64138568Ssam
65170530Ssam	uint32_t	ns_tx_data;		/* tx data frames */
66170530Ssam	uint32_t	ns_tx_mgmt;		/* tx management frames */
67193239Ssam	uint32_t	ns_tx_ctrl;		/* tx control frames */
68170530Ssam	uint32_t	ns_tx_ucast;		/* tx unicast frames */
69170530Ssam	uint32_t	ns_tx_mcast;		/* tx multi/broadcast frames */
70170530Ssam	uint64_t	ns_tx_bytes;		/* tx data count (bytes) */
71170530Ssam	uint32_t	ns_tx_probereq;		/* tx probe request frames */
72138568Ssam
73170530Ssam	uint32_t	ns_tx_novlantag;	/* tx discard 'cuz no tag */
74170530Ssam	uint32_t	ns_tx_vlanmismatch;	/* tx discard 'cuz bad tag */
75138568Ssam
76170530Ssam	uint32_t	ns_ps_discard;		/* ps discard 'cuz of age */
77138568Ssam
78138568Ssam	/* MIB-related state */
79170530Ssam	uint32_t	ns_tx_assoc;		/* [re]associations */
80170530Ssam	uint32_t	ns_tx_assoc_fail;	/* [re]association failures */
81170530Ssam	uint32_t	ns_tx_auth;		/* [re]authentications */
82170530Ssam	uint32_t	ns_tx_auth_fail;	/* [re]authentication failures*/
83170530Ssam	uint32_t	ns_tx_deauth;		/* deauthentications */
84170530Ssam	uint32_t	ns_tx_deauth_code;	/* last deauth reason */
85170530Ssam	uint32_t	ns_tx_disassoc;		/* disassociations */
86170530Ssam	uint32_t	ns_tx_disassoc_code;	/* last disassociation reason */
87193239Ssam	uint32_t	ns_spare[8];
88138568Ssam};
89138568Ssam
90138568Ssam/*
91138568Ssam * Summary statistics.
92138568Ssam */
93121180Ssamstruct ieee80211_stats {
94170530Ssam	uint32_t	is_rx_badversion;	/* rx frame with bad version */
95170530Ssam	uint32_t	is_rx_tooshort;		/* rx frame too short */
96170530Ssam	uint32_t	is_rx_wrongbss;		/* rx from wrong bssid */
97170530Ssam	uint32_t	is_rx_dup;		/* rx discard 'cuz dup */
98170530Ssam	uint32_t	is_rx_wrongdir;		/* rx w/ wrong direction */
99170530Ssam	uint32_t	is_rx_mcastecho;	/* rx discard 'cuz mcast echo */
100170530Ssam	uint32_t	is_rx_notassoc;		/* rx discard 'cuz sta !assoc */
101170530Ssam	uint32_t	is_rx_noprivacy;	/* rx w/ wep but privacy off */
102170530Ssam	uint32_t	is_rx_unencrypted;	/* rx w/o wep and privacy on */
103170530Ssam	uint32_t	is_rx_wepfail;		/* rx wep processing failed */
104170530Ssam	uint32_t	is_rx_decap;		/* rx decapsulation failed */
105170530Ssam	uint32_t	is_rx_mgtdiscard;	/* rx discard mgt frames */
106193239Ssam	uint32_t	is_rx_ctl;		/* rx ctrl frames */
107170530Ssam	uint32_t	is_rx_beacon;		/* rx beacon frames */
108170530Ssam	uint32_t	is_rx_rstoobig;		/* rx rate set truncated */
109170530Ssam	uint32_t	is_rx_elem_missing;	/* rx required element missing*/
110170530Ssam	uint32_t	is_rx_elem_toobig;	/* rx element too big */
111170530Ssam	uint32_t	is_rx_elem_toosmall;	/* rx element too small */
112170530Ssam	uint32_t	is_rx_elem_unknown;	/* rx element unknown */
113170530Ssam	uint32_t	is_rx_badchan;		/* rx frame w/ invalid chan */
114170530Ssam	uint32_t	is_rx_chanmismatch;	/* rx frame chan mismatch */
115170530Ssam	uint32_t	is_rx_nodealloc;	/* rx frame dropped */
116170530Ssam	uint32_t	is_rx_ssidmismatch;	/* rx frame ssid mismatch  */
117170530Ssam	uint32_t	is_rx_auth_unsupported;	/* rx w/ unsupported auth alg */
118170530Ssam	uint32_t	is_rx_auth_fail;	/* rx sta auth failure */
119170530Ssam	uint32_t	is_rx_auth_countermeasures;/* rx auth discard 'cuz CM */
120170530Ssam	uint32_t	is_rx_assoc_bss;	/* rx assoc from wrong bssid */
121170530Ssam	uint32_t	is_rx_assoc_notauth;	/* rx assoc w/o auth */
122170530Ssam	uint32_t	is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
123170530Ssam	uint32_t	is_rx_assoc_norate;	/* rx assoc w/ no rate match */
124170530Ssam	uint32_t	is_rx_assoc_badwpaie;	/* rx assoc w/ bad WPA IE */
125170530Ssam	uint32_t	is_rx_deauth;		/* rx deauthentication */
126170530Ssam	uint32_t	is_rx_disassoc;		/* rx disassociation */
127170530Ssam	uint32_t	is_rx_badsubtype;	/* rx frame w/ unknown subtype*/
128170530Ssam	uint32_t	is_rx_nobuf;		/* rx failed for lack of buf */
129170530Ssam	uint32_t	is_rx_decryptcrc;	/* rx decrypt failed on crc */
130170530Ssam	uint32_t	is_rx_ahdemo_mgt;	/* rx discard ahdemo mgt frame*/
131170530Ssam	uint32_t	is_rx_bad_auth;		/* rx bad auth request */
132170530Ssam	uint32_t	is_rx_unauth;		/* rx on unauthorized port */
133170530Ssam	uint32_t	is_rx_badkeyid;		/* rx w/ incorrect keyid */
134170530Ssam	uint32_t	is_rx_ccmpreplay;	/* rx seq# violation (CCMP) */
135170530Ssam	uint32_t	is_rx_ccmpformat;	/* rx format bad (CCMP) */
136170530Ssam	uint32_t	is_rx_ccmpmic;		/* rx MIC check failed (CCMP) */
137170530Ssam	uint32_t	is_rx_tkipreplay;	/* rx seq# violation (TKIP) */
138170530Ssam	uint32_t	is_rx_tkipformat;	/* rx format bad (TKIP) */
139170530Ssam	uint32_t	is_rx_tkipmic;		/* rx MIC check failed (TKIP) */
140170530Ssam	uint32_t	is_rx_tkipicv;		/* rx ICV check failed (TKIP) */
141170530Ssam	uint32_t	is_rx_badcipher;	/* rx failed 'cuz key type */
142170530Ssam	uint32_t	is_rx_nocipherctx;	/* rx failed 'cuz key !setup */
143170530Ssam	uint32_t	is_rx_acl;		/* rx discard 'cuz acl policy */
144170530Ssam	uint32_t	is_tx_nobuf;		/* tx failed for lack of buf */
145170530Ssam	uint32_t	is_tx_nonode;		/* tx failed for no node */
146170530Ssam	uint32_t	is_tx_unknownmgt;	/* tx of unknown mgt frame */
147170530Ssam	uint32_t	is_tx_badcipher;	/* tx failed 'cuz key type */
148170530Ssam	uint32_t	is_tx_nodefkey;		/* tx failed 'cuz no defkey */
149170530Ssam	uint32_t	is_tx_noheadroom;	/* tx failed 'cuz no space */
150170530Ssam	uint32_t	is_tx_fragframes;	/* tx frames fragmented */
151170530Ssam	uint32_t	is_tx_frags;		/* tx fragments created */
152170530Ssam	uint32_t	is_scan_active;		/* active scans started */
153170530Ssam	uint32_t	is_scan_passive;	/* passive scans started */
154170530Ssam	uint32_t	is_node_timeout;	/* nodes timed out inactivity */
155170530Ssam	uint32_t	is_crypto_nomem;	/* no memory for crypto ctx */
156170530Ssam	uint32_t	is_crypto_tkip;		/* tkip crypto done in s/w */
157170530Ssam	uint32_t	is_crypto_tkipenmic;	/* tkip en-MIC done in s/w */
158170530Ssam	uint32_t	is_crypto_tkipdemic;	/* tkip de-MIC done in s/w */
159170530Ssam	uint32_t	is_crypto_tkipcm;	/* tkip counter measures */
160170530Ssam	uint32_t	is_crypto_ccmp;		/* ccmp crypto done in s/w */
161170530Ssam	uint32_t	is_crypto_wep;		/* wep crypto done in s/w */
162170530Ssam	uint32_t	is_crypto_setkey_cipher;/* cipher rejected key */
163170530Ssam	uint32_t	is_crypto_setkey_nokey;	/* no key index for setkey */
164170530Ssam	uint32_t	is_crypto_delkey;	/* driver key delete failed */
165170530Ssam	uint32_t	is_crypto_badcipher;	/* unknown cipher */
166170530Ssam	uint32_t	is_crypto_nocipher;	/* cipher not available */
167170530Ssam	uint32_t	is_crypto_attachfail;	/* cipher attach failed */
168170530Ssam	uint32_t	is_crypto_swfallback;	/* cipher fallback to s/w */
169170530Ssam	uint32_t	is_crypto_keyfail;	/* driver key alloc failed */
170170530Ssam	uint32_t	is_crypto_enmicfail;	/* en-MIC failed */
171170530Ssam	uint32_t	is_ibss_capmismatch;	/* merge failed-cap mismatch */
172170530Ssam	uint32_t	is_ibss_norate;		/* merge failed-rate mismatch */
173170530Ssam	uint32_t	is_ps_unassoc;		/* ps-poll for unassoc. sta */
174170530Ssam	uint32_t	is_ps_badaid;		/* ps-poll w/ incorrect aid */
175170530Ssam	uint32_t	is_ps_qempty;		/* ps-poll w/ nothing to send */
176170530Ssam	uint32_t	is_ff_badhdr;		/* fast frame rx'd w/ bad hdr */
177170530Ssam	uint32_t	is_ff_tooshort;		/* fast frame rx decap error */
178170530Ssam	uint32_t	is_ff_split;		/* fast frame rx split error */
179170530Ssam	uint32_t	is_ff_decap;		/* fast frames decap'd */
180170530Ssam	uint32_t	is_ff_encap;		/* fast frames encap'd for tx */
181170530Ssam	uint32_t	is_rx_badbintval;	/* rx frame w/ bogus bintval */
182170530Ssam	uint32_t	is_rx_demicfail;	/* rx demic failed */
183170530Ssam	uint32_t	is_rx_defrag;		/* rx defragmentation failed */
184170530Ssam	uint32_t	is_rx_mgmt;		/* rx management frames */
185170530Ssam	uint32_t	is_rx_action;		/* rx action mgt frames */
186170530Ssam	uint32_t	is_amsdu_tooshort;	/* A-MSDU rx decap error */
187170530Ssam	uint32_t	is_amsdu_split;		/* A-MSDU rx split error */
188170530Ssam	uint32_t	is_amsdu_decap;		/* A-MSDU decap'd */
189170530Ssam	uint32_t	is_amsdu_encap;		/* A-MSDU encap'd for tx */
190170530Ssam	uint32_t	is_ampdu_bar_bad;	/* A-MPDU BAR out of window */
191170530Ssam	uint32_t	is_ampdu_bar_oow;	/* A-MPDU BAR before ADDBA */
192173273Ssam	uint32_t	is_ampdu_bar_move;	/* A-MPDU BAR moved window */
193170530Ssam	uint32_t	is_ampdu_bar_rx;	/* A-MPDU BAR frames handled */
194170530Ssam	uint32_t	is_ampdu_rx_flush;	/* A-MPDU frames flushed */
195170530Ssam	uint32_t	is_ampdu_rx_oor;	/* A-MPDU frames out-of-order */
196170530Ssam	uint32_t	is_ampdu_rx_copy;	/* A-MPDU frames copied down */
197173273Ssam	uint32_t	is_ampdu_rx_drop;	/* A-MPDU frames dropped */
198173273Ssam	uint32_t	is_tx_badstate;		/* tx discard state != RUN */
199173273Ssam	uint32_t	is_tx_notassoc;		/* tx failed, sta not assoc */
200173273Ssam	uint32_t	is_tx_classify;		/* tx classification failed */
201178354Ssam	uint32_t	is_dwds_mcast;		/* discard mcast over dwds */
202178354Ssam	uint32_t	is_dwds_qdrop;		/* dwds pending frame q full */
203173273Ssam	uint32_t	is_ht_assoc_nohtcap;	/* non-HT sta rejected */
204173273Ssam	uint32_t	is_ht_assoc_downgrade;	/* HT sta forced to legacy */
205173273Ssam	uint32_t	is_ht_assoc_norate;	/* HT assoc w/ rate mismatch */
206173273Ssam	uint32_t	is_ampdu_rx_age;	/* A-MPDU sent up 'cuz of age */
207173273Ssam	uint32_t	is_ampdu_rx_move;	/* A-MPDU MSDU moved window */
208173273Ssam	uint32_t	is_addba_reject;	/* ADDBA reject 'cuz disabled */
209173273Ssam	uint32_t	is_addba_norequest;	/* ADDBA response w/o ADDBA */
210173273Ssam	uint32_t	is_addba_badtoken;	/* ADDBA response w/ wrong
211173273Ssam						   dialogtoken */
212182829Ssam	uint32_t	is_addba_badpolicy;	/* ADDBA resp w/ wrong policy */
213173273Ssam	uint32_t	is_ampdu_stop;		/* A-MPDU stream stopped */
214173273Ssam	uint32_t	is_ampdu_stop_failed;	/* A-MPDU stream not running */
215173273Ssam	uint32_t	is_ampdu_rx_reorder;	/* A-MPDU held for rx reorder */
216178354Ssam	uint32_t	is_scan_bg;		/* background scans started */
217178354Ssam	uint8_t		is_rx_deauth_code;	/* last rx'd deauth reason */
218178354Ssam	uint8_t		is_rx_disassoc_code;	/* last rx'd disassoc reason */
219178354Ssam	uint8_t		is_rx_authfail_code;	/* last rx'd auth fail reason */
220178354Ssam	uint32_t	is_beacon_miss;		/* beacon miss notification */
221186904Ssam	uint32_t	is_rx_badstate;		/* rx discard state != RUN */
222190579Ssam	uint32_t	is_ff_flush;		/* ff's flush'd from stageq */
223193239Ssam	uint32_t	is_tx_ctl;		/* tx ctrl frames */
224193239Ssam	uint32_t	is_ampdu_rexmt;		/* A-MPDU frames rexmt ok */
225193239Ssam	uint32_t	is_ampdu_rexmt_fail;	/* A-MPDU frames rexmt fail */
226195618Srpaulo
227195618Srpaulo	uint32_t	is_mesh_wrongmesh;	/* dropped 'cuz not mesh sta*/
228195618Srpaulo	uint32_t	is_mesh_nolink;		/* dropped 'cuz link not estab*/
229195618Srpaulo	uint32_t	is_mesh_fwd_ttl;	/* mesh not fwd'd 'cuz ttl 0 */
230195618Srpaulo	uint32_t	is_mesh_fwd_nobuf;	/* mesh not fwd'd 'cuz no mbuf*/
231195618Srpaulo	uint32_t	is_mesh_fwd_tooshort;	/* mesh not fwd'd 'cuz no hdr */
232195618Srpaulo	uint32_t	is_mesh_fwd_disabled;	/* mesh not fwd'd 'cuz disabled */
233195618Srpaulo	uint32_t	is_mesh_fwd_nopath;	/* mesh not fwd'd 'cuz path unknown */
234195618Srpaulo
235195618Srpaulo	uint32_t	is_hwmp_wrongseq;	/* wrong hwmp seq no. */
236195618Srpaulo	uint32_t	is_hwmp_rootreqs;	/* root PREQs sent */
237195618Srpaulo	uint32_t	is_hwmp_rootrann;	/* root RANNs sent */
238195784Srpaulo
239195784Srpaulo	uint32_t	is_mesh_badae;		/* dropped 'cuz invalid AE */
240195784Srpaulo	uint32_t	is_mesh_rtaddfailed;	/* route add failed */
241195784Srpaulo	uint32_t	is_mesh_notproxy;	/* dropped 'cuz not proxying */
242195757Ssam	uint32_t	is_rx_badalign;		/* dropped 'cuz misaligned */
243195908Srpaulo	uint32_t	is_hwmp_proxy;		/* PREP for proxy route */
244232244Sadrian	uint32_t	is_beacon_bad;		/* Number of bad beacons */
245234018Sadrian	uint32_t	is_ampdu_bar_tx;	/* A-MPDU BAR frames TXed */
246234018Sadrian	uint32_t	is_ampdu_bar_tx_retry;	/* A-MPDU BAR frames TX rtry */
247234018Sadrian	uint32_t	is_ampdu_bar_tx_fail;	/* A-MPDU BAR frames TX fail */
248234018Sadrian
249234018Sadrian	uint32_t	is_spare[7];
250121180Ssam};
251121180Ssam
252138568Ssam/*
253138568Ssam * Max size of optional information elements.  We artificially
254138568Ssam * constrain this; it's limited only by the max frame size (and
255138568Ssam * the max parameter size of the wireless extensions).
256138568Ssam */
257138568Ssam#define	IEEE80211_MAX_OPT_IE	256
258138568Ssam
259138568Ssam/*
260138568Ssam * WPA/RSN get/set key request.  Specify the key/cipher
261138568Ssam * type and whether the key is to be used for sending and/or
262138568Ssam * receiving.  The key index should be set only when working
263138568Ssam * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
264138568Ssam * Otherwise a unicast/pairwise key is specified by the bssid
265138568Ssam * (on a station) or mac address (on an ap).  They key length
266138568Ssam * must include any MIC key data; otherwise it should be no
267173273Ssam * more than IEEE80211_KEYBUF_SIZE.
268138568Ssam */
269138568Ssamstruct ieee80211req_key {
270170530Ssam	uint8_t		ik_type;	/* key/cipher type */
271170530Ssam	uint8_t		ik_pad;
272170530Ssam	uint16_t	ik_keyix;	/* key index */
273170530Ssam	uint8_t		ik_keylen;	/* key length in bytes */
274170530Ssam	uint8_t		ik_flags;
275138568Ssam/* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */
276138568Ssam#define	IEEE80211_KEY_DEFAULT	0x80	/* default xmit key */
277170530Ssam	uint8_t		ik_macaddr[IEEE80211_ADDR_LEN];
278170530Ssam	uint64_t	ik_keyrsc;	/* key receive sequence counter */
279170530Ssam	uint64_t	ik_keytsc;	/* key transmit sequence counter */
280170530Ssam	uint8_t		ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
281138568Ssam};
282138568Ssam
283138568Ssam/*
284138568Ssam * Delete a key either by index or address.  Set the index
285138568Ssam * to IEEE80211_KEYIX_NONE when deleting a unicast key.
286138568Ssam */
287138568Ssamstruct ieee80211req_del_key {
288170530Ssam	uint8_t		idk_keyix;	/* key index */
289170530Ssam	uint8_t		idk_macaddr[IEEE80211_ADDR_LEN];
290138568Ssam};
291138568Ssam
292138568Ssam/*
293138568Ssam * MLME state manipulation request.  IEEE80211_MLME_ASSOC
294138568Ssam * only makes sense when operating as a station.  The other
295138568Ssam * requests can be used when operating as a station or an
296138568Ssam * ap (to effect a station).
297138568Ssam */
298138568Ssamstruct ieee80211req_mlme {
299170530Ssam	uint8_t		im_op;		/* operation to perform */
300138568Ssam#define	IEEE80211_MLME_ASSOC		1	/* associate station */
301138568Ssam#define	IEEE80211_MLME_DISASSOC		2	/* disassociate station */
302138568Ssam#define	IEEE80211_MLME_DEAUTH		3	/* deauthenticate station */
303138568Ssam#define	IEEE80211_MLME_AUTHORIZE	4	/* authorize station */
304138568Ssam#define	IEEE80211_MLME_UNAUTHORIZE	5	/* unauthorize station */
305178354Ssam#define	IEEE80211_MLME_AUTH		6	/* authenticate station */
306170530Ssam	uint8_t		im_ssid_len;	/* length of optional ssid */
307170530Ssam	uint16_t	im_reason;	/* 802.11 reason code */
308170530Ssam	uint8_t		im_macaddr[IEEE80211_ADDR_LEN];
309170530Ssam	uint8_t		im_ssid[IEEE80211_NWID_LEN];
310138568Ssam};
311138568Ssam
312138568Ssam/*
313138568Ssam * MAC ACL operations.
314138568Ssam */
315138568Ssamenum {
316138568Ssam	IEEE80211_MACCMD_POLICY_OPEN	= 0,	/* set policy: no ACL's */
317138568Ssam	IEEE80211_MACCMD_POLICY_ALLOW	= 1,	/* set policy: allow traffic */
318138568Ssam	IEEE80211_MACCMD_POLICY_DENY	= 2,	/* set policy: deny traffic */
319138568Ssam	IEEE80211_MACCMD_FLUSH		= 3,	/* flush ACL database */
320138568Ssam	IEEE80211_MACCMD_DETACH		= 4,	/* detach ACL policy */
321149028Ssam	IEEE80211_MACCMD_POLICY		= 5,	/* get ACL policy */
322149028Ssam	IEEE80211_MACCMD_LIST		= 6,	/* get ACL database */
323178354Ssam	IEEE80211_MACCMD_POLICY_RADIUS	= 7,	/* set policy: RADIUS managed */
324138568Ssam};
325138568Ssam
326149028Ssamstruct ieee80211req_maclist {
327170530Ssam	uint8_t		ml_macaddr[IEEE80211_ADDR_LEN];
328195561Ssam} __packed;
329149028Ssam
330138568Ssam/*
331195618Srpaulo * Mesh Routing Table Operations.
332195618Srpaulo */
333195618Srpauloenum {
334195618Srpaulo	IEEE80211_MESH_RTCMD_LIST   = 0, /* list HWMP routing table */
335195618Srpaulo	IEEE80211_MESH_RTCMD_FLUSH  = 1, /* flush HWMP routing table */
336195618Srpaulo	IEEE80211_MESH_RTCMD_ADD    = 2, /* add entry to the table */
337195618Srpaulo	IEEE80211_MESH_RTCMD_DELETE = 3, /* delete an entry from the table */
338195618Srpaulo};
339195618Srpaulo
340195784Srpaulostruct ieee80211req_mesh_route {
341203556Srpaulo	uint8_t		imr_flags;
342234894Smonthadar#define	IEEE80211_MESHRT_FLAGS_DISCOVER	0x01
343234894Smonthadar#define	IEEE80211_MESHRT_FLAGS_VALID	0x02
344234894Smonthadar#define	IEEE80211_MESHRT_FLAGS_PROXY	0x04
345246501Smonthadar#define	IEEE80211_MESHRT_FLAGS_GATE	0x08
346203422Srpaulo	uint8_t		imr_dest[IEEE80211_ADDR_LEN];
347203422Srpaulo	uint8_t		imr_nexthop[IEEE80211_ADDR_LEN];
348203422Srpaulo	uint16_t	imr_nhops;
349195908Srpaulo	uint8_t		imr_pad;
350195784Srpaulo	uint32_t	imr_metric;
351195784Srpaulo	uint32_t	imr_lifetime;
352195784Srpaulo	uint32_t	imr_lastmseq;
353195784Srpaulo};
354195784Srpaulo
355195618Srpaulo/*
356195618Srpaulo * HWMP root modes
357195618Srpaulo */
358195618Srpauloenum {
359195618Srpaulo	IEEE80211_HWMP_ROOTMODE_DISABLED	= 0, 	/* disabled */
360195618Srpaulo	IEEE80211_HWMP_ROOTMODE_NORMAL		= 1,	/* normal PREPs */
361195618Srpaulo	IEEE80211_HWMP_ROOTMODE_PROACTIVE	= 2,	/* proactive PREPS */
362195618Srpaulo	IEEE80211_HWMP_ROOTMODE_RANN		= 3,	/* use RANN elemid */
363195618Srpaulo};
364195618Srpaulo
365195618Srpaulo
366195618Srpaulo/*
367187801Ssam * Set the active channel list by IEEE channel #: each channel
368187801Ssam * to be marked active is set in a bit vector.  Note this list is
369187801Ssam * intersected with the available channel list in calculating
370187801Ssam * the set of channels actually used in scanning.
371138568Ssam */
372138568Ssamstruct ieee80211req_chanlist {
373187801Ssam	uint8_t		ic_channels[32];	/* NB: can be variable length */
374138568Ssam};
375138568Ssam
376138568Ssam/*
377138568Ssam * Get the active channel list info.
378138568Ssam */
379138568Ssamstruct ieee80211req_chaninfo {
380138568Ssam	u_int	ic_nchans;
381187801Ssam	struct ieee80211_channel ic_chans[1];	/* NB: variable length */
382138568Ssam};
383187801Ssam#define	IEEE80211_CHANINFO_SIZE(_nchan) \
384187801Ssam	(sizeof(struct ieee80211req_chaninfo) + \
385187801Ssam	 (((_nchan)-1) * sizeof(struct ieee80211_channel)))
386187801Ssam#define	IEEE80211_CHANINFO_SPACE(_ci) \
387187801Ssam	IEEE80211_CHANINFO_SIZE((_ci)->ic_nchans)
388138568Ssam
389138568Ssam/*
390138568Ssam * Retrieve the WPA/RSN information element for an associated station.
391138568Ssam */
392170530Ssamstruct ieee80211req_wpaie {	/* old version w/ only one ie */
393170530Ssam	uint8_t		wpa_macaddr[IEEE80211_ADDR_LEN];
394170530Ssam	uint8_t		wpa_ie[IEEE80211_MAX_OPT_IE];
395138568Ssam};
396170530Ssamstruct ieee80211req_wpaie2 {
397170530Ssam	uint8_t		wpa_macaddr[IEEE80211_ADDR_LEN];
398170530Ssam	uint8_t		wpa_ie[IEEE80211_MAX_OPT_IE];
399170530Ssam	uint8_t		rsn_ie[IEEE80211_MAX_OPT_IE];
400170530Ssam};
401138568Ssam
402138568Ssam/*
403138568Ssam * Retrieve per-node statistics.
404138568Ssam */
405138568Ssamstruct ieee80211req_sta_stats {
406138568Ssam	union {
407138568Ssam		/* NB: explicitly force 64-bit alignment */
408170530Ssam		uint8_t		macaddr[IEEE80211_ADDR_LEN];
409170530Ssam		uint64_t	pad;
410138568Ssam	} is_u;
411138568Ssam	struct ieee80211_nodestats is_stats;
412138568Ssam};
413138568Ssam
414138568Ssam/*
415138568Ssam * Station information block; the mac address is used
416138568Ssam * to retrieve other data like stats, unicast key, etc.
417138568Ssam */
418138568Ssamstruct ieee80211req_sta_info {
419178354Ssam	uint16_t	isi_len;		/* total length (mult of 4) */
420170530Ssam	uint16_t	isi_ie_off;		/* offset to IE data */
421170530Ssam	uint16_t	isi_ie_len;		/* IE length */
422170530Ssam	uint16_t	isi_freq;		/* MHz */
423173272Ssam	uint32_t	isi_flags;		/* channel flags */
424194136Ssam	uint32_t	isi_state;		/* state flags */
425170530Ssam	uint8_t		isi_authmode;		/* authentication algorithm */
426161146Ssam	int8_t		isi_rssi;		/* receive signal strength */
427170530Ssam	int8_t		isi_noise;		/* noise floor */
428170530Ssam	uint8_t		isi_capinfo;		/* capabilities */
429170530Ssam	uint8_t		isi_erp;		/* ERP element */
430170530Ssam	uint8_t		isi_macaddr[IEEE80211_ADDR_LEN];
431170530Ssam	uint8_t		isi_nrates;
432138568Ssam						/* negotiated rates */
433170530Ssam	uint8_t		isi_rates[IEEE80211_RATE_MAXSIZE];
434178354Ssam	uint8_t		isi_txrate;		/* legacy/IEEE rate or MCS */
435170530Ssam	uint16_t	isi_associd;		/* assoc response */
436170530Ssam	uint16_t	isi_txpower;		/* current tx power */
437170530Ssam	uint16_t	isi_vlan;		/* vlan tag */
438172225Ssam	/* NB: [IEEE80211_NONQOS_TID] holds seq#'s for non-QoS stations */
439172225Ssam	uint16_t	isi_txseqs[IEEE80211_TID_SIZE];/* tx seq #/TID */
440172225Ssam	uint16_t	isi_rxseqs[IEEE80211_TID_SIZE];/* rx seq#/TID */
441170530Ssam	uint16_t	isi_inact;		/* inactivity timer */
442178354Ssam	uint16_t	isi_txmbps;		/* current tx rate in .5 Mb/s */
443194136Ssam	uint16_t	isi_pad;
444178354Ssam	uint32_t	isi_jointime;		/* time of assoc/join */
445178354Ssam	struct ieee80211_mimo_info isi_mimo;	/* MIMO info for 11n sta's */
446195618Srpaulo	/* 11s info */
447195618Srpaulo	uint16_t	isi_peerid;
448195618Srpaulo	uint16_t	isi_localid;
449195618Srpaulo	uint8_t		isi_peerstate;
450138568Ssam	/* XXX frag state? */
451138568Ssam	/* variable length IE data */
452138568Ssam};
453138568Ssam
454138568Ssam/*
455138568Ssam * Retrieve per-station information; to retrieve all
456138568Ssam * specify a mac address of ff:ff:ff:ff:ff:ff.
457138568Ssam */
458138568Ssamstruct ieee80211req_sta_req {
459138568Ssam	union {
460138568Ssam		/* NB: explicitly force 64-bit alignment */
461170530Ssam		uint8_t		macaddr[IEEE80211_ADDR_LEN];
462170530Ssam		uint64_t	pad;
463138568Ssam	} is_u;
464138568Ssam	struct ieee80211req_sta_info info[1];	/* variable length */
465138568Ssam};
466138568Ssam
467138568Ssam/*
468138568Ssam * Get/set per-station tx power cap.
469138568Ssam */
470138568Ssamstruct ieee80211req_sta_txpow {
471170530Ssam	uint8_t		it_macaddr[IEEE80211_ADDR_LEN];
472170530Ssam	uint8_t		it_txpow;
473138568Ssam};
474138568Ssam
475138568Ssam/*
476178354Ssam * WME parameters manipulated with IEEE80211_IOC_WME_CWMIN
477178354Ssam * through IEEE80211_IOC_WME_ACKPOLICY are set and return
478178354Ssam * using i_val and i_len.  i_val holds the value itself.
479178354Ssam * i_len specifies the AC and, as appropriate, then high bit
480178354Ssam * specifies whether the operation is to be applied to the
481178354Ssam * BSS or ourself.
482138568Ssam */
483138568Ssam#define	IEEE80211_WMEPARAM_SELF	0x0000		/* parameter applies to self */
484138568Ssam#define	IEEE80211_WMEPARAM_BSS	0x8000		/* parameter applies to BSS */
485138568Ssam#define	IEEE80211_WMEPARAM_VAL	0x7fff		/* parameter value */
486138568Ssam
487178354Ssam/*
488178354Ssam * Application Information Elements can be appended to a variety
489178354Ssam * of frames with the IEE80211_IOC_APPIE request.  This request
490178354Ssam * piggybacks on a normal ieee80211req; the frame type is passed
491178354Ssam * in i_val as the 802.11 FC0 bytes and the length of the IE data
492178354Ssam * is passed in i_len.  The data is referenced in i_data.  If i_len
493178354Ssam * is zero then any previously configured IE data is removed.  At
494178354Ssam * most IEEE80211_MAX_APPIE data be appened.  Note that multiple
495178354Ssam * IE's can be supplied; the data is treated opaquely.
496178354Ssam */
497178354Ssam#define	IEEE80211_MAX_APPIE	1024		/* max app IE data */
498178354Ssam/*
499178354Ssam * Hack: the WPA authenticator uses this mechanism to specify WPA
500178354Ssam * ie's that are used instead of the ones normally constructed using
501178354Ssam * the cipher state setup with separate ioctls.  This avoids issues
502178354Ssam * like the authenticator ordering ie data differently than the
503178354Ssam * net80211 layer and needing to keep separate state for WPA and RSN.
504178354Ssam */
505178354Ssam#define	IEEE80211_APPIE_WPA \
506178354Ssam	(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_BEACON | \
507178354Ssam	 IEEE80211_FC0_SUBTYPE_PROBE_RESP)
508178354Ssam
509178354Ssam/*
510178354Ssam * Station mode roaming parameters.  These are maintained
511178354Ssam * per band/mode and control the roaming algorithm.
512178354Ssam */
513178354Ssamstruct ieee80211_roamparams_req {
514178354Ssam	struct ieee80211_roamparam params[IEEE80211_MODE_MAX];
515178354Ssam};
516178354Ssam
517178354Ssam/*
518178354Ssam * Transmit parameters.  These can be used to set fixed transmit
519178354Ssam * rate for each operating mode when operating as client or on a
520178354Ssam * per-client basis according to the capabilities of the client
521178354Ssam * (e.g. an 11b client associated to an 11g ap) when operating as
522178354Ssam * an ap.
523178354Ssam *
524178354Ssam * MCS are distinguished from legacy rates by or'ing in 0x80.
525178354Ssam */
526178354Ssamstruct ieee80211_txparams_req {
527178354Ssam	struct ieee80211_txparam params[IEEE80211_MODE_MAX];
528178354Ssam};
529178354Ssam
530178354Ssam/*
531178354Ssam * Set regulatory domain state with IEEE80211_IOC_REGDOMAIN.
532178354Ssam * Note this is both the regulatory description and the channel
533178354Ssam * list.  The get request for IEEE80211_IOC_REGDOMAIN returns
534178354Ssam * only the regdomain info; the channel list is obtained
535178354Ssam * separately with IEEE80211_IOC_CHANINFO.
536178354Ssam */
537178354Ssamstruct ieee80211_regdomain_req {
538178354Ssam	struct ieee80211_regdomain	rd;
539178354Ssam	struct ieee80211req_chaninfo	chaninfo;
540178354Ssam};
541187801Ssam#define	IEEE80211_REGDOMAIN_SIZE(_nchan) \
542187801Ssam	(sizeof(struct ieee80211_regdomain_req) + \
543187801Ssam	 (((_nchan)-1) * sizeof(struct ieee80211_channel)))
544187801Ssam#define	IEEE80211_REGDOMAIN_SPACE(_req) \
545187801Ssam	IEEE80211_REGDOMAIN_SIZE((_req)->chaninfo.ic_nchans)
546178354Ssam
547178354Ssam/*
548178354Ssam * Get driver capabilities.  Driver, hardware crypto, and
549178354Ssam * HT/802.11n capabilities, and a table that describes what
550178354Ssam * the radio can do.
551178354Ssam */
552178354Ssamstruct ieee80211_devcaps_req {
553178354Ssam	uint32_t	dc_drivercaps;		/* general driver caps */
554178354Ssam	uint32_t	dc_cryptocaps;		/* hardware crypto support */
555178354Ssam	uint32_t	dc_htcaps;		/* HT/802.11n support */
556178354Ssam	struct ieee80211req_chaninfo dc_chaninfo;
557178354Ssam};
558187801Ssam#define	IEEE80211_DEVCAPS_SIZE(_nchan) \
559187801Ssam	(sizeof(struct ieee80211_devcaps_req) + \
560187801Ssam	 (((_nchan)-1) * sizeof(struct ieee80211_channel)))
561187801Ssam#define	IEEE80211_DEVCAPS_SPACE(_dc) \
562187801Ssam	IEEE80211_DEVCAPS_SIZE((_dc)->dc_chaninfo.ic_nchans)
563178354Ssam
564178354Ssamstruct ieee80211_chanswitch_req {
565178354Ssam	struct ieee80211_channel csa_chan;	/* new channel */
566178354Ssam	int		csa_mode;		/* CSA mode */
567178354Ssam	int		csa_count;		/* beacon count to switch */
568178354Ssam};
569178354Ssam
570178354Ssam/*
571178354Ssam * Get/set per-station vlan tag.
572178354Ssam */
573178354Ssamstruct ieee80211req_sta_vlan {
574178354Ssam	uint8_t		sv_macaddr[IEEE80211_ADDR_LEN];
575178354Ssam	uint16_t	sv_vlan;
576178354Ssam};
577178354Ssam
578116742Ssam#ifdef __FreeBSD__
579116742Ssam/*
580116742Ssam * FreeBSD-style ioctls.
581116742Ssam */
582116742Ssam/* the first member must be matched with struct ifreq */
583116742Ssamstruct ieee80211req {
584116742Ssam	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
585170530Ssam	uint16_t	i_type;			/* req type */
586116742Ssam	int16_t		i_val;			/* Index or simple value */
587223145Skevlo	uint16_t	i_len;			/* Index or simple value */
588116742Ssam	void		*i_data;		/* Extra data */
589116742Ssam};
590116742Ssam#define	SIOCS80211		 _IOW('i', 234, struct ieee80211req)
591116742Ssam#define	SIOCG80211		_IOWR('i', 235, struct ieee80211req)
592170530Ssam#define	SIOCG80211STATS		_IOWR('i', 236, struct ifreq)
593116742Ssam
594116742Ssam#define IEEE80211_IOC_SSID		1
595116742Ssam#define IEEE80211_IOC_NUMSSIDS		2
596116742Ssam#define IEEE80211_IOC_WEP		3
597116742Ssam#define 	IEEE80211_WEP_NOSUP	-1
598116742Ssam#define 	IEEE80211_WEP_OFF	0
599116742Ssam#define 	IEEE80211_WEP_ON	1
600116742Ssam#define 	IEEE80211_WEP_MIXED	2
601116742Ssam#define IEEE80211_IOC_WEPKEY		4
602116742Ssam#define IEEE80211_IOC_NUMWEPKEYS	5
603116742Ssam#define IEEE80211_IOC_WEPTXKEY		6
604116742Ssam#define IEEE80211_IOC_AUTHMODE		7
605116742Ssam#define IEEE80211_IOC_STATIONNAME	8
606116742Ssam#define IEEE80211_IOC_CHANNEL		9
607116742Ssam#define IEEE80211_IOC_POWERSAVE		10
608116742Ssam#define 	IEEE80211_POWERSAVE_NOSUP	-1
609116742Ssam#define 	IEEE80211_POWERSAVE_OFF		0
610116742Ssam#define 	IEEE80211_POWERSAVE_CAM		1
611116742Ssam#define 	IEEE80211_POWERSAVE_PSP		2
612116742Ssam#define 	IEEE80211_POWERSAVE_PSP_CAM	3
613116742Ssam#define 	IEEE80211_POWERSAVE_ON		IEEE80211_POWERSAVE_CAM
614116742Ssam#define IEEE80211_IOC_POWERSAVESLEEP	11
615120480Ssam#define	IEEE80211_IOC_RTSTHRESHOLD	12
616127648Ssam#define IEEE80211_IOC_PROTMODE		13
617127648Ssam#define 	IEEE80211_PROTMODE_OFF		0
618127648Ssam#define 	IEEE80211_PROTMODE_CTS		1
619127648Ssam#define 	IEEE80211_PROTMODE_RTSCTS	2
620138568Ssam#define	IEEE80211_IOC_TXPOWER		14	/* global tx power limit */
621138568Ssam#define	IEEE80211_IOC_BSSID		15
622138568Ssam#define	IEEE80211_IOC_ROAMING		16	/* roaming mode */
623138568Ssam#define	IEEE80211_IOC_PRIVACY		17	/* privacy invoked */
624138568Ssam#define	IEEE80211_IOC_DROPUNENCRYPTED	18	/* discard unencrypted frames */
625138568Ssam#define	IEEE80211_IOC_WPAKEY		19
626138568Ssam#define	IEEE80211_IOC_DELKEY		20
627138568Ssam#define	IEEE80211_IOC_MLME		21
628178354Ssam/* 22 was IEEE80211_IOC_OPTIE, replaced by IEEE80211_IOC_APPIE */
629178354Ssam/* 23 was IEEE80211_IOC_SCAN_REQ */
630154541Ssam/* 24 was IEEE80211_IOC_SCAN_RESULTS */
631138568Ssam#define	IEEE80211_IOC_COUNTERMEASURES	25	/* WPA/TKIP countermeasures */
632138568Ssam#define	IEEE80211_IOC_WPA		26	/* WPA mode (0,1,2) */
633138568Ssam#define	IEEE80211_IOC_CHANLIST		27	/* channel list */
634138568Ssam#define	IEEE80211_IOC_WME		28	/* WME mode (on, off) */
635138568Ssam#define	IEEE80211_IOC_HIDESSID		29	/* hide SSID mode (on, off) */
636138568Ssam#define	IEEE80211_IOC_APBRIDGE		30	/* AP inter-sta bridging */
637178354Ssam/* 31-35,37-38 were for WPA authenticator settings */
638178354Ssam/* 36 was IEEE80211_IOC_DRIVER_CAPS */
639138568Ssam#define	IEEE80211_IOC_WPAIE		39	/* WPA information element */
640138568Ssam#define	IEEE80211_IOC_STA_STATS		40	/* per-station statistics */
641138568Ssam#define	IEEE80211_IOC_MACCMD		41	/* MAC ACL operation */
642138568Ssam#define	IEEE80211_IOC_CHANINFO		42	/* channel info list */
643138568Ssam#define	IEEE80211_IOC_TXPOWMAX		43	/* max tx power for channel */
644138568Ssam#define	IEEE80211_IOC_STA_TXPOW		44	/* per-station tx power limit */
645161146Ssam/* 45 was IEEE80211_IOC_STA_INFO */
646138568Ssam#define	IEEE80211_IOC_WME_CWMIN		46	/* WME: ECWmin */
647138568Ssam#define	IEEE80211_IOC_WME_CWMAX		47	/* WME: ECWmax */
648138568Ssam#define	IEEE80211_IOC_WME_AIFS		48	/* WME: AIFSN */
649138568Ssam#define	IEEE80211_IOC_WME_TXOPLIMIT	49	/* WME: txops limit */
650138568Ssam#define	IEEE80211_IOC_WME_ACM		50	/* WME: ACM (bss only) */
651138568Ssam#define	IEEE80211_IOC_WME_ACKPOLICY	51	/* WME: ACK policy (!bss only)*/
652138568Ssam#define	IEEE80211_IOC_DTIM_PERIOD	52	/* DTIM period (beacons) */
653138568Ssam#define	IEEE80211_IOC_BEACON_INTERVAL	53	/* beacon interval (ms) */
654138568Ssam#define	IEEE80211_IOC_ADDMAC		54	/* add sta to MAC ACL table */
655138568Ssam#define	IEEE80211_IOC_DELMAC		55	/* del sta from MAC ACL table */
656147794Ssam#define	IEEE80211_IOC_PUREG		56	/* pure 11g (no 11b stations) */
657170530Ssam#define	IEEE80211_IOC_FF		57	/* ATH fast frames (on, off) */
658170530Ssam#define	IEEE80211_IOC_TURBOP		58	/* ATH turbo' (on, off) */
659170530Ssam#define	IEEE80211_IOC_BGSCAN		59	/* bg scanning (on, off) */
660170530Ssam#define	IEEE80211_IOC_BGSCAN_IDLE	60	/* bg scan idle threshold */
661170530Ssam#define	IEEE80211_IOC_BGSCAN_INTERVAL	61	/* bg scan interval */
662170530Ssam#define	IEEE80211_IOC_SCANVALID		65	/* scan cache valid threshold */
663178354Ssam/* 66-72 were IEEE80211_IOC_ROAM_* and IEEE80211_IOC_MCAST_RATE */
664148292Ssam#define	IEEE80211_IOC_FRAGTHRESHOLD	73	/* tx fragmentation threshold */
665153421Ssam#define	IEEE80211_IOC_BURST		75	/* packet bursting */
666154541Ssam#define	IEEE80211_IOC_SCAN_RESULTS	76	/* get scan results */
667160686Ssam#define	IEEE80211_IOC_BMISSTHRESHOLD	77	/* beacon miss threshold */
668161146Ssam#define	IEEE80211_IOC_STA_INFO		78	/* station/neighbor info */
669170530Ssam#define	IEEE80211_IOC_WPAIE2		79	/* WPA+RSN info elements */
670170530Ssam#define	IEEE80211_IOC_CURCHAN		80	/* current channel */
671170530Ssam#define	IEEE80211_IOC_SHORTGI		81	/* 802.11n half GI */
672170530Ssam#define	IEEE80211_IOC_AMPDU		82	/* 802.11n A-MPDU (on, off) */
673170530Ssam#define	IEEE80211_IOC_AMPDU_LIMIT	83	/* A-MPDU length limit */
674170530Ssam#define	IEEE80211_IOC_AMPDU_DENSITY	84	/* A-MPDU density */
675170530Ssam#define	IEEE80211_IOC_AMSDU		85	/* 802.11n A-MSDU (on, off) */
676170530Ssam#define	IEEE80211_IOC_AMSDU_LIMIT	86	/* A-MSDU length limit */
677170530Ssam#define	IEEE80211_IOC_PUREN		87	/* pure 11n (no legacy sta's) */
678170530Ssam#define	IEEE80211_IOC_DOTH		88	/* 802.11h (on, off) */
679178354Ssam/* 89-91 were regulatory items */
680170530Ssam#define	IEEE80211_IOC_HTCOMPAT		92	/* support pre-D1.10 HT ie's */
681178354Ssam#define	IEEE80211_IOC_DWDS		93	/* DWDS/4-address handling */
682172062Ssam#define	IEEE80211_IOC_INACTIVITY	94	/* sta inactivity handling */
683178354Ssam#define	IEEE80211_IOC_APPIE		95	/* application IE's */
684178354Ssam#define	IEEE80211_IOC_WPS		96	/* WPS operation */
685178354Ssam#define	IEEE80211_IOC_TSN		97	/* TSN operation */
686178354Ssam#define	IEEE80211_IOC_DEVCAPS		98	/* driver+device capabilities */
687178354Ssam#define	IEEE80211_IOC_CHANSWITCH	99	/* start 11h channel switch */
688178354Ssam#define	IEEE80211_IOC_DFS		100	/* DFS (on, off) */
689178354Ssam#define	IEEE80211_IOC_DOTD		101	/* 802.11d (on, off) */
690173273Ssam#define IEEE80211_IOC_HTPROTMODE	102	/* HT protection (off, rts) */
691178354Ssam#define	IEEE80211_IOC_SCAN_REQ		103	/* scan w/ specified params */
692178354Ssam#define	IEEE80211_IOC_SCAN_CANCEL	104	/* cancel ongoing scan */
693173273Ssam#define	IEEE80211_IOC_HTCONF		105	/* HT config (off, HT20, HT40)*/
694178354Ssam#define	IEEE80211_IOC_REGDOMAIN		106	/* regulatory domain info */
695178354Ssam#define	IEEE80211_IOC_ROAM		107	/* roaming params en masse */
696178354Ssam#define	IEEE80211_IOC_TXPARAMS		108	/* tx parameters */
697178354Ssam#define	IEEE80211_IOC_STA_VLAN		109	/* per-station vlan tag */
698183255Ssam#define	IEEE80211_IOC_SMPS		110	/* MIMO power save */
699183256Ssam#define	IEEE80211_IOC_RIFS		111	/* RIFS config (on, off) */
700193548Ssam#define	IEEE80211_IOC_GREENFIELD	112	/* Greenfield (on, off) */
701193548Ssam#define	IEEE80211_IOC_STBC		113	/* STBC Tx/RX (on, off) */
702116742Ssam
703195618Srpaulo#define	IEEE80211_IOC_MESH_ID		170	/* mesh identifier */
704195618Srpaulo#define	IEEE80211_IOC_MESH_AP		171	/* accepting peerings */
705195618Srpaulo#define	IEEE80211_IOC_MESH_FWRD		172	/* forward frames */
706195618Srpaulo#define	IEEE80211_IOC_MESH_PROTO	173	/* mesh protocols */
707195618Srpaulo#define	IEEE80211_IOC_MESH_TTL		174	/* mesh TTL */
708195618Srpaulo#define	IEEE80211_IOC_MESH_RTCMD	175	/* mesh routing table commands*/
709195618Srpaulo#define	IEEE80211_IOC_MESH_PR_METRIC	176	/* mesh metric protocol */
710195618Srpaulo#define	IEEE80211_IOC_MESH_PR_PATH	177	/* mesh path protocol */
711195618Srpaulo#define	IEEE80211_IOC_MESH_PR_SIG	178	/* mesh sig protocol */
712195618Srpaulo#define	IEEE80211_IOC_MESH_PR_CC	179	/* mesh congestion protocol */
713195618Srpaulo#define	IEEE80211_IOC_MESH_PR_AUTH	180	/* mesh auth protocol */
714234892Smonthadar#define	IEEE80211_IOC_MESH_GATE		181	/* mesh gate XXX: 173? */
715195618Srpaulo
716195618Srpaulo#define	IEEE80211_IOC_HWMP_ROOTMODE	190	/* HWMP root mode */
717195618Srpaulo#define	IEEE80211_IOC_HWMP_MAXHOPS	191	/* number of hops before drop */
718195618Srpaulo#define	IEEE80211_IOC_HWMP_TTL		192	/* HWMP TTL */
719195618Srpaulo
720186904Ssam#define	IEEE80211_IOC_TDMA_SLOT		201	/* TDMA: assigned slot */
721186904Ssam#define	IEEE80211_IOC_TDMA_SLOTCNT	202	/* TDMA: slots in bss */
722186904Ssam#define	IEEE80211_IOC_TDMA_SLOTLEN	203	/* TDMA: slot length (usecs) */
723186904Ssam#define	IEEE80211_IOC_TDMA_BINTERVAL	204	/* TDMA: beacon intvl (slots) */
724186904Ssam
725227331Sadrian#define	IEEE80211_IOC_QUIET		205	/* Quiet Enable/Disable */
726227331Sadrian#define	IEEE80211_IOC_QUIET_PERIOD	206	/* Quiet Period */
727227331Sadrian#define	IEEE80211_IOC_QUIET_OFFSET	207	/* Quiet Offset */
728227331Sadrian#define	IEEE80211_IOC_QUIET_DUR		208	/* Quiet Duration */
729227331Sadrian#define	IEEE80211_IOC_QUIET_COUNT	209	/* Quiet Count */
730138568Ssam/*
731178354Ssam * Parameters for controlling a scan requested with
732178354Ssam * IEEE80211_IOC_SCAN_REQ.
733178354Ssam *
734178354Ssam * Active scans cause ProbeRequest frames to be issued for each
735178354Ssam * specified ssid and, by default, a broadcast ProbeRequest frame.
736178354Ssam * The set of ssid's is specified in the request.
737178354Ssam *
738178354Ssam * By default the scan will cause a BSS to be joined (in station/adhoc
739178354Ssam * mode) or a channel to be selected for operation (hostap mode).
740178354Ssam * To disable that specify IEEE80211_IOC_SCAN_NOPICK and if the
741178354Ssam *
742178354Ssam * If the station is currently associated to an AP then a scan request
743178354Ssam * will cause the station to leave the current channel and potentially
744178354Ssam * miss frames from the AP.  Alternatively the station may notify the
745178354Ssam * AP that it is going into power save mode before it leaves the channel.
746178354Ssam * This ensures frames for the station are buffered by the AP.  This is
747178354Ssam * termed a ``bg scan'' and is requested with the IEEE80211_IOC_SCAN_BGSCAN
748178354Ssam * flag.  Background scans may take longer than foreground scans and may
749178354Ssam * be preempted by traffic.  If a station is not associated to an AP
750178354Ssam * then a request for a background scan is automatically done in the
751178354Ssam * foreground.
752178354Ssam *
753178354Ssam * The results of the scan request are cached by the system.  This
754178354Ssam * information is aged out and/or invalidated based on events like not
755178354Ssam * being able to associated to an AP.  To flush the current cache
756178354Ssam * contents before doing a scan the IEEE80211_IOC_SCAN_FLUSH flag may
757178354Ssam * be specified.
758178354Ssam *
759178354Ssam * By default the scan will be done until a suitable AP is located
760178354Ssam * or a channel is found for use.  A scan can also be constrained
761178354Ssam * to be done once (IEEE80211_IOC_SCAN_ONCE) or to last for no more
762178354Ssam * than a specified duration.
763178354Ssam */
764178354Ssamstruct ieee80211_scan_req {
765178354Ssam	int		sr_flags;
766178354Ssam#define	IEEE80211_IOC_SCAN_NOPICK	0x00001	/* scan only, no selection */
767178354Ssam#define	IEEE80211_IOC_SCAN_ACTIVE	0x00002	/* active scan (probe req) */
768178354Ssam#define	IEEE80211_IOC_SCAN_PICK1ST	0x00004	/* ``hey sailor'' mode */
769178354Ssam#define	IEEE80211_IOC_SCAN_BGSCAN	0x00008	/* bg scan, exit ps at end */
770178354Ssam#define	IEEE80211_IOC_SCAN_ONCE		0x00010	/* do one complete pass */
771178354Ssam#define	IEEE80211_IOC_SCAN_NOBCAST	0x00020	/* don't send bcast probe req */
772178354Ssam#define	IEEE80211_IOC_SCAN_NOJOIN	0x00040	/* no auto-sequencing */
773178354Ssam#define	IEEE80211_IOC_SCAN_FLUSH	0x10000	/* flush scan cache first */
774178354Ssam#define	IEEE80211_IOC_SCAN_CHECK	0x20000	/* check scan cache first */
775178354Ssam	u_int		sr_duration;		/* duration (ms) */
776178354Ssam#define	IEEE80211_IOC_SCAN_DURATION_MIN	1
777178354Ssam#define	IEEE80211_IOC_SCAN_DURATION_MAX	0x7fffffff
778178354Ssam#define	IEEE80211_IOC_SCAN_FOREVER	IEEE80211_IOC_SCAN_DURATION_MAX
779178354Ssam	u_int		sr_mindwell;		/* min channel dwelltime (ms) */
780178354Ssam	u_int		sr_maxdwell;		/* max channel dwelltime (ms) */
781178354Ssam	int		sr_nssid;
782178354Ssam#define	IEEE80211_IOC_SCAN_MAX_SSID	3
783178354Ssam	struct {
784178354Ssam		int	 len;				/* length in bytes */
785178354Ssam		uint8_t ssid[IEEE80211_NWID_LEN];	/* ssid contents */
786178354Ssam	} sr_ssid[IEEE80211_IOC_SCAN_MAX_SSID];
787178354Ssam};
788178354Ssam
789178354Ssam/*
790138568Ssam * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.
791154541Ssam * Each result is a fixed size structure followed by a variable
792154541Ssam * length SSID and one or more variable length information elements.
793154541Ssam * The size of each variable length item is found in the fixed
794154541Ssam * size structure and the entire length of the record is specified
795154541Ssam * in isr_len.  Result records are rounded to a multiple of 4 bytes.
796138568Ssam */
797138568Ssamstruct ieee80211req_scan_result {
798178354Ssam	uint16_t	isr_len;		/* total length (mult of 4) */
799178354Ssam	uint16_t	isr_ie_off;		/* offset to SSID+IE data */
800170530Ssam	uint16_t	isr_ie_len;		/* IE length */
801170530Ssam	uint16_t	isr_freq;		/* MHz */
802170530Ssam	uint16_t	isr_flags;		/* channel flags */
803154541Ssam	int8_t		isr_noise;
804154541Ssam	int8_t		isr_rssi;
805199076Srpaulo	uint16_t	isr_intval;		/* beacon interval */
806170530Ssam	uint8_t		isr_capinfo;		/* capabilities */
807170530Ssam	uint8_t		isr_erp;		/* ERP element */
808170530Ssam	uint8_t		isr_bssid[IEEE80211_ADDR_LEN];
809170530Ssam	uint8_t		isr_nrates;
810170530Ssam	uint8_t		isr_rates[IEEE80211_RATE_MAXSIZE];
811170530Ssam	uint8_t		isr_ssid_len;		/* SSID length */
812195618Srpaulo	uint8_t		isr_meshid_len;		/* MESH ID length */
813195618Srpaulo	/* variable length SSID, followed by variable length MESH ID,
814195618Srpaulo	  followed by IE data */
815138568Ssam};
816121180Ssam
817178354Ssam/*
818178354Ssam * Virtual AP cloning parameters.  The parent device must
819178354Ssam * be a vap-capable device.  All parameters specified with
820178354Ssam * the clone request are fixed for the lifetime of the vap.
821178354Ssam *
822178354Ssam * There are two flavors of WDS vaps: legacy and dynamic.
823178354Ssam * Legacy WDS operation implements a static binding between
824178354Ssam * two stations encapsulating traffic in 4-address frames.
825178354Ssam * Dynamic WDS vaps are created when a station associates to
826178354Ssam * an AP and sends a 4-address frame.  If the AP vap is
827178354Ssam * configured to support WDS then this will generate an
828178354Ssam * event to user programs listening on the routing socket
829178354Ssam * and a Dynamic WDS vap will be created to handle traffic
830178354Ssam * to/from that station.  In both cases the bssid of the
831178354Ssam * peer must be specified when creating the vap.
832178354Ssam *
833178354Ssam * By default a vap will inherit the mac address/bssid of
834178354Ssam * the underlying device.  To request a unique address the
835178354Ssam * IEEE80211_CLONE_BSSID flag should be supplied.  This is
836178354Ssam * meaningless for WDS vaps as they share the bssid of an
837178354Ssam * AP vap that must otherwise exist.  Note that some devices
838178354Ssam * may not be able to support multiple addresses.
839178354Ssam *
840178354Ssam * Station mode vap's normally depend on the device to notice
841178354Ssam * when the AP stops sending beacon frames.  If IEEE80211_CLONE_NOBEACONS
842178354Ssam * is specified the net80211 layer will do this in s/w.  This
843178354Ssam * is mostly useful when setting up a WDS repeater/extender where
844178354Ssam * an AP vap is combined with a sta vap and the device isn't able
845178354Ssam * to track beacon frames in hardware.
846178354Ssam */
847170530Ssamstruct ieee80211_clone_params {
848170530Ssam	char	icp_parent[IFNAMSIZ];		/* parent device */
849178354Ssam	uint16_t icp_opmode;			/* operating mode */
850178354Ssam	uint16_t icp_flags;			/* see below */
851178354Ssam	uint8_t	icp_bssid[IEEE80211_ADDR_LEN];	/* for WDS links */
852178354Ssam	uint8_t	icp_macaddr[IEEE80211_ADDR_LEN];/* local address */
853170530Ssam};
854178354Ssam#define	IEEE80211_CLONE_BSSID		0x0001	/* allocate unique mac/bssid */
855178354Ssam#define	IEEE80211_CLONE_NOBEACONS	0x0002	/* don't setup beacon timers */
856178354Ssam#define	IEEE80211_CLONE_WDSLEGACY	0x0004	/* legacy WDS processing */
857178354Ssam#define	IEEE80211_CLONE_MACADDR		0x0008	/* use specified mac addr */
858186904Ssam#define	IEEE80211_CLONE_TDMA		0x0010	/* operate in TDMA mode */
859116742Ssam#endif /* __FreeBSD__ */
860116742Ssam
861116742Ssam#endif /* _NET80211_IEEE80211_IOCTL_H_ */
862