Wed Nov 3 20:05:22 2010 UTC ()
From: Anon Ymous
add a few constants so that if_otus.c compiles.


(christos)
diff -r1.20 -r1.21 src/sys/net80211/ieee80211.h

cvs diff -r1.20 -r1.21 src/sys/net80211/ieee80211.h (switch to unified diff)

--- src/sys/net80211/ieee80211.h 2008/11/06 03:28:59 1.20
+++ src/sys/net80211/ieee80211.h 2010/11/03 20:05:21 1.21
@@ -1,694 +1,699 @@ @@ -1,694 +1,699 @@
1/* $NetBSD: ieee80211.h,v 1.20 2008/11/06 03:28:59 dyoung Exp $ */ 1/* $NetBSD: ieee80211.h,v 1.21 2010/11/03 20:05:21 christos Exp $ */
2/*- 2/*-
3 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2001 Atsushi Onoe
4 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 4 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products 15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission. 16 * derived from this software without specific prior written permission.
17 * 17 *
18 * Alternatively, this software may be distributed under the terms of the 18 * Alternatively, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") version 2 as published by the Free 19 * GNU General Public License ("GPL") version 2 as published by the Free
20 * Software Foundation. 20 * Software Foundation.
21 * 21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * 32 *
33 * $FreeBSD: src/sys/net80211/ieee80211.h,v 1.10 2005/07/22 16:55:27 sam Exp $ 33 * $FreeBSD: src/sys/net80211/ieee80211.h,v 1.10 2005/07/22 16:55:27 sam Exp $
34 */ 34 */
35#ifndef _NET80211_IEEE80211_H_ 35#ifndef _NET80211_IEEE80211_H_
36#define _NET80211_IEEE80211_H_ 36#define _NET80211_IEEE80211_H_
37 37
38/* 38/*
39 * 802.11 protocol definitions. 39 * 802.11 protocol definitions.
40 */ 40 */
41 41
42#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ 42#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
43/* is 802.11 address multicast/broadcast? */ 43/* is 802.11 address multicast/broadcast? */
44#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) 44#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01)
45 45
46/* IEEE 802.11 PLCP header */ 46/* IEEE 802.11 PLCP header */
47struct ieee80211_plcp_hdr { 47struct ieee80211_plcp_hdr {
48 u_int16_t i_sfd; 48 u_int16_t i_sfd;
49 u_int8_t i_signal; 49 u_int8_t i_signal;
50 u_int8_t i_service; 50 u_int8_t i_service;
51 u_int16_t i_length; 51 u_int16_t i_length;
52 u_int16_t i_crc; 52 u_int16_t i_crc;
53} __packed; 53} __packed;
54 54
55#define IEEE80211_PLCP_SFD 0xF3A0  55#define IEEE80211_PLCP_SFD 0xF3A0
56#define IEEE80211_PLCP_SERVICE 0x00 56#define IEEE80211_PLCP_SERVICE 0x00
57 57
58/* 58/*
59 * generic definitions for IEEE 802.11 frames 59 * generic definitions for IEEE 802.11 frames
60 */ 60 */
61struct ieee80211_frame { 61struct ieee80211_frame {
62 u_int8_t i_fc[2]; 62 u_int8_t i_fc[2];
63 u_int8_t i_dur[2]; 63 u_int8_t i_dur[2];
64 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 64 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
65 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 65 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
66 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 66 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
67 u_int8_t i_seq[2]; 67 u_int8_t i_seq[2];
68 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 68 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
69 /* see below */ 69 /* see below */
70} __packed; 70} __packed;
71 71
72struct ieee80211_qosframe { 72struct ieee80211_qosframe {
73 u_int8_t i_fc[2]; 73 u_int8_t i_fc[2];
74 u_int8_t i_dur[2]; 74 u_int8_t i_dur[2];
75 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 75 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
76 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 76 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
77 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 77 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
78 u_int8_t i_seq[2]; 78 u_int8_t i_seq[2];
79 u_int8_t i_qos[2]; 79 u_int8_t i_qos[2];
80 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ 80 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
81 /* see below */ 81 /* see below */
82} __packed; 82} __packed;
83 83
84struct ieee80211_qoscntl { 84struct ieee80211_qoscntl {
85 u_int8_t i_qos[2]; 85 u_int8_t i_qos[2];
86}; 86};
87 87
88struct ieee80211_frame_addr4 { 88struct ieee80211_frame_addr4 {
89 u_int8_t i_fc[2]; 89 u_int8_t i_fc[2];
90 u_int8_t i_dur[2]; 90 u_int8_t i_dur[2];
91 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 91 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
92 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 92 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
93 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 93 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
94 u_int8_t i_seq[2]; 94 u_int8_t i_seq[2];
95 u_int8_t i_addr4[IEEE80211_ADDR_LEN]; 95 u_int8_t i_addr4[IEEE80211_ADDR_LEN];
96} __packed; 96} __packed;
97 97
98 98
99struct ieee80211_qosframe_addr4 { 99struct ieee80211_qosframe_addr4 {
100 u_int8_t i_fc[2]; 100 u_int8_t i_fc[2];
101 u_int8_t i_dur[2]; 101 u_int8_t i_dur[2];
102 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 102 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
103 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 103 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
104 u_int8_t i_addr3[IEEE80211_ADDR_LEN]; 104 u_int8_t i_addr3[IEEE80211_ADDR_LEN];
105 u_int8_t i_seq[2]; 105 u_int8_t i_seq[2];
106 u_int8_t i_addr4[IEEE80211_ADDR_LEN]; 106 u_int8_t i_addr4[IEEE80211_ADDR_LEN];
107 u_int8_t i_qos[2]; 107 u_int8_t i_qos[2];
108} __packed; 108} __packed;
109 109
110#define IEEE80211_FC0_VERSION_MASK 0x03 110#define IEEE80211_FC0_VERSION_MASK 0x03
111#define IEEE80211_FC0_VERSION_SHIFT 0 111#define IEEE80211_FC0_VERSION_SHIFT 0
112#define IEEE80211_FC0_VERSION_0 0x00 112#define IEEE80211_FC0_VERSION_0 0x00
113#define IEEE80211_FC0_TYPE_MASK 0x0c 113#define IEEE80211_FC0_TYPE_MASK 0x0c
114#define IEEE80211_FC0_TYPE_SHIFT 2 114#define IEEE80211_FC0_TYPE_SHIFT 2
115#define IEEE80211_FC0_TYPE_MGT 0x00 115#define IEEE80211_FC0_TYPE_MGT 0x00
116#define IEEE80211_FC0_TYPE_CTL 0x04 116#define IEEE80211_FC0_TYPE_CTL 0x04
117#define IEEE80211_FC0_TYPE_DATA 0x08 117#define IEEE80211_FC0_TYPE_DATA 0x08
118 118
119#define IEEE80211_FC0_SUBTYPE_MASK 0xf0 119#define IEEE80211_FC0_SUBTYPE_MASK 0xf0
120#define IEEE80211_FC0_SUBTYPE_SHIFT 4 120#define IEEE80211_FC0_SUBTYPE_SHIFT 4
121/* for TYPE_MGT */ 121/* for TYPE_MGT */
122#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 122#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
123#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 123#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
124#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 124#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
125#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 125#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
126#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 126#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
127#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 127#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
128#define IEEE80211_FC0_SUBTYPE_BEACON 0x80 128#define IEEE80211_FC0_SUBTYPE_BEACON 0x80
129#define IEEE80211_FC0_SUBTYPE_ATIM 0x90 129#define IEEE80211_FC0_SUBTYPE_ATIM 0x90
130#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 130#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
131#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 131#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
132#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 132#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
133/* for TYPE_CTL */ 133/* for TYPE_CTL */
134#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 134#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
135#define IEEE80211_FC0_SUBTYPE_RTS 0xb0 135#define IEEE80211_FC0_SUBTYPE_RTS 0xb0
136#define IEEE80211_FC0_SUBTYPE_CTS 0xc0 136#define IEEE80211_FC0_SUBTYPE_CTS 0xc0
137#define IEEE80211_FC0_SUBTYPE_ACK 0xd0 137#define IEEE80211_FC0_SUBTYPE_ACK 0xd0
138#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 138#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
139#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 139#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
140/* for TYPE_DATA (bit combination) */ 140/* for TYPE_DATA (bit combination) */
141#define IEEE80211_FC0_SUBTYPE_DATA 0x00 141#define IEEE80211_FC0_SUBTYPE_DATA 0x00
142#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 142#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
143#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 143#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
144#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 144#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
145#define IEEE80211_FC0_SUBTYPE_NODATA 0x40 145#define IEEE80211_FC0_SUBTYPE_NODATA 0x40
146#define IEEE80211_FC0_SUBTYPE_CFACK 0x50 146#define IEEE80211_FC0_SUBTYPE_CFACK 0x50
147#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 147#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60
148#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 148#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70
149#define IEEE80211_FC0_SUBTYPE_QOS 0x80 149#define IEEE80211_FC0_SUBTYPE_QOS 0x80
150#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 150#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0
151 151
152#define IEEE80211_FC1_DIR_MASK 0x03 152#define IEEE80211_FC1_DIR_MASK 0x03
153#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ 153#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
154#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ 154#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
155#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ 155#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
156#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ 156#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
157 157
158#define IEEE80211_FC1_MORE_FRAG 0x04 158#define IEEE80211_FC1_MORE_FRAG 0x04
159#define IEEE80211_FC1_RETRY 0x08 159#define IEEE80211_FC1_RETRY 0x08
160#define IEEE80211_FC1_PWR_MGT 0x10 160#define IEEE80211_FC1_PWR_MGT 0x10
161#define IEEE80211_FC1_MORE_DATA 0x20 161#define IEEE80211_FC1_MORE_DATA 0x20
162#define IEEE80211_FC1_WEP 0x40 162#define IEEE80211_FC1_PROTECTED 0x40
 163#define IEEE80211_FC1_WEP 0x40 /* pre-RSNA compat */
