4 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
6 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
7 * Copyright (c) 2005, Devicescape Software, Inc.
8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
18 #include <linux/types.h>
22 #define IEEE80211_FCTL_VERS 0x0003
23 #define IEEE80211_FCTL_FTYPE 0x000c
24 #define IEEE80211_FCTL_STYPE 0x00f0
25 #define IEEE80211_FCTL_TODS 0x0100
26 #define IEEE80211_FCTL_FROMDS 0x0200
27 #define IEEE80211_FCTL_MOREFRAGS 0x0400
28 #define IEEE80211_FCTL_RETRY 0x0800
29 #define IEEE80211_FCTL_PM 0x1000
30 #define IEEE80211_FCTL_MOREDATA 0x2000
31 #define IEEE80211_FCTL_PROTECTED 0x4000
32 #define IEEE80211_FCTL_ORDER 0x8000
34 #define IEEE80211_SCTL_FRAG 0x000F
35 #define IEEE80211_SCTL_SEQ 0xFFF0
37 #define IEEE80211_FTYPE_MGMT 0x0000
38 #define IEEE80211_FTYPE_CTL 0x0004
39 #define IEEE80211_FTYPE_DATA 0x0008
42 #define IEEE80211_STYPE_ASSOC_REQ 0x0000
43 #define IEEE80211_STYPE_ASSOC_RESP 0x0010
44 #define IEEE80211_STYPE_REASSOC_REQ 0x0020
45 #define IEEE80211_STYPE_REASSOC_RESP 0x0030
46 #define IEEE80211_STYPE_PROBE_REQ 0x0040
47 #define IEEE80211_STYPE_PROBE_RESP 0x0050
48 #define IEEE80211_STYPE_BEACON 0x0080
49 #define IEEE80211_STYPE_ATIM 0x0090
50 #define IEEE80211_STYPE_DISASSOC 0x00A0
51 #define IEEE80211_STYPE_AUTH 0x00B0
52 #define IEEE80211_STYPE_DEAUTH 0x00C0
53 #define IEEE80211_STYPE_ACTION 0x00D0
56 #define IEEE80211_STYPE_PSPOLL 0x00A0
57 #define IEEE80211_STYPE_RTS 0x00B0
58 #define IEEE80211_STYPE_CTS 0x00C0
59 #define IEEE80211_STYPE_ACK 0x00D0
60 #define IEEE80211_STYPE_CFEND 0x00E0
61 #define IEEE80211_STYPE_CFENDACK 0x00F0
64 #define IEEE80211_STYPE_DATA 0x0000
65 #define IEEE80211_STYPE_DATA_CFACK 0x0010
66 #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
67 #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
68 #define IEEE80211_STYPE_NULLFUNC 0x0040
69 #define IEEE80211_STYPE_CFACK 0x0050
70 #define IEEE80211_STYPE_CFPOLL 0x0060
71 #define IEEE80211_STYPE_CFACKPOLL 0x0070
72 #define IEEE80211_STYPE_QOS_DATA 0x0080
73 #define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
74 #define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
75 #define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0
76 #define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0
77 #define IEEE80211_STYPE_QOS_CFACK 0x00D0
78 #define IEEE80211_STYPE_QOS_CFPOLL 0x00E0
79 #define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0
82 /* miscellaneous IEEE 802.11 constants */
83 #define IEEE80211_MAX_FRAG_THRESHOLD 2346
84 #define IEEE80211_MAX_RTS_THRESHOLD 2347
85 #define IEEE80211_MAX_AID 2007
86 #define IEEE80211_MAX_TIM_LEN 251
87 #define IEEE80211_MAX_DATA_LEN 2304
88 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
91 The figure in section 7.1.2 suggests a body size of up to 2312
92 bytes is allowed, which is a bit confusing, I suspect this
93 represents the 2304 bytes of real data, plus a possible 8 bytes of
94 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
96 #define IEEE80211_MAX_SSID_LEN 32
98 struct ieee80211_hdr {
106 } __attribute__ ((packed));
109 struct ieee80211_mgmt {
110 __le16 frame_control;
119 __le16 auth_transaction;
121 /* possibly followed by Challenge text */
123 } __attribute__ ((packed)) auth;
126 } __attribute__ ((packed)) deauth;
129 __le16 listen_interval;
130 /* followed by SSID and Supported rates */
132 } __attribute__ ((packed)) assoc_req;
137 /* followed by Supported rates */
139 } __attribute__ ((packed)) assoc_resp, reassoc_resp;
142 __le16 listen_interval;
144 /* followed by SSID and Supported rates */
146 } __attribute__ ((packed)) reassoc_req;
149 } __attribute__ ((packed)) disassoc;
154 /* followed by some of SSID, Supported rates,
155 * FH Params, DS Params, CF Params, IBSS Params, TIM */
157 } __attribute__ ((packed)) beacon;
159 /* only variable items: SSID, Supported rates */
161 } __attribute__ ((packed)) probe_req;
166 /* followed by some of SSID, Supported rates,
167 * FH Params, DS Params, CF Params, IBSS Params */
169 } __attribute__ ((packed)) probe_resp;
178 } __attribute__ ((packed)) wme_action;
186 } __attribute__((packed)) chan_switch;
188 } __attribute__ ((packed)) action;
190 } __attribute__ ((packed));
194 struct ieee80211_rts {
195 __le16 frame_control;
199 } __attribute__ ((packed));
201 struct ieee80211_cts {
202 __le16 frame_control;
205 } __attribute__ ((packed));
208 /* Authentication algorithms */
209 #define WLAN_AUTH_OPEN 0
210 #define WLAN_AUTH_SHARED_KEY 1
211 #define WLAN_AUTH_FAST_BSS_TRANSITION 2
212 #define WLAN_AUTH_LEAP 128
214 #define WLAN_AUTH_CHALLENGE_LEN 128
216 #define WLAN_CAPABILITY_ESS (1<<0)
217 #define WLAN_CAPABILITY_IBSS (1<<1)
218 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
219 #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
220 #define WLAN_CAPABILITY_PRIVACY (1<<4)
221 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
222 #define WLAN_CAPABILITY_PBCC (1<<6)
223 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
225 #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
226 #define WLAN_CAPABILITY_QOS (1<<9)
227 #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
228 #define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
230 /* 802.11g ERP information element */
231 #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
232 #define WLAN_ERP_USE_PROTECTION (1<<1)
233 #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
235 /* WLAN_ERP_BARKER_PREAMBLE values */
237 WLAN_ERP_PREAMBLE_SHORT = 0,
238 WLAN_ERP_PREAMBLE_LONG = 1,
242 enum ieee80211_statuscode {
243 WLAN_STATUS_SUCCESS = 0,
244 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
245 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
246 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
247 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
248 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
249 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
250 WLAN_STATUS_CHALLENGE_FAIL = 15,
251 WLAN_STATUS_AUTH_TIMEOUT = 16,
252 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
253 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
255 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
256 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
257 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
259 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
260 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
261 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
263 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
264 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
266 WLAN_STATUS_INVALID_IE = 40,
267 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
268 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
269 WLAN_STATUS_INVALID_AKMP = 43,
270 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
271 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
272 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
277 enum ieee80211_reasoncode {
278 WLAN_REASON_UNSPECIFIED = 1,
279 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
280 WLAN_REASON_DEAUTH_LEAVING = 3,
281 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
282 WLAN_REASON_DISASSOC_AP_BUSY = 5,
283 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
284 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
285 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
286 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
288 WLAN_REASON_DISASSOC_BAD_POWER = 10,
289 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
291 WLAN_REASON_INVALID_IE = 13,
292 WLAN_REASON_MIC_FAILURE = 14,
293 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
294 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
295 WLAN_REASON_IE_DIFFERENT = 17,
296 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
297 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
298 WLAN_REASON_INVALID_AKMP = 20,
299 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
300 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
301 WLAN_REASON_IEEE8021X_FAILED = 23,
302 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
306 /* Information Element IDs */
309 WLAN_EID_SUPP_RATES = 1,
310 WLAN_EID_FH_PARAMS = 2,
311 WLAN_EID_DS_PARAMS = 3,
312 WLAN_EID_CF_PARAMS = 4,
314 WLAN_EID_IBSS_PARAMS = 6,
315 WLAN_EID_CHALLENGE = 16,
317 WLAN_EID_COUNTRY = 7,
318 WLAN_EID_HP_PARAMS = 8,
319 WLAN_EID_HP_TABLE = 9,
320 WLAN_EID_REQUEST = 10,
322 WLAN_EID_PWR_CONSTRAINT = 32,
323 WLAN_EID_PWR_CAPABILITY = 33,
324 WLAN_EID_TPC_REQUEST = 34,
325 WLAN_EID_TPC_REPORT = 35,
326 WLAN_EID_SUPPORTED_CHANNELS = 36,
327 WLAN_EID_CHANNEL_SWITCH = 37,
328 WLAN_EID_MEASURE_REQUEST = 38,
329 WLAN_EID_MEASURE_REPORT = 39,
331 WLAN_EID_IBSS_DFS = 41,
333 WLAN_EID_ERP_INFO = 42,
334 WLAN_EID_EXT_SUPP_RATES = 50,
338 WLAN_EID_GENERIC = 221,
339 WLAN_EID_VENDOR_SPECIFIC = 221,
340 WLAN_EID_QOS_PARAMETER = 222
343 /* cipher suite selectors */
344 #define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
345 #define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
346 #define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
347 /* reserved: 0x000FAC03 */
348 #define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
349 #define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
351 #define WLAN_MAX_KEY_LEN 32
353 #endif /* IEEE80211_H */