ieee80211_ioctl.h revision 195784
1258945Sroberto/*-
2258945Sroberto * Copyright (c) 2001 Atsushi Onoe
3258945Sroberto * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
4258945Sroberto * All rights reserved.
5258945Sroberto *
6258945Sroberto * Redistribution and use in source and binary forms, with or without
7258945Sroberto * modification, are permitted provided that the following conditions
8258945Sroberto * are met:
9258945Sroberto * 1. Redistributions of source code must retain the above copyright
10258945Sroberto *    notice, this list of conditions and the following disclaimer.
11258945Sroberto * 2. Redistributions in binary form must reproduce the above copyright
12258945Sroberto *    notice, this list of conditions and the following disclaimer in the
13258945Sroberto *    documentation and/or other materials provided with the distribution.
14258945Sroberto *
15258945Sroberto * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16258945Sroberto * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17258945Sroberto * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18258945Sroberto * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19258945Sroberto * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20258945Sroberto * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21258945Sroberto * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22258945Sroberto * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23258945Sroberto * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24258945Sroberto * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25258945Sroberto *
26258945Sroberto * $FreeBSD: head/sys/net80211/ieee80211_ioctl.h 195784 2009-07-20 19:12:08Z rpaulo $
27258945Sroberto */
28258945Sroberto#ifndef _NET80211_IEEE80211_IOCTL_H_
29258945Sroberto#define _NET80211_IEEE80211_IOCTL_H_
30258945Sroberto
31258945Sroberto/*
32258945Sroberto * IEEE 802.11 ioctls.
33258945Sroberto */
34258945Sroberto#include <net80211/_ieee80211.h>
35258945Sroberto#include <net80211/ieee80211.h>
36258945Sroberto#include <net80211/ieee80211_crypto.h>
37258945Sroberto
38258945Sroberto/*
39258945Sroberto * Per/node (station) statistics.
40258945Sroberto */
41258945Srobertostruct ieee80211_nodestats {
42258945Sroberto	uint32_t	ns_rx_data;		/* rx data frames */
43258945Sroberto	uint32_t	ns_rx_mgmt;		/* rx management frames */
44258945Sroberto	uint32_t	ns_rx_ctrl;		/* rx control frames */
45258945Sroberto	uint32_t	ns_rx_ucast;		/* rx unicast frames */
46258945Sroberto	uint32_t	ns_rx_mcast;		/* rx multi/broadcast frames */
47258945Sroberto	uint64_t	ns_rx_bytes;		/* rx data count (bytes) */
48258945Sroberto	uint64_t	ns_rx_beacons;		/* rx beacon frames */
49258945Sroberto	uint32_t	ns_rx_proberesp;	/* rx probe response frames */
50258945Sroberto
51258945Sroberto	uint32_t	ns_rx_dup;		/* rx discard 'cuz dup */
52258945Sroberto	uint32_t	ns_rx_noprivacy;	/* rx w/ wep but privacy off */
53258945Sroberto	uint32_t	ns_rx_wepfail;		/* rx wep processing failed */
54258945Sroberto	uint32_t	ns_rx_demicfail;	/* rx demic failed */
55258945Sroberto	uint32_t	ns_rx_decap;		/* rx decapsulation failed */
56258945Sroberto	uint32_t	ns_rx_defrag;		/* rx defragmentation failed */
57258945Sroberto	uint32_t	ns_rx_disassoc;		/* rx disassociation */
58258945Sroberto	uint32_t	ns_rx_deauth;		/* rx deauthentication */
59258945Sroberto	uint32_t	ns_rx_action;		/* rx action */
60258945Sroberto	uint32_t	ns_rx_decryptcrc;	/* rx decrypt failed on crc */
61258945Sroberto	uint32_t	ns_rx_unauth;		/* rx on unauthorized port */
62258945Sroberto	uint32_t	ns_rx_unencrypted;	/* rx unecrypted w/ privacy */
63258945Sroberto	uint32_t	ns_rx_drop;		/* rx discard other reason */
64258945Sroberto
65258945Sroberto	uint32_t	ns_tx_data;		/* tx data frames */
66258945Sroberto	uint32_t	ns_tx_mgmt;		/* tx management frames */
67258945Sroberto	uint32_t	ns_tx_ctrl;		/* tx control frames */
68258945Sroberto	uint32_t	ns_tx_ucast;		/* tx unicast frames */
69258945Sroberto	uint32_t	ns_tx_mcast;		/* tx multi/broadcast frames */
70258945Sroberto	uint64_t	ns_tx_bytes;		/* tx data count (bytes) */
71258945Sroberto	uint32_t	ns_tx_probereq;		/* tx probe request frames */
72258945Sroberto
73258945Sroberto	uint32_t	ns_tx_novlantag;	/* tx discard 'cuz no tag */
74258945Sroberto	uint32_t	ns_tx_vlanmismatch;	/* tx discard 'cuz bad tag */
75258945Sroberto
76258945Sroberto	uint32_t	ns_ps_discard;		/* ps discard 'cuz of age */
77258945Sroberto
78258945Sroberto	/* MIB-related state */
79258945Sroberto	uint32_t	ns_tx_assoc;		/* [re]associations */
80258945Sroberto	uint32_t	ns_tx_assoc_fail;	/* [re]association failures */
81258945Sroberto	uint32_t	ns_tx_auth;		/* [re]authentications */
82258945Sroberto	uint32_t	ns_tx_auth_fail;	/* [re]authentication failures*/
83258945Sroberto	uint32_t	ns_tx_deauth;		/* deauthentications */
84258945Sroberto	uint32_t	ns_tx_deauth_code;	/* last deauth reason */
85258945Sroberto	uint32_t	ns_tx_disassoc;		/* disassociations */
86258945Sroberto	uint32_t	ns_tx_disassoc_code;	/* last disassociation reason */
87258945Sroberto	uint32_t	ns_spare[8];
88258945Sroberto};
89258945Sroberto
90258945Sroberto/*
91258945Sroberto * Summary statistics.
92258945Sroberto */
93258945Srobertostruct ieee80211_stats {
94258945Sroberto	uint32_t	is_rx_badversion;	/* rx frame with bad version */
95258945Sroberto	uint32_t	is_rx_tooshort;		/* rx frame too short */
96258945Sroberto	uint32_t	is_rx_wrongbss;		/* rx from wrong bssid */
97258945Sroberto	uint32_t	is_rx_dup;		/* rx discard 'cuz dup */
98258945Sroberto	uint32_t	is_rx_wrongdir;		/* rx w/ wrong direction */
99258945Sroberto	uint32_t	is_rx_mcastecho;	/* rx discard 'cuz mcast echo */
100258945Sroberto	uint32_t	is_rx_notassoc;		/* rx discard 'cuz sta !assoc */
101258945Sroberto	uint32_t	is_rx_noprivacy;	/* rx w/ wep but privacy off */
102258945Sroberto	uint32_t	is_rx_unencrypted;	/* rx w/o wep and privacy on */
103258945Sroberto	uint32_t	is_rx_wepfail;		/* rx wep processing failed */
104258945Sroberto	uint32_t	is_rx_decap;		/* rx decapsulation failed */
105258945Sroberto	uint32_t	is_rx_mgtdiscard;	/* rx discard mgt frames */
106258945Sroberto	uint32_t	is_rx_ctl;		/* rx ctrl frames */
107258945Sroberto	uint32_t	is_rx_beacon;		/* rx beacon frames */
108258945Sroberto	uint32_t	is_rx_rstoobig;		/* rx rate set truncated */
109258945Sroberto	uint32_t	is_rx_elem_missing;	/* rx required element missing*/
110258945Sroberto	uint32_t	is_rx_elem_toobig;	/* rx element too big */
111258945Sroberto	uint32_t	is_rx_elem_toosmall;	/* rx element too small */
112258945Sroberto	uint32_t	is_rx_elem_unknown;	/* rx element unknown */
113258945Sroberto	uint32_t	is_rx_badchan;		/* rx frame w/ invalid chan */
114258945Sroberto	uint32_t	is_rx_chanmismatch;	/* rx frame chan mismatch */
115258945Sroberto	uint32_t	is_rx_nodealloc;	/* rx frame dropped */
116258945Sroberto	uint32_t	is_rx_ssidmismatch;	/* rx frame ssid mismatch  */
117258945Sroberto	uint32_t	is_rx_auth_unsupported;	/* rx w/ unsupported auth alg */
118258945Sroberto	uint32_t	is_rx_auth_fail;	/* rx sta auth failure */
119258945Sroberto	uint32_t	is_rx_auth_countermeasures;/* rx auth discard 'cuz CM */
120258945Sroberto	uint32_t	is_rx_assoc_bss;	/* rx assoc from wrong bssid */
121258945Sroberto	uint32_t	is_rx_assoc_notauth;	/* rx assoc w/o auth */
122258945Sroberto	uint32_t	is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */
123258945Sroberto	uint32_t	is_rx_assoc_norate;	/* rx assoc w/ no rate match */
124258945Sroberto	uint32_t	is_rx_assoc_badwpaie;	/* rx assoc w/ bad WPA IE */
125258945Sroberto	uint32_t	is_rx_deauth;		/* rx deauthentication */
126258945Sroberto	uint32_t	is_rx_disassoc;		/* rx disassociation */
127258945Sroberto	uint32_t	is_rx_badsubtype;	/* rx frame w/ unknown subtype*/
128258945Sroberto	uint32_t	is_rx_nobuf;		/* rx failed for lack of buf */
129258945Sroberto	uint32_t	is_rx_decryptcrc;	/* rx decrypt failed on crc */
130258945Sroberto	uint32_t	is_rx_ahdemo_mgt;	/* rx discard ahdemo mgt frame*/
131258945Sroberto	uint32_t	is_rx_bad_auth;		/* rx bad auth request */
132258945Sroberto	uint32_t	is_rx_unauth;		/* rx on unauthorized port */
133258945Sroberto	uint32_t	is_rx_badkeyid;		/* rx w/ incorrect keyid */
134258945Sroberto	uint32_t	is_rx_ccmpreplay;	/* rx seq# violation (CCMP) */
135258945Sroberto	uint32_t	is_rx_ccmpformat;	/* rx format bad (CCMP) */
136258945Sroberto	uint32_t	is_rx_ccmpmic;		/* rx MIC check failed (CCMP) */
137258945Sroberto	uint32_t	is_rx_tkipreplay;	/* rx seq# violation (TKIP) */
138258945Sroberto	uint32_t	is_rx_tkipformat;	/* rx format bad (TKIP) */
139258945Sroberto	uint32_t	is_rx_tkipmic;		/* rx MIC check failed (TKIP) */
140258945Sroberto	uint32_t	is_rx_tkipicv;		/* rx ICV check failed (TKIP) */
141258945Sroberto	uint32_t	is_rx_badcipher;	/* rx failed 'cuz key type */
142258945Sroberto	uint32_t	is_rx_nocipherctx;	/* rx failed 'cuz key !setup */
143258945Sroberto	uint32_t	is_rx_acl;		/* rx discard 'cuz acl policy */
144258945Sroberto	uint32_t	is_tx_nobuf;		/* tx failed for lack of buf */
145258945Sroberto	uint32_t	is_tx_nonode;		/* tx failed for no node */
146258945Sroberto	uint32_t	is_tx_unknownmgt;	/* tx of unknown mgt frame */
147258945Sroberto	uint32_t	is_tx_badcipher;	/* tx failed 'cuz key type */
148258945Sroberto	uint32_t	is_tx_nodefkey;		/* tx failed 'cuz no defkey */
149258945Sroberto	uint32_t	is_tx_noheadroom;	/* tx failed 'cuz no space */
150258945Sroberto	uint32_t	is_tx_fragframes;	/* tx frames fragmented */
151258945Sroberto	uint32_t	is_tx_frags;		/* tx fragments created */
152258945Sroberto	uint32_t	is_scan_active;		/* active scans started */
153258945Sroberto	uint32_t	is_scan_passive;	/* passive scans started */
154258945Sroberto	uint32_t	is_node_timeout;	/* nodes timed out inactivity */
155258945Sroberto	uint32_t	is_crypto_nomem;	/* no memory for crypto ctx */
156258945Sroberto	uint32_t	is_crypto_tkip;		/* tkip crypto done in s/w */
157258945Sroberto	uint32_t	is_crypto_tkipenmic;	/* tkip en-MIC done in s/w */
158258945Sroberto	uint32_t	is_crypto_tkipdemic;	/* tkip de-MIC done in s/w */
159258945Sroberto	uint32_t	is_crypto_tkipcm;	/* tkip counter measures */
160258945Sroberto	uint32_t	is_crypto_ccmp;		/* ccmp crypto done in s/w */
161258945Sroberto	uint32_t	is_crypto_wep;		/* wep crypto done in s/w */
162258945Sroberto	uint32_t	is_crypto_setkey_cipher;/* cipher rejected key */
163258945Sroberto	uint32_t	is_crypto_setkey_nokey;	/* no key index for setkey */
164258945Sroberto	uint32_t	is_crypto_delkey;	/* driver key delete failed */
165258945Sroberto	uint32_t	is_crypto_badcipher;	/* unknown cipher */
166258945Sroberto	uint32_t	is_crypto_nocipher;	/* cipher not available */
167258945Sroberto	uint32_t	is_crypto_attachfail;	/* cipher attach failed */
168258945Sroberto	uint32_t	is_crypto_swfallback;	/* cipher fallback to s/w */
169258945Sroberto	uint32_t	is_crypto_keyfail;	/* driver key alloc failed */
170258945Sroberto	uint32_t	is_crypto_enmicfail;	/* en-MIC failed */
171258945Sroberto	uint32_t	is_ibss_capmismatch;	/* merge failed-cap mismatch */
172258945Sroberto	uint32_t	is_ibss_norate;		/* merge failed-rate mismatch */
173258945Sroberto	uint32_t	is_ps_unassoc;		/* ps-poll for unassoc. sta */
174258945Sroberto	uint32_t	is_ps_badaid;		/* ps-poll w/ incorrect aid */
175258945Sroberto	uint32_t	is_ps_qempty;		/* ps-poll w/ nothing to send */
176258945Sroberto	uint32_t	is_ff_badhdr;		/* fast frame rx'd w/ bad hdr */
177258945Sroberto	uint32_t	is_ff_tooshort;		/* fast frame rx decap error */
178258945Sroberto	uint32_t	is_ff_split;		/* fast frame rx split error */
179258945Sroberto	uint32_t	is_ff_decap;		/* fast frames decap'd */
180258945Sroberto	uint32_t	is_ff_encap;		/* fast frames encap'd for tx */
181258945Sroberto	uint32_t	is_rx_badbintval;	/* rx frame w/ bogus bintval */
182258945Sroberto	uint32_t	is_rx_demicfail;	/* rx demic failed */
183258945Sroberto	uint32_t	is_rx_defrag;		/* rx defragmentation failed */
184258945Sroberto	uint32_t	is_rx_mgmt;		/* rx management frames */
185258945Sroberto	uint32_t	is_rx_action;		/* rx action mgt frames */
186258945Sroberto	uint32_t	is_amsdu_tooshort;	/* A-MSDU rx decap error */
187258945Sroberto	uint32_t	is_amsdu_split;		/* A-MSDU rx split error */
188	uint32_t	is_amsdu_decap;		/* A-MSDU decap'd */
189	uint32_t	is_amsdu_encap;		/* A-MSDU encap'd for tx */
190	uint32_t	is_ampdu_bar_bad;	/* A-MPDU BAR out of window */
191	uint32_t	is_ampdu_bar_oow;	/* A-MPDU BAR before ADDBA */
192	uint32_t	is_ampdu_bar_move;	/* A-MPDU BAR moved window */
193	uint32_t	is_ampdu_bar_rx;	/* A-MPDU BAR frames handled */
194	uint32_t	is_ampdu_rx_flush;	/* A-MPDU frames flushed */
195	uint32_t	is_ampdu_rx_oor;	/* A-MPDU frames out-of-order */
196	uint32_t	is_ampdu_rx_copy;	/* A-MPDU frames copied down */
197	uint32_t	is_ampdu_rx_drop;	/* A-MPDU frames dropped */
198	uint32_t	is_tx_badstate;		/* tx discard state != RUN */
199	uint32_t	is_tx_notassoc;		/* tx failed, sta not assoc */
200	uint32_t	is_tx_classify;		/* tx classification failed */
201	uint32_t	is_dwds_mcast;		/* discard mcast over dwds */
202	uint32_t	is_dwds_qdrop;		/* dwds pending frame q full */
203	uint32_t	is_ht_assoc_nohtcap;	/* non-HT sta rejected */
204	uint32_t	is_ht_assoc_downgrade;	/* HT sta forced to legacy */
205	uint32_t	is_ht_assoc_norate;	/* HT assoc w/ rate mismatch */
206	uint32_t	is_ampdu_rx_age;	/* A-MPDU sent up 'cuz of age */
207	uint32_t	is_ampdu_rx_move;	/* A-MPDU MSDU moved window */
208	uint32_t	is_addba_reject;	/* ADDBA reject 'cuz disabled */
209	uint32_t	is_addba_norequest;	/* ADDBA response w/o ADDBA */
210	uint32_t	is_addba_badtoken;	/* ADDBA response w/ wrong
211						   dialogtoken */
212	uint32_t	is_addba_badpolicy;	/* ADDBA resp w/ wrong policy */
213	uint32_t	is_ampdu_stop;		/* A-MPDU stream stopped */
214	uint32_t	is_ampdu_stop_failed;	/* A-MPDU stream not running */
215	uint32_t	is_ampdu_rx_reorder;	/* A-MPDU held for rx reorder */
216	uint32_t	is_scan_bg;		/* background scans started */
217	uint8_t		is_rx_deauth_code;	/* last rx'd deauth reason */
218	uint8_t		is_rx_disassoc_code;	/* last rx'd disassoc reason */
219	uint8_t		is_rx_authfail_code;	/* last rx'd auth fail reason */
220	uint32_t	is_beacon_miss;		/* beacon miss notification */
221	uint32_t	is_rx_badstate;		/* rx discard state != RUN */
222	uint32_t	is_ff_flush;		/* ff's flush'd from stageq */
223	uint32_t	is_tx_ctl;		/* tx ctrl frames */
224	uint32_t	is_ampdu_rexmt;		/* A-MPDU frames rexmt ok */
225	uint32_t	is_ampdu_rexmt_fail;	/* A-MPDU frames rexmt fail */
226
227	uint32_t	is_mesh_wrongmesh;	/* dropped 'cuz not mesh sta*/
228	uint32_t	is_mesh_nolink;		/* dropped 'cuz link not estab*/
229	uint32_t	is_mesh_fwd_ttl;	/* mesh not fwd'd 'cuz ttl 0 */
230	uint32_t	is_mesh_fwd_nobuf;	/* mesh not fwd'd 'cuz no mbuf*/
231	uint32_t	is_mesh_fwd_tooshort;	/* mesh not fwd'd 'cuz no hdr */
232	uint32_t	is_mesh_fwd_disabled;	/* mesh not fwd'd 'cuz disabled */
233	uint32_t	is_mesh_fwd_nopath;	/* mesh not fwd'd 'cuz path unknown */
234
235	uint32_t	is_hwmp_wrongseq;	/* wrong hwmp seq no. */
236	uint32_t	is_hwmp_rootreqs;	/* root PREQs sent */
237	uint32_t	is_hwmp_rootrann;	/* root RANNs sent */
238
239	uint32_t	is_mesh_badae;		/* dropped 'cuz invalid AE */
240	uint32_t	is_mesh_rtaddfailed;	/* route add failed */
241	uint32_t	is_mesh_notproxy;	/* dropped 'cuz not proxying */
242	uint32_t	is_rx_badalign;		/* dropped 'cuz misaligned */
243
244	uint32_t	is_spare[12];
245};
246
247/*
248 * Max size of optional information elements.  We artificially
249 * constrain this; it's limited only by the max frame size (and
250 * the max parameter size of the wireless extensions).
251 */
252#define	IEEE80211_MAX_OPT_IE	256
253
254/*
255 * WPA/RSN get/set key request.  Specify the key/cipher
256 * type and whether the key is to be used for sending and/or
257 * receiving.  The key index should be set only when working
258 * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
259 * Otherwise a unicast/pairwise key is specified by the bssid
260 * (on a station) or mac address (on an ap).  They key length
261 * must include any MIC key data; otherwise it should be no
262 * more than IEEE80211_KEYBUF_SIZE.
263 */
264struct ieee80211req_key {
265	uint8_t		ik_type;	/* key/cipher type */
266	uint8_t		ik_pad;
267	uint16_t	ik_keyix;	/* key index */
268	uint8_t		ik_keylen;	/* key length in bytes */
269	uint8_t		ik_flags;
270/* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */
271#define	IEEE80211_KEY_DEFAULT	0x80	/* default xmit key */
272	uint8_t		ik_macaddr[IEEE80211_ADDR_LEN];
273	uint64_t	ik_keyrsc;	/* key receive sequence counter */
274	uint64_t	ik_keytsc;	/* key transmit sequence counter */
275	uint8_t		ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
276};
277
278/*
279 * Delete a key either by index or address.  Set the index
280 * to IEEE80211_KEYIX_NONE when deleting a unicast key.
281 */
282struct ieee80211req_del_key {
283	uint8_t		idk_keyix;	/* key index */
284	uint8_t		idk_macaddr[IEEE80211_ADDR_LEN];
285};
286
287/*
288 * MLME state manipulation request.  IEEE80211_MLME_ASSOC
289 * only makes sense when operating as a station.  The other
290 * requests can be used when operating as a station or an
291 * ap (to effect a station).
292 */
293struct ieee80211req_mlme {
294	uint8_t		im_op;		/* operation to perform */
295#define	IEEE80211_MLME_ASSOC		1	/* associate station */
296#define	IEEE80211_MLME_DISASSOC		2	/* disassociate station */
297#define	IEEE80211_MLME_DEAUTH		3	/* deauthenticate station */
298#define	IEEE80211_MLME_AUTHORIZE	4	/* authorize station */
299#define	IEEE80211_MLME_UNAUTHORIZE	5	/* unauthorize station */
300#define	IEEE80211_MLME_AUTH		6	/* authenticate station */
301	uint8_t		im_ssid_len;	/* length of optional ssid */
302	uint16_t	im_reason;	/* 802.11 reason code */
303	uint8_t		im_macaddr[IEEE80211_ADDR_LEN];
304	uint8_t		im_ssid[IEEE80211_NWID_LEN];
305};
306
307/*
308 * MAC ACL operations.
309 */
310enum {
311	IEEE80211_MACCMD_POLICY_OPEN	= 0,	/* set policy: no ACL's */
312	IEEE80211_MACCMD_POLICY_ALLOW	= 1,	/* set policy: allow traffic */
313	IEEE80211_MACCMD_POLICY_DENY	= 2,	/* set policy: deny traffic */
314	IEEE80211_MACCMD_FLUSH		= 3,	/* flush ACL database */
315	IEEE80211_MACCMD_DETACH		= 4,	/* detach ACL policy */
316	IEEE80211_MACCMD_POLICY		= 5,	/* get ACL policy */
317	IEEE80211_MACCMD_LIST		= 6,	/* get ACL database */
318	IEEE80211_MACCMD_POLICY_RADIUS	= 7,	/* set policy: RADIUS managed */
319};
320
321struct ieee80211req_maclist {
322	uint8_t		ml_macaddr[IEEE80211_ADDR_LEN];
323} __packed;
324
325/*
326 * Mesh Routing Table Operations.
327 */
328enum {
329	IEEE80211_MESH_RTCMD_LIST   = 0, /* list HWMP routing table */
330	IEEE80211_MESH_RTCMD_FLUSH  = 1, /* flush HWMP routing table */
331	IEEE80211_MESH_RTCMD_ADD    = 2, /* add entry to the table */
332	IEEE80211_MESH_RTCMD_DELETE = 3, /* delete an entry from the table */
333};
334
335struct ieee80211req_mesh_route {
336	uint8_t		imr_dest[IEEE80211_ADDR_LEN];
337	uint8_t		imr_nexthop[IEEE80211_ADDR_LEN];
338	uint16_t	imr_nhops;
339	uint16_t	imr_pad;
340	uint32_t	imr_metric;
341	uint32_t	imr_lifetime;
342	uint32_t	imr_lastmseq;
343};
344
345/*
346 * HWMP root modes
347 */
348enum {
349	IEEE80211_HWMP_ROOTMODE_DISABLED	= 0, 	/* disabled */
350	IEEE80211_HWMP_ROOTMODE_NORMAL		= 1,	/* normal PREPs */
351	IEEE80211_HWMP_ROOTMODE_PROACTIVE	= 2,	/* proactive PREPS */
352	IEEE80211_HWMP_ROOTMODE_RANN		= 3,	/* use RANN elemid */
353};
354
355
356/*
357 * Set the active channel list by IEEE channel #: each channel
358 * to be marked active is set in a bit vector.  Note this list is
359 * intersected with the available channel list in calculating
360 * the set of channels actually used in scanning.
361 */
362struct ieee80211req_chanlist {
363	uint8_t		ic_channels[32];	/* NB: can be variable length */
364};
365
366/*
367 * Get the active channel list info.
368 */
369struct ieee80211req_chaninfo {
370	u_int	ic_nchans;
371	struct ieee80211_channel ic_chans[1];	/* NB: variable length */
372};
373#define	IEEE80211_CHANINFO_SIZE(_nchan) \
374	(sizeof(struct ieee80211req_chaninfo) + \
375	 (((_nchan)-1) * sizeof(struct ieee80211_channel)))
376#define	IEEE80211_CHANINFO_SPACE(_ci) \
377	IEEE80211_CHANINFO_SIZE((_ci)->ic_nchans)
378
379/*
380 * Retrieve the WPA/RSN information element for an associated station.
381 */
382struct ieee80211req_wpaie {	/* old version w/ only one ie */
383	uint8_t		wpa_macaddr[IEEE80211_ADDR_LEN];
384	uint8_t		wpa_ie[IEEE80211_MAX_OPT_IE];
385};
386struct ieee80211req_wpaie2 {
387	uint8_t		wpa_macaddr[IEEE80211_ADDR_LEN];
388	uint8_t		wpa_ie[IEEE80211_MAX_OPT_IE];
389	uint8_t		rsn_ie[IEEE80211_MAX_OPT_IE];
390};
391
392/*
393 * Retrieve per-node statistics.
394 */
395struct ieee80211req_sta_stats {
396	union {
397		/* NB: explicitly force 64-bit alignment */
398		uint8_t		macaddr[IEEE80211_ADDR_LEN];
399		uint64_t	pad;
400	} is_u;
401	struct ieee80211_nodestats is_stats;
402};
403
404/*
405 * Station information block; the mac address is used
406 * to retrieve other data like stats, unicast key, etc.
407 */
408struct ieee80211req_sta_info {
409	uint16_t	isi_len;		/* total length (mult of 4) */
410	uint16_t	isi_ie_off;		/* offset to IE data */
411	uint16_t	isi_ie_len;		/* IE length */
412	uint16_t	isi_freq;		/* MHz */
413	uint32_t	isi_flags;		/* channel flags */
414	uint32_t	isi_state;		/* state flags */
415	uint8_t		isi_authmode;		/* authentication algorithm */
416	int8_t		isi_rssi;		/* receive signal strength */
417	int8_t		isi_noise;		/* noise floor */
418	uint8_t		isi_capinfo;		/* capabilities */
419	uint8_t		isi_erp;		/* ERP element */
420	uint8_t		isi_macaddr[IEEE80211_ADDR_LEN];
421	uint8_t		isi_nrates;
422						/* negotiated rates */
423	uint8_t		isi_rates[IEEE80211_RATE_MAXSIZE];
424	uint8_t		isi_txrate;		/* legacy/IEEE rate or MCS */
425	uint16_t	isi_associd;		/* assoc response */
426	uint16_t	isi_txpower;		/* current tx power */
427	uint16_t	isi_vlan;		/* vlan tag */
428	/* NB: [IEEE80211_NONQOS_TID] holds seq#'s for non-QoS stations */
429	uint16_t	isi_txseqs[IEEE80211_TID_SIZE];/* tx seq #/TID */
430	uint16_t	isi_rxseqs[IEEE80211_TID_SIZE];/* rx seq#/TID */
431	uint16_t	isi_inact;		/* inactivity timer */
432	uint16_t	isi_txmbps;		/* current tx rate in .5 Mb/s */
433	uint16_t	isi_pad;
434	uint32_t	isi_jointime;		/* time of assoc/join */
435	struct ieee80211_mimo_info isi_mimo;	/* MIMO info for 11n sta's */
436	/* 11s info */
437	uint16_t	isi_peerid;
438	uint16_t	isi_localid;
439	uint8_t		isi_peerstate;
440	/* XXX frag state? */
441	/* variable length IE data */
442};
443
444/*
445 * Retrieve per-station information; to retrieve all
446 * specify a mac address of ff:ff:ff:ff:ff:ff.
447 */
448struct ieee80211req_sta_req {
449	union {
450		/* NB: explicitly force 64-bit alignment */
451		uint8_t		macaddr[IEEE80211_ADDR_LEN];
452		uint64_t	pad;
453	} is_u;
454	struct ieee80211req_sta_info info[1];	/* variable length */
455};
456
457/*
458 * Get/set per-station tx power cap.
459 */
460struct ieee80211req_sta_txpow {
461	uint8_t		it_macaddr[IEEE80211_ADDR_LEN];
462	uint8_t		it_txpow;
463};
464
465/*
466 * WME parameters manipulated with IEEE80211_IOC_WME_CWMIN
467 * through IEEE80211_IOC_WME_ACKPOLICY are set and return
468 * using i_val and i_len.  i_val holds the value itself.
469 * i_len specifies the AC and, as appropriate, then high bit
470 * specifies whether the operation is to be applied to the
471 * BSS or ourself.
472 */
473#define	IEEE80211_WMEPARAM_SELF	0x0000		/* parameter applies to self */
474#define	IEEE80211_WMEPARAM_BSS	0x8000		/* parameter applies to BSS */
475#define	IEEE80211_WMEPARAM_VAL	0x7fff		/* parameter value */
476
477/*
478 * Application Information Elements can be appended to a variety
479 * of frames with the IEE80211_IOC_APPIE request.  This request
480 * piggybacks on a normal ieee80211req; the frame type is passed
481 * in i_val as the 802.11 FC0 bytes and the length of the IE data
482 * is passed in i_len.  The data is referenced in i_data.  If i_len
483 * is zero then any previously configured IE data is removed.  At
484 * most IEEE80211_MAX_APPIE data be appened.  Note that multiple
485 * IE's can be supplied; the data is treated opaquely.
486 */
487#define	IEEE80211_MAX_APPIE	1024		/* max app IE data */
488/*
489 * Hack: the WPA authenticator uses this mechanism to specify WPA
490 * ie's that are used instead of the ones normally constructed using
491 * the cipher state setup with separate ioctls.  This avoids issues
492 * like the authenticator ordering ie data differently than the
493 * net80211 layer and needing to keep separate state for WPA and RSN.
494 */
495#define	IEEE80211_APPIE_WPA \
496	(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_BEACON | \
497	 IEEE80211_FC0_SUBTYPE_PROBE_RESP)
498
499/*
500 * Station mode roaming parameters.  These are maintained
501 * per band/mode and control the roaming algorithm.
502 */
503struct ieee80211_roamparams_req {
504	struct ieee80211_roamparam params[IEEE80211_MODE_MAX];
505};
506
507/*
508 * Transmit parameters.  These can be used to set fixed transmit
509 * rate for each operating mode when operating as client or on a
510 * per-client basis according to the capabilities of the client
511 * (e.g. an 11b client associated to an 11g ap) when operating as
512 * an ap.
513 *
514 * MCS are distinguished from legacy rates by or'ing in 0x80.
515 */
516struct ieee80211_txparams_req {
517	struct ieee80211_txparam params[IEEE80211_MODE_MAX];
518};
519
520/*
521 * Set regulatory domain state with IEEE80211_IOC_REGDOMAIN.
522 * Note this is both the regulatory description and the channel
523 * list.  The get request for IEEE80211_IOC_REGDOMAIN returns
524 * only the regdomain info; the channel list is obtained
525 * separately with IEEE80211_IOC_CHANINFO.
526 */
527struct ieee80211_regdomain_req {
528	struct ieee80211_regdomain	rd;
529	struct ieee80211req_chaninfo	chaninfo;
530};
531#define	IEEE80211_REGDOMAIN_SIZE(_nchan) \
532	(sizeof(struct ieee80211_regdomain_req) + \
533	 (((_nchan)-1) * sizeof(struct ieee80211_channel)))
534#define	IEEE80211_REGDOMAIN_SPACE(_req) \
535	IEEE80211_REGDOMAIN_SIZE((_req)->chaninfo.ic_nchans)
536
537/*
538 * Get driver capabilities.  Driver, hardware crypto, and
539 * HT/802.11n capabilities, and a table that describes what
540 * the radio can do.
541 */
542struct ieee80211_devcaps_req {
543	uint32_t	dc_drivercaps;		/* general driver caps */
544	uint32_t	dc_cryptocaps;		/* hardware crypto support */
545	uint32_t	dc_htcaps;		/* HT/802.11n support */
546	struct ieee80211req_chaninfo dc_chaninfo;
547};
548#define	IEEE80211_DEVCAPS_SIZE(_nchan) \
549	(sizeof(struct ieee80211_devcaps_req) + \
550	 (((_nchan)-1) * sizeof(struct ieee80211_channel)))
551#define	IEEE80211_DEVCAPS_SPACE(_dc) \
552	IEEE80211_DEVCAPS_SIZE((_dc)->dc_chaninfo.ic_nchans)
553
554struct ieee80211_chanswitch_req {
555	struct ieee80211_channel csa_chan;	/* new channel */
556	int		csa_mode;		/* CSA mode */
557	int		csa_count;		/* beacon count to switch */
558};
559
560/*
561 * Get/set per-station vlan tag.
562 */
563struct ieee80211req_sta_vlan {
564	uint8_t		sv_macaddr[IEEE80211_ADDR_LEN];
565	uint16_t	sv_vlan;
566};
567
568#ifdef __FreeBSD__
569/*
570 * FreeBSD-style ioctls.
571 */
572/* the first member must be matched with struct ifreq */
573struct ieee80211req {
574	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
575	uint16_t	i_type;			/* req type */
576	int16_t		i_val;			/* Index or simple value */
577	int16_t		i_len;			/* Index or simple value */
578	void		*i_data;		/* Extra data */
579};
580#define	SIOCS80211		 _IOW('i', 234, struct ieee80211req)
581#define	SIOCG80211		_IOWR('i', 235, struct ieee80211req)
582#define	SIOCG80211STATS		_IOWR('i', 236, struct ifreq)
583
584#define IEEE80211_IOC_SSID		1
585#define IEEE80211_IOC_NUMSSIDS		2
586#define IEEE80211_IOC_WEP		3
587#define 	IEEE80211_WEP_NOSUP	-1
588#define 	IEEE80211_WEP_OFF	0
589#define 	IEEE80211_WEP_ON	1
590#define 	IEEE80211_WEP_MIXED	2
591#define IEEE80211_IOC_WEPKEY		4
592#define IEEE80211_IOC_NUMWEPKEYS	5
593#define IEEE80211_IOC_WEPTXKEY		6
594#define IEEE80211_IOC_AUTHMODE		7
595#define IEEE80211_IOC_STATIONNAME	8
596#define IEEE80211_IOC_CHANNEL		9
597#define IEEE80211_IOC_POWERSAVE		10
598#define 	IEEE80211_POWERSAVE_NOSUP	-1
599#define 	IEEE80211_POWERSAVE_OFF		0
600#define 	IEEE80211_POWERSAVE_CAM		1
601#define 	IEEE80211_POWERSAVE_PSP		2
602#define 	IEEE80211_POWERSAVE_PSP_CAM	3
603#define 	IEEE80211_POWERSAVE_ON		IEEE80211_POWERSAVE_CAM
604#define IEEE80211_IOC_POWERSAVESLEEP	11
605#define	IEEE80211_IOC_RTSTHRESHOLD	12
606#define IEEE80211_IOC_PROTMODE		13
607#define 	IEEE80211_PROTMODE_OFF		0
608#define 	IEEE80211_PROTMODE_CTS		1
609#define 	IEEE80211_PROTMODE_RTSCTS	2
610#define	IEEE80211_IOC_TXPOWER		14	/* global tx power limit */
611#define	IEEE80211_IOC_BSSID		15
612#define	IEEE80211_IOC_ROAMING		16	/* roaming mode */
613#define	IEEE80211_IOC_PRIVACY		17	/* privacy invoked */
614#define	IEEE80211_IOC_DROPUNENCRYPTED	18	/* discard unencrypted frames */
615#define	IEEE80211_IOC_WPAKEY		19
616#define	IEEE80211_IOC_DELKEY		20
617#define	IEEE80211_IOC_MLME		21
618/* 22 was IEEE80211_IOC_OPTIE, replaced by IEEE80211_IOC_APPIE */
619/* 23 was IEEE80211_IOC_SCAN_REQ */
620/* 24 was IEEE80211_IOC_SCAN_RESULTS */
621#define	IEEE80211_IOC_COUNTERMEASURES	25	/* WPA/TKIP countermeasures */
622#define	IEEE80211_IOC_WPA		26	/* WPA mode (0,1,2) */
623#define	IEEE80211_IOC_CHANLIST		27	/* channel list */
624#define	IEEE80211_IOC_WME		28	/* WME mode (on, off) */
625#define	IEEE80211_IOC_HIDESSID		29	/* hide SSID mode (on, off) */
626#define	IEEE80211_IOC_APBRIDGE		30	/* AP inter-sta bridging */
627/* 31-35,37-38 were for WPA authenticator settings */
628/* 36 was IEEE80211_IOC_DRIVER_CAPS */
629#define	IEEE80211_IOC_WPAIE		39	/* WPA information element */
630#define	IEEE80211_IOC_STA_STATS		40	/* per-station statistics */
631#define	IEEE80211_IOC_MACCMD		41	/* MAC ACL operation */
632#define	IEEE80211_IOC_CHANINFO		42	/* channel info list */
633#define	IEEE80211_IOC_TXPOWMAX		43	/* max tx power for channel */
634#define	IEEE80211_IOC_STA_TXPOW		44	/* per-station tx power limit */
635/* 45 was IEEE80211_IOC_STA_INFO */
636#define	IEEE80211_IOC_WME_CWMIN		46	/* WME: ECWmin */
637#define	IEEE80211_IOC_WME_CWMAX		47	/* WME: ECWmax */
638#define	IEEE80211_IOC_WME_AIFS		48	/* WME: AIFSN */
639#define	IEEE80211_IOC_WME_TXOPLIMIT	49	/* WME: txops limit */
640#define	IEEE80211_IOC_WME_ACM		50	/* WME: ACM (bss only) */
641#define	IEEE80211_IOC_WME_ACKPOLICY	51	/* WME: ACK policy (!bss only)*/
642#define	IEEE80211_IOC_DTIM_PERIOD	52	/* DTIM period (beacons) */
643#define	IEEE80211_IOC_BEACON_INTERVAL	53	/* beacon interval (ms) */
644#define	IEEE80211_IOC_ADDMAC		54	/* add sta to MAC ACL table */
645#define	IEEE80211_IOC_DELMAC		55	/* del sta from MAC ACL table */
646#define	IEEE80211_IOC_PUREG		56	/* pure 11g (no 11b stations) */
647#define	IEEE80211_IOC_FF		57	/* ATH fast frames (on, off) */
648#define	IEEE80211_IOC_TURBOP		58	/* ATH turbo' (on, off) */
649#define	IEEE80211_IOC_BGSCAN		59	/* bg scanning (on, off) */
650#define	IEEE80211_IOC_BGSCAN_IDLE	60	/* bg scan idle threshold */
651#define	IEEE80211_IOC_BGSCAN_INTERVAL	61	/* bg scan interval */
652#define	IEEE80211_IOC_SCANVALID		65	/* scan cache valid threshold */
653/* 66-72 were IEEE80211_IOC_ROAM_* and IEEE80211_IOC_MCAST_RATE */
654#define	IEEE80211_IOC_FRAGTHRESHOLD	73	/* tx fragmentation threshold */
655#define	IEEE80211_IOC_BURST		75	/* packet bursting */
656#define	IEEE80211_IOC_SCAN_RESULTS	76	/* get scan results */
657#define	IEEE80211_IOC_BMISSTHRESHOLD	77	/* beacon miss threshold */
658#define	IEEE80211_IOC_STA_INFO		78	/* station/neighbor info */
659#define	IEEE80211_IOC_WPAIE2		79	/* WPA+RSN info elements */
660#define	IEEE80211_IOC_CURCHAN		80	/* current channel */
661#define	IEEE80211_IOC_SHORTGI		81	/* 802.11n half GI */
662#define	IEEE80211_IOC_AMPDU		82	/* 802.11n A-MPDU (on, off) */
663#define	IEEE80211_IOC_AMPDU_LIMIT	83	/* A-MPDU length limit */
664#define	IEEE80211_IOC_AMPDU_DENSITY	84	/* A-MPDU density */
665#define	IEEE80211_IOC_AMSDU		85	/* 802.11n A-MSDU (on, off) */
666#define	IEEE80211_IOC_AMSDU_LIMIT	86	/* A-MSDU length limit */
667#define	IEEE80211_IOC_PUREN		87	/* pure 11n (no legacy sta's) */
668#define	IEEE80211_IOC_DOTH		88	/* 802.11h (on, off) */
669/* 89-91 were regulatory items */
670#define	IEEE80211_IOC_HTCOMPAT		92	/* support pre-D1.10 HT ie's */
671#define	IEEE80211_IOC_DWDS		93	/* DWDS/4-address handling */
672#define	IEEE80211_IOC_INACTIVITY	94	/* sta inactivity handling */
673#define	IEEE80211_IOC_APPIE		95	/* application IE's */
674#define	IEEE80211_IOC_WPS		96	/* WPS operation */
675#define	IEEE80211_IOC_TSN		97	/* TSN operation */
676#define	IEEE80211_IOC_DEVCAPS		98	/* driver+device capabilities */
677#define	IEEE80211_IOC_CHANSWITCH	99	/* start 11h channel switch */
678#define	IEEE80211_IOC_DFS		100	/* DFS (on, off) */
679#define	IEEE80211_IOC_DOTD		101	/* 802.11d (on, off) */
680#define IEEE80211_IOC_HTPROTMODE	102	/* HT protection (off, rts) */
681#define	IEEE80211_IOC_SCAN_REQ		103	/* scan w/ specified params */
682#define	IEEE80211_IOC_SCAN_CANCEL	104	/* cancel ongoing scan */
683#define	IEEE80211_IOC_HTCONF		105	/* HT config (off, HT20, HT40)*/
684#define	IEEE80211_IOC_REGDOMAIN		106	/* regulatory domain info */
685#define	IEEE80211_IOC_ROAM		107	/* roaming params en masse */
686#define	IEEE80211_IOC_TXPARAMS		108	/* tx parameters */
687#define	IEEE80211_IOC_STA_VLAN		109	/* per-station vlan tag */
688#define	IEEE80211_IOC_SMPS		110	/* MIMO power save */
689#define	IEEE80211_IOC_RIFS		111	/* RIFS config (on, off) */
690#define	IEEE80211_IOC_GREENFIELD	112	/* Greenfield (on, off) */
691#define	IEEE80211_IOC_STBC		113	/* STBC Tx/RX (on, off) */
692
693#define	IEEE80211_IOC_MESH_ID		170	/* mesh identifier */
694#define	IEEE80211_IOC_MESH_AP		171	/* accepting peerings */
695#define	IEEE80211_IOC_MESH_FWRD		172	/* forward frames */
696#define	IEEE80211_IOC_MESH_PROTO	173	/* mesh protocols */
697#define	IEEE80211_IOC_MESH_TTL		174	/* mesh TTL */
698#define	IEEE80211_IOC_MESH_RTCMD	175	/* mesh routing table commands*/
699#define	IEEE80211_IOC_MESH_PR_METRIC	176	/* mesh metric protocol */
700#define	IEEE80211_IOC_MESH_PR_PATH	177	/* mesh path protocol */
701#define	IEEE80211_IOC_MESH_PR_SIG	178	/* mesh sig protocol */
702#define	IEEE80211_IOC_MESH_PR_CC	179	/* mesh congestion protocol */
703#define	IEEE80211_IOC_MESH_PR_AUTH	180	/* mesh auth protocol */
704
705#define	IEEE80211_IOC_HWMP_ROOTMODE	190	/* HWMP root mode */
706#define	IEEE80211_IOC_HWMP_MAXHOPS	191	/* number of hops before drop */
707#define	IEEE80211_IOC_HWMP_TTL		192	/* HWMP TTL */
708
709#define	IEEE80211_IOC_TDMA_SLOT		201	/* TDMA: assigned slot */
710#define	IEEE80211_IOC_TDMA_SLOTCNT	202	/* TDMA: slots in bss */
711#define	IEEE80211_IOC_TDMA_SLOTLEN	203	/* TDMA: slot length (usecs) */
712#define	IEEE80211_IOC_TDMA_BINTERVAL	204	/* TDMA: beacon intvl (slots) */
713
714/*
715 * Parameters for controlling a scan requested with
716 * IEEE80211_IOC_SCAN_REQ.
717 *
718 * Active scans cause ProbeRequest frames to be issued for each
719 * specified ssid and, by default, a broadcast ProbeRequest frame.
720 * The set of ssid's is specified in the request.
721 *
722 * By default the scan will cause a BSS to be joined (in station/adhoc
723 * mode) or a channel to be selected for operation (hostap mode).
724 * To disable that specify IEEE80211_IOC_SCAN_NOPICK and if the
725 *
726 * If the station is currently associated to an AP then a scan request
727 * will cause the station to leave the current channel and potentially
728 * miss frames from the AP.  Alternatively the station may notify the
729 * AP that it is going into power save mode before it leaves the channel.
730 * This ensures frames for the station are buffered by the AP.  This is
731 * termed a ``bg scan'' and is requested with the IEEE80211_IOC_SCAN_BGSCAN
732 * flag.  Background scans may take longer than foreground scans and may
733 * be preempted by traffic.  If a station is not associated to an AP
734 * then a request for a background scan is automatically done in the
735 * foreground.
736 *
737 * The results of the scan request are cached by the system.  This
738 * information is aged out and/or invalidated based on events like not
739 * being able to associated to an AP.  To flush the current cache
740 * contents before doing a scan the IEEE80211_IOC_SCAN_FLUSH flag may
741 * be specified.
742 *
743 * By default the scan will be done until a suitable AP is located
744 * or a channel is found for use.  A scan can also be constrained
745 * to be done once (IEEE80211_IOC_SCAN_ONCE) or to last for no more
746 * than a specified duration.
747 */
748struct ieee80211_scan_req {
749	int		sr_flags;
750#define	IEEE80211_IOC_SCAN_NOPICK	0x00001	/* scan only, no selection */
751#define	IEEE80211_IOC_SCAN_ACTIVE	0x00002	/* active scan (probe req) */
752#define	IEEE80211_IOC_SCAN_PICK1ST	0x00004	/* ``hey sailor'' mode */
753#define	IEEE80211_IOC_SCAN_BGSCAN	0x00008	/* bg scan, exit ps at end */
754#define	IEEE80211_IOC_SCAN_ONCE		0x00010	/* do one complete pass */
755#define	IEEE80211_IOC_SCAN_NOBCAST	0x00020	/* don't send bcast probe req */
756#define	IEEE80211_IOC_SCAN_NOJOIN	0x00040	/* no auto-sequencing */
757#define	IEEE80211_IOC_SCAN_FLUSH	0x10000	/* flush scan cache first */
758#define	IEEE80211_IOC_SCAN_CHECK	0x20000	/* check scan cache first */
759	u_int		sr_duration;		/* duration (ms) */
760#define	IEEE80211_IOC_SCAN_DURATION_MIN	1
761#define	IEEE80211_IOC_SCAN_DURATION_MAX	0x7fffffff
762#define	IEEE80211_IOC_SCAN_FOREVER	IEEE80211_IOC_SCAN_DURATION_MAX
763	u_int		sr_mindwell;		/* min channel dwelltime (ms) */
764	u_int		sr_maxdwell;		/* max channel dwelltime (ms) */
765	int		sr_nssid;
766#define	IEEE80211_IOC_SCAN_MAX_SSID	3
767	struct {
768		int	 len;				/* length in bytes */
769		uint8_t ssid[IEEE80211_NWID_LEN];	/* ssid contents */
770	} sr_ssid[IEEE80211_IOC_SCAN_MAX_SSID];
771};
772
773/*
774 * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.
775 * Each result is a fixed size structure followed by a variable
776 * length SSID and one or more variable length information elements.
777 * The size of each variable length item is found in the fixed
778 * size structure and the entire length of the record is specified
779 * in isr_len.  Result records are rounded to a multiple of 4 bytes.
780 */
781struct ieee80211req_scan_result {
782	uint16_t	isr_len;		/* total length (mult of 4) */
783	uint16_t	isr_ie_off;		/* offset to SSID+IE data */
784	uint16_t	isr_ie_len;		/* IE length */
785	uint16_t	isr_freq;		/* MHz */
786	uint16_t	isr_flags;		/* channel flags */
787	int8_t		isr_noise;
788	int8_t		isr_rssi;
789	uint8_t		isr_intval;		/* beacon interval */
790	uint8_t		isr_capinfo;		/* capabilities */
791	uint8_t		isr_erp;		/* ERP element */
792	uint8_t		isr_bssid[IEEE80211_ADDR_LEN];
793	uint8_t		isr_nrates;
794	uint8_t		isr_rates[IEEE80211_RATE_MAXSIZE];
795	uint8_t		isr_ssid_len;		/* SSID length */
796	uint8_t		isr_meshid_len;		/* MESH ID length */
797	/* variable length SSID, followed by variable length MESH ID,
798	  followed by IE data */
799};
800
801/*
802 * Virtual AP cloning parameters.  The parent device must
803 * be a vap-capable device.  All parameters specified with
804 * the clone request are fixed for the lifetime of the vap.
805 *
806 * There are two flavors of WDS vaps: legacy and dynamic.
807 * Legacy WDS operation implements a static binding between
808 * two stations encapsulating traffic in 4-address frames.
809 * Dynamic WDS vaps are created when a station associates to
810 * an AP and sends a 4-address frame.  If the AP vap is
811 * configured to support WDS then this will generate an
812 * event to user programs listening on the routing socket
813 * and a Dynamic WDS vap will be created to handle traffic
814 * to/from that station.  In both cases the bssid of the
815 * peer must be specified when creating the vap.
816 *
817 * By default a vap will inherit the mac address/bssid of
818 * the underlying device.  To request a unique address the
819 * IEEE80211_CLONE_BSSID flag should be supplied.  This is
820 * meaningless for WDS vaps as they share the bssid of an
821 * AP vap that must otherwise exist.  Note that some devices
822 * may not be able to support multiple addresses.
823 *
824 * Station mode vap's normally depend on the device to notice
825 * when the AP stops sending beacon frames.  If IEEE80211_CLONE_NOBEACONS
826 * is specified the net80211 layer will do this in s/w.  This
827 * is mostly useful when setting up a WDS repeater/extender where
828 * an AP vap is combined with a sta vap and the device isn't able
829 * to track beacon frames in hardware.
830 */
831struct ieee80211_clone_params {
832	char	icp_parent[IFNAMSIZ];		/* parent device */
833	uint16_t icp_opmode;			/* operating mode */
834	uint16_t icp_flags;			/* see below */
835	uint8_t	icp_bssid[IEEE80211_ADDR_LEN];	/* for WDS links */
836	uint8_t	icp_macaddr[IEEE80211_ADDR_LEN];/* local address */
837};
838#define	IEEE80211_CLONE_BSSID		0x0001	/* allocate unique mac/bssid */
839#define	IEEE80211_CLONE_NOBEACONS	0x0002	/* don't setup beacon timers */
840#define	IEEE80211_CLONE_WDSLEGACY	0x0004	/* legacy WDS processing */
841#define	IEEE80211_CLONE_MACADDR		0x0008	/* use specified mac addr */
842#define	IEEE80211_CLONE_TDMA		0x0010	/* operate in TDMA mode */
843#endif /* __FreeBSD__ */
844
845#endif /* _NET80211_IEEE80211_IOCTL_H_ */
846