163#define IEEE80211_FC1_ORDER 0x80 164#define IEEE80211_FC1_ORDER 0x80
164 165
165#define IEEE80211_SEQ_FRAG_MASK 0x000f 166#define IEEE80211_SEQ_FRAG_MASK 0x000f
166#define IEEE80211_SEQ_FRAG_SHIFT 0 167#define IEEE80211_SEQ_FRAG_SHIFT 0
167#define IEEE80211_SEQ_SEQ_MASK 0xfff0 168#define IEEE80211_SEQ_SEQ_MASK 0xfff0
168#define IEEE80211_SEQ_SEQ_SHIFT 4 169#define IEEE80211_SEQ_SEQ_SHIFT 4
169 170
170#define IEEE80211_NWID_LEN 32 171#define IEEE80211_NWID_LEN 32
171 172
172#define IEEE80211_QOS_TXOP 0x00ff 173#define IEEE80211_QOS_TXOP 0x00ff
173/* bit 8 is reserved */ 174/* bit 8 is reserved */
174#define IEEE80211_QOS_ACKPOLICY 0x60 175#define IEEE80211_QOS_ACKPOLICY 0x60
175#define IEEE80211_QOS_ACKPOLICY_S 5 176#define IEEE80211_QOS_ACKPOLICY_S 5
176#define IEEE80211_QOS_ESOP 0x10 177#define IEEE80211_QOS_ESOP 0x10
177#define IEEE80211_QOS_ESOP_S 4 178#define IEEE80211_QOS_ESOP_S 4
178#define IEEE80211_QOS_TID 0x0f 179#define IEEE80211_QOS_TID 0x0f
179 180
180/* does frame have QoS sequence control data */ 181/* does frame have QoS sequence control data */
181#define IEEE80211_QOS_HAS_SEQ(wh) \ 182#define IEEE80211_QOS_HAS_SEQ(wh) \
182 (((wh)->i_fc[0] & \ 183 (((wh)->i_fc[0] & \
183 (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \ 184 (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
184 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) 185 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
185 186
186/* 187/*
187 * WME/802.11e information element. 188 * WME/802.11e information element.
188 */ 189 */
189struct ieee80211_wme_info { 190struct ieee80211_wme_info {
190 u_int8_t wme_id; /* IEEE80211_ELEMID_VENDOR */ 191 u_int8_t wme_id; /* IEEE80211_ELEMID_VENDOR */
191 u_int8_t wme_len; /* length in bytes */ 192 u_int8_t wme_len; /* length in bytes */
192 u_int8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */ 193 u_int8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */
193 u_int8_t wme_type; /* OUI type */ 194 u_int8_t wme_type; /* OUI type */
194 u_int8_t wme_subtype; /* OUI subtype */ 195 u_int8_t wme_subtype; /* OUI subtype */
195 u_int8_t wme_version; /* spec revision */ 196 u_int8_t wme_version; /* spec revision */
196 u_int8_t wme_info; /* QoS info */ 197 u_int8_t wme_info; /* QoS info */
197} __packed; 198} __packed;
198 199
199/* 200/*
200 * WME/802.11e Tspec Element 201 * WME/802.11e Tspec Element
201 */ 202 */
202struct ieee80211_wme_tspec { 203struct ieee80211_wme_tspec {
203 u_int8_t ts_id; 204 u_int8_t ts_id;
204 u_int8_t ts_len; 205 u_int8_t ts_len;
205 u_int8_t ts_oui[3]; 206 u_int8_t ts_oui[3];
206 u_int8_t ts_oui_type; 207 u_int8_t ts_oui_type;
207 u_int8_t ts_oui_subtype; 208 u_int8_t ts_oui_subtype;
208 u_int8_t ts_version; 209 u_int8_t ts_version;
209 u_int8_t ts_tsinfo[3]; 210 u_int8_t ts_tsinfo[3];
210 u_int8_t ts_nom_msdu[2]; 211 u_int8_t ts_nom_msdu[2];
211 u_int8_t ts_max_msdu[2]; 212 u_int8_t ts_max_msdu[2];
212 u_int8_t ts_min_svc[4]; 213 u_int8_t ts_min_svc[4];
213 u_int8_t ts_max_svc[4]; 214 u_int8_t ts_max_svc[4];
214 u_int8_t ts_inactv_intv[4]; 215 u_int8_t ts_inactv_intv[4];
215 u_int8_t ts_susp_intv[4]; 216 u_int8_t ts_susp_intv[4];
216 u_int8_t ts_start_svc[4]; 217 u_int8_t ts_start_svc[4];
217 u_int8_t ts_min_rate[4]; 218 u_int8_t ts_min_rate[4];
218 u_int8_t ts_mean_rate[4]; 219 u_int8_t ts_mean_rate[4];
219 u_int8_t ts_max_burst[4]; 220 u_int8_t ts_max_burst[4];
220 u_int8_t ts_min_phy[4]; 221 u_int8_t ts_min_phy[4];
221 u_int8_t ts_peak_rate[4]; 222 u_int8_t ts_peak_rate[4];
222 u_int8_t ts_delay[4]; 223 u_int8_t ts_delay[4];
223 u_int8_t ts_surplus[2]; 224 u_int8_t ts_surplus[2];
224 u_int8_t ts_medium_time[2]; 225 u_int8_t ts_medium_time[2];
225} __packed; 226} __packed;
226 227
227/* 228/*
228 * WME AC parameter field 229 * WME AC parameter field
229 */ 230 */
230struct ieee80211_wme_acparams { 231struct ieee80211_wme_acparams {
231 u_int8_t acp_aci_aifsn; 232 u_int8_t acp_aci_aifsn;
232 u_int8_t acp_logcwminmax; 233 u_int8_t acp_logcwminmax;
233 u_int16_t acp_txop; 234 u_int16_t acp_txop;
234} __packed; 235} __packed;
235 236
236#define WME_NUM_AC 4 /* 4 AC categories */ 237#define WME_NUM_AC 4 /* 4 AC categories */
237 238
238#define WME_PARAM_ACI 0x60 /* Mask for ACI field */ 239#define WME_PARAM_ACI 0x60 /* Mask for ACI field */
239#define WME_PARAM_ACI_S 5 /* Shift for ACI field */ 240#define WME_PARAM_ACI_S 5 /* Shift for ACI field */
240#define WME_PARAM_ACM 0x10 /* Mask for ACM bit */ 241#define WME_PARAM_ACM 0x10 /* Mask for ACM bit */
241#define WME_PARAM_ACM_S 4 /* Shift for ACM bit */ 242#define WME_PARAM_ACM_S 4 /* Shift for ACM bit */
242#define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */ 243#define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */
243#define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */ 244#define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */
244#define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */ 245#define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */
245#define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */ 246#define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */
246#define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */ 247#define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */
247#define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ 248#define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */
248 249
249#define WME_AC_TO_TID(_ac) ( \ 250#define WME_AC_TO_TID(_ac) ( \
250 ((_ac) == WME_AC_VO) ? 6 : \ 251 ((_ac) == WME_AC_VO) ? 6 : \
251 ((_ac) == WME_AC_VI) ? 5 : \ 252 ((_ac) == WME_AC_VI) ? 5 : \
252 ((_ac) == WME_AC_BK) ? 1 : \ 253 ((_ac) == WME_AC_BK) ? 1 : \
253 0) 254 0)
254 255
255#define TID_TO_WME_AC(_tid) ( \ 256#define TID_TO_WME_AC(_tid) ( \
256 ((_tid) < 1) ? WME_AC_BE : \ 257 ((_tid) < 1) ? WME_AC_BE : \
257 ((_tid) < 3) ? WME_AC_BK : \ 258 ((_tid) < 3) ? WME_AC_BK : \
258 ((_tid) < 6) ? WME_AC_VI : \ 259 ((_tid) < 6) ? WME_AC_VI : \
259 WME_AC_VO) 260 WME_AC_VO)
260 261
261/* 262/*
262 * WME Parameter Element 263 * WME Parameter Element
263 */ 264 */
264struct ieee80211_wme_param { 265struct ieee80211_wme_param {
265 u_int8_t param_id; 266 u_int8_t param_id;
266 u_int8_t param_len; 267 u_int8_t param_len;
267 u_int8_t param_oui[3]; 268 u_int8_t param_oui[3];
268 u_int8_t param_oui_type; 269 u_int8_t param_oui_type;
269 u_int8_t param_oui_sybtype; 270 u_int8_t param_oui_sybtype;
270 u_int8_t param_version; 271 u_int8_t param_version;
271 u_int8_t param_qosInfo; 272 u_int8_t param_qosInfo;
272#define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */ 273#define WME_QOSINFO_COUNT 0x0f /* Mask for param count field */
273 u_int8_t param_reserved; 274 u_int8_t param_reserved;
274 struct ieee80211_wme_acparams params_acParams[WME_NUM_AC]; 275 struct ieee80211_wme_acparams params_acParams[WME_NUM_AC];
275} __packed; 276} __packed;
276 277
277/* 278/*
278 * Management Notification Frame 279 * Management Notification Frame
279 */ 280 */
280struct ieee80211_mnf { 281struct ieee80211_mnf {
281 u_int8_t mnf_category; 282 u_int8_t mnf_category;
282 u_int8_t mnf_action; 283 u_int8_t mnf_action;
283 u_int8_t mnf_dialog; 284 u_int8_t mnf_dialog;
284 u_int8_t mnf_status; 285 u_int8_t mnf_status;
285} __packed; 286} __packed;
286#define MNF_SETUP_REQ 0 287#define MNF_SETUP_REQ 0
287#define MNF_SETUP_RESP 1 288#define MNF_SETUP_RESP 1
288#define MNF_TEARDOWN 2 289#define MNF_TEARDOWN 2
289 290
290/* 291/*
291 * Control frames. 292 * Control frames.
292 */ 293 */
293struct ieee80211_frame_min { 294struct ieee80211_frame_min {
294 u_int8_t i_fc[2]; 295 u_int8_t i_fc[2];
295 u_int8_t i_dur[2]; 296 u_int8_t i_dur[2];
296 u_int8_t i_addr1[IEEE80211_ADDR_LEN]; 297 u_int8_t i_addr1[IEEE80211_ADDR_LEN];
297 u_int8_t i_addr2[IEEE80211_ADDR_LEN]; 298 u_int8_t i_addr2[IEEE80211_ADDR_LEN];
298 /* FCS */ 299 /* FCS */
299} __packed; 300} __packed;
300 301
301struct ieee80211_frame_rts { 302struct ieee80211_frame_rts {
302 u_int8_t i_fc[2]; 303 u_int8_t i_fc[2];
303 u_int8_t i_dur[2]; 304 u_int8_t i_dur[2];
304 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 305 u_int8_t i_ra[IEEE80211_ADDR_LEN];
305 u_int8_t i_ta[IEEE80211_ADDR_LEN]; 306 u_int8_t i_ta[IEEE80211_ADDR_LEN];
306 /* FCS */ 307 /* FCS */
307} __packed; 308} __packed;
308 309
309struct ieee80211_frame_cts { 310struct ieee80211_frame_cts {
310 u_int8_t i_fc[2]; 311 u_int8_t i_fc[2];
311 u_int8_t i_dur[2]; 312 u_int8_t i_dur[2];
312 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 313 u_int8_t i_ra[IEEE80211_ADDR_LEN];
313 /* FCS */ 314 /* FCS */
314} __packed; 315} __packed;
315 316
316struct ieee80211_frame_ack { 317struct ieee80211_frame_ack {
317 u_int8_t i_fc[2]; 318 u_int8_t i_fc[2];
318 u_int8_t i_dur[2]; 319 u_int8_t i_dur[2];
319 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 320 u_int8_t i_ra[IEEE80211_ADDR_LEN];
320 /* FCS */ 321 /* FCS */
321} __packed; 322} __packed;
322 323
323struct ieee80211_frame_pspoll { 324struct ieee80211_frame_pspoll {
324 u_int8_t i_fc[2]; 325 u_int8_t i_fc[2];
325 u_int8_t i_aid[2]; 326 u_int8_t i_aid[2];
326 u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 327 u_int8_t i_bssid[IEEE80211_ADDR_LEN];
327 u_int8_t i_ta[IEEE80211_ADDR_LEN]; 328 u_int8_t i_ta[IEEE80211_ADDR_LEN];
328 /* FCS */ 329 /* FCS */
329} __packed; 330} __packed;
330 331
331struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */ 332struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */
332 u_int8_t i_fc[2]; 333 u_int8_t i_fc[2];
333 u_int8_t i_dur[2]; /* should be zero */ 334 u_int8_t i_dur[2]; /* should be zero */
334 u_int8_t i_ra[IEEE80211_ADDR_LEN]; 335 u_int8_t i_ra[IEEE80211_ADDR_LEN];
335 u_int8_t i_bssid[IEEE80211_ADDR_LEN]; 336 u_int8_t i_bssid[IEEE80211_ADDR_LEN];
336 /* FCS */ 337 /* FCS */
337} __packed; 338} __packed;
338 339
339/* 340/*
340 * BEACON management packets 341 * BEACON management packets
341 * 342 *
342 * octet timestamp[8] 343 * octet timestamp[8]
343 * octet beacon interval[2] 344 * octet beacon interval[2]
344 * octet capability information[2] 345 * octet capability information[2]
345 * information element 346 * information element
346 * octet elemid 347 * octet elemid
347 * octet length 348 * octet length
348 * octet information[length] 349 * octet information[length]
349 */ 350 */
350 351
351typedef u_int8_t *ieee80211_mgt_beacon_t; 352typedef u_int8_t *ieee80211_mgt_beacon_t;
352 353
353#define IEEE80211_BEACON_INTERVAL(beacon) \ 354#define IEEE80211_BEACON_INTERVAL(beacon) \
354 ((beacon)[8] | ((beacon)[9] << 8)) 355 ((beacon)[8] | ((beacon)[9] << 8))
355#define IEEE80211_BEACON_CAPABILITY(beacon) \ 356#define IEEE80211_BEACON_CAPABILITY(beacon) \
356 ((beacon)[10] | ((beacon)[11] << 8)) 357 ((beacon)[10] | ((beacon)[11] << 8))
357 358
358#define IEEE80211_CAPINFO_ESS 0x0001 359#define IEEE80211_CAPINFO_ESS 0x0001
359#define IEEE80211_CAPINFO_IBSS 0x0002 360#define IEEE80211_CAPINFO_IBSS 0x0002
360#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004 361#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004
361#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008 362#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008
362#define IEEE80211_CAPINFO_PRIVACY 0x0010 363#define IEEE80211_CAPINFO_PRIVACY 0x0010
363#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020 364#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020
364#define IEEE80211_CAPINFO_PBCC 0x0040 365#define IEEE80211_CAPINFO_PBCC 0x0040
365#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080 366#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080
366/* bits 8-9 are reserved */ 367/* bits 8-9 are reserved */
367#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400 368#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400
368#define IEEE80211_CAPINFO_RSN 0x0800 369#define IEEE80211_CAPINFO_RSN 0x0800
369/* bit 12 is reserved */ 370/* bit 12 is reserved */
370#define IEEE80211_CAPINFO_DSSSOFDM 0x2000 371#define IEEE80211_CAPINFO_DSSSOFDM 0x2000
371/* bits 14-15 are reserved */ 372/* bits 14-15 are reserved */
372 373
373/* 374/*
374 * 802.11i/WPA information element (maximally sized). 375 * 802.11i/WPA information element (maximally sized).
375 */ 376 */
376struct ieee80211_ie_wpa { 377struct ieee80211_ie_wpa {
377 u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */ 378 u_int8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */
378 u_int8_t wpa_len; /* length in bytes */ 379 u_int8_t wpa_len; /* length in bytes */
379 u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */ 380 u_int8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */
380 u_int8_t wpa_type; /* OUI type */ 381 u_int8_t wpa_type; /* OUI type */
381 u_int16_t wpa_version; /* spec revision */ 382 u_int16_t wpa_version; /* spec revision */
382 u_int32_t wpa_mcipher[1]; /* multicast/group key cipher */ 383 u_int32_t wpa_mcipher[1]; /* multicast/group key cipher */
383 u_int16_t wpa_uciphercnt; /* # pairwise key ciphers */ 384 u_int16_t wpa_uciphercnt; /* # pairwise key ciphers */
384 u_int32_t wpa_uciphers[8];/* ciphers */ 385 u_int32_t wpa_uciphers[8];/* ciphers */
385 u_int16_t wpa_authselcnt; /* authentication selector cnt*/ 386 u_int16_t wpa_authselcnt; /* authentication selector cnt*/
386 u_int32_t wpa_authsels[8];/* selectors */ 387 u_int32_t wpa_authsels[8];/* selectors */
387 u_int16_t wpa_caps; /* 802.11i capabilities */ 388 u_int16_t wpa_caps; /* 802.11i capabilities */
388 u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */ 389 u_int16_t wpa_pmkidcnt; /* 802.11i pmkid count */
389 u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */ 390 u_int16_t wpa_pmkids[8]; /* 802.11i pmkids */
390} __packed; 391} __packed;
391 392
392/* 393/*
393 * Management information element payloads. 394 * Management information element payloads.
394 */ 395 */
395 396
396enum { 397enum {
397 IEEE80211_ELEMID_SSID = 0, 398 IEEE80211_ELEMID_SSID = 0,
398 IEEE80211_ELEMID_RATES = 1, 399 IEEE80211_ELEMID_RATES = 1,
399 IEEE80211_ELEMID_FHPARMS = 2, 400 IEEE80211_ELEMID_FHPARMS = 2,
400 IEEE80211_ELEMID_DSPARMS = 3, 401 IEEE80211_ELEMID_DSPARMS = 3,
401 IEEE80211_ELEMID_CFPARMS = 4, 402 IEEE80211_ELEMID_CFPARMS = 4,
402 IEEE80211_ELEMID_TIM = 5, 403 IEEE80211_ELEMID_TIM = 5,
403 IEEE80211_ELEMID_IBSSPARMS = 6, 404 IEEE80211_ELEMID_IBSSPARMS = 6,
404 IEEE80211_ELEMID_COUNTRY = 7, 405 IEEE80211_ELEMID_COUNTRY = 7,
 406 IEEE80211_ELEMID_EDCAPARMS = 12,
405 IEEE80211_ELEMID_CHALLENGE = 16, 407 IEEE80211_ELEMID_CHALLENGE = 16,
406 /* 17-31 reserved for challenge text extension */ 408 /* 17-31 reserved for challenge text extension */
407 IEEE80211_ELEMID_PWRCNSTR = 32, 409 IEEE80211_ELEMID_PWRCNSTR = 32,
408 IEEE80211_ELEMID_PWRCAP = 33, 410 IEEE80211_ELEMID_PWRCAP = 33,
409 IEEE80211_ELEMID_TPCREQ = 34, 411 IEEE80211_ELEMID_TPCREQ = 34,
410 IEEE80211_ELEMID_TPCREP = 35, 412 IEEE80211_ELEMID_TPCREP = 35,
411 IEEE80211_ELEMID_SUPPCHAN = 36, 413 IEEE80211_ELEMID_SUPPCHAN = 36,
412 IEEE80211_ELEMID_CHANSWITCHANN = 37, 414 IEEE80211_ELEMID_CHANSWITCHANN = 37,
413 IEEE80211_ELEMID_MEASREQ = 38, 415 IEEE80211_ELEMID_MEASREQ = 38,
414 IEEE80211_ELEMID_MEASREP = 39, 416 IEEE80211_ELEMID_MEASREP = 39,
415 IEEE80211_ELEMID_QUIET = 40, 417 IEEE80211_ELEMID_QUIET = 40,
416 IEEE80211_ELEMID_IBSSDFS = 41, 418 IEEE80211_ELEMID_IBSSDFS = 41,
417 IEEE80211_ELEMID_ERP = 42, 419 IEEE80211_ELEMID_ERP = 42,
418 IEEE80211_ELEMID_HTCAP = 45, 420 IEEE80211_ELEMID_HTCAP = 45, /* 11n */
 421 IEEE80211_ELEMID_QOS_CAP = 46,
419 IEEE80211_ELEMID_RSN = 48, 422 IEEE80211_ELEMID_RSN = 48,
420 IEEE80211_ELEMID_XRATES = 50, 423 IEEE80211_ELEMID_XRATES = 50,
421 IEEE80211_ELEMID_HTINFO = 61, 424 IEEE80211_ELEMID_TIE = 56, /* 11r */
 425 IEEE80211_ELEMID_HTINFO = 61, /* 11n */
 426 IEEE80211_ELEMID_MMIE = 76, /* 11w */
422 IEEE80211_ELEMID_TPC = 150, 427 IEEE80211_ELEMID_TPC = 150,
423 IEEE80211_ELEMID_CCKM = 156, 428 IEEE80211_ELEMID_CCKM = 156,
424 IEEE80211_ELEMID_VENDOR = 221 /* vendor private */ 429 IEEE80211_ELEMID_VENDOR = 221 /* vendor private */
425}; 430};
426 431
427struct ieee80211_tim_ie { 432struct ieee80211_tim_ie {
428 u_int8_t tim_ie; /* IEEE80211_ELEMID_TIM */ 433 u_int8_t tim_ie; /* IEEE80211_ELEMID_TIM */
429 u_int8_t tim_len; 434 u_int8_t tim_len;
430 u_int8_t tim_count; /* DTIM count */ 435 u_int8_t tim_count; /* DTIM count */
431 u_int8_t tim_period; /* DTIM period */ 436 u_int8_t tim_period; /* DTIM period */
432 u_int8_t tim_bitctl; /* bitmap control */ 437 u_int8_t tim_bitctl; /* bitmap control */
433 u_int8_t tim_bitmap[1]; /* variable-length bitmap */ 438 u_int8_t tim_bitmap[1]; /* variable-length bitmap */
434} __packed; 439} __packed;
435 440
436struct ieee80211_band { 441struct ieee80211_band {
437 u_int8_t schan; /* starting channel */ 442 u_int8_t schan; /* starting channel */
438 u_int8_t nchan; /* number channels */ 443 u_int8_t nchan; /* number channels */
439 u_int8_t maxtxpwr; /* tx power cap */ 444 u_int8_t maxtxpwr; /* tx power cap */
440} __packed; 445} __packed;
441 446
442struct ieee80211_country_ie { 447struct ieee80211_country_ie {
443 u_int8_t ie; /* IEEE80211_ELEMID_COUNTRY */ 448 u_int8_t ie; /* IEEE80211_ELEMID_COUNTRY */
444 u_int8_t len; 449 u_int8_t len;
445 u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */ 450 u_int8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */
446 struct ieee80211_band band[4]; /* up to 4 sub bands */ 451 struct ieee80211_band band[4]; /* up to 4 sub bands */
447} __packed; 452} __packed;
448 453
449#define IEEE80211_CHALLENGE_LEN 128 454#define IEEE80211_CHALLENGE_LEN 128
450 455
451#define IEEE80211_RATE_BASIC 0x80 456#define IEEE80211_RATE_BASIC 0x80
452#define IEEE80211_RATE_VAL 0x7f 457#define IEEE80211_RATE_VAL 0x7f
453 458
454/* EPR information element flags */ 459/* EPR information element flags */
455#define IEEE80211_ERP_NON_ERP_PRESENT 0x01 460#define IEEE80211_ERP_NON_ERP_PRESENT 0x01
456#define IEEE80211_ERP_USE_PROTECTION 0x02 461#define IEEE80211_ERP_USE_PROTECTION 0x02
457#define IEEE80211_ERP_LONG_PREAMBLE 0x04 462#define IEEE80211_ERP_LONG_PREAMBLE 0x04
458 463
459/* Atheros private advanced capabilities info */ 464/* Atheros private advanced capabilities info */
460#define ATHEROS_CAP_TURBO_PRIME 0x01 465#define ATHEROS_CAP_TURBO_PRIME 0x01
461#define ATHEROS_CAP_COMPRESSION 0x02 466#define ATHEROS_CAP_COMPRESSION 0x02
462#define ATHEROS_CAP_FAST_FRAME 0x04 467#define ATHEROS_CAP_FAST_FRAME 0x04
463/* bits 3-6 reserved */ 468/* bits 3-6 reserved */
464#define ATHEROS_CAP_BOOST 0x80 469#define ATHEROS_CAP_BOOST 0x80
465 470
466#define ATH_OUI 0x7f0300 /* Atheros OUI */ 471#define ATH_OUI 0x7f0300 /* Atheros OUI */
467#define ATH_OUI_TYPE 0x01 472#define ATH_OUI_TYPE 0x01
468#define ATH_OUI_VERSION 0x01 473#define ATH_OUI_VERSION 0x01
469 474
470#define WPA_OUI 0xf25000 475#define WPA_OUI 0xf25000
471#define WPA_OUI_TYPE 0x01 476#define WPA_OUI_TYPE 0x01
472#define WPA_VERSION 1 /* current supported version */ 477#define WPA_VERSION 1 /* current supported version */
473 478
474#define WPA_CSE_NULL 0x00 479#define WPA_CSE_NULL 0x00
475#define WPA_CSE_WEP40 0x01 480#define WPA_CSE_WEP40 0x01
476#define WPA_CSE_TKIP 0x02 481#define WPA_CSE_TKIP 0x02
477#define WPA_CSE_CCMP 0x04 482#define WPA_CSE_CCMP 0x04
478#define WPA_CSE_WEP104 0x05 483#define WPA_CSE_WEP104 0x05
479 484
480#define WPA_ASE_NONE 0x00 485#define WPA_ASE_NONE 0x00
481#define WPA_ASE_8021X_UNSPEC 0x01 486#define WPA_ASE_8021X_UNSPEC 0x01
482#define WPA_ASE_8021X_PSK 0x02 487#define WPA_ASE_8021X_PSK 0x02
483 488
484#define RSN_OUI 0xac0f00 489#define RSN_OUI 0xac0f00
485#define RSN_VERSION 1 /* current supported version */ 490#define RSN_VERSION 1 /* current supported version */
486 491
487#define RSN_CSE_NULL 0x00 492#define RSN_CSE_NULL 0x00
488#define RSN_CSE_WEP40 0x01 493#define RSN_CSE_WEP40 0x01
489#define RSN_CSE_TKIP 0x02 494#define RSN_CSE_TKIP 0x02
490#define RSN_CSE_WRAP 0x03 495#define RSN_CSE_WRAP 0x03
491#define RSN_CSE_CCMP 0x04 496#define RSN_CSE_CCMP 0x04
492#define RSN_CSE_WEP104 0x05 497#define RSN_CSE_WEP104 0x05
493 498
494#define RSN_ASE_NONE 0x00 499#define RSN_ASE_NONE 0x00
495#define RSN_ASE_8021X_UNSPEC 0x01 500#define RSN_ASE_8021X_UNSPEC 0x01
496#define RSN_ASE_8021X_PSK 0x02 501#define RSN_ASE_8021X_PSK 0x02
497 502
498#define RSN_CAP_PREAUTH 0x01 503#define RSN_CAP_PREAUTH 0x01
499 504
500#define WME_OUI 0xf25000 505#define WME_OUI 0xf25000
501#define WME_OUI_TYPE 0x02 506#define WME_OUI_TYPE 0x02
502#define WME_INFO_OUI_SUBTYPE 0x00 507#define WME_INFO_OUI_SUBTYPE 0x00
503#define WME_PARAM_OUI_SUBTYPE 0x01 508#define WME_PARAM_OUI_SUBTYPE 0x01
504#define WME_VERSION 1 509#define WME_VERSION 1
505 510
506/* WME stream classes */ 511/* WME stream classes */
507#define WME_AC_BE 0 /* best effort */ 512#define WME_AC_BE 0 /* best effort */
508#define WME_AC_BK 1 /* background */ 513#define WME_AC_BK 1 /* background */
509#define WME_AC_VI 2 /* video */ 514#define WME_AC_VI 2 /* video */
510#define WME_AC_VO 3 /* voice */ 515#define WME_AC_VO 3 /* voice */
511 516
512/* 517/*
513 * AUTH management packets 518 * AUTH management packets
514 * 519 *
515 * octet algo[2] 520 * octet algo[2]
516 * octet seq[2] 521 * octet seq[2]
517 * octet status[2] 522 * octet status[2]
518 * octet chal.id 523 * octet chal.id
519 * octet chal.length 524 * octet chal.length
520 * octet chal.text[253] 525 * octet chal.text[253]
521 */ 526 */
522 527
523typedef u_int8_t *ieee80211_mgt_auth_t; 528typedef u_int8_t *ieee80211_mgt_auth_t;
524 529
525#define IEEE80211_AUTH_ALGORITHM(auth) \ 530#define IEEE80211_AUTH_ALGORITHM(auth) \
526 ((auth)[0] | ((auth)[1] << 8)) 531 ((auth)[0] | ((auth)[1] << 8))
527#define IEEE80211_AUTH_TRANSACTION(auth) \ 532#define IEEE80211_AUTH_TRANSACTION(auth) \
528 ((auth)[2] | ((auth)[3] << 8)) 533 ((auth)[2] | ((auth)[3] << 8))
529#define IEEE80211_AUTH_STATUS(auth) \ 534#define IEEE80211_AUTH_STATUS(auth) \
530 ((auth)[4] | ((auth)[5] << 8)) 535 ((auth)[4] | ((auth)[5] << 8))
531 536
532#define IEEE80211_AUTH_ALG_OPEN 0x0000 537#define IEEE80211_AUTH_ALG_OPEN 0x0000
533#define IEEE80211_AUTH_ALG_SHARED 0x0001 538#define IEEE80211_AUTH_ALG_SHARED 0x0001
534#define IEEE80211_AUTH_ALG_LEAP 0x0080 539#define IEEE80211_AUTH_ALG_LEAP 0x0080
535 540
536enum { 541enum {
537 IEEE80211_AUTH_OPEN_REQUEST = 1, 542 IEEE80211_AUTH_OPEN_REQUEST = 1,
538 IEEE80211_AUTH_OPEN_RESPONSE = 2 543 IEEE80211_AUTH_OPEN_RESPONSE = 2
539}; 544};
540 545
541enum { 546enum {
542 IEEE80211_AUTH_SHARED_REQUEST = 1, 547 IEEE80211_AUTH_SHARED_REQUEST = 1,
543 IEEE80211_AUTH_SHARED_CHALLENGE = 2, 548 IEEE80211_AUTH_SHARED_CHALLENGE = 2,
544 IEEE80211_AUTH_SHARED_RESPONSE = 3, 549 IEEE80211_AUTH_SHARED_RESPONSE = 3,
545 IEEE80211_AUTH_SHARED_PASS = 4 550 IEEE80211_AUTH_SHARED_PASS = 4
546}; 551};
547 552
548/* 553/*
549 * Reason codes 554 * Reason codes
550 * 555 *
551 * Unlisted codes are reserved 556 * Unlisted codes are reserved
552 */ 557 */
553 558
554enum { 559enum {
555 IEEE80211_REASON_UNSPECIFIED = 1, 560 IEEE80211_REASON_UNSPECIFIED = 1,
556 IEEE80211_REASON_AUTH_EXPIRE = 2, 561 IEEE80211_REASON_AUTH_EXPIRE = 2,
557 IEEE80211_REASON_AUTH_LEAVE = 3, 562 IEEE80211_REASON_AUTH_LEAVE = 3,
558 IEEE80211_REASON_ASSOC_EXPIRE = 4, 563 IEEE80211_REASON_ASSOC_EXPIRE = 4,
559 IEEE80211_REASON_ASSOC_TOOMANY = 5, 564 IEEE80211_REASON_ASSOC_TOOMANY = 5,
560 IEEE80211_REASON_NOT_AUTHED = 6, 565 IEEE80211_REASON_NOT_AUTHED = 6,
561 IEEE80211_REASON_NOT_ASSOCED = 7, 566 IEEE80211_REASON_NOT_ASSOCED = 7,
562 IEEE80211_REASON_ASSOC_LEAVE = 8, 567 IEEE80211_REASON_ASSOC_LEAVE = 8,
563 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9, 568 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9,
564 569
565 IEEE80211_REASON_RSN_REQUIRED = 11, 570 IEEE80211_REASON_RSN_REQUIRED = 11,
566 IEEE80211_REASON_RSN_INCONSISTENT = 12, 571 IEEE80211_REASON_RSN_INCONSISTENT = 12,
567 IEEE80211_REASON_IE_INVALID = 13, 572 IEEE80211_REASON_IE_INVALID = 13,
568 IEEE80211_REASON_MIC_FAILURE = 14, 573 IEEE80211_REASON_MIC_FAILURE = 14,
569 574
570 IEEE80211_STATUS_SUCCESS = 0, 575 IEEE80211_STATUS_SUCCESS = 0,
571 IEEE80211_STATUS_UNSPECIFIED = 1, 576 IEEE80211_STATUS_UNSPECIFIED = 1,
572 IEEE80211_STATUS_CAPINFO = 10, 577 IEEE80211_STATUS_CAPINFO = 10,
573 IEEE80211_STATUS_NOT_ASSOCED = 11, 578 IEEE80211_STATUS_NOT_ASSOCED = 11,
574 IEEE80211_STATUS_OTHER = 12, 579 IEEE80211_STATUS_OTHER = 12,
575 IEEE80211_STATUS_ALG = 13, 580 IEEE80211_STATUS_ALG = 13,
576 IEEE80211_STATUS_SEQUENCE = 14, 581 IEEE80211_STATUS_SEQUENCE = 14,
577 IEEE80211_STATUS_CHALLENGE = 15, 582 IEEE80211_STATUS_CHALLENGE = 15,
578 IEEE80211_STATUS_TIMEOUT = 16, 583 IEEE80211_STATUS_TIMEOUT = 16,
579 IEEE80211_STATUS_TOOMANY = 17, 584 IEEE80211_STATUS_TOOMANY = 17,
580 IEEE80211_STATUS_BASIC_RATE = 18, 585 IEEE80211_STATUS_BASIC_RATE = 18,
581 IEEE80211_STATUS_SP_REQUIRED = 19, 586 IEEE80211_STATUS_SP_REQUIRED = 19,
582 IEEE80211_STATUS_PBCC_REQUIRED = 20, 587 IEEE80211_STATUS_PBCC_REQUIRED = 20,
583 IEEE80211_STATUS_CA_REQUIRED = 21, 588 IEEE80211_STATUS_CA_REQUIRED = 21,
584 IEEE80211_STATUS_TOO_MANY_STATIONS = 22, 589 IEEE80211_STATUS_TOO_MANY_STATIONS = 22,
585 IEEE80211_STATUS_RATES = 23, 590 IEEE80211_STATUS_RATES = 23,
586 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25, 591 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25,
587 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26 592 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26
588}; 593};
589 594
590#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ 595#define IEEE80211_WEP_KEYLEN 5 /* 40bit */
591#define IEEE80211_WEP_IVLEN 3 /* 24bit */ 596#define IEEE80211_WEP_IVLEN 3 /* 24bit */
592#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ 597#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
593#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ 598#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
594#define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \ 599#define IEEE80211_WEP_TOTLEN (IEEE80211_WEP_IVLEN + \
595 IEEE80211_WEP_KIDLEN + \ 600 IEEE80211_WEP_KIDLEN + \
596 IEEE80211_WEP_CRCLEN) 601 IEEE80211_WEP_CRCLEN)
597#define IEEE80211_WEP_NKID 4 /* number of key ids */ 602#define IEEE80211_WEP_NKID 4 /* number of key ids */
598 603
599/* 604/*
600 * 802.11i defines an extended IV for use with non-WEP ciphers. 605 * 802.11i defines an extended IV for use with non-WEP ciphers.
601 * When the EXTIV bit is set in the key id byte an additional 606 * When the EXTIV bit is set in the key id byte an additional
602 * 4 bytes immediately follow the IV for TKIP. For CCMP the 607 * 4 bytes immediately follow the IV for TKIP. For CCMP the
603 * EXTIV bit is likewise set but the 8 bytes represent the 608 * EXTIV bit is likewise set but the 8 bytes represent the
604 * CCMP header rather than IV+extended-IV. 609 * CCMP header rather than IV+extended-IV.
605 */ 610 */
606#define IEEE80211_WEP_EXTIV 0x20 611#define IEEE80211_WEP_EXTIV 0x20
607#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ 612#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */
608#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ 613#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */
609 614
610#define IEEE80211_CRC_LEN 4 615#define IEEE80211_CRC_LEN 4
611 616
612/* 617/*
613 * Maximum acceptable MTU is: 618 * Maximum acceptable MTU is:
614 * IEEE80211_MAX_LEN - WEP overhead - CRC - 619 * IEEE80211_MAX_LEN - WEP overhead - CRC -
615 * QoS overhead - RSN/WPA overhead 620 * QoS overhead - RSN/WPA overhead
616 * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default 621 * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default
617 * mtu is Ethernet-compatible; it's set by ether_ifattach. 622 * mtu is Ethernet-compatible; it's set by ether_ifattach.
618 */ 623 */
619#define IEEE80211_MTU_MAX 2290 624#define IEEE80211_MTU_MAX 2290
620#define IEEE80211_MTU_MIN 32 625#define IEEE80211_MTU_MIN 32
621 626
622#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \ 627#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \
623 (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN)) 628 (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
624#define IEEE80211_ACK_LEN \ 629#define IEEE80211_ACK_LEN \
625 (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN) 630 (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
626#define IEEE80211_MIN_LEN \ 631#define IEEE80211_MIN_LEN \
627 (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN) 632 (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
628 633
629/* 634/*
630 * The 802.11 spec says at most 2007 stations may be 635 * The 802.11 spec says at most 2007 stations may be
631 * associated at once. For most AP's this is way more 636 * associated at once. For most AP's this is way more
632 * than is feasible so we use a default of 128. This 637 * than is feasible so we use a default of 128. This
633 * number may be overridden by the driver and/or by 638 * number may be overridden by the driver and/or by
634 * user configuration. 639 * user configuration.
635 */ 640 */
636#define IEEE80211_AID_MAX 2007 641#define IEEE80211_AID_MAX 2007
637#define IEEE80211_AID_DEF 128 642#define IEEE80211_AID_DEF 128
638 643
639#define IEEE80211_AID(b) ((b) &~ 0xc000) 644#define IEEE80211_AID(b) ((b) &~ 0xc000)
640 645
641/*  646/*
642 * RTS frame length parameters. The default is specified in 647 * RTS frame length parameters. The default is specified in
643 * the 802.11 spec as 512; we treat it as implementation-dependent 648 * the 802.11 spec as 512; we treat it as implementation-dependent
644 * so it's defined in ieee80211_var.h. The max may be wrong 649 * so it's defined in ieee80211_var.h. The max may be wrong
645 * for jumbo frames. 650 * for jumbo frames.
646 */ 651 */
647#define IEEE80211_RTS_MIN 1 652#define IEEE80211_RTS_MIN 1
648#define IEEE80211_RTS_MAX 2346 653#define IEEE80211_RTS_MAX 2346
649 654
650/*  655/*
651 * TX fragmentation parameters. As above for RTS, we treat 656 * TX fragmentation parameters. As above for RTS, we treat
652 * default as implementation-dependent so define it elsewhere. 657 * default as implementation-dependent so define it elsewhere.
653 */ 658 */
654#define IEEE80211_FRAG_MIN 256 659#define IEEE80211_FRAG_MIN 256
655#define IEEE80211_FRAG_MAX 2346 660#define IEEE80211_FRAG_MAX 2346
656 661
657/* 662/*
658 * 802.11 frame duration definitions. 663 * 802.11 frame duration definitions.
659 */ 664 */
660 665
661struct ieee80211_duration { 666struct ieee80211_duration {
662 uint16_t d_rts_dur; 667 uint16_t d_rts_dur;
663 uint16_t d_data_dur; 668 uint16_t d_data_dur;
664 uint16_t d_plcp_len; 669 uint16_t d_plcp_len;
665 uint8_t d_residue; /* unused octets in time slot */ 670 uint8_t d_residue; /* unused octets in time slot */
666}; 671};
667 672
668/* One Time Unit (TU) is 1Kus = 1024 microseconds. */ 673/* One Time Unit (TU) is 1Kus = 1024 microseconds. */
669#define IEEE80211_DUR_TU 1024 674#define IEEE80211_DUR_TU 1024
670 675
671/* IEEE 802.11b durations for DSSS PHY in microseconds */ 676/* IEEE 802.11b durations for DSSS PHY in microseconds */
672#define IEEE80211_DUR_DS_LONG_PREAMBLE 144 677#define IEEE80211_DUR_DS_LONG_PREAMBLE 144
673#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72 678#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72
674 679
675#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48 680#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48
676#define IEEE80211_DUR_DS_FAST_PLCPHDR 24 681#define IEEE80211_DUR_DS_FAST_PLCPHDR 24
677#define IEEE80211_DUR_DS_SLOW_ACK 112 682#define IEEE80211_DUR_DS_SLOW_ACK 112
678#define IEEE80211_DUR_DS_FAST_ACK 56 683#define IEEE80211_DUR_DS_FAST_ACK 56
679#define IEEE80211_DUR_DS_SLOW_CTS 112 684#define IEEE80211_DUR_DS_SLOW_CTS 112
680#define IEEE80211_DUR_DS_FAST_CTS 56 685#define IEEE80211_DUR_DS_FAST_CTS 56
681 686
682#define IEEE80211_DUR_DS_SLOT 20 687#define IEEE80211_DUR_DS_SLOT 20
683#define IEEE80211_DUR_DS_SIFS 10 688#define IEEE80211_DUR_DS_SIFS 10
684#define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT) 689#define IEEE80211_DUR_DS_PIFS (IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)
685#define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \ 690#define IEEE80211_DUR_DS_DIFS (IEEE80211_DUR_DS_SIFS + \
686 2 * IEEE80211_DUR_DS_SLOT) 691 2 * IEEE80211_DUR_DS_SLOT)
687#define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \ 692#define IEEE80211_DUR_DS_EIFS (IEEE80211_DUR_DS_SIFS + \
688 IEEE80211_DUR_DS_SLOW_ACK + \ 693 IEEE80211_DUR_DS_SLOW_ACK + \
689 IEEE80211_DUR_DS_LONG_PREAMBLE + \ 694 IEEE80211_DUR_DS_LONG_PREAMBLE + \
690 IEEE80211_DUR_DS_SLOW_PLCPHDR + \ 695 IEEE80211_DUR_DS_SLOW_PLCPHDR + \
691 IEEE80211_DUR_DS_DIFS) 696 IEEE80211_DUR_DS_DIFS)
692 697
693 698
694#endif /* !_NET80211_IEEE80211_H_ */ 699#endif /* !_NET80211_IEEE80211_H_ */