ieee80211.h revision 170360
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/net80211/ieee80211.h 170360 2007-06-06 04:56:04Z sam $
27 */
28#ifndef _NET80211_IEEE80211_H_
29#define _NET80211_IEEE80211_H_
30
31/*
32 * 802.11 protocol definitions.
33 */
34
35#define	IEEE80211_ADDR_LEN	6		/* size of 802.11 address */
36/* is 802.11 address multicast/broadcast? */
37#define	IEEE80211_IS_MULTICAST(_a)	(*(_a) & 0x01)
38
39/* IEEE 802.11 PLCP header */
40struct ieee80211_plcp_hdr {
41	u_int16_t	i_sfd;
42	u_int8_t	i_signal;
43	u_int8_t	i_service;
44	u_int16_t	i_length;
45	u_int16_t	i_crc;
46} __packed;
47
48#define IEEE80211_PLCP_SFD      0xF3A0
49#define IEEE80211_PLCP_SERVICE  0x00
50
51/*
52 * generic definitions for IEEE 802.11 frames
53 */
54struct ieee80211_frame {
55	u_int8_t	i_fc[2];
56	u_int8_t	i_dur[2];
57	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
58	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
59	u_int8_t	i_addr3[IEEE80211_ADDR_LEN];
60	u_int8_t	i_seq[2];
61	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
62	/* see below */
63} __packed;
64
65struct ieee80211_qosframe {
66	u_int8_t	i_fc[2];
67	u_int8_t	i_dur[2];
68	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
69	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
70	u_int8_t	i_addr3[IEEE80211_ADDR_LEN];
71	u_int8_t	i_seq[2];
72	u_int8_t	i_qos[2];
73	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
74	/* see below */
75} __packed;
76
77struct ieee80211_qoscntl {
78	u_int8_t	i_qos[2];
79};
80
81struct ieee80211_frame_addr4 {
82	u_int8_t	i_fc[2];
83	u_int8_t	i_dur[2];
84	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
85	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
86	u_int8_t	i_addr3[IEEE80211_ADDR_LEN];
87	u_int8_t	i_seq[2];
88	u_int8_t	i_addr4[IEEE80211_ADDR_LEN];
89} __packed;
90
91
92struct ieee80211_qosframe_addr4 {
93	u_int8_t	i_fc[2];
94	u_int8_t	i_dur[2];
95	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
96	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
97	u_int8_t	i_addr3[IEEE80211_ADDR_LEN];
98	u_int8_t	i_seq[2];
99	u_int8_t	i_addr4[IEEE80211_ADDR_LEN];
100	u_int8_t	i_qos[2];
101} __packed;
102
103#define	IEEE80211_FC0_VERSION_MASK		0x03
104#define	IEEE80211_FC0_VERSION_SHIFT		0
105#define	IEEE80211_FC0_VERSION_0			0x00
106#define	IEEE80211_FC0_TYPE_MASK			0x0c
107#define	IEEE80211_FC0_TYPE_SHIFT		2
108#define	IEEE80211_FC0_TYPE_MGT			0x00
109#define	IEEE80211_FC0_TYPE_CTL			0x04
110#define	IEEE80211_FC0_TYPE_DATA			0x08
111
112#define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
113#define	IEEE80211_FC0_SUBTYPE_SHIFT		4
114/* for TYPE_MGT */
115#define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
116#define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
117#define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
118#define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
119#define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
120#define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
121#define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
122#define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
123#define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
124#define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
125#define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
126/* for TYPE_CTL */
127#define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
128#define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
129#define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
130#define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
131#define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
132#define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
133/* for TYPE_DATA (bit combination) */
134#define	IEEE80211_FC0_SUBTYPE_DATA		0x00
135#define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
136#define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
137#define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
138#define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
139#define	IEEE80211_FC0_SUBTYPE_CFACK		0x50
140#define	IEEE80211_FC0_SUBTYPE_CFPOLL		0x60
141#define	IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK	0x70
142#define	IEEE80211_FC0_SUBTYPE_QOS		0x80
143#define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
144
145#define	IEEE80211_FC1_DIR_MASK			0x03
146#define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */
147#define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP  */
148#define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */
149#define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP  */
150
151#define	IEEE80211_FC1_MORE_FRAG			0x04
152#define	IEEE80211_FC1_RETRY			0x08
153#define	IEEE80211_FC1_PWR_MGT			0x10
154#define	IEEE80211_FC1_MORE_DATA			0x20
155#define	IEEE80211_FC1_WEP			0x40
156#define	IEEE80211_FC1_ORDER			0x80
157
158#define	IEEE80211_SEQ_FRAG_MASK			0x000f
159#define	IEEE80211_SEQ_FRAG_SHIFT		0
160#define	IEEE80211_SEQ_SEQ_MASK			0xfff0
161#define	IEEE80211_SEQ_SEQ_SHIFT			4
162
163#define	IEEE80211_NWID_LEN			32
164
165#define	IEEE80211_QOS_TXOP			0x00ff
166/* bit 8 is reserved */
167#define	IEEE80211_QOS_ACKPOLICY			0x60
168#define	IEEE80211_QOS_ACKPOLICY_S		5
169#define	IEEE80211_QOS_ESOP			0x10
170#define	IEEE80211_QOS_ESOP_S			4
171#define	IEEE80211_QOS_TID			0x0f
172
173/* does frame have QoS sequence control data */
174#define	IEEE80211_QOS_HAS_SEQ(wh) \
175	(((wh)->i_fc[0] & \
176	  (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
177	  (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
178
179/*
180 * WME/802.11e information element.
181 */
182struct ieee80211_wme_info {
183	u_int8_t	wme_id;		/* IEEE80211_ELEMID_VENDOR */
184	u_int8_t	wme_len;	/* length in bytes */
185	u_int8_t	wme_oui[3];	/* 0x00, 0x50, 0xf2 */
186	u_int8_t	wme_type;	/* OUI type */
187	u_int8_t	wme_subtype;	/* OUI subtype */
188	u_int8_t	wme_version;	/* spec revision */
189	u_int8_t	wme_info;	/* QoS info */
190} __packed;
191
192/*
193 * WME/802.11e Tspec Element
194 */
195struct ieee80211_wme_tspec {
196	u_int8_t	ts_id;
197	u_int8_t	ts_len;
198	u_int8_t	ts_oui[3];
199	u_int8_t	ts_oui_type;
200	u_int8_t	ts_oui_subtype;
201	u_int8_t	ts_version;
202	u_int8_t	ts_tsinfo[3];
203	u_int8_t	ts_nom_msdu[2];
204	u_int8_t	ts_max_msdu[2];
205	u_int8_t	ts_min_svc[4];
206	u_int8_t	ts_max_svc[4];
207	u_int8_t	ts_inactv_intv[4];
208	u_int8_t	ts_susp_intv[4];
209	u_int8_t	ts_start_svc[4];
210	u_int8_t	ts_min_rate[4];
211	u_int8_t	ts_mean_rate[4];
212	u_int8_t	ts_max_burst[4];
213	u_int8_t	ts_min_phy[4];
214	u_int8_t	ts_peak_rate[4];
215	u_int8_t	ts_delay[4];
216	u_int8_t	ts_surplus[2];
217	u_int8_t	ts_medium_time[2];
218} __packed;
219
220/*
221 * WME AC parameter field
222 */
223struct ieee80211_wme_acparams {
224	u_int8_t	acp_aci_aifsn;
225	u_int8_t	acp_logcwminmax;
226	u_int16_t	acp_txop;
227} __packed;
228
229#define WME_NUM_AC		4	/* 4 AC categories */
230
231#define WME_PARAM_ACI		0x60	/* Mask for ACI field */
232#define WME_PARAM_ACI_S		5	/* Shift for ACI field */
233#define WME_PARAM_ACM		0x10	/* Mask for ACM bit */
234#define WME_PARAM_ACM_S		4	/* Shift for ACM bit */
235#define WME_PARAM_AIFSN		0x0f	/* Mask for aifsn field */
236#define WME_PARAM_AIFSN_S	0	/* Shift for aifsn field */
237#define WME_PARAM_LOGCWMIN	0x0f	/* Mask for CwMin field (in log) */
238#define WME_PARAM_LOGCWMIN_S	0	/* Shift for CwMin field */
239#define WME_PARAM_LOGCWMAX	0xf0	/* Mask for CwMax field (in log) */
240#define WME_PARAM_LOGCWMAX_S	4	/* Shift for CwMax field */
241
242#define WME_AC_TO_TID(_ac) (       \
243	((_ac) == WME_AC_VO) ? 6 : \
244	((_ac) == WME_AC_VI) ? 5 : \
245	((_ac) == WME_AC_BK) ? 1 : \
246	0)
247
248#define TID_TO_WME_AC(_tid) (      \
249	((_tid) < 1) ? WME_AC_BE : \
250	((_tid) < 3) ? WME_AC_BK : \
251	((_tid) < 6) ? WME_AC_VI : \
252	WME_AC_VO)
253
254/*
255 * WME Parameter Element
256 */
257struct ieee80211_wme_param {
258	u_int8_t	param_id;
259	u_int8_t	param_len;
260	u_int8_t	param_oui[3];
261	u_int8_t	param_oui_type;
262	u_int8_t	param_oui_sybtype;
263	u_int8_t	param_version;
264	u_int8_t	param_qosInfo;
265#define	WME_QOSINFO_COUNT	0x0f	/* Mask for param count field */
266	u_int8_t	param_reserved;
267	struct ieee80211_wme_acparams	params_acParams[WME_NUM_AC];
268} __packed;
269
270/*
271 * Management Notification Frame
272 */
273struct ieee80211_mnf {
274	u_int8_t	mnf_category;
275	u_int8_t	mnf_action;
276	u_int8_t	mnf_dialog;
277	u_int8_t	mnf_status;
278} __packed;
279#define	MNF_SETUP_REQ	0
280#define	MNF_SETUP_RESP	1
281#define	MNF_TEARDOWN	2
282
283/*
284 * Control frames.
285 */
286struct ieee80211_frame_min {
287	u_int8_t	i_fc[2];
288	u_int8_t	i_dur[2];
289	u_int8_t	i_addr1[IEEE80211_ADDR_LEN];
290	u_int8_t	i_addr2[IEEE80211_ADDR_LEN];
291	/* FCS */
292} __packed;
293
294struct ieee80211_frame_rts {
295	u_int8_t	i_fc[2];
296	u_int8_t	i_dur[2];
297	u_int8_t	i_ra[IEEE80211_ADDR_LEN];
298	u_int8_t	i_ta[IEEE80211_ADDR_LEN];
299	/* FCS */
300} __packed;
301
302struct ieee80211_frame_cts {
303	u_int8_t	i_fc[2];
304	u_int8_t	i_dur[2];
305	u_int8_t	i_ra[IEEE80211_ADDR_LEN];
306	/* FCS */
307} __packed;
308
309struct ieee80211_frame_ack {
310	u_int8_t	i_fc[2];
311	u_int8_t	i_dur[2];
312	u_int8_t	i_ra[IEEE80211_ADDR_LEN];
313	/* FCS */
314} __packed;
315
316struct ieee80211_frame_pspoll {
317	u_int8_t	i_fc[2];
318	u_int8_t	i_aid[2];
319	u_int8_t	i_bssid[IEEE80211_ADDR_LEN];
320	u_int8_t	i_ta[IEEE80211_ADDR_LEN];
321	/* FCS */
322} __packed;
323
324struct ieee80211_frame_cfend {		/* NB: also CF-End+CF-Ack */
325	u_int8_t	i_fc[2];
326	u_int8_t	i_dur[2];	/* should be zero */
327	u_int8_t	i_ra[IEEE80211_ADDR_LEN];
328	u_int8_t	i_bssid[IEEE80211_ADDR_LEN];
329	/* FCS */
330} __packed;
331
332/*
333 * BEACON management packets
334 *
335 *	octet timestamp[8]
336 *	octet beacon interval[2]
337 *	octet capability information[2]
338 *	information element
339 *		octet elemid
340 *		octet length
341 *		octet information[length]
342 */
343
344typedef u_int8_t *ieee80211_mgt_beacon_t;
345
346#define	IEEE80211_BEACON_INTERVAL(beacon) \
347	((beacon)[8] | ((beacon)[9] << 8))
348#define	IEEE80211_BEACON_CAPABILITY(beacon) \
349	((beacon)[10] | ((beacon)[11] << 8))
350
351#define	IEEE80211_CAPINFO_ESS			0x0001
352#define	IEEE80211_CAPINFO_IBSS			0x0002
353#define	IEEE80211_CAPINFO_CF_POLLABLE		0x0004
354#define	IEEE80211_CAPINFO_CF_POLLREQ		0x0008
355#define	IEEE80211_CAPINFO_PRIVACY		0x0010
356#define	IEEE80211_CAPINFO_SHORT_PREAMBLE	0x0020
357#define	IEEE80211_CAPINFO_PBCC			0x0040
358#define	IEEE80211_CAPINFO_CHNL_AGILITY		0x0080
359/* bits 8-9 are reserved */
360#define	IEEE80211_CAPINFO_SHORT_SLOTTIME	0x0400
361#define	IEEE80211_CAPINFO_RSN			0x0800
362/* bit 12 is reserved */
363#define	IEEE80211_CAPINFO_DSSSOFDM		0x2000
364/* bits 14-15 are reserved */
365
366/*
367 * 802.11i/WPA information element (maximally sized).
368 */
369struct ieee80211_ie_wpa {
370	u_int8_t	wpa_id;		/* IEEE80211_ELEMID_VENDOR */
371	u_int8_t	wpa_len;	/* length in bytes */
372	u_int8_t	wpa_oui[3];	/* 0x00, 0x50, 0xf2 */
373	u_int8_t	wpa_type;	/* OUI type */
374	u_int16_t	wpa_version;	/* spec revision */
375	u_int32_t	wpa_mcipher[1];	/* multicast/group key cipher */
376	u_int16_t	wpa_uciphercnt;	/* # pairwise key ciphers */
377	u_int32_t	wpa_uciphers[8];/* ciphers */
378	u_int16_t	wpa_authselcnt;	/* authentication selector cnt*/
379	u_int32_t	wpa_authsels[8];/* selectors */
380	u_int16_t	wpa_caps;	/* 802.11i capabilities */
381	u_int16_t	wpa_pmkidcnt;	/* 802.11i pmkid count */
382	u_int16_t	wpa_pmkids[8];	/* 802.11i pmkids */
383} __packed;
384
385/*
386 * Management information element payloads.
387 */
388
389enum {
390	IEEE80211_ELEMID_SSID		= 0,
391	IEEE80211_ELEMID_RATES		= 1,
392	IEEE80211_ELEMID_FHPARMS	= 2,
393	IEEE80211_ELEMID_DSPARMS	= 3,
394	IEEE80211_ELEMID_CFPARMS	= 4,
395	IEEE80211_ELEMID_TIM		= 5,
396	IEEE80211_ELEMID_IBSSPARMS	= 6,
397	IEEE80211_ELEMID_COUNTRY	= 7,
398	IEEE80211_ELEMID_CHALLENGE	= 16,
399	/* 17-31 reserved for challenge text extension */
400	IEEE80211_ELEMID_ERP		= 42,
401	IEEE80211_ELEMID_RSN		= 48,
402	IEEE80211_ELEMID_XRATES		= 50,
403	IEEE80211_ELEMID_TPC		= 150,
404	IEEE80211_ELEMID_CCKM		= 156,
405	IEEE80211_ELEMID_VENDOR		= 221,	/* vendor private */
406};
407
408struct ieee80211_tim_ie {
409	u_int8_t	tim_ie;			/* IEEE80211_ELEMID_TIM */
410	u_int8_t	tim_len;
411	u_int8_t	tim_count;		/* DTIM count */
412	u_int8_t	tim_period;		/* DTIM period */
413	u_int8_t	tim_bitctl;		/* bitmap control */
414	u_int8_t	tim_bitmap[1];		/* variable-length bitmap */
415} __packed;
416
417struct ieee80211_country_ie {
418	u_int8_t	ie;			/* IEEE80211_ELEMID_COUNTRY */
419	u_int8_t	len;
420	u_int8_t	cc[3];			/* ISO CC+(I)ndoor/(O)utdoor */
421	struct {
422		u_int8_t schan;			/* starting channel */
423		u_int8_t nchan;			/* number channels */
424		u_int8_t maxtxpwr;		/* tx power cap */
425	} __packed band[4];			/* up to 4 sub bands */
426} __packed;
427
428#define IEEE80211_CHALLENGE_LEN		128
429
430#define	IEEE80211_RATE_BASIC		0x80
431#define	IEEE80211_RATE_VAL		0x7f
432
433/* EPR information element flags */
434#define	IEEE80211_ERP_NON_ERP_PRESENT	0x01
435#define	IEEE80211_ERP_USE_PROTECTION	0x02
436#define	IEEE80211_ERP_LONG_PREAMBLE	0x04
437
438/* Atheros private advanced capabilities info */
439#define	ATHEROS_CAP_TURBO_PRIME		0x01
440#define	ATHEROS_CAP_COMPRESSION		0x02
441#define	ATHEROS_CAP_FAST_FRAME		0x04
442/* bits 3-6 reserved */
443#define	ATHEROS_CAP_BOOST		0x80
444
445#define	ATH_OUI			0x7f0300		/* Atheros OUI */
446#define	ATH_OUI_TYPE		0x01
447#define	ATH_OUI_VERSION		0x01
448
449#define	WPA_OUI			0xf25000
450#define	WPA_OUI_TYPE		0x01
451#define	WPA_VERSION		1		/* current supported version */
452
453#define	WPA_CSE_NULL		0x00
454#define	WPA_CSE_WEP40		0x01
455#define	WPA_CSE_TKIP		0x02
456#define	WPA_CSE_CCMP		0x04
457#define	WPA_CSE_WEP104		0x05
458
459#define	WPA_ASE_NONE		0x00
460#define	WPA_ASE_8021X_UNSPEC	0x01
461#define	WPA_ASE_8021X_PSK	0x02
462
463#define	RSN_OUI			0xac0f00
464#define	RSN_VERSION		1		/* current supported version */
465
466#define	RSN_CSE_NULL		0x00
467#define	RSN_CSE_WEP40		0x01
468#define	RSN_CSE_TKIP		0x02
469#define	RSN_CSE_WRAP		0x03
470#define	RSN_CSE_CCMP		0x04
471#define	RSN_CSE_WEP104		0x05
472
473#define	RSN_ASE_NONE		0x00
474#define	RSN_ASE_8021X_UNSPEC	0x01
475#define	RSN_ASE_8021X_PSK	0x02
476
477#define	RSN_CAP_PREAUTH		0x01
478
479#define	WME_OUI			0xf25000
480#define	WME_OUI_TYPE		0x02
481#define	WME_INFO_OUI_SUBTYPE	0x00
482#define	WME_PARAM_OUI_SUBTYPE	0x01
483#define	WME_VERSION		1
484
485/* WME stream classes */
486#define	WME_AC_BE	0		/* best effort */
487#define	WME_AC_BK	1		/* background */
488#define	WME_AC_VI	2		/* video */
489#define	WME_AC_VO	3		/* voice */
490
491/*
492 * AUTH management packets
493 *
494 *	octet algo[2]
495 *	octet seq[2]
496 *	octet status[2]
497 *	octet chal.id
498 *	octet chal.length
499 *	octet chal.text[253]
500 */
501
502typedef u_int8_t *ieee80211_mgt_auth_t;
503
504#define	IEEE80211_AUTH_ALGORITHM(auth) \
505	((auth)[0] | ((auth)[1] << 8))
506#define	IEEE80211_AUTH_TRANSACTION(auth) \
507	((auth)[2] | ((auth)[3] << 8))
508#define	IEEE80211_AUTH_STATUS(auth) \
509	((auth)[4] | ((auth)[5] << 8))
510
511#define	IEEE80211_AUTH_ALG_OPEN		0x0000
512#define	IEEE80211_AUTH_ALG_SHARED	0x0001
513#define	IEEE80211_AUTH_ALG_LEAP		0x0080
514
515enum {
516	IEEE80211_AUTH_OPEN_REQUEST		= 1,
517	IEEE80211_AUTH_OPEN_RESPONSE		= 2,
518};
519
520enum {
521	IEEE80211_AUTH_SHARED_REQUEST		= 1,
522	IEEE80211_AUTH_SHARED_CHALLENGE		= 2,
523	IEEE80211_AUTH_SHARED_RESPONSE		= 3,
524	IEEE80211_AUTH_SHARED_PASS		= 4,
525};
526
527/*
528 * Reason codes
529 *
530 * Unlisted codes are reserved
531 */
532
533enum {
534	IEEE80211_REASON_UNSPECIFIED		= 1,
535	IEEE80211_REASON_AUTH_EXPIRE		= 2,
536	IEEE80211_REASON_AUTH_LEAVE		= 3,
537	IEEE80211_REASON_ASSOC_EXPIRE		= 4,
538	IEEE80211_REASON_ASSOC_TOOMANY		= 5,
539	IEEE80211_REASON_NOT_AUTHED		= 6,
540	IEEE80211_REASON_NOT_ASSOCED		= 7,
541	IEEE80211_REASON_ASSOC_LEAVE		= 8,
542	IEEE80211_REASON_ASSOC_NOT_AUTHED	= 9,
543
544	IEEE80211_REASON_RSN_REQUIRED		= 11,
545	IEEE80211_REASON_RSN_INCONSISTENT	= 12,
546	IEEE80211_REASON_IE_INVALID		= 13,
547	IEEE80211_REASON_MIC_FAILURE		= 14,
548
549	IEEE80211_STATUS_SUCCESS		= 0,
550	IEEE80211_STATUS_UNSPECIFIED		= 1,
551	IEEE80211_STATUS_CAPINFO		= 10,
552	IEEE80211_STATUS_NOT_ASSOCED		= 11,
553	IEEE80211_STATUS_OTHER			= 12,
554	IEEE80211_STATUS_ALG			= 13,
555	IEEE80211_STATUS_SEQUENCE		= 14,
556	IEEE80211_STATUS_CHALLENGE		= 15,
557	IEEE80211_STATUS_TIMEOUT		= 16,
558	IEEE80211_STATUS_TOOMANY		= 17,
559	IEEE80211_STATUS_BASIC_RATE		= 18,
560	IEEE80211_STATUS_SP_REQUIRED		= 19,
561	IEEE80211_STATUS_PBCC_REQUIRED		= 20,
562	IEEE80211_STATUS_CA_REQUIRED		= 21,
563	IEEE80211_STATUS_TOO_MANY_STATIONS	= 22,
564	IEEE80211_STATUS_RATES			= 23,
565	IEEE80211_STATUS_SHORTSLOT_REQUIRED	= 25,
566	IEEE80211_STATUS_DSSSOFDM_REQUIRED	= 26,
567};
568
569#define	IEEE80211_WEP_KEYLEN		5	/* 40bit */
570#define	IEEE80211_WEP_IVLEN		3	/* 24bit */
571#define	IEEE80211_WEP_KIDLEN		1	/* 1 octet */
572#define	IEEE80211_WEP_CRCLEN		4	/* CRC-32 */
573#define	IEEE80211_WEP_NKID		4	/* number of key ids */
574
575/*
576 * 802.11i defines an extended IV for use with non-WEP ciphers.
577 * When the EXTIV bit is set in the key id byte an additional
578 * 4 bytes immediately follow the IV for TKIP.  For CCMP the
579 * EXTIV bit is likewise set but the 8 bytes represent the
580 * CCMP header rather than IV+extended-IV.
581 */
582#define	IEEE80211_WEP_EXTIV		0x20
583#define	IEEE80211_WEP_EXTIVLEN		4	/* extended IV length */
584#define	IEEE80211_WEP_MICLEN		8	/* trailing MIC */
585
586#define	IEEE80211_CRC_LEN		4
587
588/*
589 * Maximum acceptable MTU is:
590 *	IEEE80211_MAX_LEN - WEP overhead - CRC -
591 *		QoS overhead - RSN/WPA overhead
592 * Min is arbitrarily chosen > IEEE80211_MIN_LEN.  The default
593 * mtu is Ethernet-compatible; it's set by ether_ifattach.
594 */
595#define	IEEE80211_MTU_MAX		2290
596#define	IEEE80211_MTU_MIN		32
597
598#define	IEEE80211_MAX_LEN		(2300 + IEEE80211_CRC_LEN + \
599    (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
600#define	IEEE80211_ACK_LEN \
601	(sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
602#define	IEEE80211_MIN_LEN \
603	(sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
604
605/*
606 * The 802.11 spec says at most 2007 stations may be
607 * associated at once.  For most AP's this is way more
608 * than is feasible so we use a default of 128.  This
609 * number may be overridden by the driver and/or by
610 * user configuration.
611 */
612#define	IEEE80211_AID_MAX		2007
613#define	IEEE80211_AID_DEF		128
614
615#define	IEEE80211_AID(b)	((b) &~ 0xc000)
616
617/*
618 * RTS frame length parameters.  The default is specified in
619 * the 802.11 spec as 512; we treat it as implementation-dependent
620 * so it's defined in ieee80211_var.h.  The max may be wrong
621 * for jumbo frames.
622 */
623#define	IEEE80211_RTS_MIN		1
624#define	IEEE80211_RTS_MAX		2346
625
626/*
627 * TX fragmentation parameters.  As above for RTS, we treat
628 * default as implementation-dependent so define it elsewhere.
629 */
630#define	IEEE80211_FRAG_MIN		256
631#define	IEEE80211_FRAG_MAX		2346
632
633/*
634 * Beacon interval (TU's).  Min+max come from WiFi requirements.
635 * As above, we treat default as implementation-dependent so
636 * define it elsewhere.
637 */
638#define	IEEE80211_BINTVAL_MAX	1000	/* max beacon interval (TU's) */
639#define	IEEE80211_BINTVAL_MIN	25	/* min beacon interval (TU's) */
640
641/*
642 * DTIM period (beacons).  Min+max are not really defined
643 * by the protocol but we want them publicly visible so
644 * define them here.
645 */
646#define	IEEE80211_DTIM_MAX	15	/* max DTIM period */
647#define	IEEE80211_DTIM_MIN	1	/* min DTIM period */
648
649/*
650 * Beacon miss threshold (beacons).  As for DTIM, we define
651 * them here to be publicly visible.  Note the max may be
652 * clamped depending on device capabilities.
653 */
654#define	IEEE80211_HWBMISS_MIN 	1
655#define	IEEE80211_HWBMISS_MAX 	255
656
657#endif /* _NET80211_IEEE80211_H_ */
658