blob: 8f2c20b4a15d2230d2b7dd46bcf1f7dfa30de823 [file] [log] [blame]
Jiri Benca9de8ce2007-05-05 11:43:04 -07001/*
2 * IEEE 802.11 defines
3 *
4 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
5 * <jkmaline@cc.hut.fi>
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>
9 *
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.
13 */
14
15#ifndef IEEE80211_H
16#define IEEE80211_H
17
18#include <linux/types.h>
Johannes Bergf97df022007-09-18 17:29:20 -040019#include <asm/byteorder.h>
Jiri Benca9de8ce2007-05-05 11:43:04 -070020
21#define FCS_LEN 4
22
23#define IEEE80211_FCTL_VERS 0x0003
24#define IEEE80211_FCTL_FTYPE 0x000c
25#define IEEE80211_FCTL_STYPE 0x00f0
26#define IEEE80211_FCTL_TODS 0x0100
27#define IEEE80211_FCTL_FROMDS 0x0200
28#define IEEE80211_FCTL_MOREFRAGS 0x0400
29#define IEEE80211_FCTL_RETRY 0x0800
30#define IEEE80211_FCTL_PM 0x1000
31#define IEEE80211_FCTL_MOREDATA 0x2000
32#define IEEE80211_FCTL_PROTECTED 0x4000
33#define IEEE80211_FCTL_ORDER 0x8000
34
35#define IEEE80211_SCTL_FRAG 0x000F
36#define IEEE80211_SCTL_SEQ 0xFFF0
37
38#define IEEE80211_FTYPE_MGMT 0x0000
39#define IEEE80211_FTYPE_CTL 0x0004
40#define IEEE80211_FTYPE_DATA 0x0008
41
42/* management */
43#define IEEE80211_STYPE_ASSOC_REQ 0x0000
44#define IEEE80211_STYPE_ASSOC_RESP 0x0010
45#define IEEE80211_STYPE_REASSOC_REQ 0x0020
46#define IEEE80211_STYPE_REASSOC_RESP 0x0030
47#define IEEE80211_STYPE_PROBE_REQ 0x0040
48#define IEEE80211_STYPE_PROBE_RESP 0x0050
49#define IEEE80211_STYPE_BEACON 0x0080
50#define IEEE80211_STYPE_ATIM 0x0090
51#define IEEE80211_STYPE_DISASSOC 0x00A0
52#define IEEE80211_STYPE_AUTH 0x00B0
53#define IEEE80211_STYPE_DEAUTH 0x00C0
54#define IEEE80211_STYPE_ACTION 0x00D0
55
56/* control */
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +020057#define IEEE80211_STYPE_BACK_REQ 0x0080
58#define IEEE80211_STYPE_BACK 0x0090
Jiri Benca9de8ce2007-05-05 11:43:04 -070059#define IEEE80211_STYPE_PSPOLL 0x00A0
60#define IEEE80211_STYPE_RTS 0x00B0
61#define IEEE80211_STYPE_CTS 0x00C0
62#define IEEE80211_STYPE_ACK 0x00D0
63#define IEEE80211_STYPE_CFEND 0x00E0
64#define IEEE80211_STYPE_CFENDACK 0x00F0
65
66/* data */
67#define IEEE80211_STYPE_DATA 0x0000
68#define IEEE80211_STYPE_DATA_CFACK 0x0010
69#define IEEE80211_STYPE_DATA_CFPOLL 0x0020
70#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
71#define IEEE80211_STYPE_NULLFUNC 0x0040
72#define IEEE80211_STYPE_CFACK 0x0050
73#define IEEE80211_STYPE_CFPOLL 0x0060
74#define IEEE80211_STYPE_CFACKPOLL 0x0070
75#define IEEE80211_STYPE_QOS_DATA 0x0080
76#define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
77#define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
78#define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0
79#define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0
80#define IEEE80211_STYPE_QOS_CFACK 0x00D0
81#define IEEE80211_STYPE_QOS_CFPOLL 0x00E0
82#define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0
83
84
85/* miscellaneous IEEE 802.11 constants */
Michael Wuc2378992007-10-30 16:50:05 -040086#define IEEE80211_MAX_FRAG_THRESHOLD 2352
87#define IEEE80211_MAX_RTS_THRESHOLD 2353
Jiri Benca9de8ce2007-05-05 11:43:04 -070088#define IEEE80211_MAX_AID 2007
89#define IEEE80211_MAX_TIM_LEN 251
Jiri Benca9de8ce2007-05-05 11:43:04 -070090/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
91 6.2.1.1.2.
92
Michael Wuc2378992007-10-30 16:50:05 -040093 802.11e clarifies the figure in section 7.1.2. The frame body is
94 up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
95#define IEEE80211_MAX_DATA_LEN 2304
96/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
97#define IEEE80211_MAX_FRAME_LEN 2352
Jiri Benca9de8ce2007-05-05 11:43:04 -070098
99#define IEEE80211_MAX_SSID_LEN 32
Luis Carlos Cobo37c57982008-02-23 15:17:04 +0100100#define IEEE80211_MAX_MESH_ID_LEN 32
Jiri Benca9de8ce2007-05-05 11:43:04 -0700101
102struct ieee80211_hdr {
103 __le16 frame_control;
104 __le16 duration_id;
105 u8 addr1[6];
106 u8 addr2[6];
107 u8 addr3[6];
108 __le16 seq_ctrl;
109 u8 addr4[6];
110} __attribute__ ((packed));
111
112
Luis Carlos Cobo37c57982008-02-23 15:17:04 +0100113struct ieee80211s_hdr {
114 u8 flags;
115 u8 ttl;
Luis Carlos Cobo51cedda2008-04-23 12:15:29 -0700116 __le32 seqnum;
Luis Carlos Cobo37c57982008-02-23 15:17:04 +0100117 u8 eaddr1[6];
118 u8 eaddr2[6];
119 u8 eaddr3[6];
120} __attribute__ ((packed));
121
122
Jiri Benca9de8ce2007-05-05 11:43:04 -0700123struct ieee80211_mgmt {
124 __le16 frame_control;
125 __le16 duration;
126 u8 da[6];
127 u8 sa[6];
128 u8 bssid[6];
129 __le16 seq_ctrl;
130 union {
131 struct {
132 __le16 auth_alg;
133 __le16 auth_transaction;
134 __le16 status_code;
135 /* possibly followed by Challenge text */
136 u8 variable[0];
137 } __attribute__ ((packed)) auth;
138 struct {
139 __le16 reason_code;
140 } __attribute__ ((packed)) deauth;
141 struct {
142 __le16 capab_info;
143 __le16 listen_interval;
144 /* followed by SSID and Supported rates */
145 u8 variable[0];
146 } __attribute__ ((packed)) assoc_req;
147 struct {
148 __le16 capab_info;
149 __le16 status_code;
150 __le16 aid;
151 /* followed by Supported rates */
152 u8 variable[0];
153 } __attribute__ ((packed)) assoc_resp, reassoc_resp;
154 struct {
155 __le16 capab_info;
156 __le16 listen_interval;
157 u8 current_ap[6];
158 /* followed by SSID and Supported rates */
159 u8 variable[0];
160 } __attribute__ ((packed)) reassoc_req;
161 struct {
162 __le16 reason_code;
163 } __attribute__ ((packed)) disassoc;
164 struct {
165 __le64 timestamp;
166 __le16 beacon_int;
167 __le16 capab_info;
168 /* followed by some of SSID, Supported rates,
169 * FH Params, DS Params, CF Params, IBSS Params, TIM */
170 u8 variable[0];
171 } __attribute__ ((packed)) beacon;
172 struct {
173 /* only variable items: SSID, Supported rates */
174 u8 variable[0];
175 } __attribute__ ((packed)) probe_req;
176 struct {
177 __le64 timestamp;
178 __le16 beacon_int;
179 __le16 capab_info;
180 /* followed by some of SSID, Supported rates,
181 * FH Params, DS Params, CF Params, IBSS Params */
182 u8 variable[0];
183 } __attribute__ ((packed)) probe_resp;
184 struct {
185 u8 category;
186 union {
187 struct {
188 u8 action_code;
189 u8 dialog_token;
190 u8 status_code;
191 u8 variable[0];
192 } __attribute__ ((packed)) wme_action;
193 struct{
194 u8 action_code;
195 u8 element_id;
196 u8 length;
197 u8 switch_mode;
198 u8 new_chan;
199 u8 switch_count;
200 } __attribute__((packed)) chan_switch;
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200201 struct{
202 u8 action_code;
203 u8 dialog_token;
204 __le16 capab;
205 __le16 timeout;
206 __le16 start_seq_num;
207 } __attribute__((packed)) addba_req;
208 struct{
209 u8 action_code;
210 u8 dialog_token;
211 __le16 status;
212 __le16 capab;
213 __le16 timeout;
214 } __attribute__((packed)) addba_resp;
215 struct{
216 u8 action_code;
217 __le16 params;
218 __le16 reason_code;
219 } __attribute__((packed)) delba;
Luis Carlos Cobo37c57982008-02-23 15:17:04 +0100220 struct{
221 u8 action_code;
222 /* capab_info for open and confirm,
223 * reason for close
224 */
225 __le16 aux;
226 /* Followed in plink_confirm by status
227 * code, AID and supported rates,
228 * and directly by supported rates in
229 * plink_open and plink_close
230 */
231 u8 variable[0];
232 } __attribute__((packed)) plink_action;
233 struct{
234 u8 action_code;
235 u8 variable[0];
236 } __attribute__((packed)) mesh_action;
Jiri Benca9de8ce2007-05-05 11:43:04 -0700237 } u;
238 } __attribute__ ((packed)) action;
239 } u;
240} __attribute__ ((packed));
241
242
243/* Control frames */
244struct ieee80211_rts {
245 __le16 frame_control;
246 __le16 duration;
247 u8 ra[6];
248 u8 ta[6];
249} __attribute__ ((packed));
250
251struct ieee80211_cts {
252 __le16 frame_control;
253 __le16 duration;
254 u8 ra[6];
255} __attribute__ ((packed));
256
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200257/**
258 * struct ieee80211_bar - HT Block Ack Request
259 *
260 * This structure refers to "HT BlockAckReq" as
261 * described in 802.11n draft section 7.2.1.7.1
262 */
263struct ieee80211_bar {
264 __le16 frame_control;
265 __le16 duration;
266 __u8 ra[6];
267 __u8 ta[6];
Ron Rindjunskya8b47ea2008-01-21 12:39:11 +0200268 __le16 control;
269 __le16 start_seq_num;
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200270} __attribute__((packed));
271
272/**
273 * struct ieee80211_ht_cap - HT capabilities
274 *
275 * This structure refers to "HT capabilities element" as
276 * described in 802.11n draft section 7.3.2.52
277 */
278struct ieee80211_ht_cap {
279 __le16 cap_info;
280 u8 ampdu_params_info;
281 u8 supp_mcs_set[16];
282 __le16 extended_ht_cap_info;
283 __le32 tx_BF_cap_info;
284 u8 antenna_selection_info;
285} __attribute__ ((packed));
286
287/**
288 * struct ieee80211_ht_cap - HT additional information
289 *
290 * This structure refers to "HT information element" as
291 * described in 802.11n draft section 7.3.2.53
292 */
293struct ieee80211_ht_addt_info {
294 u8 control_chan;
295 u8 ht_param;
296 __le16 operation_mode;
297 __le16 stbc_param;
298 u8 basic_set[16];
299} __attribute__ ((packed));
300
301/* 802.11n HT capabilities masks */
302#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
303#define IEEE80211_HT_CAP_MIMO_PS 0x000C
304#define IEEE80211_HT_CAP_GRN_FLD 0x0010
305#define IEEE80211_HT_CAP_SGI_20 0x0020
306#define IEEE80211_HT_CAP_SGI_40 0x0040
307#define IEEE80211_HT_CAP_DELAY_BA 0x0400
308#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
Ron Rindjunskyedcdf8b2008-05-15 13:53:55 +0800309/* 802.11n HT capability AMPDU settings */
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200310#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
311#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
Ron Rindjunskyedcdf8b2008-05-15 13:53:55 +0800312/* 802.11n HT capability MSC set */
313#define IEEE80211_SUPP_MCS_SET_UEQM 4
314#define IEEE80211_HT_CAP_MAX_STREAMS 4
315#define IEEE80211_SUPP_MCS_SET_LEN 10
316/* maximum streams the spec allows */
317#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01
318#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02
319#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C
320#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200321/* 802.11n HT IE masks */
322#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
Emmanuel Grumbach963f5512008-06-12 09:47:00 +0800323#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00
Emmanuel Grumbach93061022008-05-29 16:35:23 +0800324#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01
325#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200326#define IEEE80211_HT_IE_CHA_WIDTH 0x04
327#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
328#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
329#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
Jiri Benca9de8ce2007-05-05 11:43:04 -0700330
Tomas Winklere53cfe02008-01-30 22:05:13 -0800331/* MIMO Power Save Modes */
Ron Rindjunskyedcdf8b2008-05-15 13:53:55 +0800332#define WLAN_HT_CAP_MIMO_PS_STATIC 0
333#define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1
334#define WLAN_HT_CAP_MIMO_PS_INVALID 2
335#define WLAN_HT_CAP_MIMO_PS_DISABLED 3
Tomas Winklere53cfe02008-01-30 22:05:13 -0800336
Jiri Benca9de8ce2007-05-05 11:43:04 -0700337/* Authentication algorithms */
338#define WLAN_AUTH_OPEN 0
339#define WLAN_AUTH_SHARED_KEY 1
340#define WLAN_AUTH_FAST_BSS_TRANSITION 2
341#define WLAN_AUTH_LEAP 128
342
343#define WLAN_AUTH_CHALLENGE_LEN 128
344
345#define WLAN_CAPABILITY_ESS (1<<0)
346#define WLAN_CAPABILITY_IBSS (1<<1)
347#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
348#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
349#define WLAN_CAPABILITY_PRIVACY (1<<4)
350#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
351#define WLAN_CAPABILITY_PBCC (1<<6)
352#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
353/* 802.11h */
354#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
355#define WLAN_CAPABILITY_QOS (1<<9)
356#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
357#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
358
Daniel Drake56282212007-07-10 19:32:10 +0200359/* 802.11g ERP information element */
360#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
361#define WLAN_ERP_USE_PROTECTION (1<<1)
362#define WLAN_ERP_BARKER_PREAMBLE (1<<2)
363
364/* WLAN_ERP_BARKER_PREAMBLE values */
365enum {
366 WLAN_ERP_PREAMBLE_SHORT = 0,
367 WLAN_ERP_PREAMBLE_LONG = 1,
368};
369
Jiri Benca9de8ce2007-05-05 11:43:04 -0700370/* Status codes */
371enum ieee80211_statuscode {
372 WLAN_STATUS_SUCCESS = 0,
373 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
374 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
375 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
376 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
377 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
378 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
379 WLAN_STATUS_CHALLENGE_FAIL = 15,
380 WLAN_STATUS_AUTH_TIMEOUT = 16,
381 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
382 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
383 /* 802.11b */
384 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
385 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
386 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
387 /* 802.11h */
388 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
389 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
390 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
391 /* 802.11g */
392 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
393 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
394 /* 802.11i */
395 WLAN_STATUS_INVALID_IE = 40,
396 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
397 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
398 WLAN_STATUS_INVALID_AKMP = 43,
399 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
400 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
401 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200402 /* 802.11e */
403 WLAN_STATUS_UNSPECIFIED_QOS = 32,
404 WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
405 WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
406 WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
407 WLAN_STATUS_REQUEST_DECLINED = 37,
408 WLAN_STATUS_INVALID_QOS_PARAM = 38,
409 WLAN_STATUS_CHANGE_TSPEC = 39,
410 WLAN_STATUS_WAIT_TS_DELAY = 47,
411 WLAN_STATUS_NO_DIRECT_LINK = 48,
412 WLAN_STATUS_STA_NOT_PRESENT = 49,
413 WLAN_STATUS_STA_NOT_QSTA = 50,
Jiri Benca9de8ce2007-05-05 11:43:04 -0700414};
415
416
417/* Reason codes */
418enum ieee80211_reasoncode {
419 WLAN_REASON_UNSPECIFIED = 1,
420 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
421 WLAN_REASON_DEAUTH_LEAVING = 3,
422 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
423 WLAN_REASON_DISASSOC_AP_BUSY = 5,
424 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
425 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
426 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
427 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
428 /* 802.11h */
429 WLAN_REASON_DISASSOC_BAD_POWER = 10,
430 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
431 /* 802.11i */
432 WLAN_REASON_INVALID_IE = 13,
433 WLAN_REASON_MIC_FAILURE = 14,
434 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
435 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
436 WLAN_REASON_IE_DIFFERENT = 17,
437 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
438 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
439 WLAN_REASON_INVALID_AKMP = 20,
440 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
441 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
442 WLAN_REASON_IEEE8021X_FAILED = 23,
443 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200444 /* 802.11e */
445 WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
446 WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
447 WLAN_REASON_DISASSOC_LOW_ACK = 34,
448 WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
449 WLAN_REASON_QSTA_LEAVE_QBSS = 36,
450 WLAN_REASON_QSTA_NOT_USE = 37,
451 WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
452 WLAN_REASON_QSTA_TIMEOUT = 39,
453 WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
Jiri Benca9de8ce2007-05-05 11:43:04 -0700454};
455
456
457/* Information Element IDs */
458enum ieee80211_eid {
459 WLAN_EID_SSID = 0,
460 WLAN_EID_SUPP_RATES = 1,
461 WLAN_EID_FH_PARAMS = 2,
462 WLAN_EID_DS_PARAMS = 3,
463 WLAN_EID_CF_PARAMS = 4,
464 WLAN_EID_TIM = 5,
465 WLAN_EID_IBSS_PARAMS = 6,
466 WLAN_EID_CHALLENGE = 16,
467 /* 802.11d */
468 WLAN_EID_COUNTRY = 7,
469 WLAN_EID_HP_PARAMS = 8,
470 WLAN_EID_HP_TABLE = 9,
471 WLAN_EID_REQUEST = 10,
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200472 /* 802.11e */
473 WLAN_EID_QBSS_LOAD = 11,
474 WLAN_EID_EDCA_PARAM_SET = 12,
475 WLAN_EID_TSPEC = 13,
476 WLAN_EID_TCLAS = 14,
477 WLAN_EID_SCHEDULE = 15,
478 WLAN_EID_TS_DELAY = 43,
479 WLAN_EID_TCLAS_PROCESSING = 44,
480 WLAN_EID_QOS_CAPA = 46,
Luis Carlos Cobod619ee02008-04-23 12:34:59 -0700481 /* 802.11s
482 *
483 * All mesh EID numbers are pending IEEE 802.11 ANA approval.
484 * The numbers have been incremented from those suggested in
485 * 802.11s/D2.0 so that MESH_CONFIG does not conflict with
486 * EXT_SUPP_RATES.
487 */
488 WLAN_EID_MESH_CONFIG = 51,
489 WLAN_EID_MESH_ID = 52,
490 WLAN_EID_PEER_LINK = 55,
491 WLAN_EID_PREQ = 68,
492 WLAN_EID_PREP = 69,
493 WLAN_EID_PERR = 70,
Jiri Benca9de8ce2007-05-05 11:43:04 -0700494 /* 802.11h */
495 WLAN_EID_PWR_CONSTRAINT = 32,
496 WLAN_EID_PWR_CAPABILITY = 33,
497 WLAN_EID_TPC_REQUEST = 34,
498 WLAN_EID_TPC_REPORT = 35,
499 WLAN_EID_SUPPORTED_CHANNELS = 36,
500 WLAN_EID_CHANNEL_SWITCH = 37,
501 WLAN_EID_MEASURE_REQUEST = 38,
502 WLAN_EID_MEASURE_REPORT = 39,
503 WLAN_EID_QUIET = 40,
504 WLAN_EID_IBSS_DFS = 41,
505 /* 802.11g */
506 WLAN_EID_ERP_INFO = 42,
507 WLAN_EID_EXT_SUPP_RATES = 50,
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200508 /* 802.11n */
509 WLAN_EID_HT_CAPABILITY = 45,
510 WLAN_EID_HT_EXTRA_INFO = 61,
Jiri Benca9de8ce2007-05-05 11:43:04 -0700511 /* 802.11i */
512 WLAN_EID_RSN = 48,
513 WLAN_EID_WPA = 221,
514 WLAN_EID_GENERIC = 221,
515 WLAN_EID_VENDOR_SPECIFIC = 221,
516 WLAN_EID_QOS_PARAMETER = 222
517};
518
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200519/* Action category code */
520enum ieee80211_category {
521 WLAN_CATEGORY_SPECTRUM_MGMT = 0,
522 WLAN_CATEGORY_QOS = 1,
523 WLAN_CATEGORY_DLS = 2,
524 WLAN_CATEGORY_BACK = 3,
525 WLAN_CATEGORY_WMM = 17,
526};
527
528/* BACK action code */
529enum ieee80211_back_actioncode {
530 WLAN_ACTION_ADDBA_REQ = 0,
531 WLAN_ACTION_ADDBA_RESP = 1,
532 WLAN_ACTION_DELBA = 2,
533};
534
Ron Rindjunsky07db2182007-12-25 17:00:33 +0200535/* BACK (block-ack) parties */
536enum ieee80211_back_parties {
537 WLAN_BACK_RECIPIENT = 0,
538 WLAN_BACK_INITIATOR = 1,
539 WLAN_BACK_TIMER = 2,
540};
541
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200542/* A-MSDU 802.11n */
543#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
544
Jiri Benca9de8ce2007-05-05 11:43:04 -0700545/* cipher suite selectors */
546#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
547#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
548#define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
549/* reserved: 0x000FAC03 */
550#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
551#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
552
553#define WLAN_MAX_KEY_LEN 32
554
Johannes Bergf97df022007-09-18 17:29:20 -0400555/**
556 * ieee80211_get_SA - get pointer to SA
557 *
558 * Given an 802.11 frame, this function returns the offset
559 * to the source address (SA). It does not verify that the
560 * header is long enough to contain the address, and the
561 * header must be long enough to contain the frame control
562 * field.
563 *
564 * @hdr: the frame
565 */
566static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
567{
Harvey Harrison5a433b32008-04-21 10:41:10 -0700568 __le16 fc = hdr->frame_control;
569 fc &= cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
Johannes Bergf97df022007-09-18 17:29:20 -0400570
Harvey Harrison5a433b32008-04-21 10:41:10 -0700571 switch (fc) {
572 case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS):
573 return hdr->addr3;
574 case __constant_cpu_to_le16(IEEE80211_FCTL_TODS|IEEE80211_FCTL_FROMDS):
575 return hdr->addr4;
576 default:
577 return hdr->addr2;
Johannes Bergf97df022007-09-18 17:29:20 -0400578 }
Johannes Bergf97df022007-09-18 17:29:20 -0400579}
580
581/**
582 * ieee80211_get_DA - get pointer to DA
583 *
584 * Given an 802.11 frame, this function returns the offset
585 * to the destination address (DA). It does not verify that
586 * the header is long enough to contain the address, and the
587 * header must be long enough to contain the frame control
588 * field.
589 *
590 * @hdr: the frame
591 */
592static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
593{
Harvey Harrison5a433b32008-04-21 10:41:10 -0700594 __le16 fc = hdr->frame_control;
595 fc &= cpu_to_le16(IEEE80211_FCTL_TODS);
Johannes Bergf97df022007-09-18 17:29:20 -0400596
Harvey Harrison5a433b32008-04-21 10:41:10 -0700597 if (fc)
Johannes Bergf97df022007-09-18 17:29:20 -0400598 return hdr->addr3;
Harvey Harrison5a433b32008-04-21 10:41:10 -0700599 else
600 return hdr->addr1;
Johannes Bergf97df022007-09-18 17:29:20 -0400601}
602
603/**
604 * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set
605 *
606 * This function determines whether the "more fragments" bit is set
607 * in the frame.
608 *
609 * @hdr: the frame
610 */
611static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
612{
Harvey Harrison5a433b32008-04-21 10:41:10 -0700613 __le16 fc = hdr->frame_control;
614 return !!(fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS));
Johannes Bergf97df022007-09-18 17:29:20 -0400615}
616
Jiri Benca9de8ce2007-05-05 11:43:04 -0700617#endif /* IEEE80211_H */