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