10ba2cbe9Sxc /*
2*e2cf88acSQuaker Fang  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
30ba2cbe9Sxc  * Use is subject to license terms.
40ba2cbe9Sxc  */
50ba2cbe9Sxc 
60ba2cbe9Sxc /*
70ba2cbe9Sxc  * Copyright (c) 2001 Atsushi Onoe
8*e2cf88acSQuaker Fang  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
90ba2cbe9Sxc  * All rights reserved.
100ba2cbe9Sxc  *
110ba2cbe9Sxc  * Redistribution and use in source and binary forms, with or without
120ba2cbe9Sxc  * modification, are permitted provided that the following conditions
130ba2cbe9Sxc  * are met:
140ba2cbe9Sxc  * 1. Redistributions of source code must retain the above copyright
150ba2cbe9Sxc  *    notice, this list of conditions and the following disclaimer.
160ba2cbe9Sxc  * 2. Redistributions in binary form must reproduce the above copyright
170ba2cbe9Sxc  *    notice, this list of conditions and the following disclaimer in the
180ba2cbe9Sxc  *    documentation and/or other materials provided with the distribution.
190ba2cbe9Sxc  * 3. The name of the author may not be used to endorse or promote products
200ba2cbe9Sxc  *    derived from this software without specific prior written permission.
210ba2cbe9Sxc  *
220ba2cbe9Sxc  * Alternatively, this software may be distributed under the terms of the
230ba2cbe9Sxc  * GNU General Public License ("GPL") version 2 as published by the Free
240ba2cbe9Sxc  * Software Foundation.
250ba2cbe9Sxc  *
260ba2cbe9Sxc  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
270ba2cbe9Sxc  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
280ba2cbe9Sxc  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
290ba2cbe9Sxc  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
300ba2cbe9Sxc  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
310ba2cbe9Sxc  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
320ba2cbe9Sxc  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
330ba2cbe9Sxc  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
340ba2cbe9Sxc  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
350ba2cbe9Sxc  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
360ba2cbe9Sxc  */
370ba2cbe9Sxc 
380ba2cbe9Sxc #ifndef _SYS_NET80211_PROTO_H
390ba2cbe9Sxc #define	_SYS_NET80211_PROTO_H
400ba2cbe9Sxc 
410ba2cbe9Sxc /*
420ba2cbe9Sxc  * 802.11 protocol definitions
430ba2cbe9Sxc  */
440ba2cbe9Sxc 
450ba2cbe9Sxc #ifdef	__cplusplus
460ba2cbe9Sxc extern "C" {
470ba2cbe9Sxc #endif
480ba2cbe9Sxc 
490ba2cbe9Sxc #define	IEEE80211_ADDR_LEN	6	/* size of 802.11 address */
500ba2cbe9Sxc #define	IEEE80211_ADDR_COPY(dst, src)	\
510ba2cbe9Sxc 	((void) bcopy(src, dst, IEEE80211_ADDR_LEN))
520ba2cbe9Sxc #define	IEEE80211_ADDR_EQ(a1, a2)	\
530ba2cbe9Sxc 	(bcmp(a1, a2, IEEE80211_ADDR_LEN) == 0)
540ba2cbe9Sxc /* is 802.11 address multicast/broadcast? */
550ba2cbe9Sxc #define	IEEE80211_IS_MULTICAST(addr)	\
560ba2cbe9Sxc 	((((uint8_t *)addr)[0]) & 0x01)
570ba2cbe9Sxc 
580ba2cbe9Sxc /*
590ba2cbe9Sxc  * Size of an ACK control frame in bytes.
600ba2cbe9Sxc  */
610ba2cbe9Sxc #define	IEEE80211_ACK_SIZE	(2 + 2 + IEEE80211_ADDR_LEN + 4)
620ba2cbe9Sxc 
630ba2cbe9Sxc #define	WME_NUM_AC		4	/* 4 AC categories */
640ba2cbe9Sxc 
65*e2cf88acSQuaker Fang /*
66*e2cf88acSQuaker Fang  * The formation of some management frames requires guidance to
67*e2cf88acSQuaker Fang  * deal with legacy clients.  When the client is identified as
68*e2cf88acSQuaker Fang  * "legacy 11b" this parameter can be passed in the arg param of a
69*e2cf88acSQuaker Fang  * IEEE80211_SEND_MGMT call.
70*e2cf88acSQuaker Fang  */
71*e2cf88acSQuaker Fang #define	IEEE80211_SEND_LEGACY_11B	0x1	/* legacy 11b client */
72*e2cf88acSQuaker Fang #define	IEEE80211_SEND_LEGACY_11	0x2	/* other legacy client */
73*e2cf88acSQuaker Fang #define	IEEE80211_SEND_LEGACY		0x3	/* any legacy client */
74*e2cf88acSQuaker Fang 
750ba2cbe9Sxc /*
760ba2cbe9Sxc  * Protocol Physical Layer
770ba2cbe9Sxc  */
780ba2cbe9Sxc 
790ba2cbe9Sxc /* XXX not really a mode; there are really multiple PHY's */
800ba2cbe9Sxc enum ieee80211_phymode {
810ba2cbe9Sxc 	IEEE80211_MODE_AUTO	= 0,	/* autoselect */
820ba2cbe9Sxc 	IEEE80211_MODE_11A	= 1,	/* 5GHz, OFDM */
830ba2cbe9Sxc 	IEEE80211_MODE_11B	= 2,	/* 2GHz, CCK */
840ba2cbe9Sxc 	IEEE80211_MODE_11G	= 3,	/* 2GHz, OFDM */
850ba2cbe9Sxc 	IEEE80211_MODE_FH	= 4,	/* 2GHz, GFSK */
860ba2cbe9Sxc 	IEEE80211_MODE_TURBO_A	= 5,	/* 5GHz, OFDM, 2x clock */
87*e2cf88acSQuaker Fang 	IEEE80211_MODE_TURBO_G	= 6,	/* 2GHz, OFDM, 2x clock */
88*e2cf88acSQuaker Fang 	IEEE80211_MODE_STURBO_A	= 7,	/* 5GHz, OFDM, 2x clock, static */
89*e2cf88acSQuaker Fang 	IEEE80211_MODE_11NA	= 8,	/* 5GHz, w/ HT */
90*e2cf88acSQuaker Fang 	IEEE80211_MODE_11NG	= 9	/* 2GHz, w/ HT */
910ba2cbe9Sxc };
92*e2cf88acSQuaker Fang #define	IEEE80211_MODE_MAX	(IEEE80211_MODE_11NG + 1)
930ba2cbe9Sxc 
940ba2cbe9Sxc enum ieee80211_phytype {
950ba2cbe9Sxc 	IEEE80211_T_DS,		/* direct sequence spread spectrum */
960ba2cbe9Sxc 	IEEE80211_T_FH,		/* frequency hopping */
970ba2cbe9Sxc 	IEEE80211_T_OFDM,	/* frequency division multiplexing */
98*e2cf88acSQuaker Fang 	IEEE80211_T_TURBO,	/* high rate OFDM, aka turbo mode */
99*e2cf88acSQuaker Fang 	IEEE80211_T_HT		/* high throughput, full GI */
1000ba2cbe9Sxc };
1010ba2cbe9Sxc #define	IEEE80211_T_CCK	IEEE80211_T_DS	/* more common nomenclature */
1020ba2cbe9Sxc 
1030ba2cbe9Sxc enum ieee80211_opmode {
1040ba2cbe9Sxc 	IEEE80211_M_STA		= 1,	/* infrastructure station */
1050ba2cbe9Sxc 	IEEE80211_M_IBSS 	= 0,	/* IBSS (adhoc) station */
1060ba2cbe9Sxc 	IEEE80211_M_AHDEMO	= 3,	/* Old lucent compatible adhoc demo */
1070ba2cbe9Sxc 	IEEE80211_M_HOSTAP	= 6,	/* Software Access Point */
1080ba2cbe9Sxc 	IEEE80211_M_MONITOR	= 8	/* Monitor mode */
1090ba2cbe9Sxc };
1100ba2cbe9Sxc 
1110ba2cbe9Sxc /*
1120ba2cbe9Sxc  * 802.11g protection mode.
1130ba2cbe9Sxc  */
1140ba2cbe9Sxc enum ieee80211_protmode {
1150ba2cbe9Sxc 	IEEE80211_PROT_NONE	= 0,	/* no protection */
1160ba2cbe9Sxc 	IEEE80211_PROT_CTSONLY	= 1,	/* CTS to self */
1170ba2cbe9Sxc 	IEEE80211_PROT_RTSCTS	= 2	/* RTS-CTS */
1180ba2cbe9Sxc };
1190ba2cbe9Sxc 
1200ba2cbe9Sxc /*
1210ba2cbe9Sxc  * generic definitions for IEEE 802.11 frames
1220ba2cbe9Sxc  */
1230ba2cbe9Sxc #pragma pack(1)
1240ba2cbe9Sxc struct ieee80211_frame {
1250ba2cbe9Sxc 	uint8_t		i_fc[2]; /* [0]-protocol version, [1]-type & subtype */
1260ba2cbe9Sxc 	uint8_t		i_dur[2];
1270ba2cbe9Sxc 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
1280ba2cbe9Sxc 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
1290ba2cbe9Sxc 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
1300ba2cbe9Sxc 	uint8_t		i_seq[2];
1310ba2cbe9Sxc 	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
1320ba2cbe9Sxc 	/* see below */
1330ba2cbe9Sxc };
1340ba2cbe9Sxc 
135*e2cf88acSQuaker Fang struct ieee80211_qosframe {
136*e2cf88acSQuaker Fang 	uint8_t		i_fc[2];
137*e2cf88acSQuaker Fang 	uint8_t		i_dur[2];
138*e2cf88acSQuaker Fang 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
139*e2cf88acSQuaker Fang 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
140*e2cf88acSQuaker Fang 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
141*e2cf88acSQuaker Fang 	uint8_t		i_seq[2];
142*e2cf88acSQuaker Fang 	uint8_t		i_qos[2];
143*e2cf88acSQuaker Fang 	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
144*e2cf88acSQuaker Fang 	/* see below */
145*e2cf88acSQuaker Fang };
146*e2cf88acSQuaker Fang 
147*e2cf88acSQuaker Fang struct ieee80211_qoscntl {
148*e2cf88acSQuaker Fang 	uint8_t		i_qos[2];
149*e2cf88acSQuaker Fang };
150*e2cf88acSQuaker Fang 
1510ba2cbe9Sxc struct ieee80211_frame_addr4 {
1520ba2cbe9Sxc 	uint8_t		i_fc[2];
1530ba2cbe9Sxc 	uint8_t		i_dur[2];
1540ba2cbe9Sxc 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
1550ba2cbe9Sxc 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
1560ba2cbe9Sxc 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
1570ba2cbe9Sxc 	uint8_t		i_seq[2];
1580ba2cbe9Sxc 	uint8_t		i_addr4[IEEE80211_ADDR_LEN];
1590ba2cbe9Sxc };
1600ba2cbe9Sxc 
161*e2cf88acSQuaker Fang struct ieee80211_qosframe_addr4 {
162*e2cf88acSQuaker Fang 	uint8_t		i_fc[2];
163*e2cf88acSQuaker Fang 	uint8_t		i_dur[2];
164*e2cf88acSQuaker Fang 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
165*e2cf88acSQuaker Fang 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
166*e2cf88acSQuaker Fang 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
167*e2cf88acSQuaker Fang 	uint8_t		i_seq[2];
168*e2cf88acSQuaker Fang 	uint8_t		i_addr4[IEEE80211_ADDR_LEN];
169*e2cf88acSQuaker Fang 	uint8_t		i_qos[2];
170*e2cf88acSQuaker Fang };
171*e2cf88acSQuaker Fang 
1720ba2cbe9Sxc /* Start part(LLC and SNAP) of payload of IEEE80211 frame */
1730ba2cbe9Sxc struct ieee80211_llc {
1740ba2cbe9Sxc 	/* LLC */
1750ba2cbe9Sxc 	uint8_t		illc_dsap;
1760ba2cbe9Sxc 	uint8_t		illc_ssap;
1770ba2cbe9Sxc 	uint8_t		illc_control;
1780ba2cbe9Sxc 	/* SNAP */
1790ba2cbe9Sxc 	uint8_t		illc_oc[3]; /* protocol ID or organization code */
1800ba2cbe9Sxc 	uint16_t	illc_ether_type; /* ethernet type */
1810ba2cbe9Sxc };
1820ba2cbe9Sxc 
1830ba2cbe9Sxc /*
1840ba2cbe9Sxc  * Management Notification Frame
1850ba2cbe9Sxc  */
1860ba2cbe9Sxc struct ieee80211_mnf {
1870ba2cbe9Sxc 	uint8_t		mnf_category;
1880ba2cbe9Sxc 	uint8_t		mnf_action;
1890ba2cbe9Sxc 	uint8_t		mnf_dialog;
1900ba2cbe9Sxc 	uint8_t		mnf_status;
1910ba2cbe9Sxc };
1920ba2cbe9Sxc 
1930ba2cbe9Sxc /*
1940ba2cbe9Sxc  * Control frames.
1950ba2cbe9Sxc  */
1960ba2cbe9Sxc struct ieee80211_frame_min {
1970ba2cbe9Sxc 	uint8_t		i_fc[2];
1980ba2cbe9Sxc 	uint8_t		i_dur[2];
1990ba2cbe9Sxc 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
2000ba2cbe9Sxc 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
2010ba2cbe9Sxc 	/* FCS */
2020ba2cbe9Sxc };
2030ba2cbe9Sxc 
2040ba2cbe9Sxc struct ieee80211_frame_rts {
2050ba2cbe9Sxc 	uint8_t		i_fc[2];
2060ba2cbe9Sxc 	uint8_t		i_dur[2];
2070ba2cbe9Sxc 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
2080ba2cbe9Sxc 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
2090ba2cbe9Sxc 	/* FCS */
2100ba2cbe9Sxc };
2110ba2cbe9Sxc 
2120ba2cbe9Sxc struct ieee80211_frame_cts {
2130ba2cbe9Sxc 	uint8_t		i_fc[2];
2140ba2cbe9Sxc 	uint8_t		i_dur[2];
2150ba2cbe9Sxc 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
2160ba2cbe9Sxc 	/* FCS */
2170ba2cbe9Sxc };
2180ba2cbe9Sxc 
2190ba2cbe9Sxc struct ieee80211_frame_ack {
2200ba2cbe9Sxc 	uint8_t		i_fc[2];
2210ba2cbe9Sxc 	uint8_t		i_dur[2];
2220ba2cbe9Sxc 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
2230ba2cbe9Sxc 	/* FCS */
2240ba2cbe9Sxc };
2250ba2cbe9Sxc 
2260ba2cbe9Sxc struct ieee80211_frame_pspoll {
2270ba2cbe9Sxc 	uint8_t		i_fc[2];
2280ba2cbe9Sxc 	uint8_t		i_aid[2];
2290ba2cbe9Sxc 	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
2300ba2cbe9Sxc 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
2310ba2cbe9Sxc 	/* FCS */
2320ba2cbe9Sxc };
2330ba2cbe9Sxc 
2340ba2cbe9Sxc struct ieee80211_frame_cfend {		/* NB: also CF-End+CF-Ack */
2350ba2cbe9Sxc 	uint8_t		i_fc[2];
2360ba2cbe9Sxc 	uint8_t		i_dur[2];	/* should be zero */
2370ba2cbe9Sxc 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
2380ba2cbe9Sxc 	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
2390ba2cbe9Sxc 	/* FCS */
2400ba2cbe9Sxc };
2410ba2cbe9Sxc 
242*e2cf88acSQuaker Fang struct ieee80211_frame_bar {
243*e2cf88acSQuaker Fang 	uint8_t		i_fc[2];
244*e2cf88acSQuaker Fang 	uint8_t		i_dur[2];
245*e2cf88acSQuaker Fang 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
246*e2cf88acSQuaker Fang 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
247*e2cf88acSQuaker Fang 	uint16_t	i_ctl;
248*e2cf88acSQuaker Fang 	uint16_t	i_seq;
249*e2cf88acSQuaker Fang 	/* FCS */
250*e2cf88acSQuaker Fang };
251*e2cf88acSQuaker Fang 
2520ba2cbe9Sxc struct ieee80211_tim_ie {
2530ba2cbe9Sxc 	uint8_t		tim_ie;			/* IEEE80211_ELEMID_TIM */
2540ba2cbe9Sxc 	uint8_t		tim_len;
2550ba2cbe9Sxc 	uint8_t		tim_count;		/* DTIM count */
2560ba2cbe9Sxc 	uint8_t		tim_period;		/* DTIM period */
2570ba2cbe9Sxc 	uint8_t		tim_bitctl;		/* bitmap control */
2580ba2cbe9Sxc 	uint8_t		tim_bitmap[1];		/* variable-length bitmap */
2590ba2cbe9Sxc };
2600ba2cbe9Sxc 
2610ba2cbe9Sxc /*
2620ba2cbe9Sxc  * 802.11i/WPA information element (maximally sized).
2630ba2cbe9Sxc  */
2640ba2cbe9Sxc struct ieee80211_ie_wpa {
2650ba2cbe9Sxc 	uint8_t		wpa_id;		 /* IEEE80211_ELEMID_VENDOR */
2660ba2cbe9Sxc 	uint8_t		wpa_len;	 /* length in bytes */
2670ba2cbe9Sxc 	uint8_t		wpa_oui[3];	 /* 0x00, 0x50, 0xf2 */
2680ba2cbe9Sxc 	uint8_t		wpa_type;	 /* OUI type */
2690ba2cbe9Sxc 	uint16_t	wpa_version;	 /* spec revision */
2700ba2cbe9Sxc 	uint32_t	wpa_mcipher[1];	 /* multicast/group key cipher */
2710ba2cbe9Sxc 	uint16_t	wpa_uciphercnt;	 /* # pairwise key ciphers */
2720ba2cbe9Sxc 	uint32_t	wpa_uciphers[8]; /* ciphers */
2730ba2cbe9Sxc 	uint16_t	wpa_authselcnt;	 /* authentication selector cnt */
2740ba2cbe9Sxc 	uint32_t	wpa_authsels[8]; /* selectors */
2750ba2cbe9Sxc 	uint16_t	wpa_caps;	 /* 802.11i capabilities */
2760ba2cbe9Sxc 	uint16_t	wpa_pmkidcnt;	 /* 802.11i pmkid count */
2770ba2cbe9Sxc 	uint16_t	wpa_pmkids[8];	 /* 802.11i pmkids */
2780ba2cbe9Sxc };
2790ba2cbe9Sxc 
2800ba2cbe9Sxc /*
2810ba2cbe9Sxc  * WME AC parameter field
2820ba2cbe9Sxc  */
2830ba2cbe9Sxc struct ieee80211_wme_acparams {
2840ba2cbe9Sxc 	uint8_t		acp_aci_aifsn;
2850ba2cbe9Sxc 	uint8_t		acp_logcwminmax;
2860ba2cbe9Sxc 	uint16_t	acp_txop;
2870ba2cbe9Sxc };
2880ba2cbe9Sxc 
2890ba2cbe9Sxc /*
2900ba2cbe9Sxc  * WME Parameter Element
2910ba2cbe9Sxc  */
2920ba2cbe9Sxc struct ieee80211_wme_param {
2930ba2cbe9Sxc 	uint8_t		wme_id;
2940ba2cbe9Sxc 	uint8_t		wme_len;
2950ba2cbe9Sxc 	uint8_t		wme_oui[3];
2960ba2cbe9Sxc 	uint8_t		wme_oui_type;
2970ba2cbe9Sxc 	uint8_t		wme_oui_sybtype;
2980ba2cbe9Sxc 	uint8_t		wme_version;
2990ba2cbe9Sxc 	uint8_t		wme_qosInfo;
300*e2cf88acSQuaker Fang #define	WME_QOSINFO_COUNT	0x0f	/* Mask for param count field */
3010ba2cbe9Sxc 	uint8_t		wme_reserved;
3020ba2cbe9Sxc 	struct ieee80211_wme_acparams	wme_acParams[WME_NUM_AC];
3030ba2cbe9Sxc };
304*e2cf88acSQuaker Fang 
305*e2cf88acSQuaker Fang /*
306*e2cf88acSQuaker Fang  * WME/802.11e information element.
307*e2cf88acSQuaker Fang  */
308*e2cf88acSQuaker Fang struct ieee80211_wme_info {
309*e2cf88acSQuaker Fang 	uint8_t		wme_id;		/* IEEE80211_ELEMID_VENDOR */
310*e2cf88acSQuaker Fang 	uint8_t		wme_len;	/* length in bytes */
311*e2cf88acSQuaker Fang 	uint8_t		wme_oui[3];	/* 0x00, 0x50, 0xf2 */
312*e2cf88acSQuaker Fang 	uint8_t		wme_type;	/* OUI type */
313*e2cf88acSQuaker Fang 	uint8_t		wme_subtype;	/* OUI subtype */
314*e2cf88acSQuaker Fang 	uint8_t		wme_version;	/* spec revision */
315*e2cf88acSQuaker Fang 	uint8_t		wme_info;	/* QoS info */
316*e2cf88acSQuaker Fang };
317*e2cf88acSQuaker Fang 
318*e2cf88acSQuaker Fang /*
319*e2cf88acSQuaker Fang  * WME/802.11e Tspec Element
320*e2cf88acSQuaker Fang  */
321*e2cf88acSQuaker Fang struct ieee80211_wme_tspec {
322*e2cf88acSQuaker Fang 	uint8_t		ts_id;
323*e2cf88acSQuaker Fang 	uint8_t		ts_len;
324*e2cf88acSQuaker Fang 	uint8_t		ts_oui[3];
325*e2cf88acSQuaker Fang 	uint8_t		ts_oui_type;
326*e2cf88acSQuaker Fang 	uint8_t		ts_oui_subtype;
327*e2cf88acSQuaker Fang 	uint8_t		ts_version;
328*e2cf88acSQuaker Fang 	uint8_t		ts_tsinfo[3];
329*e2cf88acSQuaker Fang 	uint8_t		ts_nom_msdu[2];
330*e2cf88acSQuaker Fang 	uint8_t		ts_max_msdu[2];
331*e2cf88acSQuaker Fang 	uint8_t		ts_min_svc[4];
332*e2cf88acSQuaker Fang 	uint8_t		ts_max_svc[4];
333*e2cf88acSQuaker Fang 	uint8_t		ts_inactv_intv[4];
334*e2cf88acSQuaker Fang 	uint8_t		ts_susp_intv[4];
335*e2cf88acSQuaker Fang 	uint8_t		ts_start_svc[4];
336*e2cf88acSQuaker Fang 	uint8_t		ts_min_rate[4];
337*e2cf88acSQuaker Fang 	uint8_t		ts_mean_rate[4];
338*e2cf88acSQuaker Fang 	uint8_t		ts_max_burst[4];
339*e2cf88acSQuaker Fang 	uint8_t		ts_min_phy[4];
340*e2cf88acSQuaker Fang 	uint8_t		ts_peak_rate[4];
341*e2cf88acSQuaker Fang 	uint8_t		ts_delay[4];
342*e2cf88acSQuaker Fang 	uint8_t		ts_surplus[2];
343*e2cf88acSQuaker Fang 	uint8_t		ts_medium_time[2];
344*e2cf88acSQuaker Fang };
345*e2cf88acSQuaker Fang 
346*e2cf88acSQuaker Fang /*
347*e2cf88acSQuaker Fang  * 802.11n Management Action Frames
348*e2cf88acSQuaker Fang  */
349*e2cf88acSQuaker Fang /* generic frame format */
350*e2cf88acSQuaker Fang struct ieee80211_action {
351*e2cf88acSQuaker Fang 	uint8_t		ia_category;
352*e2cf88acSQuaker Fang 	uint8_t		ia_action;
353*e2cf88acSQuaker Fang };
354*e2cf88acSQuaker Fang 
355*e2cf88acSQuaker Fang /* HT - recommended transmission channel width */
356*e2cf88acSQuaker Fang struct ieee80211_action_ht_txchwidth {
357*e2cf88acSQuaker Fang 	struct ieee80211_action	at_header;
358*e2cf88acSQuaker Fang 	uint8_t		at_chwidth;
359*e2cf88acSQuaker Fang };
360*e2cf88acSQuaker Fang 
361*e2cf88acSQuaker Fang struct ieee80211_action_ht_mimopowersave {
362*e2cf88acSQuaker Fang 	struct ieee80211_action am_header;
363*e2cf88acSQuaker Fang 	uint8_t		am_control;
364*e2cf88acSQuaker Fang };
365*e2cf88acSQuaker Fang 
366*e2cf88acSQuaker Fang /* BA - ADDBA request */
367*e2cf88acSQuaker Fang struct ieee80211_action_ba_addbarequest {
368*e2cf88acSQuaker Fang 	struct ieee80211_action rq_header;
369*e2cf88acSQuaker Fang 	uint8_t		rq_dialogtoken;
370*e2cf88acSQuaker Fang 	uint16_t	rq_baparamset;
371*e2cf88acSQuaker Fang 	uint16_t	rq_batimeout;		/* in TUs */
372*e2cf88acSQuaker Fang 	uint16_t	rq_baseqctl;
373*e2cf88acSQuaker Fang };
374*e2cf88acSQuaker Fang 
375*e2cf88acSQuaker Fang /* BA - ADDBA response */
376*e2cf88acSQuaker Fang struct ieee80211_action_ba_addbaresponse {
377*e2cf88acSQuaker Fang 	struct ieee80211_action rs_header;
378*e2cf88acSQuaker Fang 	uint8_t		rs_dialogtoken;
379*e2cf88acSQuaker Fang 	uint16_t	rs_statuscode;
380*e2cf88acSQuaker Fang 	uint16_t	rs_baparamset;
381*e2cf88acSQuaker Fang 	uint16_t	rs_batimeout;		/* in TUs */
382*e2cf88acSQuaker Fang };
383*e2cf88acSQuaker Fang 
384*e2cf88acSQuaker Fang /* BA - DELBA */
385*e2cf88acSQuaker Fang struct ieee80211_action_ba_delba {
386*e2cf88acSQuaker Fang 	struct ieee80211_action dl_header;
387*e2cf88acSQuaker Fang 	uint16_t	dl_baparamset;
388*e2cf88acSQuaker Fang 	uint16_t	dl_reasoncode;
389*e2cf88acSQuaker Fang };
390*e2cf88acSQuaker Fang 
391*e2cf88acSQuaker Fang struct ieee80211_ba_request {
392*e2cf88acSQuaker Fang 	uint16_t	rq_barctl;
393*e2cf88acSQuaker Fang 	uint16_t	rq_barseqctl;
394*e2cf88acSQuaker Fang };
395*e2cf88acSQuaker Fang 
396*e2cf88acSQuaker Fang /*
397*e2cf88acSQuaker Fang  * 802.11n HT Capability IE
398*e2cf88acSQuaker Fang  * NB: these reflect D1.10
399*e2cf88acSQuaker Fang  */
400*e2cf88acSQuaker Fang struct ieee80211_ie_htcap {
401*e2cf88acSQuaker Fang 	uint8_t		hc_id;			/* element ID */
402*e2cf88acSQuaker Fang 	uint8_t		hc_len;			/* length in bytes */
403*e2cf88acSQuaker Fang 	uint16_t	hc_cap;			/* HT caps (see below) */
404*e2cf88acSQuaker Fang 	uint8_t		hc_param;		/* HT params (see below) */
405*e2cf88acSQuaker Fang 	uint8_t 	hc_mcsset[16]; 		/* supported MCS set */
406*e2cf88acSQuaker Fang 	uint16_t	hc_extcap;		/* extended HT capabilities */
407*e2cf88acSQuaker Fang 	uint32_t	hc_txbf;		/* txbf capabilities */
408*e2cf88acSQuaker Fang 	uint8_t		hc_antenna;		/* antenna capabilities */
409*e2cf88acSQuaker Fang };
410*e2cf88acSQuaker Fang 
411*e2cf88acSQuaker Fang /*
412*e2cf88acSQuaker Fang  * 802.11n HT Information IE
413*e2cf88acSQuaker Fang  */
414*e2cf88acSQuaker Fang struct ieee80211_ie_htinfo {
415*e2cf88acSQuaker Fang 	uint8_t		hi_id;			/* element ID */
416*e2cf88acSQuaker Fang 	uint8_t		hi_len;			/* length in bytes */
417*e2cf88acSQuaker Fang 	uint8_t		hi_ctrlchannel;		/* primary channel */
418*e2cf88acSQuaker Fang 	uint8_t		hi_byte1;		/* ht ie byte 1 */
419*e2cf88acSQuaker Fang 	uint8_t		hi_byte2;		/* ht ie byte 2 */
420*e2cf88acSQuaker Fang 	uint8_t		hi_byte3;		/* ht ie byte 3 */
421*e2cf88acSQuaker Fang 	uint16_t	hi_byte45;		/* ht ie bytes 4+5 */
422*e2cf88acSQuaker Fang 	uint8_t 	hi_basicmcsset[16]; 	/* basic MCS set */
423*e2cf88acSQuaker Fang };
4240ba2cbe9Sxc #pragma pack()
4250ba2cbe9Sxc 
4260ba2cbe9Sxc #define	IEEE80211_FC0_VERSION_MASK		0x03
4270ba2cbe9Sxc #define	IEEE80211_FC0_VERSION_SHIFT		0
4280ba2cbe9Sxc #define	IEEE80211_FC0_VERSION_0			0x00
4290ba2cbe9Sxc #define	IEEE80211_FC0_TYPE_MASK			0x0c
4300ba2cbe9Sxc #define	IEEE80211_FC0_TYPE_SHIFT		2
4310ba2cbe9Sxc #define	IEEE80211_FC0_TYPE_MGT			0x00
4320ba2cbe9Sxc #define	IEEE80211_FC0_TYPE_CTL			0x04
4330ba2cbe9Sxc #define	IEEE80211_FC0_TYPE_DATA			0x08
4340ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
4350ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_SHIFT		4
4360ba2cbe9Sxc /* for TYPE_MGT */
4370ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
4380ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
4390ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
4400ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
4410ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
4420ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
4430ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
4440ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
4450ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
4460ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
4470ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
448*e2cf88acSQuaker Fang #define	IEEE80211_FC0_SUBTYPE_ACTION		0xd0
4490ba2cbe9Sxc /* for TYPE_CTL */
450*e2cf88acSQuaker Fang #define	IEEE80211_FC0_SUBTYPE_BAR		0x80
4510ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
4520ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
4530ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
4540ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
4550ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
4560ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
4570ba2cbe9Sxc /* for TYPE_DATA (bit combination) */
4580ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_DATA		0x00
4590ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
4600ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
4610ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
4620ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
4630ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_CFACK		0x50
4640ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_CFPOLL		0x60
4650ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK	0x70
4660ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_QOS		0x80
4670ba2cbe9Sxc #define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
4680ba2cbe9Sxc 
4690ba2cbe9Sxc #define	IEEE80211_FC1_DIR_MASK			0x03
4700ba2cbe9Sxc #define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */
4710ba2cbe9Sxc #define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP  */
4720ba2cbe9Sxc #define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */
4730ba2cbe9Sxc #define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP  */
474*e2cf88acSQuaker Fang 
4750ba2cbe9Sxc #define	IEEE80211_FC1_MORE_FRAG			0x04
4760ba2cbe9Sxc #define	IEEE80211_FC1_RETRY			0x08
4770ba2cbe9Sxc #define	IEEE80211_FC1_PWR_MGT			0x10
4780ba2cbe9Sxc #define	IEEE80211_FC1_MORE_DATA			0x20
4790ba2cbe9Sxc #define	IEEE80211_FC1_WEP			0x40
4800ba2cbe9Sxc #define	IEEE80211_FC1_ORDER			0x80
4810ba2cbe9Sxc 
4820ba2cbe9Sxc #define	IEEE80211_SEQ_FRAG_MASK			0x000f
4830ba2cbe9Sxc #define	IEEE80211_SEQ_FRAG_SHIFT		0
4840ba2cbe9Sxc #define	IEEE80211_SEQ_SEQ_MASK			0xfff0
4850ba2cbe9Sxc #define	IEEE80211_SEQ_SEQ_SHIFT			4	/* 4bit frag number */
486*e2cf88acSQuaker Fang #define	IEEE80211_SEQ_RANGE			4096
487*e2cf88acSQuaker Fang 
488*e2cf88acSQuaker Fang #define	IEEE80211_SEQ_ADD(seq, incr) \
489*e2cf88acSQuaker Fang 	(((seq) + (incr)) & (IEEE80211_SEQ_RANGE - 1))
490*e2cf88acSQuaker Fang #define	IEEE80211_SEQ_INC(seq)	IEEE80211_SEQ_ADD(seq, 1)
491*e2cf88acSQuaker Fang #define	IEEE80211_SEQ_SUB(a, b) \
492*e2cf88acSQuaker Fang 	(((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE - 1))
493*e2cf88acSQuaker Fang 
494*e2cf88acSQuaker Fang #define	IEEE80211_SEQ_BA_RANGE			2048	/* 2^11 */
495*e2cf88acSQuaker Fang #define	IEEE80211_SEQ_BA_BEFORE(a, b) \
496*e2cf88acSQuaker Fang 	(IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1)
4970ba2cbe9Sxc 
4980ba2cbe9Sxc /* Length of management frame variable-length components in bytes */
4990ba2cbe9Sxc #define	IEEE80211_NWID_LEN			32	/* SSID */
5000ba2cbe9Sxc #define	IEEE80211_FH_LEN			5	/* FH parameters */
5010ba2cbe9Sxc #define	IEEE80211_DS_LEN			1	/* DS parameters */
5020ba2cbe9Sxc #define	IEEE80211_IBSS_LEN			4	/* IBSS parameters */
5030ba2cbe9Sxc #define	IEEE80211_ERP_LEN			1	/* ERP information */
5040ba2cbe9Sxc 
505*e2cf88acSQuaker Fang #define	IEEE80211_QOS_TXOP			0x00ff
506*e2cf88acSQuaker Fang /* bit 8 is reserved */
507*e2cf88acSQuaker Fang #define	IEEE80211_QOS_AMSDU			0x80
508*e2cf88acSQuaker Fang #define	IEEE80211_QOS_AMSDU_S			7
509*e2cf88acSQuaker Fang #define	IEEE80211_QOS_ACKPOLICY			0x60
510*e2cf88acSQuaker Fang #define	IEEE80211_QOS_ACKPOLICY_S		5
511*e2cf88acSQuaker Fang #define	IEEE80211_QOS_ACKPOLICY_NOACK		0x20	/* No ACK required */
512*e2cf88acSQuaker Fang #define	IEEE80211_QOS_ACKPOLICY_BA		0x60	/* Block ACK */
513*e2cf88acSQuaker Fang #define	IEEE80211_QOS_ESOP			0x10
514*e2cf88acSQuaker Fang #define	IEEE80211_QOS_ESOP_S			4
515*e2cf88acSQuaker Fang #define	IEEE80211_QOS_TID			0x0f
516*e2cf88acSQuaker Fang 
517*e2cf88acSQuaker Fang /* does frame have QoS sequence control data */
518*e2cf88acSQuaker Fang #define	IEEE80211_QOS_HAS_SEQ(wh) \
519*e2cf88acSQuaker Fang 	(((wh)->i_fc[0] & \
520*e2cf88acSQuaker Fang 	(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
521*e2cf88acSQuaker Fang 	(IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
522*e2cf88acSQuaker Fang 
523*e2cf88acSQuaker Fang #define	WME_NUM_AC		4	/* 4 AC categories */
524*e2cf88acSQuaker Fang #define	WME_NUM_TID		16	/* 16 tids */
525*e2cf88acSQuaker Fang 
526*e2cf88acSQuaker Fang #define	WME_PARAM_ACI		0x60	/* Mask for ACI field */
527*e2cf88acSQuaker Fang #define	WME_PARAM_ACI_S		5	/* Shift for ACI field */
528*e2cf88acSQuaker Fang #define	WME_PARAM_ACM		0x10	/* Mask for ACM bit */
529*e2cf88acSQuaker Fang #define	WME_PARAM_ACM_S		4	/* Shift for ACM bit */
530*e2cf88acSQuaker Fang #define	WME_PARAM_AIFSN		0x0f	/* Mask for aifsn field */
531*e2cf88acSQuaker Fang #define	WME_PARAM_AIFSN_S	0	/* Shift for aifsn field */
532*e2cf88acSQuaker Fang #define	WME_PARAM_LOGCWMIN	0x0f	/* Mask for CwMin field (in log) */
533*e2cf88acSQuaker Fang #define	WME_PARAM_LOGCWMIN_S	0	/* Shift for CwMin field */
534*e2cf88acSQuaker Fang #define	WME_PARAM_LOGCWMAX	0xf0	/* Mask for CwMax field (in log) */
535*e2cf88acSQuaker Fang #define	WME_PARAM_LOGCWMAX_S	4	/* Shift for CwMax field */
536*e2cf88acSQuaker Fang 
537*e2cf88acSQuaker Fang #define	WME_AC_TO_TID(_ac) (       \
538*e2cf88acSQuaker Fang 	((_ac) == WME_AC_VO) ? 6 : \
539*e2cf88acSQuaker Fang 	((_ac) == WME_AC_VI) ? 5 : \
540*e2cf88acSQuaker Fang 	((_ac) == WME_AC_BK) ? 1 : \
541*e2cf88acSQuaker Fang 	0)
542*e2cf88acSQuaker Fang 
543*e2cf88acSQuaker Fang #define	TID_TO_WME_AC(_tid) (      \
544*e2cf88acSQuaker Fang 	((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \
545*e2cf88acSQuaker Fang 	((_tid) < 3) ? WME_AC_BK : \
546*e2cf88acSQuaker Fang 	((_tid) < 6) ? WME_AC_VI : \
547*e2cf88acSQuaker Fang 	WME_AC_VO)
548*e2cf88acSQuaker Fang 
549*e2cf88acSQuaker Fang #define	IEEE80211_MNF_SETUP_REQ		0
550*e2cf88acSQuaker Fang #define	IEEE80211_MNF_SETUP_RESP	1
551*e2cf88acSQuaker Fang #define	IEEE80211_MNF_TEARDOWN		2
552*e2cf88acSQuaker Fang 
553*e2cf88acSQuaker Fang #define	IEEE80211_ACTION_CAT_QOS	0	/* QoS */
554*e2cf88acSQuaker Fang #define	IEEE80211_ACTION_CAT_BA		3	/* BA */
555*e2cf88acSQuaker Fang #define	IEEE80211_ACTION_CAT_HT		7	/* HT */
556*e2cf88acSQuaker Fang 
557*e2cf88acSQuaker Fang #define	IEEE80211_ACTION_HT_TXCHWIDTH	0	/* recommend xmit chan width */
558*e2cf88acSQuaker Fang #define	IEEE80211_ACTION_HT_MIMOPWRSAVE	1	/* MIMO power save */
559*e2cf88acSQuaker Fang 
560*e2cf88acSQuaker Fang #define	IEEE80211_A_HT_TXCHWIDTH_20	0
561*e2cf88acSQuaker Fang #define	IEEE80211_A_HT_TXCHWIDTH_2040	1
562*e2cf88acSQuaker Fang 
563*e2cf88acSQuaker Fang #define	IEEE80211_A_HT_MIMOPWRSAVE_ENA		0x01	/* PS enabled */
564*e2cf88acSQuaker Fang #define	IEEE80211_A_HT_MIMOPWRSAVE_MODE		0x02
565*e2cf88acSQuaker Fang #define	IEEE80211_A_HT_MIMOPWRSAVE_MODE_S	1
566*e2cf88acSQuaker Fang #define	IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC	0x02	/* Dynamic Mode */
567*e2cf88acSQuaker Fang #define	IEEE80211_A_HT_MIMOPWRSAVE_STATIC	0x00	/* no SM packets */
568*e2cf88acSQuaker Fang /* bits 2-7 reserved */
569*e2cf88acSQuaker Fang 
570*e2cf88acSQuaker Fang /* Block Ack actions */
571*e2cf88acSQuaker Fang #define	IEEE80211_ACTION_BA_ADDBA_REQUEST	0   /* ADDBA request */
572*e2cf88acSQuaker Fang #define	IEEE80211_ACTION_BA_ADDBA_RESPONSE	1   /* ADDBA response */
573*e2cf88acSQuaker Fang #define	IEEE80211_ACTION_BA_DELBA		2   /* DELBA */
574*e2cf88acSQuaker Fang 
575*e2cf88acSQuaker Fang /* Block Ack Parameter Set */
576*e2cf88acSQuaker Fang #define	IEEE80211_BAPS_BUFSIZ	0xffc0		/* buffer size */
577*e2cf88acSQuaker Fang #define	IEEE80211_BAPS_BUFSIZ_S	6
578*e2cf88acSQuaker Fang #define	IEEE80211_BAPS_TID	0x003c		/* TID */
579*e2cf88acSQuaker Fang #define	IEEE80211_BAPS_TID_S	2
580*e2cf88acSQuaker Fang #define	IEEE80211_BAPS_POLICY	0x0002		/* block ack policy */
581*e2cf88acSQuaker Fang #define	IEEE80211_BAPS_POLICY_S	1
582*e2cf88acSQuaker Fang 
583*e2cf88acSQuaker Fang #define	IEEE80211_BAPS_POLICY_DELAYED	(0<<IEEE80211_BAPS_POLICY_S)
584*e2cf88acSQuaker Fang #define	IEEE80211_BAPS_POLICY_IMMEDIATE	(1<<IEEE80211_BAPS_POLICY_S)
585*e2cf88acSQuaker Fang 
586*e2cf88acSQuaker Fang /* Block Ack Sequence Control */
587*e2cf88acSQuaker Fang #define	IEEE80211_BASEQ_START	0xfff0		/* starting seqnum */
588*e2cf88acSQuaker Fang #define	IEEE80211_BASEQ_START_S	4
589*e2cf88acSQuaker Fang #define	IEEE80211_BASEQ_FRAG	0x000f		/* fragment number */
590*e2cf88acSQuaker Fang #define	IEEE80211_BASEQ_FRAG_S	0
591*e2cf88acSQuaker Fang 
592*e2cf88acSQuaker Fang /* Delayed Block Ack Parameter Set */
593*e2cf88acSQuaker Fang #define	IEEE80211_DELBAPS_TID	0xf000		/* TID */
594*e2cf88acSQuaker Fang #define	IEEE80211_DELBAPS_TID_S	12
595*e2cf88acSQuaker Fang #define	IEEE80211_DELBAPS_INIT	0x0800		/* initiator */
596*e2cf88acSQuaker Fang #define	IEEE80211_DELBAPS_INIT_S 11
597*e2cf88acSQuaker Fang 
598*e2cf88acSQuaker Fang /* BAR Control */
599*e2cf88acSQuaker Fang #define	IEEE80211_BAR_TID	0xf000		/* TID */
600*e2cf88acSQuaker Fang #define	IEEE80211_BAR_TID_S	12
601*e2cf88acSQuaker Fang #define	IEEE80211_BAR_COMP	0x0004		/* compressed */
602*e2cf88acSQuaker Fang #define	IEEE80211_BAR_MTID	0x0002
603*e2cf88acSQuaker Fang #define	IEEE80211_BAR_NOACK	0x0001		/* no-ack policy */
604*e2cf88acSQuaker Fang 
605*e2cf88acSQuaker Fang /* HT capability flags (ht_cap) */
606*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_LDPC		0x0001	/* LDPC supported */
607*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_CHWIDTH40	0x0002	/* 20/40 supported */
608*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_SMPS		0x000c	/* SM Power Save mode */
609*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_SMPS_OFF	0x0000	/* none (static mode) */
610*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_SMPS_DYNAMIC	0x0004	/* send RTS first */
611*e2cf88acSQuaker Fang /* NB: SMPS value 2 is reserved */
612*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_SMPS_ENA	0x000c	/* enabled */
613*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_GREENFIELD	0x0010	/* Greenfield supported */
614*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_SHORTGI20	0x0020	/* Short GI in 20MHz */
615*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_SHORTGI40	0x0040	/* Short GI in 40MHz */
616*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_TXSTBC		0x0080	/* STBC tx ok */
617*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_RXSTBC		0x0300  /* STBC rx support */
618*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_RXSTBC_S	8
619*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_RXSTBC_1STREAM	0x0100  /* 1 spatial stream */
620*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_RXSTBC_2STREAM	0x0200  /* 1-2 spatial streams */
621*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_RXSTBC_3STREAM	0x0300  /* 1-3 spatial streams */
622*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_DELBA		0x0400	/* HT DELBA supported */
623*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MAXAMSDU	0x0800	/* max A-MSDU length */
624*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MAXAMSDU_7935	0x0800	/* 7935 octets */
625*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MAXAMSDU_3839	0x0000	/* 3839 octets */
626*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_DSSSCCK40	0x1000  /* DSSS/CCK in 40MHz */
627*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_PSMP		0x2000  /* PSMP supported */
628*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_40INTOLERANT	0x4000  /* 40MHz intolerant */
629*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_LSIGTXOPPROT	0x8000  /* L-SIG TXOP prot */
630*e2cf88acSQuaker Fang 
631*e2cf88acSQuaker Fang /* HT parameters (hc_param) */
632*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MAXRXAMPDU	0x03	/* max rx A-MPDU factor */
633*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MAXRXAMPDU_S	0
634*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MAXRXAMPDU_8K	0
635*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MAXRXAMPDU_16K	1
636*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MAXRXAMPDU_32K	2
637*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MAXRXAMPDU_64K	3
638*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY	0x1c	/* min MPDU start spacing */
639*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY_S	2
640*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY_NA	0	/* no time restriction */
641*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY_025	1	/* 1/4 us */
642*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY_05	2	/* 1/2 us */
643*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY_1	3	/* 1 us */
644*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY_2	4	/* 2 us */
645*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY_4	5	/* 4 us */
646*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY_8	6	/* 8 us */
647*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MPDUDENSITY_16	7	/* 16 us */
648*e2cf88acSQuaker Fang 
649*e2cf88acSQuaker Fang /* HT extended capabilities (hc_extcap) */
650*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_PCO		0x0001	/* PCO capable */
651*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_PCOTRANS	0x0006	/* PCO transition time */
652*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_PCOTRANS_S	1
653*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_PCOTRANS_04	0x0002	/* 400 us */
654*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_PCOTRANS_15	0x0004	/* 1.5 ms */
655*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_PCOTRANS_5	0x0006	/* 5 ms */
656*e2cf88acSQuaker Fang /* bits 3-7 reserved */
657*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MCSFBACK	0x0300	/* MCS feedback */
658*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MCSFBACK_S	8
659*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MCSFBACK_NONE	0x0000	/* nothing provided */
660*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MCSFBACK_UNSOL	0x0200	/* unsolicited feedback */
661*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_MCSFBACK_MRQ	0x0300	/* " "+respond to MRQ */
662*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_HTC		0x0400	/* +HTC support */
663*e2cf88acSQuaker Fang #define	IEEE80211_HTCAP_RDR		0x0800
664*e2cf88acSQuaker Fang 					/* reverse direction responder */
665*e2cf88acSQuaker Fang /* bits 12-15 reserved */
666*e2cf88acSQuaker Fang 
667*e2cf88acSQuaker Fang /* byte1 */
668*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_2NDCHAN	0x03	/* secondary/ext chan offset */
669*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_2NDCHAN_S	0
670*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_2NDCHAN_NONE	0x00	/* no secondary/ext channel */
671*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_2NDCHAN_ABOVE	0x01	/* above private channel */
672*e2cf88acSQuaker Fang /* NB: 2 is reserved */
673*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_2NDCHAN_BELOW	0x03	/* below primary channel */
674*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_TXWIDTH	0x04	/* tx channel width */
675*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_TXWIDTH_20	0x00	/* 20MHz width */
676*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_TXWIDTH_2040	0x04	/* any supported width */
677*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_RIFSMODE	0x08	/* Reduced IFS (RIFS) use */
678*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_RIFSMODE_PROH	0x00	/* RIFS use prohibited */
679*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_RIFSMODE_PERM	0x08	/* RIFS use permitted */
680*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_PMSPONLY	0x10	/* PSMP required to associate */
681*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_SIGRAN		0xe0	/* shortest Service Interval */
682*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_SIGRAN_S	5
683*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_SIGRAN_5	0x00	/* 5 ms */
684*e2cf88acSQuaker Fang /* XXX add rest */
685*e2cf88acSQuaker Fang 
686*e2cf88acSQuaker Fang /* bytes 2+3 */
687*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_OPMODE		0x03	/* operating mode */
688*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_OPMODE_S	0
689*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_OPMODE_PURE	0x00	/* no protection */
690*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_OPMODE_PROTOPT	0x01	/* protection optional */
691*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_OPMODE_HT20PR	0x02	/* protection for HT20 sta's */
692*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_OPMODE_MIXED	0x03	/* protection for legacy sta */
693*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_NONGF_PRESENT	0x04	/* non-GF sta's present */
694*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_TXBL		0x08	/* transmit burst limit */
695*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_NONHT_PRESENT	0x10	/* non-HT sta's present */
696*e2cf88acSQuaker Fang /* bits 5-15 reserved */
697*e2cf88acSQuaker Fang 
698*e2cf88acSQuaker Fang /* bytes 4+5 */
699*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_2NDARYBEACON	0x01
700*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_LSIGTXOPPROT	0x02
701*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_PCO_ACTIVE	0x04
702*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_40MHZPHASE	0x08
703*e2cf88acSQuaker Fang 
704*e2cf88acSQuaker Fang /* byte5 */
705*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_BASIC_STBCMCS	0x7f
706*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_BASIC_STBCMCS_S 0
707*e2cf88acSQuaker Fang #define	IEEE80211_HTINFO_DUALPROTECTED	0x80
708*e2cf88acSQuaker Fang 
7090ba2cbe9Sxc /*
7100ba2cbe9Sxc  * Length of management frame information elements containing
7110ba2cbe9Sxc  * a variable-length component is:
7120ba2cbe9Sxc  *    element_id(1 byte) + length(1 byte) + component(variable bytes)
7130ba2cbe9Sxc  */
7140ba2cbe9Sxc #define	IEEE80211_ELEM_LEN(complen)		(2 + (complen))
7150ba2cbe9Sxc 
7160ba2cbe9Sxc /*
7170ba2cbe9Sxc  * minimal length of beacon/probe response frame elements
7180ba2cbe9Sxc  *  time stamp[8] + beacon interval[2] + capability[2]
7190ba2cbe9Sxc  */
7200ba2cbe9Sxc #define	IEEE80211_BEACON_ELEM_MIN		12
7210ba2cbe9Sxc /*
7220ba2cbe9Sxc  * Minimal length of authentication frame elements
7230ba2cbe9Sxc  *    algorithm[2] + sequence[2] + status[2]
7240ba2cbe9Sxc  */
7250ba2cbe9Sxc #define	IEEE80211_AUTH_ELEM_MIN			6
7260ba2cbe9Sxc /*
7270ba2cbe9Sxc  * Minimal length of association response frame elements
7280ba2cbe9Sxc  *    capability[2] + status[2] + association ID[2]
7290ba2cbe9Sxc  */
7300ba2cbe9Sxc #define	IEEE80211_ASSOC_RESP_ELEM_MIN		6
7310ba2cbe9Sxc 
7320ba2cbe9Sxc #define	IEEE80211_CAPINFO_ESS			0x0001
7330ba2cbe9Sxc #define	IEEE80211_CAPINFO_IBSS			0x0002
7340ba2cbe9Sxc #define	IEEE80211_CAPINFO_CF_POLLABLE		0x0004
7350ba2cbe9Sxc #define	IEEE80211_CAPINFO_CF_POLLREQ		0x0008
7360ba2cbe9Sxc #define	IEEE80211_CAPINFO_PRIVACY		0x0010
7370ba2cbe9Sxc #define	IEEE80211_CAPINFO_SHORT_PREAMBLE	0x0020
7380ba2cbe9Sxc #define	IEEE80211_CAPINFO_PBCC			0x0040
7390ba2cbe9Sxc #define	IEEE80211_CAPINFO_CHNL_AGILITY		0x0080
740*e2cf88acSQuaker Fang #define	IEEE80211_CAPINFO_SPECTRUM_MGMT		0x0100
7410ba2cbe9Sxc /* bits 8-9 are reserved */
7420ba2cbe9Sxc #define	IEEE80211_CAPINFO_SHORT_SLOTTIME	0x0400
7430ba2cbe9Sxc #define	IEEE80211_CAPINFO_RSN			0x0800
7440ba2cbe9Sxc /* bit 12 is reserved */
7450ba2cbe9Sxc #define	IEEE80211_CAPINFO_DSSSOFDM		0x2000
7460ba2cbe9Sxc /* bits 14-15 are reserved */
7470ba2cbe9Sxc 
7480ba2cbe9Sxc /*
7490ba2cbe9Sxc  * Management information element payloads.
7500ba2cbe9Sxc  */
7510ba2cbe9Sxc 
7520ba2cbe9Sxc enum {
7530ba2cbe9Sxc 	IEEE80211_ELEMID_SSID			= 0,
7540ba2cbe9Sxc 	IEEE80211_ELEMID_RATES			= 1,
7550ba2cbe9Sxc 	IEEE80211_ELEMID_FHPARMS		= 2,
7560ba2cbe9Sxc 	IEEE80211_ELEMID_DSPARMS		= 3,
7570ba2cbe9Sxc 	IEEE80211_ELEMID_CFPARMS		= 4,
7580ba2cbe9Sxc 	IEEE80211_ELEMID_TIM			= 5,
7590ba2cbe9Sxc 	IEEE80211_ELEMID_IBSSPARMS		= 6,
7600ba2cbe9Sxc 	IEEE80211_ELEMID_COUNTRY		= 7,
7610ba2cbe9Sxc 	IEEE80211_ELEMID_CHALLENGE		= 16,
7620ba2cbe9Sxc 	/* 17-31 reserved for challenge text extension */
763*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_PWRCNSTR		= 32,
764*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_PWRCAP			= 33,
765*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_TPCREQ			= 34,
766*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_TPCREP			= 35,
767*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_SUPPCHAN		= 36,
768*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_CHANSWITCHANN		= 37,
769*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_MEASREQ		= 38,
770*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_MEASREP		= 39,
771*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_QUIET			= 40,
772*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_IBSSDFS		= 41,
7730ba2cbe9Sxc 	IEEE80211_ELEMID_ERP			= 42,
774*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_HTCAP			= 45,
7750ba2cbe9Sxc 	IEEE80211_ELEMID_RSN			= 48,
7760ba2cbe9Sxc 	IEEE80211_ELEMID_XRATES			= 50,
777*e2cf88acSQuaker Fang 	IEEE80211_ELEMID_HTINFO			= 61,
7780ba2cbe9Sxc 	/* 128-129 proprietary elements used by Agere chipsets */
7790ba2cbe9Sxc 	IEEE80211_ELEMID_AGERE1			= 128,
7800ba2cbe9Sxc 	IEEE80211_ELEMID_AGERE2			= 129,
7810ba2cbe9Sxc 	IEEE80211_ELEMID_TPC			= 150,
7820ba2cbe9Sxc 	IEEE80211_ELEMID_CCKM			= 156,
7830ba2cbe9Sxc 	IEEE80211_ELEMID_VENDOR			= 221	/* vendor private */
7840ba2cbe9Sxc };
7850ba2cbe9Sxc 
786*e2cf88acSQuaker Fang #define	BCM_OUI			0x4c9000	/* Broadcom OUI */
787*e2cf88acSQuaker Fang #define	BCM_OUI_HTCAP		51		/* pre-draft HTCAP ie */
788*e2cf88acSQuaker Fang #define	BCM_OUI_HTINFO		52		/* pre-draft HTINFO ie */
789*e2cf88acSQuaker Fang 
790a399b765Szf #define	WPA_OUI			0xf25000
791a399b765Szf #define	WPA_OUI_TYPE		0x01
792a399b765Szf #define	WPA_VERSION		1		/* current supported version */
793a399b765Szf 
7940ba2cbe9Sxc #define	IEEE80211_CHALLENGE_LEN			128
7950ba2cbe9Sxc 
7960ba2cbe9Sxc #define	IEEE80211_RATE_BASIC			0x80
7970ba2cbe9Sxc #define	IEEE80211_RATE_VAL			0x7f
7980ba2cbe9Sxc 
7990ba2cbe9Sxc /* EPR information element flags */
8000ba2cbe9Sxc #define	IEEE80211_ERP_NON_ERP_PRESENT		0x01
8010ba2cbe9Sxc #define	IEEE80211_ERP_USE_PROTECTION		0x02
8020ba2cbe9Sxc #define	IEEE80211_ERP_LONG_PREAMBLE		0x04
8030ba2cbe9Sxc 
8040ba2cbe9Sxc #define	IEEE80211_AUTH_ALG_OPEN			0x0000
8050ba2cbe9Sxc #define	IEEE80211_AUTH_ALG_SHARED		0x0001
8060ba2cbe9Sxc #define	IEEE80211_AUTH_ALG_LEAP			0x0080
8070ba2cbe9Sxc 
8080ba2cbe9Sxc 
8090ba2cbe9Sxc enum {
8100ba2cbe9Sxc 	IEEE80211_AUTH_OPEN_REQUEST		= 1,
8110ba2cbe9Sxc 	IEEE80211_AUTH_OPEN_RESPONSE		= 2
8120ba2cbe9Sxc };
8130ba2cbe9Sxc 
8140ba2cbe9Sxc enum {
8150ba2cbe9Sxc 	IEEE80211_AUTH_SHARED_REQUEST		= 1,
8160ba2cbe9Sxc 	IEEE80211_AUTH_SHARED_CHALLENGE		= 2,
8170ba2cbe9Sxc 	IEEE80211_AUTH_SHARED_RESPONSE		= 3,
8180ba2cbe9Sxc 	IEEE80211_AUTH_SHARED_PASS		= 4
8190ba2cbe9Sxc };
8200ba2cbe9Sxc 
8210ba2cbe9Sxc /*
8220ba2cbe9Sxc  * Reason codes
8230ba2cbe9Sxc  *
8240ba2cbe9Sxc  * Unlisted codes are reserved
8250ba2cbe9Sxc  */
8260ba2cbe9Sxc enum {
8270ba2cbe9Sxc 	IEEE80211_REASON_UNSPECIFIED		= 1,
8280ba2cbe9Sxc 	IEEE80211_REASON_AUTH_EXPIRE		= 2,
8290ba2cbe9Sxc 	IEEE80211_REASON_AUTH_LEAVE		= 3,
8300ba2cbe9Sxc 	IEEE80211_REASON_ASSOC_EXPIRE		= 4,
8310ba2cbe9Sxc 	IEEE80211_REASON_ASSOC_TOOMANY		= 5,
8320ba2cbe9Sxc 	IEEE80211_REASON_NOT_AUTHED		= 6,
8330ba2cbe9Sxc 	IEEE80211_REASON_NOT_ASSOCED		= 7,
8340ba2cbe9Sxc 	IEEE80211_REASON_ASSOC_LEAVE		= 8,
8350ba2cbe9Sxc 	IEEE80211_REASON_ASSOC_NOT_AUTHED	= 9,
836*e2cf88acSQuaker Fang 	IEEE80211_REASON_DISASSOC_PWRCAP_BAD	= 10,	/* 11h */
837*e2cf88acSQuaker Fang 	IEEE80211_REASON_DISASSOC_SUPCHAN_BAD	= 11,	/* 11h */
838*e2cf88acSQuaker Fang 	IEEE80211_REASON_IE_INVALID		= 13,	/* 11i */
839*e2cf88acSQuaker Fang 	IEEE80211_REASON_MIC_FAILURE		= 14,	/* 11i */
840*e2cf88acSQuaker Fang 	IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT	= 15,	/* 11i */
841*e2cf88acSQuaker Fang 	IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,	/* 11i */
842*e2cf88acSQuaker Fang 	IEEE80211_REASON_IE_IN_4WAY_DIFFERS	= 17,	/* 11i */
843*e2cf88acSQuaker Fang 	IEEE80211_REASON_GROUP_CIPHER_INVALID	= 18,	/* 11i */
844*e2cf88acSQuaker Fang 	IEEE80211_REASON_PAIRWISE_CIPHER_INVALID = 19,	/* 11i */
845*e2cf88acSQuaker Fang 	IEEE80211_REASON_AKMP_INVALID		= 20,	/* 11i */
846*e2cf88acSQuaker Fang 	IEEE80211_REASON_UNSUPP_RSN_IE_VERSION	= 21,	/* 11i */
847*e2cf88acSQuaker Fang 	IEEE80211_REASON_INVALID_RSN_IE_CAP	= 22,	/* 11i */
848*e2cf88acSQuaker Fang 	IEEE80211_REASON_802_1X_AUTH_FAILED	= 23,	/* 11i */
849*e2cf88acSQuaker Fang 	IEEE80211_REASON_CIPHER_SUITE_REJECTED	= 24	/* 11i */
8500ba2cbe9Sxc };
8510ba2cbe9Sxc 
8520ba2cbe9Sxc /*
8530ba2cbe9Sxc  * Status codes
8540ba2cbe9Sxc  *
8550ba2cbe9Sxc  * Unlisted codes are reserved and unused
8560ba2cbe9Sxc  */
8570ba2cbe9Sxc enum {
8580ba2cbe9Sxc 	IEEE80211_STATUS_SUCCESS		= 0,
8590ba2cbe9Sxc 	IEEE80211_STATUS_UNSPECIFIED		= 1,
8600ba2cbe9Sxc 	IEEE80211_STATUS_CAPINFO		= 10,
8610ba2cbe9Sxc 	IEEE80211_STATUS_NOT_ASSOCED		= 11,
8620ba2cbe9Sxc 	IEEE80211_STATUS_OTHER			= 12,
8630ba2cbe9Sxc 	IEEE80211_STATUS_ALG			= 13,
8640ba2cbe9Sxc 	IEEE80211_STATUS_SEQUENCE		= 14,
8650ba2cbe9Sxc 	IEEE80211_STATUS_CHALLENGE		= 15,
8660ba2cbe9Sxc 	IEEE80211_STATUS_TIMEOUT		= 16,
8670ba2cbe9Sxc 	IEEE80211_STATUS_TOOMANY		= 17,
8680ba2cbe9Sxc 	IEEE80211_STATUS_BASIC_RATE		= 18,
869*e2cf88acSQuaker Fang 	IEEE80211_STATUS_SP_REQUIRED		= 19,	/* 11b */
870*e2cf88acSQuaker Fang 	IEEE80211_STATUS_PBCC_REQUIRED		= 20,	/* 11b */
871*e2cf88acSQuaker Fang 	IEEE80211_STATUS_CA_REQUIRED		= 21,	/* 11b */
872*e2cf88acSQuaker Fang 	IEEE80211_STATUS_SPECMGMT_REQUIRED	= 22,	/* 11h */
873*e2cf88acSQuaker Fang 	IEEE80211_STATUS_PWRCAP_REQUIRED	= 23,	/* 11h */
874*e2cf88acSQuaker Fang 	IEEE80211_STATUS_SUPCHAN_REQUIRED	= 24,	/* 11h */
875*e2cf88acSQuaker Fang 	IEEE80211_STATUS_SHORTSLOT_REQUIRED	= 25,	/* 11g */
876*e2cf88acSQuaker Fang 	IEEE80211_STATUS_DSSSOFDM_REQUIRED	= 26,	/* 11g */
877*e2cf88acSQuaker Fang 	IEEE80211_STATUS_INVALID_IE		= 40,	/* 11i */
878*e2cf88acSQuaker Fang 	IEEE80211_STATUS_GROUP_CIPHER_INVALID	= 41,	/* 11i */
879*e2cf88acSQuaker Fang 	IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42,	/* 11i */
880*e2cf88acSQuaker Fang 	IEEE80211_STATUS_AKMP_INVALID		= 43,	/* 11i */
881*e2cf88acSQuaker Fang 	IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION	= 44,	/* 11i */
882*e2cf88acSQuaker Fang 	IEEE80211_STATUS_INVALID_RSN_IE_CAP	= 45,	/* 11i */
883*e2cf88acSQuaker Fang 	IEEE80211_STATUS_CIPHER_SUITE_REJECTED	= 46	/* 11i */
8840ba2cbe9Sxc };
8850ba2cbe9Sxc 
8860ba2cbe9Sxc #define	IEEE80211_WEP_KEYLEN		5	/* 40bit */
8870ba2cbe9Sxc #define	IEEE80211_WEP_IVLEN		3	/* 24bit */
8880ba2cbe9Sxc #define	IEEE80211_WEP_KIDLEN		1	/* 1 octet */
8890ba2cbe9Sxc #define	IEEE80211_WEP_CRCLEN		4	/* CRC-32 */
8900ba2cbe9Sxc #define	IEEE80211_WEP_NKID		4	/* number of key ids */
8910ba2cbe9Sxc 
892a399b765Szf /*
893a399b765Szf  * 802.11i defines an extended IV for use with non-WEP ciphers.
894a399b765Szf  * When the EXTIV bit is set in the key id byte an additional
895a399b765Szf  * 4 bytes immediately follow the IV for TKIP.  For CCMP the
896a399b765Szf  * EXTIV bit is likewise set but the 8 bytes represent the
897a399b765Szf  * CCMP header rather than IV+extended-IV.
898a399b765Szf  */
899a399b765Szf #define	IEEE80211_WEP_EXTIV		0x20
900a399b765Szf #define	IEEE80211_WEP_EXTIVLEN		4	/* extended IV length */
901a399b765Szf #define	IEEE80211_WEP_MICLEN		8	/* trailing MIC */
902a399b765Szf 
9030ba2cbe9Sxc #define	IEEE80211_CRC_LEN		4
9040ba2cbe9Sxc 
9050ba2cbe9Sxc /*
9060ba2cbe9Sxc  * Maximum acceptable MTU is defined by 802.11
9070ba2cbe9Sxc  * Min is arbitrarily chosen > IEEE80211_MIN_LEN.
9080ba2cbe9Sxc  */
9090ba2cbe9Sxc #define	IEEE80211_MTU_MAX		2304
9100ba2cbe9Sxc #define	IEEE80211_MTU_MIN		32
9110ba2cbe9Sxc #define	IEEE80211_MTU			1500
9120ba2cbe9Sxc 
9130ba2cbe9Sxc #define	IEEE80211_MAX_LEN				\
9140ba2cbe9Sxc 	(sizeof (struct ieee80211_frame_addr4) +	\
9150ba2cbe9Sxc 	(IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN) + \
9160ba2cbe9Sxc 	IEEE80211_MTU_MAX + IEEE80211_CRC_LEN)
9170ba2cbe9Sxc #define	IEEE80211_ACK_LEN				\
9180ba2cbe9Sxc 	(sizeof (struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
9190ba2cbe9Sxc #define	IEEE80211_MIN_LEN				\
9200ba2cbe9Sxc 	(sizeof (struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
9210ba2cbe9Sxc 
9220ba2cbe9Sxc /*
9230ba2cbe9Sxc  * The 802.11 spec says at most 2007 stations may be
9240ba2cbe9Sxc  * associated at once.  For most AP's this is way more
9250ba2cbe9Sxc  * than is feasible so we use a default of 128.  This
9260ba2cbe9Sxc  * number may be overridden by the driver and/or by
9270ba2cbe9Sxc  * user configuration.
9280ba2cbe9Sxc  */
9290ba2cbe9Sxc #define	IEEE80211_AID_MAX		2007
9300ba2cbe9Sxc #define	IEEE80211_AID_DEF		128
9310ba2cbe9Sxc 
9320ba2cbe9Sxc #define	IEEE80211_AID(b)		((b) &~ 0xc000)
9330ba2cbe9Sxc 
9340ba2cbe9Sxc /*
9350ba2cbe9Sxc  * RTS frame length parameters.  The default is specified in
9360ba2cbe9Sxc  * the 802.11 spec as 512; we treat it as implementation-dependent
9370ba2cbe9Sxc  * so it's defined in ieee80211_var.h.  The max may be wrong
9380ba2cbe9Sxc  * for jumbo frames.
9390ba2cbe9Sxc  */
9400ba2cbe9Sxc #define	IEEE80211_RTS_MIN		1
9410ba2cbe9Sxc #define	IEEE80211_RTS_MAX		2346
9420ba2cbe9Sxc 
9430ba2cbe9Sxc /*
9440ba2cbe9Sxc  * TX fragmentation parameters.  As above for RTS, we treat
9450ba2cbe9Sxc  * default as implementation-dependent so define it elsewhere.
9460ba2cbe9Sxc  */
9470ba2cbe9Sxc #define	IEEE80211_FRAG_MIN		256
9480ba2cbe9Sxc #define	IEEE80211_FRAG_MAX		2346
9490ba2cbe9Sxc 
9500ba2cbe9Sxc /* flags for ieee80211_fix_rate() */
9510ba2cbe9Sxc #define	IEEE80211_F_DOSORT		0x00000001 /* sort rate list */
9520ba2cbe9Sxc #define	IEEE80211_F_DOFRATE		0x00000002 /* use fixed rate */
9530ba2cbe9Sxc #define	IEEE80211_F_DONEGO		0x00000004 /* calc negotiated rate */
9540ba2cbe9Sxc #define	IEEE80211_F_DODEL		0x00000008 /* delete ignore rate */
955*e2cf88acSQuaker Fang #define	IEEE80211_F_DOBRS		0x00000010 /* check basic rate set */
956*e2cf88acSQuaker Fang #define	IEEE80211_F_JOIN		0x00000020 /* sta joining our bss */
9570ba2cbe9Sxc 
9580ba2cbe9Sxc /*
9590ba2cbe9Sxc  * Beacon frames constructed by ieee80211_beacon_alloc
9600ba2cbe9Sxc  * have the following structure filled in so drivers
9610ba2cbe9Sxc  * can update the frame later w/ minimal overhead.
9620ba2cbe9Sxc  */
9630ba2cbe9Sxc struct ieee80211_beacon_offsets {
9640ba2cbe9Sxc 	uint16_t	*bo_caps;	/* capabilities */
9650ba2cbe9Sxc 	uint8_t		*bo_tim;	/* start of atim/dtim */
9660ba2cbe9Sxc 	uint8_t		*bo_wme;	/* start of WME parameters */
9670ba2cbe9Sxc 	uint8_t		*bo_trailer;	/* start of fixed-size trailer */
9680ba2cbe9Sxc 	uint16_t	bo_tim_len;	/* atim/dtim length in bytes */
9690ba2cbe9Sxc 	uint16_t	bo_trailer_len;	/* trailer length in bytes */
9700ba2cbe9Sxc 	uint8_t		*bo_erp;	/* start of ERP element */
971*e2cf88acSQuaker Fang 	uint8_t		*bo_htinfo;	/* start of HT info element */
9720ba2cbe9Sxc };
9730ba2cbe9Sxc 
9740ba2cbe9Sxc #ifdef	__cplusplus
9750ba2cbe9Sxc }
9760ba2cbe9Sxc #endif
9770ba2cbe9Sxc 
9780ba2cbe9Sxc #endif	/* _SYS_NET80211_PROTO_H */
979