xref: /onnv-gate/usr/src/uts/common/sys/net80211_proto.h (revision 4126:31652d91f33e)
13147Sxc151355 /*
2*4126Szf162725  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
33147Sxc151355  * Use is subject to license terms.
43147Sxc151355  */
53147Sxc151355 
63147Sxc151355 /*
73147Sxc151355  * Copyright (c) 2001 Atsushi Onoe
83147Sxc151355  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
93147Sxc151355  * All rights reserved.
103147Sxc151355  *
113147Sxc151355  * Redistribution and use in source and binary forms, with or without
123147Sxc151355  * modification, are permitted provided that the following conditions
133147Sxc151355  * are met:
143147Sxc151355  * 1. Redistributions of source code must retain the above copyright
153147Sxc151355  *    notice, this list of conditions and the following disclaimer.
163147Sxc151355  * 2. Redistributions in binary form must reproduce the above copyright
173147Sxc151355  *    notice, this list of conditions and the following disclaimer in the
183147Sxc151355  *    documentation and/or other materials provided with the distribution.
193147Sxc151355  * 3. The name of the author may not be used to endorse or promote products
203147Sxc151355  *    derived from this software without specific prior written permission.
213147Sxc151355  *
223147Sxc151355  * Alternatively, this software may be distributed under the terms of the
233147Sxc151355  * GNU General Public License ("GPL") version 2 as published by the Free
243147Sxc151355  * Software Foundation.
253147Sxc151355  *
263147Sxc151355  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
273147Sxc151355  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
283147Sxc151355  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
293147Sxc151355  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
303147Sxc151355  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
313147Sxc151355  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
323147Sxc151355  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
333147Sxc151355  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
343147Sxc151355  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
353147Sxc151355  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
363147Sxc151355  */
373147Sxc151355 
383147Sxc151355 #pragma ident	"%Z%%M%	%I%	%E% SMI"
393147Sxc151355 
403147Sxc151355 #ifndef _SYS_NET80211_PROTO_H
413147Sxc151355 #define	_SYS_NET80211_PROTO_H
423147Sxc151355 
433147Sxc151355 /*
443147Sxc151355  * 802.11 protocol definitions
453147Sxc151355  */
463147Sxc151355 
473147Sxc151355 #ifdef	__cplusplus
483147Sxc151355 extern "C" {
493147Sxc151355 #endif
503147Sxc151355 
513147Sxc151355 #define	IEEE80211_ADDR_LEN	6	/* size of 802.11 address */
523147Sxc151355 #define	IEEE80211_ADDR_COPY(dst, src)	\
533147Sxc151355 	((void) bcopy(src, dst, IEEE80211_ADDR_LEN))
543147Sxc151355 #define	IEEE80211_ADDR_EQ(a1, a2)	\
553147Sxc151355 	(bcmp(a1, a2, IEEE80211_ADDR_LEN) == 0)
563147Sxc151355 /* is 802.11 address multicast/broadcast? */
573147Sxc151355 #define	IEEE80211_IS_MULTICAST(addr)	\
583147Sxc151355 	((((uint8_t *)addr)[0]) & 0x01)
593147Sxc151355 
603147Sxc151355 /*
613147Sxc151355  * Size of an ACK control frame in bytes.
623147Sxc151355  */
633147Sxc151355 #define	IEEE80211_ACK_SIZE	(2 + 2 + IEEE80211_ADDR_LEN + 4)
643147Sxc151355 
653147Sxc151355 #define	WME_NUM_AC		4	/* 4 AC categories */
663147Sxc151355 
673147Sxc151355 /*
683147Sxc151355  * Protocol Physical Layer
693147Sxc151355  */
703147Sxc151355 
713147Sxc151355 /* XXX not really a mode; there are really multiple PHY's */
723147Sxc151355 enum ieee80211_phymode {
733147Sxc151355 	IEEE80211_MODE_AUTO	= 0,	/* autoselect */
743147Sxc151355 	IEEE80211_MODE_11A	= 1,	/* 5GHz, OFDM */
753147Sxc151355 	IEEE80211_MODE_11B	= 2,	/* 2GHz, CCK */
763147Sxc151355 	IEEE80211_MODE_11G	= 3,	/* 2GHz, OFDM */
773147Sxc151355 	IEEE80211_MODE_FH	= 4,	/* 2GHz, GFSK */
783147Sxc151355 	IEEE80211_MODE_TURBO_A	= 5,	/* 5GHz, OFDM, 2x clock */
793147Sxc151355 	IEEE80211_MODE_TURBO_G	= 6	/* 2GHz, OFDM, 2x clock */
803147Sxc151355 };
813147Sxc151355 #define	IEEE80211_MODE_MAX	(IEEE80211_MODE_TURBO_G+1)
823147Sxc151355 
833147Sxc151355 enum ieee80211_phytype {
843147Sxc151355 	IEEE80211_T_DS,		/* direct sequence spread spectrum */
853147Sxc151355 	IEEE80211_T_FH,		/* frequency hopping */
863147Sxc151355 	IEEE80211_T_OFDM,	/* frequency division multiplexing */
873147Sxc151355 	IEEE80211_T_TURBO	/* high rate OFDM, aka turbo mode */
883147Sxc151355 };
893147Sxc151355 #define	IEEE80211_T_CCK	IEEE80211_T_DS	/* more common nomenclature */
903147Sxc151355 
913147Sxc151355 enum ieee80211_opmode {
923147Sxc151355 	IEEE80211_M_STA		= 1,	/* infrastructure station */
933147Sxc151355 	IEEE80211_M_IBSS 	= 0,	/* IBSS (adhoc) station */
943147Sxc151355 	IEEE80211_M_AHDEMO	= 3,	/* Old lucent compatible adhoc demo */
953147Sxc151355 	IEEE80211_M_HOSTAP	= 6,	/* Software Access Point */
963147Sxc151355 	IEEE80211_M_MONITOR	= 8	/* Monitor mode */
973147Sxc151355 };
983147Sxc151355 
993147Sxc151355 /*
1003147Sxc151355  * 802.11g protection mode.
1013147Sxc151355  */
1023147Sxc151355 enum ieee80211_protmode {
1033147Sxc151355 	IEEE80211_PROT_NONE	= 0,	/* no protection */
1043147Sxc151355 	IEEE80211_PROT_CTSONLY	= 1,	/* CTS to self */
1053147Sxc151355 	IEEE80211_PROT_RTSCTS	= 2	/* RTS-CTS */
1063147Sxc151355 };
1073147Sxc151355 
1083147Sxc151355 /*
1093147Sxc151355  * generic definitions for IEEE 802.11 frames
1103147Sxc151355  */
1113147Sxc151355 #pragma pack(1)
1123147Sxc151355 struct ieee80211_frame {
1133147Sxc151355 	uint8_t		i_fc[2]; /* [0]-protocol version, [1]-type & subtype */
1143147Sxc151355 	uint8_t		i_dur[2];
1153147Sxc151355 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
1163147Sxc151355 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
1173147Sxc151355 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
1183147Sxc151355 	uint8_t		i_seq[2];
1193147Sxc151355 	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
1203147Sxc151355 	/* see below */
1213147Sxc151355 };
1223147Sxc151355 
1233147Sxc151355 struct ieee80211_frame_addr4 {
1243147Sxc151355 	uint8_t		i_fc[2];
1253147Sxc151355 	uint8_t		i_dur[2];
1263147Sxc151355 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
1273147Sxc151355 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
1283147Sxc151355 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
1293147Sxc151355 	uint8_t		i_seq[2];
1303147Sxc151355 	uint8_t		i_addr4[IEEE80211_ADDR_LEN];
1313147Sxc151355 };
1323147Sxc151355 
1333147Sxc151355 /* Start part(LLC and SNAP) of payload of IEEE80211 frame */
1343147Sxc151355 struct ieee80211_llc {
1353147Sxc151355 	/* LLC */
1363147Sxc151355 	uint8_t		illc_dsap;
1373147Sxc151355 	uint8_t		illc_ssap;
1383147Sxc151355 	uint8_t		illc_control;
1393147Sxc151355 	/* SNAP */
1403147Sxc151355 	uint8_t		illc_oc[3]; /* protocol ID or organization code */
1413147Sxc151355 	uint16_t	illc_ether_type; /* ethernet type */
1423147Sxc151355 };
1433147Sxc151355 
1443147Sxc151355 /*
1453147Sxc151355  * Management Notification Frame
1463147Sxc151355  */
1473147Sxc151355 struct ieee80211_mnf {
1483147Sxc151355 	uint8_t		mnf_category;
1493147Sxc151355 	uint8_t		mnf_action;
1503147Sxc151355 	uint8_t		mnf_dialog;
1513147Sxc151355 	uint8_t		mnf_status;
1523147Sxc151355 };
1533147Sxc151355 #define	IEEE80211_MNF_SETUP_REQ	0
1543147Sxc151355 #define	IEEE80211_MNF_SETUP_RESP	1
1553147Sxc151355 #define	IEEE80211_MNF_TEARDOWN	2
1563147Sxc151355 
1573147Sxc151355 /*
1583147Sxc151355  * Control frames.
1593147Sxc151355  */
1603147Sxc151355 struct ieee80211_frame_min {
1613147Sxc151355 	uint8_t		i_fc[2];
1623147Sxc151355 	uint8_t		i_dur[2];
1633147Sxc151355 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
1643147Sxc151355 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
1653147Sxc151355 	/* FCS */
1663147Sxc151355 };
1673147Sxc151355 
1683147Sxc151355 struct ieee80211_frame_rts {
1693147Sxc151355 	uint8_t		i_fc[2];
1703147Sxc151355 	uint8_t		i_dur[2];
1713147Sxc151355 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
1723147Sxc151355 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
1733147Sxc151355 	/* FCS */
1743147Sxc151355 };
1753147Sxc151355 
1763147Sxc151355 struct ieee80211_frame_cts {
1773147Sxc151355 	uint8_t		i_fc[2];
1783147Sxc151355 	uint8_t		i_dur[2];
1793147Sxc151355 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
1803147Sxc151355 	/* FCS */
1813147Sxc151355 };
1823147Sxc151355 
1833147Sxc151355 struct ieee80211_frame_ack {
1843147Sxc151355 	uint8_t		i_fc[2];
1853147Sxc151355 	uint8_t		i_dur[2];
1863147Sxc151355 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
1873147Sxc151355 	/* FCS */
1883147Sxc151355 };
1893147Sxc151355 
1903147Sxc151355 struct ieee80211_frame_pspoll {
1913147Sxc151355 	uint8_t		i_fc[2];
1923147Sxc151355 	uint8_t		i_aid[2];
1933147Sxc151355 	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
1943147Sxc151355 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
1953147Sxc151355 	/* FCS */
1963147Sxc151355 };
1973147Sxc151355 
1983147Sxc151355 struct ieee80211_frame_cfend {		/* NB: also CF-End+CF-Ack */
1993147Sxc151355 	uint8_t		i_fc[2];
2003147Sxc151355 	uint8_t		i_dur[2];	/* should be zero */
2013147Sxc151355 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
2023147Sxc151355 	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
2033147Sxc151355 	/* FCS */
2043147Sxc151355 };
2053147Sxc151355 
2063147Sxc151355 struct ieee80211_tim_ie {
2073147Sxc151355 	uint8_t		tim_ie;			/* IEEE80211_ELEMID_TIM */
2083147Sxc151355 	uint8_t		tim_len;
2093147Sxc151355 	uint8_t		tim_count;		/* DTIM count */
2103147Sxc151355 	uint8_t		tim_period;		/* DTIM period */
2113147Sxc151355 	uint8_t		tim_bitctl;		/* bitmap control */
2123147Sxc151355 	uint8_t		tim_bitmap[1];		/* variable-length bitmap */
2133147Sxc151355 };
2143147Sxc151355 
2153147Sxc151355 /*
2163147Sxc151355  * 802.11i/WPA information element (maximally sized).
2173147Sxc151355  */
2183147Sxc151355 struct ieee80211_ie_wpa {
2193147Sxc151355 	uint8_t		wpa_id;		 /* IEEE80211_ELEMID_VENDOR */
2203147Sxc151355 	uint8_t		wpa_len;	 /* length in bytes */
2213147Sxc151355 	uint8_t		wpa_oui[3];	 /* 0x00, 0x50, 0xf2 */
2223147Sxc151355 	uint8_t		wpa_type;	 /* OUI type */
2233147Sxc151355 	uint16_t	wpa_version;	 /* spec revision */
2243147Sxc151355 	uint32_t	wpa_mcipher[1];	 /* multicast/group key cipher */
2253147Sxc151355 	uint16_t	wpa_uciphercnt;	 /* # pairwise key ciphers */
2263147Sxc151355 	uint32_t	wpa_uciphers[8]; /* ciphers */
2273147Sxc151355 	uint16_t	wpa_authselcnt;	 /* authentication selector cnt */
2283147Sxc151355 	uint32_t	wpa_authsels[8]; /* selectors */
2293147Sxc151355 	uint16_t	wpa_caps;	 /* 802.11i capabilities */
2303147Sxc151355 	uint16_t	wpa_pmkidcnt;	 /* 802.11i pmkid count */
2313147Sxc151355 	uint16_t	wpa_pmkids[8];	 /* 802.11i pmkids */
2323147Sxc151355 };
2333147Sxc151355 
2343147Sxc151355 /*
2353147Sxc151355  * WME AC parameter field
2363147Sxc151355  */
2373147Sxc151355 struct ieee80211_wme_acparams {
2383147Sxc151355 	uint8_t		acp_aci_aifsn;
2393147Sxc151355 	uint8_t		acp_logcwminmax;
2403147Sxc151355 	uint16_t	acp_txop;
2413147Sxc151355 };
2423147Sxc151355 
2433147Sxc151355 /*
2443147Sxc151355  * WME Parameter Element
2453147Sxc151355  */
2463147Sxc151355 struct ieee80211_wme_param {
2473147Sxc151355 	uint8_t		wme_id;
2483147Sxc151355 	uint8_t		wme_len;
2493147Sxc151355 	uint8_t		wme_oui[3];
2503147Sxc151355 	uint8_t		wme_oui_type;
2513147Sxc151355 	uint8_t		wme_oui_sybtype;
2523147Sxc151355 	uint8_t		wme_version;
2533147Sxc151355 	uint8_t		wme_qosInfo;
2543147Sxc151355 	uint8_t		wme_reserved;
2553147Sxc151355 	struct ieee80211_wme_acparams	wme_acParams[WME_NUM_AC];
2563147Sxc151355 };
2573147Sxc151355 #pragma pack()
2583147Sxc151355 
2593147Sxc151355 #define	IEEE80211_FC0_VERSION_MASK		0x03
2603147Sxc151355 #define	IEEE80211_FC0_VERSION_SHIFT		0
2613147Sxc151355 #define	IEEE80211_FC0_VERSION_0			0x00
2623147Sxc151355 #define	IEEE80211_FC0_TYPE_MASK			0x0c
2633147Sxc151355 #define	IEEE80211_FC0_TYPE_SHIFT		2
2643147Sxc151355 #define	IEEE80211_FC0_TYPE_MGT			0x00
2653147Sxc151355 #define	IEEE80211_FC0_TYPE_CTL			0x04
2663147Sxc151355 #define	IEEE80211_FC0_TYPE_DATA			0x08
2673147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
2683147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_SHIFT		4
2693147Sxc151355 /* for TYPE_MGT */
2703147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
2713147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
2723147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
2733147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
2743147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
2753147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
2763147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
2773147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
2783147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
2793147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
2803147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
2813147Sxc151355 /* for TYPE_CTL */
2823147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
2833147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
2843147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
2853147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
2863147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
2873147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
2883147Sxc151355 /* for TYPE_DATA (bit combination) */
2893147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_DATA		0x00
2903147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
2913147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
2923147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
2933147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
2943147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_CFACK		0x50
2953147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_CFPOLL		0x60
2963147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK	0x70
2973147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_QOS		0x80
2983147Sxc151355 #define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
2993147Sxc151355 
3003147Sxc151355 #define	IEEE80211_FC1_DIR_MASK			0x03
3013147Sxc151355 #define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */
3023147Sxc151355 #define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP  */
3033147Sxc151355 #define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */
3043147Sxc151355 #define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP  */
3053147Sxc151355 #define	IEEE80211_FC1_MORE_FRAG			0x04
3063147Sxc151355 #define	IEEE80211_FC1_RETRY			0x08
3073147Sxc151355 #define	IEEE80211_FC1_PWR_MGT			0x10
3083147Sxc151355 #define	IEEE80211_FC1_MORE_DATA			0x20
3093147Sxc151355 #define	IEEE80211_FC1_WEP			0x40
3103147Sxc151355 #define	IEEE80211_FC1_ORDER			0x80
3113147Sxc151355 
3123147Sxc151355 #define	IEEE80211_SEQ_FRAG_MASK			0x000f
3133147Sxc151355 #define	IEEE80211_SEQ_FRAG_SHIFT		0
3143147Sxc151355 #define	IEEE80211_SEQ_SEQ_MASK			0xfff0
3153147Sxc151355 #define	IEEE80211_SEQ_SEQ_SHIFT			4	/* 4bit frag number */
3163147Sxc151355 
3173147Sxc151355 /* Length of management frame variable-length components in bytes */
3183147Sxc151355 #define	IEEE80211_NWID_LEN			32	/* SSID */
3193147Sxc151355 #define	IEEE80211_FH_LEN			5	/* FH parameters */
3203147Sxc151355 #define	IEEE80211_DS_LEN			1	/* DS parameters */
3213147Sxc151355 #define	IEEE80211_IBSS_LEN			4	/* IBSS parameters */
3223147Sxc151355 #define	IEEE80211_ERP_LEN			1	/* ERP information */
3233147Sxc151355 
3243147Sxc151355 /*
3253147Sxc151355  * Length of management frame information elements containing
3263147Sxc151355  * a variable-length component is:
3273147Sxc151355  *    element_id(1 byte) + length(1 byte) + component(variable bytes)
3283147Sxc151355  */
3293147Sxc151355 #define	IEEE80211_ELEM_LEN(complen)		(2 + (complen))
3303147Sxc151355 
3313147Sxc151355 /*
3323147Sxc151355  * minimal length of beacon/probe response frame elements
3333147Sxc151355  *  time stamp[8] + beacon interval[2] + capability[2]
3343147Sxc151355  */
3353147Sxc151355 #define	IEEE80211_BEACON_ELEM_MIN		12
3363147Sxc151355 /*
3373147Sxc151355  * Minimal length of authentication frame elements
3383147Sxc151355  *    algorithm[2] + sequence[2] + status[2]
3393147Sxc151355  */
3403147Sxc151355 #define	IEEE80211_AUTH_ELEM_MIN			6
3413147Sxc151355 /*
3423147Sxc151355  * Minimal length of association response frame elements
3433147Sxc151355  *    capability[2] + status[2] + association ID[2]
3443147Sxc151355  */
3453147Sxc151355 #define	IEEE80211_ASSOC_RESP_ELEM_MIN		6
3463147Sxc151355 
3473147Sxc151355 #define	IEEE80211_CAPINFO_ESS			0x0001
3483147Sxc151355 #define	IEEE80211_CAPINFO_IBSS			0x0002
3493147Sxc151355 #define	IEEE80211_CAPINFO_CF_POLLABLE		0x0004
3503147Sxc151355 #define	IEEE80211_CAPINFO_CF_POLLREQ		0x0008
3513147Sxc151355 #define	IEEE80211_CAPINFO_PRIVACY		0x0010
3523147Sxc151355 #define	IEEE80211_CAPINFO_SHORT_PREAMBLE	0x0020
3533147Sxc151355 #define	IEEE80211_CAPINFO_PBCC			0x0040
3543147Sxc151355 #define	IEEE80211_CAPINFO_CHNL_AGILITY		0x0080
3553147Sxc151355 /* bits 8-9 are reserved */
3563147Sxc151355 #define	IEEE80211_CAPINFO_SHORT_SLOTTIME	0x0400
3573147Sxc151355 #define	IEEE80211_CAPINFO_RSN			0x0800
3583147Sxc151355 /* bit 12 is reserved */
3593147Sxc151355 #define	IEEE80211_CAPINFO_DSSSOFDM		0x2000
3603147Sxc151355 /* bits 14-15 are reserved */
3613147Sxc151355 
3623147Sxc151355 /*
3633147Sxc151355  * Management information element payloads.
3643147Sxc151355  */
3653147Sxc151355 
3663147Sxc151355 enum {
3673147Sxc151355 	IEEE80211_ELEMID_SSID			= 0,
3683147Sxc151355 	IEEE80211_ELEMID_RATES			= 1,
3693147Sxc151355 	IEEE80211_ELEMID_FHPARMS		= 2,
3703147Sxc151355 	IEEE80211_ELEMID_DSPARMS		= 3,
3713147Sxc151355 	IEEE80211_ELEMID_CFPARMS		= 4,
3723147Sxc151355 	IEEE80211_ELEMID_TIM			= 5,
3733147Sxc151355 	IEEE80211_ELEMID_IBSSPARMS		= 6,
3743147Sxc151355 	IEEE80211_ELEMID_COUNTRY		= 7,
3753147Sxc151355 	IEEE80211_ELEMID_CHALLENGE		= 16,
3763147Sxc151355 	/* 17-31 reserved for challenge text extension */
3773147Sxc151355 	IEEE80211_ELEMID_ERP			= 42,
3783147Sxc151355 	IEEE80211_ELEMID_RSN			= 48,
3793147Sxc151355 	IEEE80211_ELEMID_XRATES			= 50,
3803147Sxc151355 	/* 128-129 proprietary elements used by Agere chipsets */
3813147Sxc151355 	IEEE80211_ELEMID_AGERE1			= 128,
3823147Sxc151355 	IEEE80211_ELEMID_AGERE2			= 129,
3833147Sxc151355 	IEEE80211_ELEMID_TPC			= 150,
3843147Sxc151355 	IEEE80211_ELEMID_CCKM			= 156,
3853147Sxc151355 	IEEE80211_ELEMID_VENDOR			= 221	/* vendor private */
3863147Sxc151355 };
3873147Sxc151355 
388*4126Szf162725 #define	WPA_OUI			0xf25000
389*4126Szf162725 #define	WPA_OUI_TYPE		0x01
390*4126Szf162725 #define	WPA_VERSION		1		/* current supported version */
391*4126Szf162725 
3923147Sxc151355 #define	IEEE80211_CHALLENGE_LEN			128
3933147Sxc151355 
3943147Sxc151355 #define	IEEE80211_RATE_BASIC			0x80
3953147Sxc151355 #define	IEEE80211_RATE_VAL			0x7f
3963147Sxc151355 
3973147Sxc151355 /* EPR information element flags */
3983147Sxc151355 #define	IEEE80211_ERP_NON_ERP_PRESENT		0x01
3993147Sxc151355 #define	IEEE80211_ERP_USE_PROTECTION		0x02
4003147Sxc151355 #define	IEEE80211_ERP_LONG_PREAMBLE		0x04
4013147Sxc151355 
4023147Sxc151355 #define	IEEE80211_AUTH_ALG_OPEN			0x0000
4033147Sxc151355 #define	IEEE80211_AUTH_ALG_SHARED		0x0001
4043147Sxc151355 #define	IEEE80211_AUTH_ALG_LEAP			0x0080
4053147Sxc151355 
4063147Sxc151355 
4073147Sxc151355 enum {
4083147Sxc151355 	IEEE80211_AUTH_OPEN_REQUEST		= 1,
4093147Sxc151355 	IEEE80211_AUTH_OPEN_RESPONSE		= 2
4103147Sxc151355 };
4113147Sxc151355 
4123147Sxc151355 enum {
4133147Sxc151355 	IEEE80211_AUTH_SHARED_REQUEST		= 1,
4143147Sxc151355 	IEEE80211_AUTH_SHARED_CHALLENGE		= 2,
4153147Sxc151355 	IEEE80211_AUTH_SHARED_RESPONSE		= 3,
4163147Sxc151355 	IEEE80211_AUTH_SHARED_PASS		= 4
4173147Sxc151355 };
4183147Sxc151355 
4193147Sxc151355 /*
4203147Sxc151355  * Reason codes
4213147Sxc151355  *
4223147Sxc151355  * Unlisted codes are reserved
4233147Sxc151355  */
4243147Sxc151355 enum {
4253147Sxc151355 	IEEE80211_REASON_UNSPECIFIED		= 1,
4263147Sxc151355 	IEEE80211_REASON_AUTH_EXPIRE		= 2,
4273147Sxc151355 	IEEE80211_REASON_AUTH_LEAVE		= 3,
4283147Sxc151355 	IEEE80211_REASON_ASSOC_EXPIRE		= 4,
4293147Sxc151355 	IEEE80211_REASON_ASSOC_TOOMANY		= 5,
4303147Sxc151355 	IEEE80211_REASON_NOT_AUTHED		= 6,
4313147Sxc151355 	IEEE80211_REASON_NOT_ASSOCED		= 7,
4323147Sxc151355 	IEEE80211_REASON_ASSOC_LEAVE		= 8,
4333147Sxc151355 	IEEE80211_REASON_ASSOC_NOT_AUTHED	= 9,
4343147Sxc151355 	IEEE80211_REASON_INVALID_POWER		= 10,
4353147Sxc151355 	IEEE80211_REASON_RSN_REQUIRED		= 11,
4363147Sxc151355 	IEEE80211_REASON_RSN_INCONSISTENT	= 12,
4373147Sxc151355 	IEEE80211_REASON_IE_INVALID		= 13,
4383147Sxc151355 	IEEE80211_REASON_MIC_FAILURE		= 14
4393147Sxc151355 };
4403147Sxc151355 
4413147Sxc151355 /*
4423147Sxc151355  * Status codes
4433147Sxc151355  *
4443147Sxc151355  * Unlisted codes are reserved and unused
4453147Sxc151355  */
4463147Sxc151355 enum {
4473147Sxc151355 	IEEE80211_STATUS_SUCCESS		= 0,
4483147Sxc151355 	IEEE80211_STATUS_UNSPECIFIED		= 1,
4493147Sxc151355 	IEEE80211_STATUS_CAPINFO		= 10,
4503147Sxc151355 	IEEE80211_STATUS_NOT_ASSOCED		= 11,
4513147Sxc151355 	IEEE80211_STATUS_OTHER			= 12,
4523147Sxc151355 	IEEE80211_STATUS_ALG			= 13,
4533147Sxc151355 	IEEE80211_STATUS_SEQUENCE		= 14,
4543147Sxc151355 	IEEE80211_STATUS_CHALLENGE		= 15,
4553147Sxc151355 	IEEE80211_STATUS_TIMEOUT		= 16,
4563147Sxc151355 	IEEE80211_STATUS_TOOMANY		= 17,
4573147Sxc151355 	IEEE80211_STATUS_BASIC_RATE		= 18,
4583147Sxc151355 	IEEE80211_STATUS_SP_REQUIRED		= 19,
4593147Sxc151355 	IEEE80211_STATUS_PBCC_REQUIRED		= 20,
4603147Sxc151355 	IEEE80211_STATUS_CA_REQUIRED		= 21,
4613147Sxc151355 	IEEE80211_STATUS_TOO_MANY_STATIONS	= 22,
4623147Sxc151355 	IEEE80211_STATUS_RATES			= 23,
4633147Sxc151355 	IEEE80211_STATUS_SHORTSLOT_REQUIRED	= 25,
4643147Sxc151355 	IEEE80211_STATUS_DSSSOFDM_REQUIRED	= 26
4653147Sxc151355 };
4663147Sxc151355 
4673147Sxc151355 #define	IEEE80211_WEP_KEYLEN		5	/* 40bit */
4683147Sxc151355 #define	IEEE80211_WEP_IVLEN		3	/* 24bit */
4693147Sxc151355 #define	IEEE80211_WEP_KIDLEN		1	/* 1 octet */
4703147Sxc151355 #define	IEEE80211_WEP_CRCLEN		4	/* CRC-32 */
4713147Sxc151355 #define	IEEE80211_WEP_NKID		4	/* number of key ids */
4723147Sxc151355 
473*4126Szf162725 /*
474*4126Szf162725  * 802.11i defines an extended IV for use with non-WEP ciphers.
475*4126Szf162725  * When the EXTIV bit is set in the key id byte an additional
476*4126Szf162725  * 4 bytes immediately follow the IV for TKIP.  For CCMP the
477*4126Szf162725  * EXTIV bit is likewise set but the 8 bytes represent the
478*4126Szf162725  * CCMP header rather than IV+extended-IV.
479*4126Szf162725  */
480*4126Szf162725 #define	IEEE80211_WEP_EXTIV		0x20
481*4126Szf162725 #define	IEEE80211_WEP_EXTIVLEN		4	/* extended IV length */
482*4126Szf162725 #define	IEEE80211_WEP_MICLEN		8	/* trailing MIC */
483*4126Szf162725 
4843147Sxc151355 #define	IEEE80211_CRC_LEN		4
4853147Sxc151355 
4863147Sxc151355 /*
4873147Sxc151355  * Maximum acceptable MTU is defined by 802.11
4883147Sxc151355  * Min is arbitrarily chosen > IEEE80211_MIN_LEN.
4893147Sxc151355  */
4903147Sxc151355 #define	IEEE80211_MTU_MAX		2304
4913147Sxc151355 #define	IEEE80211_MTU_MIN		32
4923147Sxc151355 #define	IEEE80211_MTU			1500
4933147Sxc151355 
4943147Sxc151355 #define	IEEE80211_MAX_LEN				\
4953147Sxc151355 	(sizeof (struct ieee80211_frame_addr4) +	\
4963147Sxc151355 	(IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN) + \
4973147Sxc151355 	IEEE80211_MTU_MAX + IEEE80211_CRC_LEN)
4983147Sxc151355 #define	IEEE80211_ACK_LEN				\
4993147Sxc151355 	(sizeof (struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
5003147Sxc151355 #define	IEEE80211_MIN_LEN				\
5013147Sxc151355 	(sizeof (struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
5023147Sxc151355 
5033147Sxc151355 /*
5043147Sxc151355  * The 802.11 spec says at most 2007 stations may be
5053147Sxc151355  * associated at once.  For most AP's this is way more
5063147Sxc151355  * than is feasible so we use a default of 128.  This
5073147Sxc151355  * number may be overridden by the driver and/or by
5083147Sxc151355  * user configuration.
5093147Sxc151355  */
5103147Sxc151355 #define	IEEE80211_AID_MAX		2007
5113147Sxc151355 #define	IEEE80211_AID_DEF		128
5123147Sxc151355 
5133147Sxc151355 #define	IEEE80211_AID(b)		((b) &~ 0xc000)
5143147Sxc151355 
5153147Sxc151355 /*
5163147Sxc151355  * RTS frame length parameters.  The default is specified in
5173147Sxc151355  * the 802.11 spec as 512; we treat it as implementation-dependent
5183147Sxc151355  * so it's defined in ieee80211_var.h.  The max may be wrong
5193147Sxc151355  * for jumbo frames.
5203147Sxc151355  */
5213147Sxc151355 #define	IEEE80211_RTS_MIN		1
5223147Sxc151355 #define	IEEE80211_RTS_MAX		2346
5233147Sxc151355 
5243147Sxc151355 /*
5253147Sxc151355  * TX fragmentation parameters.  As above for RTS, we treat
5263147Sxc151355  * default as implementation-dependent so define it elsewhere.
5273147Sxc151355  */
5283147Sxc151355 #define	IEEE80211_FRAG_MIN		256
5293147Sxc151355 #define	IEEE80211_FRAG_MAX		2346
5303147Sxc151355 
5313147Sxc151355 /* flags for ieee80211_fix_rate() */
5323147Sxc151355 #define	IEEE80211_F_DOSORT		0x00000001 /* sort rate list */
5333147Sxc151355 #define	IEEE80211_F_DOFRATE		0x00000002 /* use fixed rate */
5343147Sxc151355 #define	IEEE80211_F_DONEGO		0x00000004 /* calc negotiated rate */
5353147Sxc151355 #define	IEEE80211_F_DODEL		0x00000008 /* delete ignore rate */
5363147Sxc151355 
5373147Sxc151355 /*
5383147Sxc151355  * Beacon frames constructed by ieee80211_beacon_alloc
5393147Sxc151355  * have the following structure filled in so drivers
5403147Sxc151355  * can update the frame later w/ minimal overhead.
5413147Sxc151355  */
5423147Sxc151355 struct ieee80211_beacon_offsets {
5433147Sxc151355 	uint16_t	*bo_caps;	/* capabilities */
5443147Sxc151355 	uint8_t		*bo_tim;	/* start of atim/dtim */
5453147Sxc151355 	uint8_t		*bo_wme;	/* start of WME parameters */
5463147Sxc151355 	uint8_t		*bo_trailer;	/* start of fixed-size trailer */
5473147Sxc151355 	uint16_t	bo_tim_len;	/* atim/dtim length in bytes */
5483147Sxc151355 	uint16_t	bo_trailer_len;	/* trailer length in bytes */
5493147Sxc151355 	uint8_t		*bo_erp;	/* start of ERP element */
5503147Sxc151355 };
5513147Sxc151355 
5523147Sxc151355 #ifdef	__cplusplus
5533147Sxc151355 }
5543147Sxc151355 #endif
5553147Sxc151355 
5563147Sxc151355 #endif	/* _SYS_NET80211_PROTO_H */
557