xref: /titanic_41/usr/src/uts/common/sys/net80211_proto.h (revision cde2885fdf538266ee2a3b08dee2d5075ce8fa2b)
1 /*
2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 2001 Atsushi Onoe
8  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * Alternatively, this software may be distributed under the terms of the
23  * GNU General Public License ("GPL") version 2 as published by the Free
24  * Software Foundation.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef _SYS_NET80211_PROTO_H
39 #define	_SYS_NET80211_PROTO_H
40 
41 #pragma ident	"%Z%%M%	%I%	%E% SMI"
42 
43 /*
44  * 802.11 protocol definitions
45  */
46 
47 #ifdef	__cplusplus
48 extern "C" {
49 #endif
50 
51 #define	IEEE80211_ADDR_LEN	6	/* size of 802.11 address */
52 #define	IEEE80211_ADDR_COPY(dst, src)	\
53 	((void) bcopy(src, dst, IEEE80211_ADDR_LEN))
54 #define	IEEE80211_ADDR_EQ(a1, a2)	\
55 	(bcmp(a1, a2, IEEE80211_ADDR_LEN) == 0)
56 /* is 802.11 address multicast/broadcast? */
57 #define	IEEE80211_IS_MULTICAST(addr)	\
58 	((((uint8_t *)addr)[0]) & 0x01)
59 
60 /*
61  * Size of an ACK control frame in bytes.
62  */
63 #define	IEEE80211_ACK_SIZE	(2 + 2 + IEEE80211_ADDR_LEN + 4)
64 
65 #define	WME_NUM_AC		4	/* 4 AC categories */
66 
67 /*
68  * Protocol Physical Layer
69  */
70 
71 /* XXX not really a mode; there are really multiple PHY's */
72 enum ieee80211_phymode {
73 	IEEE80211_MODE_AUTO	= 0,	/* autoselect */
74 	IEEE80211_MODE_11A	= 1,	/* 5GHz, OFDM */
75 	IEEE80211_MODE_11B	= 2,	/* 2GHz, CCK */
76 	IEEE80211_MODE_11G	= 3,	/* 2GHz, OFDM */
77 	IEEE80211_MODE_FH	= 4,	/* 2GHz, GFSK */
78 	IEEE80211_MODE_TURBO_A	= 5,	/* 5GHz, OFDM, 2x clock */
79 	IEEE80211_MODE_TURBO_G	= 6	/* 2GHz, OFDM, 2x clock */
80 };
81 #define	IEEE80211_MODE_MAX	(IEEE80211_MODE_TURBO_G+1)
82 
83 enum ieee80211_phytype {
84 	IEEE80211_T_DS,		/* direct sequence spread spectrum */
85 	IEEE80211_T_FH,		/* frequency hopping */
86 	IEEE80211_T_OFDM,	/* frequency division multiplexing */
87 	IEEE80211_T_TURBO	/* high rate OFDM, aka turbo mode */
88 };
89 #define	IEEE80211_T_CCK	IEEE80211_T_DS	/* more common nomenclature */
90 
91 enum ieee80211_opmode {
92 	IEEE80211_M_STA		= 1,	/* infrastructure station */
93 	IEEE80211_M_IBSS 	= 0,	/* IBSS (adhoc) station */
94 	IEEE80211_M_AHDEMO	= 3,	/* Old lucent compatible adhoc demo */
95 	IEEE80211_M_HOSTAP	= 6,	/* Software Access Point */
96 	IEEE80211_M_MONITOR	= 8	/* Monitor mode */
97 };
98 
99 /*
100  * 802.11g protection mode.
101  */
102 enum ieee80211_protmode {
103 	IEEE80211_PROT_NONE	= 0,	/* no protection */
104 	IEEE80211_PROT_CTSONLY	= 1,	/* CTS to self */
105 	IEEE80211_PROT_RTSCTS	= 2	/* RTS-CTS */
106 };
107 
108 /*
109  * generic definitions for IEEE 802.11 frames
110  */
111 #pragma pack(1)
112 struct ieee80211_frame {
113 	uint8_t		i_fc[2]; /* [0]-protocol version, [1]-type & subtype */
114 	uint8_t		i_dur[2];
115 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
116 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
117 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
118 	uint8_t		i_seq[2];
119 	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
120 	/* see below */
121 };
122 
123 struct ieee80211_frame_addr4 {
124 	uint8_t		i_fc[2];
125 	uint8_t		i_dur[2];
126 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
127 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
128 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
129 	uint8_t		i_seq[2];
130 	uint8_t		i_addr4[IEEE80211_ADDR_LEN];
131 };
132 
133 /* Start part(LLC and SNAP) of payload of IEEE80211 frame */
134 struct ieee80211_llc {
135 	/* LLC */
136 	uint8_t		illc_dsap;
137 	uint8_t		illc_ssap;
138 	uint8_t		illc_control;
139 	/* SNAP */
140 	uint8_t		illc_oc[3]; /* protocol ID or organization code */
141 	uint16_t	illc_ether_type; /* ethernet type */
142 };
143 
144 /*
145  * Management Notification Frame
146  */
147 struct ieee80211_mnf {
148 	uint8_t		mnf_category;
149 	uint8_t		mnf_action;
150 	uint8_t		mnf_dialog;
151 	uint8_t		mnf_status;
152 };
153 #define	IEEE80211_MNF_SETUP_REQ	0
154 #define	IEEE80211_MNF_SETUP_RESP	1
155 #define	IEEE80211_MNF_TEARDOWN	2
156 
157 /*
158  * Control frames.
159  */
160 struct ieee80211_frame_min {
161 	uint8_t		i_fc[2];
162 	uint8_t		i_dur[2];
163 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
164 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
165 	/* FCS */
166 };
167 
168 struct ieee80211_frame_rts {
169 	uint8_t		i_fc[2];
170 	uint8_t		i_dur[2];
171 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
172 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
173 	/* FCS */
174 };
175 
176 struct ieee80211_frame_cts {
177 	uint8_t		i_fc[2];
178 	uint8_t		i_dur[2];
179 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
180 	/* FCS */
181 };
182 
183 struct ieee80211_frame_ack {
184 	uint8_t		i_fc[2];
185 	uint8_t		i_dur[2];
186 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
187 	/* FCS */
188 };
189 
190 struct ieee80211_frame_pspoll {
191 	uint8_t		i_fc[2];
192 	uint8_t		i_aid[2];
193 	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
194 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
195 	/* FCS */
196 };
197 
198 struct ieee80211_frame_cfend {		/* NB: also CF-End+CF-Ack */
199 	uint8_t		i_fc[2];
200 	uint8_t		i_dur[2];	/* should be zero */
201 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
202 	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
203 	/* FCS */
204 };
205 
206 struct ieee80211_tim_ie {
207 	uint8_t		tim_ie;			/* IEEE80211_ELEMID_TIM */
208 	uint8_t		tim_len;
209 	uint8_t		tim_count;		/* DTIM count */
210 	uint8_t		tim_period;		/* DTIM period */
211 	uint8_t		tim_bitctl;		/* bitmap control */
212 	uint8_t		tim_bitmap[1];		/* variable-length bitmap */
213 };
214 
215 /*
216  * 802.11i/WPA information element (maximally sized).
217  */
218 struct ieee80211_ie_wpa {
219 	uint8_t		wpa_id;		 /* IEEE80211_ELEMID_VENDOR */
220 	uint8_t		wpa_len;	 /* length in bytes */
221 	uint8_t		wpa_oui[3];	 /* 0x00, 0x50, 0xf2 */
222 	uint8_t		wpa_type;	 /* OUI type */
223 	uint16_t	wpa_version;	 /* spec revision */
224 	uint32_t	wpa_mcipher[1];	 /* multicast/group key cipher */
225 	uint16_t	wpa_uciphercnt;	 /* # pairwise key ciphers */
226 	uint32_t	wpa_uciphers[8]; /* ciphers */
227 	uint16_t	wpa_authselcnt;	 /* authentication selector cnt */
228 	uint32_t	wpa_authsels[8]; /* selectors */
229 	uint16_t	wpa_caps;	 /* 802.11i capabilities */
230 	uint16_t	wpa_pmkidcnt;	 /* 802.11i pmkid count */
231 	uint16_t	wpa_pmkids[8];	 /* 802.11i pmkids */
232 };
233 
234 /*
235  * WME AC parameter field
236  */
237 struct ieee80211_wme_acparams {
238 	uint8_t		acp_aci_aifsn;
239 	uint8_t		acp_logcwminmax;
240 	uint16_t	acp_txop;
241 };
242 
243 /*
244  * WME Parameter Element
245  */
246 struct ieee80211_wme_param {
247 	uint8_t		wme_id;
248 	uint8_t		wme_len;
249 	uint8_t		wme_oui[3];
250 	uint8_t		wme_oui_type;
251 	uint8_t		wme_oui_sybtype;
252 	uint8_t		wme_version;
253 	uint8_t		wme_qosInfo;
254 	uint8_t		wme_reserved;
255 	struct ieee80211_wme_acparams	wme_acParams[WME_NUM_AC];
256 };
257 #pragma pack()
258 
259 #define	IEEE80211_FC0_VERSION_MASK		0x03
260 #define	IEEE80211_FC0_VERSION_SHIFT		0
261 #define	IEEE80211_FC0_VERSION_0			0x00
262 #define	IEEE80211_FC0_TYPE_MASK			0x0c
263 #define	IEEE80211_FC0_TYPE_SHIFT		2
264 #define	IEEE80211_FC0_TYPE_MGT			0x00
265 #define	IEEE80211_FC0_TYPE_CTL			0x04
266 #define	IEEE80211_FC0_TYPE_DATA			0x08
267 #define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
268 #define	IEEE80211_FC0_SUBTYPE_SHIFT		4
269 /* for TYPE_MGT */
270 #define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
271 #define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
272 #define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
273 #define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
274 #define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
275 #define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
276 #define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
277 #define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
278 #define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
279 #define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
280 #define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
281 /* for TYPE_CTL */
282 #define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
283 #define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
284 #define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
285 #define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
286 #define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
287 #define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
288 /* for TYPE_DATA (bit combination) */
289 #define	IEEE80211_FC0_SUBTYPE_DATA		0x00
290 #define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
291 #define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
292 #define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
293 #define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
294 #define	IEEE80211_FC0_SUBTYPE_CFACK		0x50
295 #define	IEEE80211_FC0_SUBTYPE_CFPOLL		0x60
296 #define	IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK	0x70
297 #define	IEEE80211_FC0_SUBTYPE_QOS		0x80
298 #define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
299 
300 #define	IEEE80211_FC1_DIR_MASK			0x03
301 #define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */
302 #define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP  */
303 #define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */
304 #define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP  */
305 #define	IEEE80211_FC1_MORE_FRAG			0x04
306 #define	IEEE80211_FC1_RETRY			0x08
307 #define	IEEE80211_FC1_PWR_MGT			0x10
308 #define	IEEE80211_FC1_MORE_DATA			0x20
309 #define	IEEE80211_FC1_WEP			0x40
310 #define	IEEE80211_FC1_ORDER			0x80
311 
312 #define	IEEE80211_SEQ_FRAG_MASK			0x000f
313 #define	IEEE80211_SEQ_FRAG_SHIFT		0
314 #define	IEEE80211_SEQ_SEQ_MASK			0xfff0
315 #define	IEEE80211_SEQ_SEQ_SHIFT			4	/* 4bit frag number */
316 
317 /* Length of management frame variable-length components in bytes */
318 #define	IEEE80211_NWID_LEN			32	/* SSID */
319 #define	IEEE80211_FH_LEN			5	/* FH parameters */
320 #define	IEEE80211_DS_LEN			1	/* DS parameters */
321 #define	IEEE80211_IBSS_LEN			4	/* IBSS parameters */
322 #define	IEEE80211_ERP_LEN			1	/* ERP information */
323 
324 /*
325  * Length of management frame information elements containing
326  * a variable-length component is:
327  *    element_id(1 byte) + length(1 byte) + component(variable bytes)
328  */
329 #define	IEEE80211_ELEM_LEN(complen)		(2 + (complen))
330 
331 /*
332  * minimal length of beacon/probe response frame elements
333  *  time stamp[8] + beacon interval[2] + capability[2]
334  */
335 #define	IEEE80211_BEACON_ELEM_MIN		12
336 /*
337  * Minimal length of authentication frame elements
338  *    algorithm[2] + sequence[2] + status[2]
339  */
340 #define	IEEE80211_AUTH_ELEM_MIN			6
341 /*
342  * Minimal length of association response frame elements
343  *    capability[2] + status[2] + association ID[2]
344  */
345 #define	IEEE80211_ASSOC_RESP_ELEM_MIN		6
346 
347 #define	IEEE80211_CAPINFO_ESS			0x0001
348 #define	IEEE80211_CAPINFO_IBSS			0x0002
349 #define	IEEE80211_CAPINFO_CF_POLLABLE		0x0004
350 #define	IEEE80211_CAPINFO_CF_POLLREQ		0x0008
351 #define	IEEE80211_CAPINFO_PRIVACY		0x0010
352 #define	IEEE80211_CAPINFO_SHORT_PREAMBLE	0x0020
353 #define	IEEE80211_CAPINFO_PBCC			0x0040
354 #define	IEEE80211_CAPINFO_CHNL_AGILITY		0x0080
355 /* bits 8-9 are reserved */
356 #define	IEEE80211_CAPINFO_SHORT_SLOTTIME	0x0400
357 #define	IEEE80211_CAPINFO_RSN			0x0800
358 /* bit 12 is reserved */
359 #define	IEEE80211_CAPINFO_DSSSOFDM		0x2000
360 /* bits 14-15 are reserved */
361 
362 /*
363  * Management information element payloads.
364  */
365 
366 enum {
367 	IEEE80211_ELEMID_SSID			= 0,
368 	IEEE80211_ELEMID_RATES			= 1,
369 	IEEE80211_ELEMID_FHPARMS		= 2,
370 	IEEE80211_ELEMID_DSPARMS		= 3,
371 	IEEE80211_ELEMID_CFPARMS		= 4,
372 	IEEE80211_ELEMID_TIM			= 5,
373 	IEEE80211_ELEMID_IBSSPARMS		= 6,
374 	IEEE80211_ELEMID_COUNTRY		= 7,
375 	IEEE80211_ELEMID_CHALLENGE		= 16,
376 	/* 17-31 reserved for challenge text extension */
377 	IEEE80211_ELEMID_ERP			= 42,
378 	IEEE80211_ELEMID_RSN			= 48,
379 	IEEE80211_ELEMID_XRATES			= 50,
380 	/* 128-129 proprietary elements used by Agere chipsets */
381 	IEEE80211_ELEMID_AGERE1			= 128,
382 	IEEE80211_ELEMID_AGERE2			= 129,
383 	IEEE80211_ELEMID_TPC			= 150,
384 	IEEE80211_ELEMID_CCKM			= 156,
385 	IEEE80211_ELEMID_VENDOR			= 221	/* vendor private */
386 };
387 
388 #define	WPA_OUI			0xf25000
389 #define	WPA_OUI_TYPE		0x01
390 #define	WPA_VERSION		1		/* current supported version */
391 
392 #define	IEEE80211_CHALLENGE_LEN			128
393 
394 #define	IEEE80211_RATE_BASIC			0x80
395 #define	IEEE80211_RATE_VAL			0x7f
396 
397 /* EPR information element flags */
398 #define	IEEE80211_ERP_NON_ERP_PRESENT		0x01
399 #define	IEEE80211_ERP_USE_PROTECTION		0x02
400 #define	IEEE80211_ERP_LONG_PREAMBLE		0x04
401 
402 #define	IEEE80211_AUTH_ALG_OPEN			0x0000
403 #define	IEEE80211_AUTH_ALG_SHARED		0x0001
404 #define	IEEE80211_AUTH_ALG_LEAP			0x0080
405 
406 
407 enum {
408 	IEEE80211_AUTH_OPEN_REQUEST		= 1,
409 	IEEE80211_AUTH_OPEN_RESPONSE		= 2
410 };
411 
412 enum {
413 	IEEE80211_AUTH_SHARED_REQUEST		= 1,
414 	IEEE80211_AUTH_SHARED_CHALLENGE		= 2,
415 	IEEE80211_AUTH_SHARED_RESPONSE		= 3,
416 	IEEE80211_AUTH_SHARED_PASS		= 4
417 };
418 
419 /*
420  * Reason codes
421  *
422  * Unlisted codes are reserved
423  */
424 enum {
425 	IEEE80211_REASON_UNSPECIFIED		= 1,
426 	IEEE80211_REASON_AUTH_EXPIRE		= 2,
427 	IEEE80211_REASON_AUTH_LEAVE		= 3,
428 	IEEE80211_REASON_ASSOC_EXPIRE		= 4,
429 	IEEE80211_REASON_ASSOC_TOOMANY		= 5,
430 	IEEE80211_REASON_NOT_AUTHED		= 6,
431 	IEEE80211_REASON_NOT_ASSOCED		= 7,
432 	IEEE80211_REASON_ASSOC_LEAVE		= 8,
433 	IEEE80211_REASON_ASSOC_NOT_AUTHED	= 9,
434 	IEEE80211_REASON_INVALID_POWER		= 10,
435 	IEEE80211_REASON_RSN_REQUIRED		= 11,
436 	IEEE80211_REASON_RSN_INCONSISTENT	= 12,
437 	IEEE80211_REASON_IE_INVALID		= 13,
438 	IEEE80211_REASON_MIC_FAILURE		= 14
439 };
440 
441 /*
442  * Status codes
443  *
444  * Unlisted codes are reserved and unused
445  */
446 enum {
447 	IEEE80211_STATUS_SUCCESS		= 0,
448 	IEEE80211_STATUS_UNSPECIFIED		= 1,
449 	IEEE80211_STATUS_CAPINFO		= 10,
450 	IEEE80211_STATUS_NOT_ASSOCED		= 11,
451 	IEEE80211_STATUS_OTHER			= 12,
452 	IEEE80211_STATUS_ALG			= 13,
453 	IEEE80211_STATUS_SEQUENCE		= 14,
454 	IEEE80211_STATUS_CHALLENGE		= 15,
455 	IEEE80211_STATUS_TIMEOUT		= 16,
456 	IEEE80211_STATUS_TOOMANY		= 17,
457 	IEEE80211_STATUS_BASIC_RATE		= 18,
458 	IEEE80211_STATUS_SP_REQUIRED		= 19,
459 	IEEE80211_STATUS_PBCC_REQUIRED		= 20,
460 	IEEE80211_STATUS_CA_REQUIRED		= 21,
461 	IEEE80211_STATUS_TOO_MANY_STATIONS	= 22,
462 	IEEE80211_STATUS_RATES			= 23,
463 	IEEE80211_STATUS_SHORTSLOT_REQUIRED	= 25,
464 	IEEE80211_STATUS_DSSSOFDM_REQUIRED	= 26
465 };
466 
467 #define	IEEE80211_WEP_KEYLEN		5	/* 40bit */
468 #define	IEEE80211_WEP_IVLEN		3	/* 24bit */
469 #define	IEEE80211_WEP_KIDLEN		1	/* 1 octet */
470 #define	IEEE80211_WEP_CRCLEN		4	/* CRC-32 */
471 #define	IEEE80211_WEP_NKID		4	/* number of key ids */
472 
473 /*
474  * 802.11i defines an extended IV for use with non-WEP ciphers.
475  * When the EXTIV bit is set in the key id byte an additional
476  * 4 bytes immediately follow the IV for TKIP.  For CCMP the
477  * EXTIV bit is likewise set but the 8 bytes represent the
478  * CCMP header rather than IV+extended-IV.
479  */
480 #define	IEEE80211_WEP_EXTIV		0x20
481 #define	IEEE80211_WEP_EXTIVLEN		4	/* extended IV length */
482 #define	IEEE80211_WEP_MICLEN		8	/* trailing MIC */
483 
484 #define	IEEE80211_CRC_LEN		4
485 
486 /*
487  * Maximum acceptable MTU is defined by 802.11
488  * Min is arbitrarily chosen > IEEE80211_MIN_LEN.
489  */
490 #define	IEEE80211_MTU_MAX		2304
491 #define	IEEE80211_MTU_MIN		32
492 #define	IEEE80211_MTU			1500
493 
494 #define	IEEE80211_MAX_LEN				\
495 	(sizeof (struct ieee80211_frame_addr4) +	\
496 	(IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN) + \
497 	IEEE80211_MTU_MAX + IEEE80211_CRC_LEN)
498 #define	IEEE80211_ACK_LEN				\
499 	(sizeof (struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
500 #define	IEEE80211_MIN_LEN				\
501 	(sizeof (struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
502 
503 /*
504  * The 802.11 spec says at most 2007 stations may be
505  * associated at once.  For most AP's this is way more
506  * than is feasible so we use a default of 128.  This
507  * number may be overridden by the driver and/or by
508  * user configuration.
509  */
510 #define	IEEE80211_AID_MAX		2007
511 #define	IEEE80211_AID_DEF		128
512 
513 #define	IEEE80211_AID(b)		((b) &~ 0xc000)
514 
515 /*
516  * RTS frame length parameters.  The default is specified in
517  * the 802.11 spec as 512; we treat it as implementation-dependent
518  * so it's defined in ieee80211_var.h.  The max may be wrong
519  * for jumbo frames.
520  */
521 #define	IEEE80211_RTS_MIN		1
522 #define	IEEE80211_RTS_MAX		2346
523 
524 /*
525  * TX fragmentation parameters.  As above for RTS, we treat
526  * default as implementation-dependent so define it elsewhere.
527  */
528 #define	IEEE80211_FRAG_MIN		256
529 #define	IEEE80211_FRAG_MAX		2346
530 
531 /* flags for ieee80211_fix_rate() */
532 #define	IEEE80211_F_DOSORT		0x00000001 /* sort rate list */
533 #define	IEEE80211_F_DOFRATE		0x00000002 /* use fixed rate */
534 #define	IEEE80211_F_DONEGO		0x00000004 /* calc negotiated rate */
535 #define	IEEE80211_F_DODEL		0x00000008 /* delete ignore rate */
536 
537 /*
538  * Beacon frames constructed by ieee80211_beacon_alloc
539  * have the following structure filled in so drivers
540  * can update the frame later w/ minimal overhead.
541  */
542 struct ieee80211_beacon_offsets {
543 	uint16_t	*bo_caps;	/* capabilities */
544 	uint8_t		*bo_tim;	/* start of atim/dtim */
545 	uint8_t		*bo_wme;	/* start of WME parameters */
546 	uint8_t		*bo_trailer;	/* start of fixed-size trailer */
547 	uint16_t	bo_tim_len;	/* atim/dtim length in bytes */
548 	uint16_t	bo_trailer_len;	/* trailer length in bytes */
549 	uint8_t		*bo_erp;	/* start of ERP element */
550 };
551 
552 #ifdef	__cplusplus
553 }
554 #endif
555 
556 #endif	/* _SYS_NET80211_PROTO_H */
557