when changing the mac address of a bridge interface, keep member interface addresses...
[openwrt.git] / target / linux / s3c24xx / files-2.6.30 / drivers / ar6000 / include / ieee80211.h
1 /*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
4 * Copyright (c) 2006 Atheros Communications, Inc.
5 *
6 * Wireless Network driver for Atheros AR6001
7 * All rights reserved.
8 *
9 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
10 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
11 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
12 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
13 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
15 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
16 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
18 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 *
20 */
21 #ifndef _NET80211_IEEE80211_H_
22 #define _NET80211_IEEE80211_H_
23
24 #include "athstartpack.h"
25
26 /*
27 * 802.11 protocol definitions.
28 */
29
30 #define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
31 /* is 802.11 address multicast/broadcast? */
32 #define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01)
33 #define IEEE80211_ADDR_EQ(addr1, addr2) \
34 (A_MEMCMP(addr1, addr2, IEEE80211_ADDR_LEN) == 0)
35
36 #define IEEE80211_KEYBUF_SIZE 16
37 #define IEEE80211_MICBUF_SIZE (8+8) /* space for both tx and rx */
38
39 /*
40 * NB: these values are ordered carefully; there are lots of
41 * of implications in any reordering. In particular beware
42 * that 4 is not used to avoid conflicting with IEEE80211_F_PRIVACY.
43 */
44 #define IEEE80211_CIPHER_WEP 0
45 #define IEEE80211_CIPHER_TKIP 1
46 #define IEEE80211_CIPHER_AES_OCB 2
47 #define IEEE80211_CIPHER_AES_CCM 3
48 #define IEEE80211_CIPHER_CKIP 5
49 #define IEEE80211_CIPHER_CCKM_KRK 6
50 #define IEEE80211_CIPHER_NONE 7 /* pseudo value */
51
52 #define IEEE80211_CIPHER_MAX (IEEE80211_CIPHER_NONE+1)
53
54 #define IEEE80211_IS_VALID_WEP_CIPHER_LEN(len) \
55 (((len) == 5) || ((len) == 13) || ((len) == 16))
56
57
58
59 /*
60 * generic definitions for IEEE 802.11 frames
61 */
62 PREPACK struct ieee80211_frame {
63 A_UINT8 i_fc[2];
64 A_UINT8 i_dur[2];
65 A_UINT8 i_addr1[IEEE80211_ADDR_LEN];
66 A_UINT8 i_addr2[IEEE80211_ADDR_LEN];
67 A_UINT8 i_addr3[IEEE80211_ADDR_LEN];
68 A_UINT8 i_seq[2];
69 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
70 /* see below */
71 } POSTPACK;
72
73 #define IEEE80211_FC0_VERSION_MASK 0x03
74 #define IEEE80211_FC0_VERSION_SHIFT 0
75 #define IEEE80211_FC0_VERSION_0 0x00
76 #define IEEE80211_FC0_TYPE_MASK 0x0c
77 #define IEEE80211_FC0_TYPE_SHIFT 2
78 #define IEEE80211_FC0_TYPE_MGT 0x00
79 #define IEEE80211_FC0_TYPE_CTL 0x04
80 #define IEEE80211_FC0_TYPE_DATA 0x08
81
82 #define IEEE80211_FC0_SUBTYPE_MASK 0xf0
83 #define IEEE80211_FC0_SUBTYPE_SHIFT 4
84 /* for TYPE_MGT */
85 #define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
86 #define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
87 #define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
88 #define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
89 #define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
90 #define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
91 #define IEEE80211_FC0_SUBTYPE_BEACON 0x80
92 #define IEEE80211_FC0_SUBTYPE_ATIM 0x90
93 #define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
94 #define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
95 #define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
96 /* for TYPE_CTL */
97 #define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
98 #define IEEE80211_FC0_SUBTYPE_RTS 0xb0
99 #define IEEE80211_FC0_SUBTYPE_CTS 0xc0
100 #define IEEE80211_FC0_SUBTYPE_ACK 0xd0
101 #define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
102 #define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
103 /* for TYPE_DATA (bit combination) */
104 #define IEEE80211_FC0_SUBTYPE_DATA 0x00
105 #define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
106 #define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
107 #define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
108 #define IEEE80211_FC0_SUBTYPE_NODATA 0x40
109 #define IEEE80211_FC0_SUBTYPE_CFACK 0x50
110 #define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60
111 #define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70
112 #define IEEE80211_FC0_SUBTYPE_QOS 0x80
113 #define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0
114
115 #define IEEE80211_FC1_DIR_MASK 0x03
116 #define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
117 #define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
118 #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
119 #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
120
121 #define IEEE80211_FC1_MORE_FRAG 0x04
122 #define IEEE80211_FC1_RETRY 0x08
123 #define IEEE80211_FC1_PWR_MGT 0x10
124 #define IEEE80211_FC1_MORE_DATA 0x20
125 #define IEEE80211_FC1_WEP 0x40
126 #define IEEE80211_FC1_ORDER 0x80
127
128 #define IEEE80211_SEQ_FRAG_MASK 0x000f
129 #define IEEE80211_SEQ_FRAG_SHIFT 0
130 #define IEEE80211_SEQ_SEQ_MASK 0xfff0
131 #define IEEE80211_SEQ_SEQ_SHIFT 4
132
133 #define IEEE80211_NWID_LEN 32
134
135 /*
136 * 802.11 rate set.
137 */
138 #define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
139 #define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */
140
141 #define WMM_NUM_AC 4 /* 4 AC categories */
142
143 #define WMM_PARAM_ACI_M 0x60 /* Mask for ACI field */
144 #define WMM_PARAM_ACI_S 5 /* Shift for ACI field */
145 #define WMM_PARAM_ACM_M 0x10 /* Mask for ACM bit */
146 #define WMM_PARAM_ACM_S 4 /* Shift for ACM bit */
147 #define WMM_PARAM_AIFSN_M 0x0f /* Mask for aifsn field */
148 #define WMM_PARAM_LOGCWMIN_M 0x0f /* Mask for CwMin field (in log) */
149 #define WMM_PARAM_LOGCWMAX_M 0xf0 /* Mask for CwMax field (in log) */
150 #define WMM_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */
151
152 #define WMM_AC_TO_TID(_ac) ( \
153 ((_ac) == WMM_AC_VO) ? 6 : \
154 ((_ac) == WMM_AC_VI) ? 5 : \
155 ((_ac) == WMM_AC_BK) ? 1 : \
156 0)
157
158 #define TID_TO_WMM_AC(_tid) ( \
159 ((_tid) < 1) ? WMM_AC_BE : \
160 ((_tid) < 3) ? WMM_AC_BK : \
161 ((_tid) < 6) ? WMM_AC_VI : \
162 WMM_AC_VO)
163 /*
164 * Management information element payloads.
165 */
166
167 enum {
168 IEEE80211_ELEMID_SSID = 0,
169 IEEE80211_ELEMID_RATES = 1,
170 IEEE80211_ELEMID_FHPARMS = 2,
171 IEEE80211_ELEMID_DSPARMS = 3,
172 IEEE80211_ELEMID_CFPARMS = 4,
173 IEEE80211_ELEMID_TIM = 5,
174 IEEE80211_ELEMID_IBSSPARMS = 6,
175 IEEE80211_ELEMID_COUNTRY = 7,
176 IEEE80211_ELEMID_CHALLENGE = 16,
177 /* 17-31 reserved for challenge text extension */
178 IEEE80211_ELEMID_PWRCNSTR = 32,
179 IEEE80211_ELEMID_PWRCAP = 33,
180 IEEE80211_ELEMID_TPCREQ = 34,
181 IEEE80211_ELEMID_TPCREP = 35,
182 IEEE80211_ELEMID_SUPPCHAN = 36,
183 IEEE80211_ELEMID_CHANSWITCH = 37,
184 IEEE80211_ELEMID_MEASREQ = 38,
185 IEEE80211_ELEMID_MEASREP = 39,
186 IEEE80211_ELEMID_QUIET = 40,
187 IEEE80211_ELEMID_IBSSDFS = 41,
188 IEEE80211_ELEMID_ERP = 42,
189 IEEE80211_ELEMID_RSN = 48,
190 IEEE80211_ELEMID_XRATES = 50,
191 IEEE80211_ELEMID_TPC = 150,
192 IEEE80211_ELEMID_CCKM = 156,
193 IEEE80211_ELEMID_VENDOR = 221, /* vendor private */
194 };
195
196 #define ATH_OUI 0x7f0300 /* Atheros OUI */
197 #define ATH_OUI_TYPE 0x01
198 #define ATH_OUI_SUBTYPE 0x01
199 #define ATH_OUI_VERSION 0x00
200
201 #define WPA_OUI 0xf25000
202 #define WPA_OUI_TYPE 0x01
203 #define WPA_VERSION 1 /* current supported version */
204
205 #define WPA_CSE_NULL 0x00
206 #define WPA_CSE_WEP40 0x01
207 #define WPA_CSE_TKIP 0x02
208 #define WPA_CSE_CCMP 0x04
209 #define WPA_CSE_WEP104 0x05
210
211 #define WPA_ASE_NONE 0x00
212 #define WPA_ASE_8021X_UNSPEC 0x01
213 #define WPA_ASE_8021X_PSK 0x02
214
215 #define RSN_OUI 0xac0f00
216 #define RSN_VERSION 1 /* current supported version */
217
218 #define RSN_CSE_NULL 0x00
219 #define RSN_CSE_WEP40 0x01
220 #define RSN_CSE_TKIP 0x02
221 #define RSN_CSE_WRAP 0x03
222 #define RSN_CSE_CCMP 0x04
223 #define RSN_CSE_WEP104 0x05
224
225 #define RSN_ASE_NONE 0x00
226 #define RSN_ASE_8021X_UNSPEC 0x01
227 #define RSN_ASE_8021X_PSK 0x02
228
229 #define RSN_CAP_PREAUTH 0x01
230
231 #define WMM_OUI 0xf25000
232 #define WMM_OUI_TYPE 0x02
233 #define WMM_INFO_OUI_SUBTYPE 0x00
234 #define WMM_PARAM_OUI_SUBTYPE 0x01
235 #define WMM_VERSION 1
236
237 /* WMM stream classes */
238 #define WMM_NUM_AC 4
239 #define WMM_AC_BE 0 /* best effort */
240 #define WMM_AC_BK 1 /* background */
241 #define WMM_AC_VI 2 /* video */
242 #define WMM_AC_VO 3 /* voice */
243
244 /* TSPEC related */
245 #define ACTION_CATEGORY_CODE_TSPEC 17
246 #define ACTION_CODE_TSPEC_ADDTS 0
247 #define ACTION_CODE_TSPEC_ADDTS_RESP 1
248 #define ACTION_CODE_TSPEC_DELTS 2
249
250 typedef enum {
251 TSPEC_STATUS_CODE_ADMISSION_ACCEPTED = 0,
252 TSPEC_STATUS_CODE_ADDTS_INVALID_PARAMS = 0x1,
253 TSPEC_STATUS_CODE_ADDTS_REQUEST_REFUSED = 0x3,
254 TSPEC_STATUS_CODE_UNSPECIFIED_QOS_RELATED_FAILURE = 0xC8,
255 TSPEC_STATUS_CODE_REQUESTED_REFUSED_POLICY_CONFIGURATION = 0xC9,
256 TSPEC_STATUS_CODE_INSUFFCIENT_BANDWIDTH = 0xCA,
257 TSPEC_STATUS_CODE_INVALID_PARAMS = 0xCB,
258 TSPEC_STATUS_CODE_DELTS_SENT = 0x30,
259 TSPEC_STATUS_CODE_DELTS_RECV = 0x31,
260 } TSPEC_STATUS_CODE;
261
262 /*
263 * WMM/802.11e Tspec Element
264 */
265 typedef PREPACK struct wmm_tspec_ie_t {
266 A_UINT8 elementId;
267 A_UINT8 len;
268 A_UINT8 oui[3];
269 A_UINT8 ouiType;
270 A_UINT8 ouiSubType;
271 A_UINT8 version;
272 A_UINT16 tsInfo_info;
273 A_UINT8 tsInfo_reserved;
274 A_UINT16 nominalMSDU;
275 A_UINT16 maxMSDU;
276 A_UINT32 minServiceInt;
277 A_UINT32 maxServiceInt;
278 A_UINT32 inactivityInt;
279 A_UINT32 suspensionInt;
280 A_UINT32 serviceStartTime;
281 A_UINT32 minDataRate;
282 A_UINT32 meanDataRate;
283 A_UINT32 peakDataRate;
284 A_UINT32 maxBurstSize;
285 A_UINT32 delayBound;
286 A_UINT32 minPhyRate;
287 A_UINT16 sba;
288 A_UINT16 mediumTime;
289 } POSTPACK WMM_TSPEC_IE;
290
291
292 /*
293 * BEACON management packets
294 *
295 * octet timestamp[8]
296 * octet beacon interval[2]
297 * octet capability information[2]
298 * information element
299 * octet elemid
300 * octet length
301 * octet information[length]
302 */
303
304 #define IEEE80211_BEACON_INTERVAL(beacon) \
305 ((beacon)[8] | ((beacon)[9] << 8))
306 #define IEEE80211_BEACON_CAPABILITY(beacon) \
307 ((beacon)[10] | ((beacon)[11] << 8))
308
309 #define IEEE80211_CAPINFO_ESS 0x0001
310 #define IEEE80211_CAPINFO_IBSS 0x0002
311 #define IEEE80211_CAPINFO_CF_POLLABLE 0x0004
312 #define IEEE80211_CAPINFO_CF_POLLREQ 0x0008
313 #define IEEE80211_CAPINFO_PRIVACY 0x0010
314 #define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020
315 #define IEEE80211_CAPINFO_PBCC 0x0040
316 #define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080
317 /* bits 8-9 are reserved */
318 #define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400
319 #define IEEE80211_CAPINFO_APSD 0x0800
320 /* bit 12 is reserved */
321 #define IEEE80211_CAPINFO_DSSSOFDM 0x2000
322 /* bits 14-15 are reserved */
323
324 /*
325 * Authentication Modes
326 */
327
328 enum ieee80211_authmode {
329 IEEE80211_AUTH_NONE = 0,
330 IEEE80211_AUTH_OPEN = 1,
331 IEEE80211_AUTH_SHARED = 2,
332 IEEE80211_AUTH_8021X = 3,
333 IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */
334 /* NB: these are used only for ioctls */
335 IEEE80211_AUTH_WPA = 5, /* WPA/RSN w/ 802.1x */
336 IEEE80211_AUTH_WPA_PSK = 6, /* WPA/RSN w/ PSK */
337 IEEE80211_AUTH_WPA_CCKM = 7, /* WPA/RSN IE w/ CCKM */
338 };
339
340 #include "athendpack.h"
341
342 #endif /* _NET80211_IEEE80211_H_ */
This page took 0.068054 seconds and 5 git commands to generate.