ieee80211.h revision 187797
1116742Ssam/*-
2116904Ssam * Copyright (c) 2001 Atsushi Onoe
3186904Ssam * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
4116742Ssam * All rights reserved.
5116742Ssam *
6116742Ssam * Redistribution and use in source and binary forms, with or without
7116742Ssam * modification, are permitted provided that the following conditions
8116742Ssam * are met:
9116742Ssam * 1. Redistributions of source code must retain the above copyright
10116742Ssam *    notice, this list of conditions and the following disclaimer.
11116742Ssam * 2. Redistributions in binary form must reproduce the above copyright
12116742Ssam *    notice, this list of conditions and the following disclaimer in the
13116742Ssam *    documentation and/or other materials provided with the distribution.
14116742Ssam *
15116904Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16116904Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17116904Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18116904Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19116904Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20116904Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21116904Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22116904Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23116904Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24116904Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25116904Ssam *
26116742Ssam * $FreeBSD: head/sys/net80211/ieee80211.h 187797 2009-01-27 23:00:38Z sam $
27116742Ssam */
28116742Ssam#ifndef _NET80211_IEEE80211_H_
29116742Ssam#define _NET80211_IEEE80211_H_
30116742Ssam
31116742Ssam/*
32116742Ssam * 802.11 protocol definitions.
33116742Ssam */
34116742Ssam
35116742Ssam#define	IEEE80211_ADDR_LEN	6		/* size of 802.11 address */
36116742Ssam/* is 802.11 address multicast/broadcast? */
37116742Ssam#define	IEEE80211_IS_MULTICAST(_a)	(*(_a) & 0x01)
38116742Ssam
39116742Ssam/* IEEE 802.11 PLCP header */
40116742Ssamstruct ieee80211_plcp_hdr {
41170530Ssam	uint16_t	i_sfd;
42170530Ssam	uint8_t		i_signal;
43170530Ssam	uint8_t		i_service;
44170530Ssam	uint16_t	i_length;
45170530Ssam	uint16_t	i_crc;
46138568Ssam} __packed;
47116742Ssam
48127903Ssam#define IEEE80211_PLCP_SFD      0xF3A0
49127903Ssam#define IEEE80211_PLCP_SERVICE  0x00
50178952Ssam#define IEEE80211_PLCP_SERVICE_LOCKED	0x04
51178952Ssam#define IEEE80211_PLCL_SERVICE_PBCC	0x08
52178952Ssam#define IEEE80211_PLCP_SERVICE_LENEXT5	0x20
53178952Ssam#define IEEE80211_PLCP_SERVICE_LENEXT6	0x40
54178952Ssam#define IEEE80211_PLCP_SERVICE_LENEXT7	0x80
55127903Ssam
56116742Ssam/*
57116742Ssam * generic definitions for IEEE 802.11 frames
58116742Ssam */
59116742Ssamstruct ieee80211_frame {
60170530Ssam	uint8_t		i_fc[2];
61170530Ssam	uint8_t		i_dur[2];
62170530Ssam	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
63170530Ssam	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
64170530Ssam	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
65170530Ssam	uint8_t		i_seq[2];
66116742Ssam	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
67116742Ssam	/* see below */
68138568Ssam} __packed;
69116742Ssam
70127903Ssamstruct ieee80211_qosframe {
71170530Ssam	uint8_t		i_fc[2];
72170530Ssam	uint8_t		i_dur[2];
73170530Ssam	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
74170530Ssam	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
75170530Ssam	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
76170530Ssam	uint8_t		i_seq[2];
77170530Ssam	uint8_t		i_qos[2];
78127903Ssam	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
79127903Ssam	/* see below */
80138568Ssam} __packed;
81127903Ssam
82127903Ssamstruct ieee80211_qoscntl {
83170530Ssam	uint8_t		i_qos[2];
84127903Ssam};
85127903Ssam
86116742Ssamstruct ieee80211_frame_addr4 {
87170530Ssam	uint8_t		i_fc[2];
88170530Ssam	uint8_t		i_dur[2];
89170530Ssam	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
90170530Ssam	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
91170530Ssam	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
92170530Ssam	uint8_t		i_seq[2];
93170530Ssam	uint8_t		i_addr4[IEEE80211_ADDR_LEN];
94138568Ssam} __packed;
95116742Ssam
96127903Ssam
97127903Ssamstruct ieee80211_qosframe_addr4 {
98170530Ssam	uint8_t		i_fc[2];
99170530Ssam	uint8_t		i_dur[2];
100170530Ssam	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
101170530Ssam	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
102170530Ssam	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
103170530Ssam	uint8_t		i_seq[2];
104170530Ssam	uint8_t		i_addr4[IEEE80211_ADDR_LEN];
105170530Ssam	uint8_t		i_qos[2];
106138568Ssam} __packed;
107127903Ssam
108116742Ssam#define	IEEE80211_FC0_VERSION_MASK		0x03
109116742Ssam#define	IEEE80211_FC0_VERSION_SHIFT		0
110116742Ssam#define	IEEE80211_FC0_VERSION_0			0x00
111116742Ssam#define	IEEE80211_FC0_TYPE_MASK			0x0c
112116742Ssam#define	IEEE80211_FC0_TYPE_SHIFT		2
113116742Ssam#define	IEEE80211_FC0_TYPE_MGT			0x00
114116742Ssam#define	IEEE80211_FC0_TYPE_CTL			0x04
115116742Ssam#define	IEEE80211_FC0_TYPE_DATA			0x08
116116742Ssam
117116742Ssam#define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
118116742Ssam#define	IEEE80211_FC0_SUBTYPE_SHIFT		4
119116742Ssam/* for TYPE_MGT */
120116742Ssam#define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
121116742Ssam#define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
122116742Ssam#define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
123116742Ssam#define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
124116742Ssam#define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
125116742Ssam#define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
126116742Ssam#define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
127116742Ssam#define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
128116742Ssam#define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
129116742Ssam#define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
130116742Ssam#define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
131170530Ssam#define	IEEE80211_FC0_SUBTYPE_ACTION		0xd0
132116742Ssam/* for TYPE_CTL */
133170530Ssam#define	IEEE80211_FC0_SUBTYPE_BAR		0x80
134116742Ssam#define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
135116742Ssam#define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
136116742Ssam#define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
137116742Ssam#define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
138116742Ssam#define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
139116742Ssam#define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
140116742Ssam/* for TYPE_DATA (bit combination) */
141116742Ssam#define	IEEE80211_FC0_SUBTYPE_DATA		0x00
142116742Ssam#define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
143116742Ssam#define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
144116742Ssam#define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
145116742Ssam#define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
146116742Ssam#define	IEEE80211_FC0_SUBTYPE_CFACK		0x50
147116742Ssam#define	IEEE80211_FC0_SUBTYPE_CFPOLL		0x60
148116742Ssam#define	IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK	0x70
149127903Ssam#define	IEEE80211_FC0_SUBTYPE_QOS		0x80
150138568Ssam#define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
151116742Ssam
152116742Ssam#define	IEEE80211_FC1_DIR_MASK			0x03
153116742Ssam#define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */
154116742Ssam#define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP  */
155116742Ssam#define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */
156116742Ssam#define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP  */
157116742Ssam
158116742Ssam#define	IEEE80211_FC1_MORE_FRAG			0x04
159116742Ssam#define	IEEE80211_FC1_RETRY			0x08
160116742Ssam#define	IEEE80211_FC1_PWR_MGT			0x10
161116742Ssam#define	IEEE80211_FC1_MORE_DATA			0x20
162116742Ssam#define	IEEE80211_FC1_WEP			0x40
163116742Ssam#define	IEEE80211_FC1_ORDER			0x80
164116742Ssam
165116742Ssam#define	IEEE80211_SEQ_FRAG_MASK			0x000f
166116742Ssam#define	IEEE80211_SEQ_FRAG_SHIFT		0
167116742Ssam#define	IEEE80211_SEQ_SEQ_MASK			0xfff0
168116742Ssam#define	IEEE80211_SEQ_SEQ_SHIFT			4
169170530Ssam#define	IEEE80211_SEQ_RANGE			4096
170116742Ssam
171170530Ssam#define	IEEE80211_SEQ_ADD(seq, incr) \
172170530Ssam	(((seq) + (incr)) & (IEEE80211_SEQ_RANGE-1))
173170530Ssam#define	IEEE80211_SEQ_INC(seq)	IEEE80211_SEQ_ADD(seq,1)
174170530Ssam#define	IEEE80211_SEQ_SUB(a, b) \
175170530Ssam	(((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE-1))
176170530Ssam
177173273Ssam#define	IEEE80211_SEQ_BA_RANGE			2048	/* 2^11 */
178173273Ssam#define	IEEE80211_SEQ_BA_BEFORE(a, b) \
179173273Ssam	(IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1)
180173273Ssam
181116742Ssam#define	IEEE80211_NWID_LEN			32
182116742Ssam
183127903Ssam#define	IEEE80211_QOS_TXOP			0x00ff
184127903Ssam/* bit 8 is reserved */
185170530Ssam#define	IEEE80211_QOS_AMSDU			0x80
186170530Ssam#define	IEEE80211_QOS_AMSDU_S			7
187138568Ssam#define	IEEE80211_QOS_ACKPOLICY			0x60
188138568Ssam#define	IEEE80211_QOS_ACKPOLICY_S		5
189170530Ssam#define	IEEE80211_QOS_ACKPOLICY_NOACK		0x20	/* No ACK required */
190170530Ssam#define	IEEE80211_QOS_ACKPOLICY_BA		0x60	/* Block ACK */
191183243Ssam#define	IEEE80211_QOS_EOSP			0x10	/* EndOfService Period*/
192183243Ssam#define	IEEE80211_QOS_EOSP_S			4
193138568Ssam#define	IEEE80211_QOS_TID			0x0f
194127903Ssam
195138568Ssam/* does frame have QoS sequence control data */
196138568Ssam#define	IEEE80211_QOS_HAS_SEQ(wh) \
197138568Ssam	(((wh)->i_fc[0] & \
198138568Ssam	  (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
199138568Ssam	  (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
200138568Ssam
201116742Ssam/*
202138568Ssam * WME/802.11e information element.
203138568Ssam */
204138568Ssamstruct ieee80211_wme_info {
205170530Ssam	uint8_t		wme_id;		/* IEEE80211_ELEMID_VENDOR */
206170530Ssam	uint8_t		wme_len;	/* length in bytes */
207170530Ssam	uint8_t		wme_oui[3];	/* 0x00, 0x50, 0xf2 */
208170530Ssam	uint8_t		wme_type;	/* OUI type */
209170530Ssam	uint8_t		wme_subtype;	/* OUI subtype */
210170530Ssam	uint8_t		wme_version;	/* spec revision */
211170530Ssam	uint8_t		wme_info;	/* QoS info */
212138568Ssam} __packed;
213138568Ssam
214138568Ssam/*
215138568Ssam * WME/802.11e Tspec Element
216138568Ssam */
217138568Ssamstruct ieee80211_wme_tspec {
218170530Ssam	uint8_t		ts_id;
219170530Ssam	uint8_t		ts_len;
220170530Ssam	uint8_t		ts_oui[3];
221170530Ssam	uint8_t		ts_oui_type;
222170530Ssam	uint8_t		ts_oui_subtype;
223170530Ssam	uint8_t		ts_version;
224170530Ssam	uint8_t		ts_tsinfo[3];
225170530Ssam	uint8_t		ts_nom_msdu[2];
226170530Ssam	uint8_t		ts_max_msdu[2];
227170530Ssam	uint8_t		ts_min_svc[4];
228170530Ssam	uint8_t		ts_max_svc[4];
229170530Ssam	uint8_t		ts_inactv_intv[4];
230170530Ssam	uint8_t		ts_susp_intv[4];
231170530Ssam	uint8_t		ts_start_svc[4];
232170530Ssam	uint8_t		ts_min_rate[4];
233170530Ssam	uint8_t		ts_mean_rate[4];
234170530Ssam	uint8_t		ts_max_burst[4];
235170530Ssam	uint8_t		ts_min_phy[4];
236170530Ssam	uint8_t		ts_peak_rate[4];
237170530Ssam	uint8_t		ts_delay[4];
238170530Ssam	uint8_t		ts_surplus[2];
239170530Ssam	uint8_t		ts_medium_time[2];
240138568Ssam} __packed;
241138568Ssam
242138568Ssam/*
243138568Ssam * WME AC parameter field
244138568Ssam */
245138568Ssamstruct ieee80211_wme_acparams {
246170530Ssam	uint8_t		acp_aci_aifsn;
247170530Ssam	uint8_t		acp_logcwminmax;
248170530Ssam	uint16_t	acp_txop;
249138568Ssam} __packed;
250138568Ssam
251138568Ssam#define WME_NUM_AC		4	/* 4 AC categories */
252170530Ssam#define	WME_NUM_TID		16	/* 16 tids */
253138568Ssam
254138568Ssam#define WME_PARAM_ACI		0x60	/* Mask for ACI field */
255138568Ssam#define WME_PARAM_ACI_S		5	/* Shift for ACI field */
256138568Ssam#define WME_PARAM_ACM		0x10	/* Mask for ACM bit */
257138568Ssam#define WME_PARAM_ACM_S		4	/* Shift for ACM bit */
258138568Ssam#define WME_PARAM_AIFSN		0x0f	/* Mask for aifsn field */
259138568Ssam#define WME_PARAM_AIFSN_S	0	/* Shift for aifsn field */
260138568Ssam#define WME_PARAM_LOGCWMIN	0x0f	/* Mask for CwMin field (in log) */
261138568Ssam#define WME_PARAM_LOGCWMIN_S	0	/* Shift for CwMin field */
262138568Ssam#define WME_PARAM_LOGCWMAX	0xf0	/* Mask for CwMax field (in log) */
263138568Ssam#define WME_PARAM_LOGCWMAX_S	4	/* Shift for CwMax field */
264138568Ssam
265138568Ssam#define WME_AC_TO_TID(_ac) (       \
266138568Ssam	((_ac) == WME_AC_VO) ? 6 : \
267138568Ssam	((_ac) == WME_AC_VI) ? 5 : \
268138568Ssam	((_ac) == WME_AC_BK) ? 1 : \
269138568Ssam	0)
270138568Ssam
271138568Ssam#define TID_TO_WME_AC(_tid) (      \
272173863Ssam	((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \
273138568Ssam	((_tid) < 3) ? WME_AC_BK : \
274138568Ssam	((_tid) < 6) ? WME_AC_VI : \
275138568Ssam	WME_AC_VO)
276138568Ssam
277138568Ssam/*
278138568Ssam * WME Parameter Element
279138568Ssam */
280138568Ssamstruct ieee80211_wme_param {
281170530Ssam	uint8_t		param_id;
282170530Ssam	uint8_t		param_len;
283170530Ssam	uint8_t		param_oui[3];
284170530Ssam	uint8_t		param_oui_type;
285172055Ssam	uint8_t		param_oui_subtype;
286170530Ssam	uint8_t		param_version;
287170530Ssam	uint8_t		param_qosInfo;
288138568Ssam#define	WME_QOSINFO_COUNT	0x0f	/* Mask for param count field */
289170530Ssam	uint8_t		param_reserved;
290138568Ssam	struct ieee80211_wme_acparams	params_acParams[WME_NUM_AC];
291138568Ssam} __packed;
292138568Ssam
293138568Ssam/*
294138568Ssam * Management Notification Frame
295138568Ssam */
296138568Ssamstruct ieee80211_mnf {
297170530Ssam	uint8_t		mnf_category;
298170530Ssam	uint8_t		mnf_action;
299170530Ssam	uint8_t		mnf_dialog;
300170530Ssam	uint8_t		mnf_status;
301138568Ssam} __packed;
302138568Ssam#define	MNF_SETUP_REQ	0
303138568Ssam#define	MNF_SETUP_RESP	1
304138568Ssam#define	MNF_TEARDOWN	2
305138568Ssam
306170530Ssam/*
307170530Ssam * 802.11n Management Action Frames
308170530Ssam */
309170530Ssam/* generic frame format */
310170530Ssamstruct ieee80211_action {
311170530Ssam	uint8_t		ia_category;
312170530Ssam	uint8_t		ia_action;
313170530Ssam} __packed;
314170530Ssam
315170530Ssam#define	IEEE80211_ACTION_CAT_QOS	0	/* QoS */
316170530Ssam#define	IEEE80211_ACTION_CAT_BA		3	/* BA */
317172055Ssam#define	IEEE80211_ACTION_CAT_HT		7	/* HT */
318170530Ssam
319170530Ssam#define	IEEE80211_ACTION_HT_TXCHWIDTH	0	/* recommended xmit chan width*/
320170530Ssam#define	IEEE80211_ACTION_HT_MIMOPWRSAVE	1	/* MIMO power save */
321170530Ssam
322170530Ssam/* HT - recommended transmission channel width */
323170530Ssamstruct ieee80211_action_ht_txchwidth {
324170530Ssam	struct ieee80211_action	at_header;
325170530Ssam	uint8_t		at_chwidth;
326170530Ssam} __packed;
327170530Ssam
328170530Ssam#define	IEEE80211_A_HT_TXCHWIDTH_20	0
329170530Ssam#define	IEEE80211_A_HT_TXCHWIDTH_2040	1
330170530Ssam
331172055Ssam/* HT - MIMO Power Save (NB: D2.04) */
332170530Ssamstruct ieee80211_action_ht_mimopowersave {
333170530Ssam	struct ieee80211_action am_header;
334173618Ssam	uint8_t		am_control;
335170530Ssam} __packed;
336170530Ssam
337173618Ssam#define	IEEE80211_A_HT_MIMOPWRSAVE_ENA		0x01	/* PS enabled */
338173618Ssam#define	IEEE80211_A_HT_MIMOPWRSAVE_MODE		0x02
339173618Ssam#define	IEEE80211_A_HT_MIMOPWRSAVE_MODE_S	1
340173618Ssam#define	IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC	0x02	/* Dynamic Mode */
341173618Ssam#define	IEEE80211_A_HT_MIMOPWRSAVE_STATIC	0x00	/* no SM packets */
342173618Ssam/* bits 2-7 reserved */
343173618Ssam
344170530Ssam/* Block Ack actions */
345170530Ssam#define IEEE80211_ACTION_BA_ADDBA_REQUEST       0   /* ADDBA request */
346170530Ssam#define IEEE80211_ACTION_BA_ADDBA_RESPONSE      1   /* ADDBA response */
347170530Ssam#define IEEE80211_ACTION_BA_DELBA	        2   /* DELBA */
348170530Ssam
349170530Ssam/* Block Ack Parameter Set */
350170530Ssam#define	IEEE80211_BAPS_BUFSIZ	0xffc0		/* buffer size */
351170530Ssam#define	IEEE80211_BAPS_BUFSIZ_S	6
352170530Ssam#define	IEEE80211_BAPS_TID	0x003c		/* TID */
353170530Ssam#define	IEEE80211_BAPS_TID_S	2
354170530Ssam#define	IEEE80211_BAPS_POLICY	0x0002		/* block ack policy */
355170530Ssam#define	IEEE80211_BAPS_POLICY_S	1
356170530Ssam
357170530Ssam#define	IEEE80211_BAPS_POLICY_DELAYED	(0<<IEEE80211_BAPS_POLICY_S)
358170530Ssam#define	IEEE80211_BAPS_POLICY_IMMEDIATE	(1<<IEEE80211_BAPS_POLICY_S)
359170530Ssam
360170530Ssam/* Block Ack Sequence Control */
361170530Ssam#define	IEEE80211_BASEQ_START	0xfff0		/* starting seqnum */
362170530Ssam#define	IEEE80211_BASEQ_START_S	4
363170530Ssam#define	IEEE80211_BASEQ_FRAG	0x000f		/* fragment number */
364170530Ssam#define	IEEE80211_BASEQ_FRAG_S	0
365170530Ssam
366170530Ssam/* Delayed Block Ack Parameter Set */
367170530Ssam#define	IEEE80211_DELBAPS_TID	0xf000		/* TID */
368170530Ssam#define	IEEE80211_DELBAPS_TID_S	12
369170530Ssam#define	IEEE80211_DELBAPS_INIT	0x0800		/* initiator */
370170530Ssam#define	IEEE80211_DELBAPS_INIT_S 11
371170530Ssam
372170530Ssam/* BA - ADDBA request */
373170530Ssamstruct ieee80211_action_ba_addbarequest {
374170530Ssam	struct ieee80211_action rq_header;
375170530Ssam	uint8_t		rq_dialogtoken;
376170530Ssam	uint16_t	rq_baparamset;
377170530Ssam	uint16_t	rq_batimeout;		/* in TUs */
378170530Ssam	uint16_t	rq_baseqctl;
379170530Ssam} __packed;
380170530Ssam
381170530Ssam/* BA - ADDBA response */
382170530Ssamstruct ieee80211_action_ba_addbaresponse {
383170530Ssam	struct ieee80211_action rs_header;
384170530Ssam	uint8_t		rs_dialogtoken;
385170530Ssam	uint16_t	rs_statuscode;
386170530Ssam	uint16_t	rs_baparamset;
387170530Ssam	uint16_t	rs_batimeout;		/* in TUs */
388170530Ssam} __packed;
389170530Ssam
390170530Ssam/* BA - DELBA */
391170530Ssamstruct ieee80211_action_ba_delba {
392170530Ssam	struct ieee80211_action dl_header;
393170530Ssam	uint16_t	dl_baparamset;
394170530Ssam	uint16_t	dl_reasoncode;
395170530Ssam} __packed;
396170530Ssam
397170530Ssam/* BAR Control */
398170530Ssam#define	IEEE80211_BAR_TID	0xf000		/* TID */
399170530Ssam#define	IEEE80211_BAR_TID_S	12
400182820Ssam#define	IEEE80211_BAR_COMP	0x0004		/* Compressed Bitmap */
401182820Ssam#define	IEEE80211_BAR_MTID	0x0002		/* Multi-TID */
402182820Ssam#define	IEEE80211_BAR_NOACK	0x0001		/* No-Ack policy */
403170530Ssam
404182820Ssam/* BAR Starting Sequence Control */
405182820Ssam#define	IEEE80211_BAR_SEQ_START	0xfff0		/* starting seqnum */
406182820Ssam#define	IEEE80211_BAR_SEQ_START_S	4
407182820Ssam
408170530Ssamstruct ieee80211_ba_request {
409170530Ssam	uint16_t	rq_barctl;
410170530Ssam	uint16_t	rq_barseqctl;
411170530Ssam} __packed;
412170530Ssam
413138568Ssam/*
414120098Ssam * Control frames.
415120098Ssam */
416120098Ssamstruct ieee80211_frame_min {
417170530Ssam	uint8_t		i_fc[2];
418170530Ssam	uint8_t		i_dur[2];
419170530Ssam	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
420170530Ssam	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
421120098Ssam	/* FCS */
422138568Ssam} __packed;
423120098Ssam
424120098Ssamstruct ieee80211_frame_rts {
425170530Ssam	uint8_t		i_fc[2];
426170530Ssam	uint8_t		i_dur[2];
427170530Ssam	uint8_t		i_ra[IEEE80211_ADDR_LEN];
428170530Ssam	uint8_t		i_ta[IEEE80211_ADDR_LEN];
429120098Ssam	/* FCS */
430138568Ssam} __packed;
431120098Ssam
432120098Ssamstruct ieee80211_frame_cts {
433170530Ssam	uint8_t		i_fc[2];
434170530Ssam	uint8_t		i_dur[2];
435170530Ssam	uint8_t		i_ra[IEEE80211_ADDR_LEN];
436120098Ssam	/* FCS */
437138568Ssam} __packed;
438120098Ssam
439120098Ssamstruct ieee80211_frame_ack {
440170530Ssam	uint8_t		i_fc[2];
441170530Ssam	uint8_t		i_dur[2];
442170530Ssam	uint8_t		i_ra[IEEE80211_ADDR_LEN];
443120098Ssam	/* FCS */
444138568Ssam} __packed;
445120098Ssam
446120098Ssamstruct ieee80211_frame_pspoll {
447170530Ssam	uint8_t		i_fc[2];
448170530Ssam	uint8_t		i_aid[2];
449170530Ssam	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
450170530Ssam	uint8_t		i_ta[IEEE80211_ADDR_LEN];
451120098Ssam	/* FCS */
452138568Ssam} __packed;
453120098Ssam
454120098Ssamstruct ieee80211_frame_cfend {		/* NB: also CF-End+CF-Ack */
455170530Ssam	uint8_t		i_fc[2];
456170530Ssam	uint8_t		i_dur[2];	/* should be zero */
457170530Ssam	uint8_t		i_ra[IEEE80211_ADDR_LEN];
458170530Ssam	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
459120098Ssam	/* FCS */
460138568Ssam} __packed;
461120098Ssam
462170530Ssamstruct ieee80211_frame_bar {
463170530Ssam	uint8_t		i_fc[2];
464170530Ssam	uint8_t		i_dur[2];
465170530Ssam	uint8_t		i_ra[IEEE80211_ADDR_LEN];
466170530Ssam	uint8_t		i_ta[IEEE80211_ADDR_LEN];
467170530Ssam	uint16_t	i_ctl;
468170530Ssam	uint16_t	i_seq;
469170530Ssam	/* FCS */
470170530Ssam} __packed;
471170530Ssam
472120098Ssam/*
473116742Ssam * BEACON management packets
474116742Ssam *
475116742Ssam *	octet timestamp[8]
476116742Ssam *	octet beacon interval[2]
477116742Ssam *	octet capability information[2]
478116742Ssam *	information element
479116742Ssam *		octet elemid
480116742Ssam *		octet length
481116742Ssam *		octet information[length]
482116742Ssam */
483116742Ssam
484116742Ssam#define	IEEE80211_BEACON_INTERVAL(beacon) \
485116742Ssam	((beacon)[8] | ((beacon)[9] << 8))
486116742Ssam#define	IEEE80211_BEACON_CAPABILITY(beacon) \
487116742Ssam	((beacon)[10] | ((beacon)[11] << 8))
488116742Ssam
489116742Ssam#define	IEEE80211_CAPINFO_ESS			0x0001
490116742Ssam#define	IEEE80211_CAPINFO_IBSS			0x0002
491116742Ssam#define	IEEE80211_CAPINFO_CF_POLLABLE		0x0004
492116742Ssam#define	IEEE80211_CAPINFO_CF_POLLREQ		0x0008
493116742Ssam#define	IEEE80211_CAPINFO_PRIVACY		0x0010
494116742Ssam#define	IEEE80211_CAPINFO_SHORT_PREAMBLE	0x0020
495116742Ssam#define	IEEE80211_CAPINFO_PBCC			0x0040
496116742Ssam#define	IEEE80211_CAPINFO_CHNL_AGILITY		0x0080
497172055Ssam#define	IEEE80211_CAPINFO_SPECTRUM_MGMT		0x0100
498172055Ssam/* bit 9 is reserved */
499116742Ssam#define	IEEE80211_CAPINFO_SHORT_SLOTTIME	0x0400
500127903Ssam#define	IEEE80211_CAPINFO_RSN			0x0800
501127903Ssam/* bit 12 is reserved */
502116742Ssam#define	IEEE80211_CAPINFO_DSSSOFDM		0x2000
503116742Ssam/* bits 14-15 are reserved */
504116742Ssam
505187797Ssam#define	IEEE80211_CAPINFO_BITS \
506187797Ssam	"\20\1ESS\2IBSS\3CF_POLLABLE\4CF_POLLREQ\5PRIVACY\6SHORT_PREAMBLE" \
507187797Ssam	"\7PBCC\10CHNL_AGILITY\11SPECTRUM_MGMT\13SHORT_SLOTTIME\14RSN" \
508187797Ssam	"\16DSSOFDM"
509187797Ssam
510116742Ssam/*
511127903Ssam * 802.11i/WPA information element (maximally sized).
512127903Ssam */
513127903Ssamstruct ieee80211_ie_wpa {
514170530Ssam	uint8_t		wpa_id;		/* IEEE80211_ELEMID_VENDOR */
515170530Ssam	uint8_t		wpa_len;	/* length in bytes */
516170530Ssam	uint8_t		wpa_oui[3];	/* 0x00, 0x50, 0xf2 */
517170530Ssam	uint8_t		wpa_type;	/* OUI type */
518170530Ssam	uint16_t	wpa_version;	/* spec revision */
519170530Ssam	uint32_t	wpa_mcipher[1];	/* multicast/group key cipher */
520170530Ssam	uint16_t	wpa_uciphercnt;	/* # pairwise key ciphers */
521170530Ssam	uint32_t	wpa_uciphers[8];/* ciphers */
522170530Ssam	uint16_t	wpa_authselcnt;	/* authentication selector cnt*/
523170530Ssam	uint32_t	wpa_authsels[8];/* selectors */
524170530Ssam	uint16_t	wpa_caps;	/* 802.11i capabilities */
525170530Ssam	uint16_t	wpa_pmkidcnt;	/* 802.11i pmkid count */
526170530Ssam	uint16_t	wpa_pmkids[8];	/* 802.11i pmkids */
527138568Ssam} __packed;
528127903Ssam
529127903Ssam/*
530170530Ssam * 802.11n HT Capability IE
531170530Ssam * NB: these reflect D1.10
532170530Ssam */
533170530Ssamstruct ieee80211_ie_htcap {
534170530Ssam	uint8_t		hc_id;			/* element ID */
535170530Ssam	uint8_t		hc_len;			/* length in bytes */
536170530Ssam	uint16_t	hc_cap;			/* HT caps (see below) */
537170530Ssam	uint8_t		hc_param;		/* HT params (see below) */
538170530Ssam	uint8_t 	hc_mcsset[16]; 		/* supported MCS set */
539170530Ssam	uint16_t	hc_extcap;		/* extended HT capabilities */
540170530Ssam	uint32_t	hc_txbf;		/* txbf capabilities */
541170530Ssam	uint8_t		hc_antenna;		/* antenna capabilities */
542170530Ssam} __packed;
543170530Ssam
544170530Ssam/* HT capability flags (ht_cap) */
545170530Ssam#define	IEEE80211_HTCAP_LDPC		0x0001	/* LDPC supported */
546170530Ssam#define	IEEE80211_HTCAP_CHWIDTH40	0x0002	/* 20/40 supported */
547170530Ssam#define	IEEE80211_HTCAP_SMPS		0x000c	/* SM Power Save mode */
548183243Ssam#define	IEEE80211_HTCAP_SMPS_OFF	0x000c	/* disabled */
549170530Ssam#define	IEEE80211_HTCAP_SMPS_DYNAMIC	0x0004	/* send RTS first */
550170530Ssam/* NB: SMPS value 2 is reserved */
551183243Ssam#define	IEEE80211_HTCAP_SMPS_ENA	0x0000	/* enabled (static mode) */
552170530Ssam#define	IEEE80211_HTCAP_GREENFIELD	0x0010	/* Greenfield supported */
553170530Ssam#define	IEEE80211_HTCAP_SHORTGI20	0x0020	/* Short GI in 20MHz */
554170530Ssam#define	IEEE80211_HTCAP_SHORTGI40	0x0040	/* Short GI in 40MHz */
555170530Ssam#define	IEEE80211_HTCAP_TXSTBC		0x0080	/* STBC tx ok */
556170530Ssam#define	IEEE80211_HTCAP_RXSTBC		0x0300  /* STBC rx support */
557170530Ssam#define	IEEE80211_HTCAP_RXSTBC_S	8
558170530Ssam#define	IEEE80211_HTCAP_RXSTBC_1STREAM	0x0100  /* 1 spatial stream */
559170530Ssam#define	IEEE80211_HTCAP_RXSTBC_2STREAM	0x0200  /* 1-2 spatial streams*/
560170530Ssam#define	IEEE80211_HTCAP_RXSTBC_3STREAM	0x0300  /* 1-3 spatial streams*/
561170530Ssam#define	IEEE80211_HTCAP_DELBA		0x0400	/* HT DELBA supported */
562170530Ssam#define	IEEE80211_HTCAP_MAXAMSDU	0x0800	/* max A-MSDU length */
563170530Ssam#define	IEEE80211_HTCAP_MAXAMSDU_7935	0x0800	/* 7935 octets */
564170530Ssam#define	IEEE80211_HTCAP_MAXAMSDU_3839	0x0000	/* 3839 octets */
565170530Ssam#define	IEEE80211_HTCAP_DSSSCCK40	0x1000  /* DSSS/CCK in 40MHz */
566170530Ssam#define	IEEE80211_HTCAP_PSMP		0x2000  /* PSMP supported */
567170530Ssam#define	IEEE80211_HTCAP_40INTOLERANT	0x4000  /* 40MHz intolerant */
568170530Ssam#define	IEEE80211_HTCAP_LSIGTXOPPROT	0x8000  /* L-SIG TXOP prot */
569170530Ssam
570187797Ssam#define	IEEE80211_HTCAP_BITS \
571187797Ssam	"\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \
572187797Ssam	"\13DELBA\14AMSDU(7935)\15DSSSCCK40\16PSMP\1740INTOLERANT" \
573187797Ssam	"\20LSIGTXOPPROT"
574187797Ssam
575170530Ssam/* HT parameters (hc_param) */
576170530Ssam#define	IEEE80211_HTCAP_MAXRXAMPDU	0x03	/* max rx A-MPDU factor */
577170530Ssam#define	IEEE80211_HTCAP_MAXRXAMPDU_S	0
578173273Ssam#define	IEEE80211_HTCAP_MAXRXAMPDU_8K	0
579173273Ssam#define	IEEE80211_HTCAP_MAXRXAMPDU_16K	1
580173273Ssam#define	IEEE80211_HTCAP_MAXRXAMPDU_32K	2
581173273Ssam#define	IEEE80211_HTCAP_MAXRXAMPDU_64K	3
582170530Ssam#define	IEEE80211_HTCAP_MPDUDENSITY	0x1c	/* min MPDU start spacing */
583170530Ssam#define	IEEE80211_HTCAP_MPDUDENSITY_S	2
584173273Ssam#define	IEEE80211_HTCAP_MPDUDENSITY_NA	0	/* no time restriction */
585173273Ssam#define	IEEE80211_HTCAP_MPDUDENSITY_025	1	/* 1/4 us */
586173273Ssam#define	IEEE80211_HTCAP_MPDUDENSITY_05	2	/* 1/2 us */
587173273Ssam#define	IEEE80211_HTCAP_MPDUDENSITY_1	3	/* 1 us */
588173273Ssam#define	IEEE80211_HTCAP_MPDUDENSITY_2	4	/* 2 us */
589173273Ssam#define	IEEE80211_HTCAP_MPDUDENSITY_4	5	/* 4 us */
590173273Ssam#define	IEEE80211_HTCAP_MPDUDENSITY_8	6	/* 8 us */
591173273Ssam#define	IEEE80211_HTCAP_MPDUDENSITY_16	7	/* 16 us */
592170530Ssam
593170530Ssam/* HT extended capabilities (hc_extcap) */
594170530Ssam#define	IEEE80211_HTCAP_PCO		0x0001	/* PCO capable */
595170530Ssam#define	IEEE80211_HTCAP_PCOTRANS	0x0006	/* PCO transition time */
596170530Ssam#define	IEEE80211_HTCAP_PCOTRANS_S	1
597170530Ssam#define	IEEE80211_HTCAP_PCOTRANS_04	0x0002	/* 400 us */
598170530Ssam#define	IEEE80211_HTCAP_PCOTRANS_15	0x0004	/* 1.5 ms */
599170530Ssam#define	IEEE80211_HTCAP_PCOTRANS_5	0x0006	/* 5 ms */
600170530Ssam/* bits 3-7 reserved */
601170530Ssam#define	IEEE80211_HTCAP_MCSFBACK	0x0300	/* MCS feedback */
602170530Ssam#define	IEEE80211_HTCAP_MCSFBACK_S	8
603170530Ssam#define	IEEE80211_HTCAP_MCSFBACK_NONE	0x0000	/* nothing provided */
604170530Ssam#define	IEEE80211_HTCAP_MCSFBACK_UNSOL	0x0200	/* unsolicited feedback */
605170530Ssam#define	IEEE80211_HTCAP_MCSFBACK_MRQ	0x0300	/* " "+respond to MRQ */
606170530Ssam#define	IEEE80211_HTCAP_HTC		0x0400	/* +HTC support */
607170530Ssam#define	IEEE80211_HTCAP_RDR		0x0800	/* reverse direction responder*/
608170530Ssam/* bits 12-15 reserved */
609170530Ssam
610170530Ssam/*
611170530Ssam * 802.11n HT Information IE
612170530Ssam */
613170530Ssamstruct ieee80211_ie_htinfo {
614170530Ssam	uint8_t		hi_id;			/* element ID */
615170530Ssam	uint8_t		hi_len;			/* length in bytes */
616170530Ssam	uint8_t		hi_ctrlchannel;		/* primary channel */
617170530Ssam	uint8_t		hi_byte1;		/* ht ie byte 1 */
618172055Ssam	uint8_t		hi_byte2;		/* ht ie byte 2 */
619172055Ssam	uint8_t		hi_byte3;		/* ht ie byte 3 */
620170530Ssam	uint16_t	hi_byte45;		/* ht ie bytes 4+5 */
621172055Ssam	uint8_t 	hi_basicmcsset[16]; 	/* basic MCS set */
622170530Ssam} __packed;
623170530Ssam
624170530Ssam/* byte1 */
625170530Ssam#define	IEEE80211_HTINFO_2NDCHAN	0x03	/* secondary/ext chan offset */
626170530Ssam#define	IEEE80211_HTINFO_2NDCHAN_S	0
627170530Ssam#define	IEEE80211_HTINFO_2NDCHAN_NONE	0x00	/* no secondary/ext channel */
628170530Ssam#define	IEEE80211_HTINFO_2NDCHAN_ABOVE	0x01	/* above private channel */
629170530Ssam/* NB: 2 is reserved */
630170530Ssam#define	IEEE80211_HTINFO_2NDCHAN_BELOW	0x03	/* below primary channel */
631170530Ssam#define	IEEE80211_HTINFO_TXWIDTH	0x04	/* tx channel width */
632170530Ssam#define	IEEE80211_HTINFO_TXWIDTH_20	0x00	/* 20MHz width */
633170530Ssam#define	IEEE80211_HTINFO_TXWIDTH_2040	0x04	/* any supported width */
634170530Ssam#define	IEEE80211_HTINFO_RIFSMODE	0x08	/* Reduced IFS (RIFS) use */
635170530Ssam#define	IEEE80211_HTINFO_RIFSMODE_PROH	0x00	/* RIFS use prohibited */
636170530Ssam#define	IEEE80211_HTINFO_RIFSMODE_PERM	0x08	/* RIFS use permitted */
637170530Ssam#define	IEEE80211_HTINFO_PMSPONLY	0x10	/* PSMP required to associate */
638170530Ssam#define	IEEE80211_HTINFO_SIGRAN		0xe0	/* shortest Service Interval */
639170530Ssam#define	IEEE80211_HTINFO_SIGRAN_S	5
640170530Ssam#define	IEEE80211_HTINFO_SIGRAN_5	0x00	/* 5 ms */
641170530Ssam/* XXX add rest */
642170530Ssam
643170530Ssam/* bytes 2+3 */
644170530Ssam#define	IEEE80211_HTINFO_OPMODE		0x03	/* operating mode */
645170530Ssam#define	IEEE80211_HTINFO_OPMODE_S	0
646170530Ssam#define	IEEE80211_HTINFO_OPMODE_PURE	0x00	/* no protection */
647172055Ssam#define	IEEE80211_HTINFO_OPMODE_PROTOPT	0x01	/* protection optional */
648172055Ssam#define	IEEE80211_HTINFO_OPMODE_HT20PR	0x02	/* protection for HT20 sta's */
649172055Ssam#define	IEEE80211_HTINFO_OPMODE_MIXED	0x03	/* protection for legacy sta's*/
650170530Ssam#define	IEEE80211_HTINFO_NONGF_PRESENT	0x04	/* non-GF sta's present */
651170530Ssam#define	IEEE80211_HTINFO_TXBL		0x08	/* transmit burst limit */
652170530Ssam#define	IEEE80211_HTINFO_NONHT_PRESENT	0x10	/* non-HT sta's present */
653170530Ssam/* bits 5-15 reserved */
654170530Ssam
655170530Ssam/* bytes 4+5 */
656170530Ssam#define	IEEE80211_HTINFO_2NDARYBEACON	0x01
657170530Ssam#define	IEEE80211_HTINFO_LSIGTXOPPROT	0x02
658170530Ssam#define	IEEE80211_HTINFO_PCO_ACTIVE	0x04
659170530Ssam#define	IEEE80211_HTINFO_40MHZPHASE	0x08
660170530Ssam
661170530Ssam/* byte5 */
662170530Ssam#define	IEEE80211_HTINFO_BASIC_STBCMCS	0x7f
663170530Ssam#define	IEEE80211_HTINFO_BASIC_STBCMCS_S 0
664170530Ssam#define	IEEE80211_HTINFO_DUALPROTECTED	0x80
665170530Ssam
666170530Ssam/*
667138568Ssam * Management information element payloads.
668116742Ssam */
669116742Ssam
670116742Ssamenum {
671138568Ssam	IEEE80211_ELEMID_SSID		= 0,
672138568Ssam	IEEE80211_ELEMID_RATES		= 1,
673138568Ssam	IEEE80211_ELEMID_FHPARMS	= 2,
674138568Ssam	IEEE80211_ELEMID_DSPARMS	= 3,
675138568Ssam	IEEE80211_ELEMID_CFPARMS	= 4,
676138568Ssam	IEEE80211_ELEMID_TIM		= 5,
677138568Ssam	IEEE80211_ELEMID_IBSSPARMS	= 6,
678138568Ssam	IEEE80211_ELEMID_COUNTRY	= 7,
679138568Ssam	IEEE80211_ELEMID_CHALLENGE	= 16,
680127903Ssam	/* 17-31 reserved for challenge text extension */
681170530Ssam	IEEE80211_ELEMID_PWRCNSTR	= 32,
682170530Ssam	IEEE80211_ELEMID_PWRCAP		= 33,
683170530Ssam	IEEE80211_ELEMID_TPCREQ		= 34,
684170530Ssam	IEEE80211_ELEMID_TPCREP		= 35,
685170530Ssam	IEEE80211_ELEMID_SUPPCHAN	= 36,
686170530Ssam	IEEE80211_ELEMID_CHANSWITCHANN	= 37,
687170530Ssam	IEEE80211_ELEMID_MEASREQ	= 38,
688170530Ssam	IEEE80211_ELEMID_MEASREP	= 39,
689170530Ssam	IEEE80211_ELEMID_QUIET		= 40,
690170530Ssam	IEEE80211_ELEMID_IBSSDFS	= 41,
691138568Ssam	IEEE80211_ELEMID_ERP		= 42,
692170530Ssam	IEEE80211_ELEMID_HTCAP		= 45,
693138568Ssam	IEEE80211_ELEMID_RSN		= 48,
694138568Ssam	IEEE80211_ELEMID_XRATES		= 50,
695170530Ssam	IEEE80211_ELEMID_HTINFO		= 61,
696138568Ssam	IEEE80211_ELEMID_TPC		= 150,
697138568Ssam	IEEE80211_ELEMID_CCKM		= 156,
698138568Ssam	IEEE80211_ELEMID_VENDOR		= 221,	/* vendor private */
699116742Ssam};
700116742Ssam
701138568Ssamstruct ieee80211_tim_ie {
702170530Ssam	uint8_t		tim_ie;			/* IEEE80211_ELEMID_TIM */
703170530Ssam	uint8_t		tim_len;
704170530Ssam	uint8_t		tim_count;		/* DTIM count */
705170530Ssam	uint8_t		tim_period;		/* DTIM period */
706170530Ssam	uint8_t		tim_bitctl;		/* bitmap control */
707170530Ssam	uint8_t		tim_bitmap[1];		/* variable-length bitmap */
708138568Ssam} __packed;
709127903Ssam
710138568Ssamstruct ieee80211_country_ie {
711170530Ssam	uint8_t		ie;			/* IEEE80211_ELEMID_COUNTRY */
712170530Ssam	uint8_t		len;
713170530Ssam	uint8_t		cc[3];			/* ISO CC+(I)ndoor/(O)utdoor */
714138568Ssam	struct {
715170530Ssam		uint8_t schan;			/* starting channel */
716170530Ssam		uint8_t nchan;			/* number channels */
717170530Ssam		uint8_t maxtxpwr;		/* tx power cap */
718178354Ssam	} __packed band[1];			/* sub bands (NB: var size) */
719138568Ssam} __packed;
720116742Ssam
721178354Ssam#define	IEEE80211_COUNTRY_MAX_BANDS	84	/* max possible bands */
722178354Ssam#define	IEEE80211_COUNTRY_MAX_SIZE \
723178354Ssam	(sizeof(struct ieee80211_country_ie) + 3*(IEEE80211_COUNTRY_MAX_BANDS-1))
724178354Ssam
725170530Ssam/*
726172055Ssam * 802.11h Channel Switch Announcement (CSA).
727172055Ssam */
728172055Ssamstruct ieee80211_csa_ie {
729172055Ssam	uint8_t		csa_ie;		/* IEEE80211_ELEMID_CHANSWITCHANN */
730172055Ssam	uint8_t		csa_len;
731172055Ssam	uint8_t		csa_mode;		/* Channel Switch Mode */
732172055Ssam	uint8_t		csa_newchan;		/* New Channel Number */
733172055Ssam	uint8_t		csa_count;		/* Channel Switch Count */
734172055Ssam} __packed;
735172055Ssam
736172055Ssam/*
737170530Ssam * Atheros advanced capability information element.
738170530Ssam */
739170530Ssamstruct ieee80211_ath_ie {
740170530Ssam	uint8_t		ath_id;			/* IEEE80211_ELEMID_VENDOR */
741170530Ssam	uint8_t		ath_len;		/* length in bytes */
742170530Ssam	uint8_t		ath_oui[3];		/* 0x00, 0x03, 0x7f */
743170530Ssam	uint8_t		ath_oui_type;		/* OUI type */
744170530Ssam	uint8_t		ath_oui_subtype;	/* OUI subtype */
745170530Ssam	uint8_t		ath_version;		/* spec revision */
746170530Ssam	uint8_t		ath_capability;		/* capability info */
747170530Ssam#define	ATHEROS_CAP_TURBO_PRIME		0x01	/* dynamic turbo--aka Turbo' */
748170530Ssam#define	ATHEROS_CAP_COMPRESSION		0x02	/* data compression */
749170530Ssam#define	ATHEROS_CAP_FAST_FRAME		0x04	/* fast (jumbo) frames */
750170530Ssam#define	ATHEROS_CAP_XR			0x08	/* Xtended Range support */
751170530Ssam#define	ATHEROS_CAP_AR			0x10	/* Advanded Radar support */
752170530Ssam#define	ATHEROS_CAP_BURST		0x20	/* Bursting - not negotiated */
753170530Ssam#define	ATHEROS_CAP_WME			0x40	/* CWMin tuning */
754170530Ssam#define	ATHEROS_CAP_BOOST		0x80	/* use turbo/!turbo mode */
755170530Ssam	uint8_t		ath_defkeyix[2];
756170530Ssam} __packed;
757170530Ssam
758172055Ssam/* rate set entries are in .5 Mb/s units, and potentially marked as basic */
759138568Ssam#define	IEEE80211_RATE_BASIC		0x80
760138568Ssam#define	IEEE80211_RATE_VAL		0x7f
761138568Ssam
762116742Ssam/* EPR information element flags */
763138568Ssam#define	IEEE80211_ERP_NON_ERP_PRESENT	0x01
764138568Ssam#define	IEEE80211_ERP_USE_PROTECTION	0x02
765138568Ssam#define	IEEE80211_ERP_LONG_PREAMBLE	0x04
766116742Ssam
767187797Ssam#define	IEEE80211_ERP_BITS \
768187797Ssam	"\20\1NON_ERP_PRESENT\2USE_PROTECTION\3LONG_PREAMBLE"
769187797Ssam
770170530Ssam#define	ATH_OUI			0x7f0300	/* Atheros OUI */
771127903Ssam#define	ATH_OUI_TYPE		0x01
772170530Ssam#define	ATH_OUI_SUBTYPE		0x01
773170530Ssam#define	ATH_OUI_VERSION		0x00
774127903Ssam
775170530Ssam#define	BCM_OUI			0x4c9000	/* Broadcom OUI */
776170530Ssam#define	BCM_OUI_HTCAP		51		/* pre-draft HTCAP ie */
777170530Ssam#define	BCM_OUI_HTINFO		52		/* pre-draft HTINFO ie */
778170530Ssam
779127903Ssam#define	WPA_OUI			0xf25000
780127903Ssam#define	WPA_OUI_TYPE		0x01
781138568Ssam#define	WPA_VERSION		1		/* current supported version */
782127903Ssam
783127903Ssam#define	WPA_CSE_NULL		0x00
784127903Ssam#define	WPA_CSE_WEP40		0x01
785127903Ssam#define	WPA_CSE_TKIP		0x02
786127903Ssam#define	WPA_CSE_CCMP		0x04
787127903Ssam#define	WPA_CSE_WEP104		0x05
788127903Ssam
789127903Ssam#define	WPA_ASE_NONE		0x00
790127903Ssam#define	WPA_ASE_8021X_UNSPEC	0x01
791127903Ssam#define	WPA_ASE_8021X_PSK	0x02
792127903Ssam
793181347Ssam#define	WPS_OUI_TYPE		0x04
794181347Ssam
795138568Ssam#define	RSN_OUI			0xac0f00
796138568Ssam#define	RSN_VERSION		1		/* current supported version */
797138568Ssam
798138568Ssam#define	RSN_CSE_NULL		0x00
799138568Ssam#define	RSN_CSE_WEP40		0x01
800138568Ssam#define	RSN_CSE_TKIP		0x02
801138568Ssam#define	RSN_CSE_WRAP		0x03
802138568Ssam#define	RSN_CSE_CCMP		0x04
803138568Ssam#define	RSN_CSE_WEP104		0x05
804138568Ssam
805138568Ssam#define	RSN_ASE_NONE		0x00
806138568Ssam#define	RSN_ASE_8021X_UNSPEC	0x01
807138568Ssam#define	RSN_ASE_8021X_PSK	0x02
808138568Ssam
809138568Ssam#define	RSN_CAP_PREAUTH		0x01
810138568Ssam
811138568Ssam#define	WME_OUI			0xf25000
812138568Ssam#define	WME_OUI_TYPE		0x02
813138568Ssam#define	WME_INFO_OUI_SUBTYPE	0x00
814138568Ssam#define	WME_PARAM_OUI_SUBTYPE	0x01
815138568Ssam#define	WME_VERSION		1
816138568Ssam
817138568Ssam/* WME stream classes */
818138568Ssam#define	WME_AC_BE	0		/* best effort */
819138568Ssam#define	WME_AC_BK	1		/* background */
820138568Ssam#define	WME_AC_VI	2		/* video */
821138568Ssam#define	WME_AC_VO	3		/* voice */
822138568Ssam
823116742Ssam/*
824116742Ssam * AUTH management packets
825116742Ssam *
826116742Ssam *	octet algo[2]
827116742Ssam *	octet seq[2]
828116742Ssam *	octet status[2]
829116742Ssam *	octet chal.id
830116742Ssam *	octet chal.length
831172055Ssam *	octet chal.text[253]		NB: 1-253 bytes
832116742Ssam */
833116742Ssam
834172055Ssam/* challenge length for shared key auth */
835172055Ssam#define IEEE80211_CHALLENGE_LEN		128
836116742Ssam
837138568Ssam#define	IEEE80211_AUTH_ALG_OPEN		0x0000
838138568Ssam#define	IEEE80211_AUTH_ALG_SHARED	0x0001
839138568Ssam#define	IEEE80211_AUTH_ALG_LEAP		0x0080
840116742Ssam
841116742Ssamenum {
842116742Ssam	IEEE80211_AUTH_OPEN_REQUEST		= 1,
843116742Ssam	IEEE80211_AUTH_OPEN_RESPONSE		= 2,
844116742Ssam};
845116742Ssam
846116742Ssamenum {
847116742Ssam	IEEE80211_AUTH_SHARED_REQUEST		= 1,
848116742Ssam	IEEE80211_AUTH_SHARED_CHALLENGE		= 2,
849116742Ssam	IEEE80211_AUTH_SHARED_RESPONSE		= 3,
850116742Ssam	IEEE80211_AUTH_SHARED_PASS		= 4,
851116742Ssam};
852116742Ssam
853116742Ssam/*
854172055Ssam * Reason and status codes.
855116742Ssam *
856172055Ssam * Reason codes are used in management frames to indicate why an
857172055Ssam * action took place (e.g. on disassociation).  Status codes are
858172055Ssam * used in management frames to indicate the result of an operation.
859172055Ssam *
860116742Ssam * Unlisted codes are reserved
861116742Ssam */
862116742Ssam
863116742Ssamenum {
864116742Ssam	IEEE80211_REASON_UNSPECIFIED		= 1,
865116742Ssam	IEEE80211_REASON_AUTH_EXPIRE		= 2,
866116742Ssam	IEEE80211_REASON_AUTH_LEAVE		= 3,
867116742Ssam	IEEE80211_REASON_ASSOC_EXPIRE		= 4,
868116742Ssam	IEEE80211_REASON_ASSOC_TOOMANY		= 5,
869116742Ssam	IEEE80211_REASON_NOT_AUTHED		= 6,
870116742Ssam	IEEE80211_REASON_NOT_ASSOCED		= 7,
871116742Ssam	IEEE80211_REASON_ASSOC_LEAVE		= 8,
872116742Ssam	IEEE80211_REASON_ASSOC_NOT_AUTHED	= 9,
873172055Ssam	IEEE80211_REASON_DISASSOC_PWRCAP_BAD	= 10,	/* 11h */
874172055Ssam	IEEE80211_REASON_DISASSOC_SUPCHAN_BAD	= 11,	/* 11h */
875172055Ssam	IEEE80211_REASON_IE_INVALID		= 13,	/* 11i */
876172055Ssam	IEEE80211_REASON_MIC_FAILURE		= 14,	/* 11i */
877172055Ssam	IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT	= 15,	/* 11i */
878172055Ssam	IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,	/* 11i */
879172055Ssam	IEEE80211_REASON_IE_IN_4WAY_DIFFERS	= 17,	/* 11i */
880172055Ssam	IEEE80211_REASON_GROUP_CIPHER_INVALID	= 18,	/* 11i */
881172055Ssam	IEEE80211_REASON_PAIRWISE_CIPHER_INVALID= 19,	/* 11i */
882172055Ssam	IEEE80211_REASON_AKMP_INVALID		= 20,	/* 11i */
883172055Ssam	IEEE80211_REASON_UNSUPP_RSN_IE_VERSION	= 21,	/* 11i */
884172055Ssam	IEEE80211_REASON_INVALID_RSN_IE_CAP	= 22,	/* 11i */
885172055Ssam	IEEE80211_REASON_802_1X_AUTH_FAILED	= 23,	/* 11i */
886172055Ssam	IEEE80211_REASON_CIPHER_SUITE_REJECTED	= 24,	/* 11i */
887182820Ssam	IEEE80211_REASON_UNSPECIFIED_QOS	= 32,	/* 11e */
888182820Ssam	IEEE80211_REASON_INSUFFICIENT_BW	= 33,	/* 11e */
889182820Ssam	IEEE80211_REASON_TOOMANY_FRAMES		= 34,	/* 11e */
890182820Ssam	IEEE80211_REASON_OUTSIDE_TXOP		= 35,	/* 11e */
891182820Ssam	IEEE80211_REASON_LEAVING_QBSS		= 36,	/* 11e */
892182820Ssam	IEEE80211_REASON_BAD_MECHANISM		= 37,	/* 11e */
893182820Ssam	IEEE80211_REASON_SETUP_NEEDED		= 38,	/* 11e */
894182820Ssam	IEEE80211_REASON_TIMEOUT		= 39,	/* 11e */
895116742Ssam
896116742Ssam	IEEE80211_STATUS_SUCCESS		= 0,
897116742Ssam	IEEE80211_STATUS_UNSPECIFIED		= 1,
898116742Ssam	IEEE80211_STATUS_CAPINFO		= 10,
899116742Ssam	IEEE80211_STATUS_NOT_ASSOCED		= 11,
900116742Ssam	IEEE80211_STATUS_OTHER			= 12,
901116742Ssam	IEEE80211_STATUS_ALG			= 13,
902116742Ssam	IEEE80211_STATUS_SEQUENCE		= 14,
903116742Ssam	IEEE80211_STATUS_CHALLENGE		= 15,
904116742Ssam	IEEE80211_STATUS_TIMEOUT		= 16,
905116742Ssam	IEEE80211_STATUS_TOOMANY		= 17,
906116742Ssam	IEEE80211_STATUS_BASIC_RATE		= 18,
907172055Ssam	IEEE80211_STATUS_SP_REQUIRED		= 19,	/* 11b */
908172055Ssam	IEEE80211_STATUS_PBCC_REQUIRED		= 20,	/* 11b */
909172055Ssam	IEEE80211_STATUS_CA_REQUIRED		= 21,	/* 11b */
910172055Ssam	IEEE80211_STATUS_SPECMGMT_REQUIRED	= 22,	/* 11h */
911172055Ssam	IEEE80211_STATUS_PWRCAP_REQUIRED	= 23,	/* 11h */
912172055Ssam	IEEE80211_STATUS_SUPCHAN_REQUIRED	= 24,	/* 11h */
913172055Ssam	IEEE80211_STATUS_SHORTSLOT_REQUIRED	= 25,	/* 11g */
914172055Ssam	IEEE80211_STATUS_DSSSOFDM_REQUIRED	= 26,	/* 11g */
915172055Ssam	IEEE80211_STATUS_INVALID_IE		= 40,	/* 11i */
916172055Ssam	IEEE80211_STATUS_GROUP_CIPHER_INVALID	= 41,	/* 11i */
917172055Ssam	IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42,	/* 11i */
918172055Ssam	IEEE80211_STATUS_AKMP_INVALID		= 43,	/* 11i */
919172055Ssam	IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION	= 44,	/* 11i */
920172055Ssam	IEEE80211_STATUS_INVALID_RSN_IE_CAP	= 45,	/* 11i */
921172055Ssam	IEEE80211_STATUS_CIPHER_SUITE_REJECTED	= 46,	/* 11i */
922116742Ssam};
923116742Ssam
924138568Ssam#define	IEEE80211_WEP_KEYLEN		5	/* 40bit */
925138568Ssam#define	IEEE80211_WEP_IVLEN		3	/* 24bit */
926138568Ssam#define	IEEE80211_WEP_KIDLEN		1	/* 1 octet */
927138568Ssam#define	IEEE80211_WEP_CRCLEN		4	/* CRC-32 */
928178354Ssam#define	IEEE80211_WEP_TOTLEN		(IEEE80211_WEP_IVLEN + \
929178354Ssam					 IEEE80211_WEP_KIDLEN + \
930178354Ssam					 IEEE80211_WEP_CRCLEN)
931138568Ssam#define	IEEE80211_WEP_NKID		4	/* number of key ids */
932116742Ssam
933138568Ssam/*
934138568Ssam * 802.11i defines an extended IV for use with non-WEP ciphers.
935138568Ssam * When the EXTIV bit is set in the key id byte an additional
936138568Ssam * 4 bytes immediately follow the IV for TKIP.  For CCMP the
937138568Ssam * EXTIV bit is likewise set but the 8 bytes represent the
938138568Ssam * CCMP header rather than IV+extended-IV.
939138568Ssam */
940138568Ssam#define	IEEE80211_WEP_EXTIV		0x20
941138568Ssam#define	IEEE80211_WEP_EXTIVLEN		4	/* extended IV length */
942138568Ssam#define	IEEE80211_WEP_MICLEN		8	/* trailing MIC */
943116742Ssam
944138568Ssam#define	IEEE80211_CRC_LEN		4
945138568Ssam
946124457Ssam/*
947124457Ssam * Maximum acceptable MTU is:
948124457Ssam *	IEEE80211_MAX_LEN - WEP overhead - CRC -
949124457Ssam *		QoS overhead - RSN/WPA overhead
950124457Ssam * Min is arbitrarily chosen > IEEE80211_MIN_LEN.  The default
951124457Ssam * mtu is Ethernet-compatible; it's set by ether_ifattach.
952124457Ssam */
953138568Ssam#define	IEEE80211_MTU_MAX		2290
954138568Ssam#define	IEEE80211_MTU_MIN		32
955124457Ssam
956138568Ssam#define	IEEE80211_MAX_LEN		(2300 + IEEE80211_CRC_LEN + \
957116742Ssam    (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
958138568Ssam#define	IEEE80211_ACK_LEN \
959138568Ssam	(sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
960120098Ssam#define	IEEE80211_MIN_LEN \
961120098Ssam	(sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
962116742Ssam
963138568Ssam/*
964138568Ssam * The 802.11 spec says at most 2007 stations may be
965138568Ssam * associated at once.  For most AP's this is way more
966178354Ssam * than is feasible so we use a default of IEEE80211_AID_DEF.
967178354Ssam * This number may be overridden by the driver and/or by
968178354Ssam * user configuration but may not be less than IEEE80211_AID_MIN
969178354Ssam * (see _ieee80211.h for implementation-specific settings).
970138568Ssam */
971138568Ssam#define	IEEE80211_AID_MAX		2007
972138568Ssam
973138568Ssam#define	IEEE80211_AID(b)	((b) &~ 0xc000)
974138568Ssam
975116742Ssam/*
976116742Ssam * RTS frame length parameters.  The default is specified in
977148291Ssam * the 802.11 spec as 512; we treat it as implementation-dependent
978148291Ssam * so it's defined in ieee80211_var.h.  The max may be wrong
979148291Ssam * for jumbo frames.
980116742Ssam */
981138568Ssam#define	IEEE80211_RTS_MIN		1
982148291Ssam#define	IEEE80211_RTS_MAX		2346
983116742Ssam
984148291Ssam/*
985148291Ssam * TX fragmentation parameters.  As above for RTS, we treat
986148291Ssam * default as implementation-dependent so define it elsewhere.
987148291Ssam */
988148291Ssam#define	IEEE80211_FRAG_MIN		256
989148291Ssam#define	IEEE80211_FRAG_MAX		2346
990148291Ssam
991160685Ssam/*
992160685Ssam * Beacon interval (TU's).  Min+max come from WiFi requirements.
993160685Ssam * As above, we treat default as implementation-dependent so
994160685Ssam * define it elsewhere.
995160685Ssam */
996160685Ssam#define	IEEE80211_BINTVAL_MAX	1000	/* max beacon interval (TU's) */
997160685Ssam#define	IEEE80211_BINTVAL_MIN	25	/* min beacon interval (TU's) */
998160685Ssam
999160685Ssam/*
1000160685Ssam * DTIM period (beacons).  Min+max are not really defined
1001160685Ssam * by the protocol but we want them publicly visible so
1002160685Ssam * define them here.
1003160685Ssam */
1004160685Ssam#define	IEEE80211_DTIM_MAX	15	/* max DTIM period */
1005160685Ssam#define	IEEE80211_DTIM_MIN	1	/* min DTIM period */
1006160685Ssam
1007160685Ssam/*
1008160685Ssam * Beacon miss threshold (beacons).  As for DTIM, we define
1009160685Ssam * them here to be publicly visible.  Note the max may be
1010160685Ssam * clamped depending on device capabilities.
1011160685Ssam */
1012160685Ssam#define	IEEE80211_HWBMISS_MIN 	1
1013160685Ssam#define	IEEE80211_HWBMISS_MAX 	255
1014160685Ssam
1015170530Ssam/*
1016170530Ssam * 802.11 frame duration definitions.
1017170530Ssam */
1018170530Ssam
1019170530Ssamstruct ieee80211_duration {
1020170530Ssam	uint16_t	d_rts_dur;
1021170530Ssam	uint16_t	d_data_dur;
1022170530Ssam	uint16_t	d_plcp_len;
1023170530Ssam	uint8_t		d_residue;	/* unused octets in time slot */
1024170530Ssam};
1025170530Ssam
1026170530Ssam/* One Time Unit (TU) is 1Kus = 1024 microseconds. */
1027170530Ssam#define IEEE80211_DUR_TU		1024
1028170530Ssam
1029170530Ssam/* IEEE 802.11b durations for DSSS PHY in microseconds */
1030170530Ssam#define IEEE80211_DUR_DS_LONG_PREAMBLE	144
1031170530Ssam#define IEEE80211_DUR_DS_SHORT_PREAMBLE	72
1032170530Ssam
1033170530Ssam#define IEEE80211_DUR_DS_SLOW_PLCPHDR	48
1034170530Ssam#define IEEE80211_DUR_DS_FAST_PLCPHDR	24
1035170530Ssam#define IEEE80211_DUR_DS_SLOW_ACK	112
1036170530Ssam#define IEEE80211_DUR_DS_FAST_ACK	56
1037170530Ssam#define IEEE80211_DUR_DS_SLOW_CTS	112
1038170530Ssam#define IEEE80211_DUR_DS_FAST_CTS	56
1039170530Ssam
1040170530Ssam#define IEEE80211_DUR_DS_SLOT		20
1041170530Ssam#define IEEE80211_DUR_DS_SIFS		10
1042170530Ssam#define IEEE80211_DUR_DS_PIFS	(IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)
1043170530Ssam#define IEEE80211_DUR_DS_DIFS	(IEEE80211_DUR_DS_SIFS + \
1044170530Ssam				 2 * IEEE80211_DUR_DS_SLOT)
1045170530Ssam#define IEEE80211_DUR_DS_EIFS	(IEEE80211_DUR_DS_SIFS + \
1046170530Ssam				 IEEE80211_DUR_DS_SLOW_ACK + \
1047170530Ssam				 IEEE80211_DUR_DS_LONG_PREAMBLE + \
1048170530Ssam				 IEEE80211_DUR_DS_SLOW_PLCPHDR + \
1049170530Ssam				 IEEE80211_DUR_DIFS)
1050170530Ssam
1051170530Ssam/*
1052170530Ssam * Atheros fast-frame encapsulation format.
1053170530Ssam * FF max payload:
1054170530Ssam * 802.2 + FFHDR + HPAD + 802.3 + 802.2 + 1500 + SPAD + 802.3 + 802.2 + 1500:
1055170530Ssam *   8   +   4   +  4   +   14  +   8   + 1500 +  6   +   14  +   8   + 1500
1056170530Ssam * = 3066
1057170530Ssam */
1058170530Ssam/* fast frame header is 32-bits */
1059170530Ssam#define	ATH_FF_PROTO	0x0000003f	/* protocol */
1060170530Ssam#define	ATH_FF_PROTO_S	0
1061170530Ssam#define	ATH_FF_FTYPE	0x000000c0	/* frame type */
1062170530Ssam#define	ATH_FF_FTYPE_S	6
1063170530Ssam#define	ATH_FF_HLEN32	0x00000300	/* optional hdr length */
1064170530Ssam#define	ATH_FF_HLEN32_S	8
1065170530Ssam#define	ATH_FF_SEQNUM	0x001ffc00	/* sequence number */
1066170530Ssam#define	ATH_FF_SEQNUM_S	10
1067170530Ssam#define	ATH_FF_OFFSET	0xffe00000	/* offset to 2nd payload */
1068170530Ssam#define	ATH_FF_OFFSET_S	21
1069170530Ssam
1070170530Ssam#define	ATH_FF_MAX_HDR_PAD	4
1071170530Ssam#define	ATH_FF_MAX_SEP_PAD	6
1072170530Ssam#define	ATH_FF_MAX_HDR		30
1073170530Ssam
1074170530Ssam#define	ATH_FF_PROTO_L2TUNNEL	0	/* L2 tunnel protocol */
1075170530Ssam#define	ATH_FF_ETH_TYPE		0x88bd	/* Ether type for encapsulated frames */
1076170530Ssam#define	ATH_FF_SNAP_ORGCODE_0	0x00
1077170530Ssam#define	ATH_FF_SNAP_ORGCODE_1	0x03
1078170530Ssam#define	ATH_FF_SNAP_ORGCODE_2	0x7f
1079170530Ssam
1080186904Ssamstruct ieee80211_tdma_param {
1081186904Ssam	u_int8_t	tdma_id;	/* IEEE80211_ELEMID_VENDOR */
1082186904Ssam	u_int8_t	tdma_len;
1083186904Ssam	u_int8_t	tdma_oui[3];	/* 0x00, 0x03, 0x7f */
1084186904Ssam	u_int8_t	tdma_type;	/* OUI type */
1085186904Ssam	u_int8_t	tdma_subtype;	/* OUI subtype */
1086186904Ssam	u_int8_t	tdma_version;	/* spec revision */
1087186904Ssam	u_int8_t	tdma_slot;	/* station slot # */
1088186904Ssam	u_int8_t	tdma_slotcnt;	/* bss slot count */
1089186904Ssam	u_int16_t	tdma_slotlen;	/* bss slot len (100us) */
1090186904Ssam	u_int8_t	tdma_bintval;	/* beacon interval (superframes) */
1091186904Ssam	u_int8_t	tdma_inuse[1];	/* slot occupancy map */
1092186904Ssam	u_int8_t	tdma_pad[2];
1093186904Ssam	u_int8_t	tdma_tstamp[8];	/* timestamp from last beacon */
1094186904Ssam} __packed;
1095186904Ssam
1096186904Ssam/* NB: Atheros allocated the OUI for this purpose ~3 years ago but beware ... */
1097186904Ssam#define	TDMA_OUI		ATH_OUI
1098186904Ssam#define	TDMA_OUI_TYPE		0x02
1099186904Ssam#define	TDMA_SUBTYPE_PARAM	0x01
1100186904Ssam#define	TDMA_VERSION		2
1101186904Ssam
1102116742Ssam#endif /* _NET80211_IEEE80211_H_ */
1103