blob: 64a4abce6d91cdba6e830a8e908f95cbe2827c4c [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
Harvey Harrisonfd7c8a42008-06-11 14:21:56 -0700101#define IEEE80211_QOS_CTL_LEN 2
Harvey Harrison238f74a2008-07-02 11:05:34 -0700102#define IEEE80211_QOS_CTL_TID_MASK 0x000F
103#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
Jiri Benca9de8ce2007-05-05 11:43:04 -0700104
105struct ieee80211_hdr {
106 __le16 frame_control;
107 __le16 duration_id;
108 u8 addr1[6];
109 u8 addr2[6];
110 u8 addr3[6];
111 __le16 seq_ctrl;
112 u8 addr4[6];
113} __attribute__ ((packed));
114
Harvey Harrisonfd7c8a42008-06-11 14:21:56 -0700115/**
116 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
117 * @fc: frame control bytes in little-endian byteorder
118 */
119static inline int ieee80211_has_tods(__le16 fc)
120{
121 return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0;
122}
123
124/**
125 * ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set
126 * @fc: frame control bytes in little-endian byteorder
127 */
128static inline int ieee80211_has_fromds(__le16 fc)
129{
130 return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0;
131}
132
133/**
134 * ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set
135 * @fc: frame control bytes in little-endian byteorder
136 */
137static inline int ieee80211_has_a4(__le16 fc)
138{
139 __le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
140 return (fc & tmp) == tmp;
141}
142
143/**
144 * ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set
145 * @fc: frame control bytes in little-endian byteorder
146 */
147static inline int ieee80211_has_morefrags(__le16 fc)
148{
149 return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0;
150}
151
152/**
153 * ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set
154 * @fc: frame control bytes in little-endian byteorder
155 */
156static inline int ieee80211_has_retry(__le16 fc)
157{
158 return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0;
159}
160
161/**
162 * ieee80211_has_pm - check if IEEE80211_FCTL_PM is set
163 * @fc: frame control bytes in little-endian byteorder
164 */
165static inline int ieee80211_has_pm(__le16 fc)
166{
167 return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0;
168}
169
170/**
171 * ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set
172 * @fc: frame control bytes in little-endian byteorder
173 */
174static inline int ieee80211_has_moredata(__le16 fc)
175{
176 return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0;
177}
178
179/**
180 * ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set
181 * @fc: frame control bytes in little-endian byteorder
182 */
183static inline int ieee80211_has_protected(__le16 fc)
184{
185 return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0;
186}
187
188/**
189 * ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set
190 * @fc: frame control bytes in little-endian byteorder
191 */
192static inline int ieee80211_has_order(__le16 fc)
193{
194 return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0;
195}
196
197/**
198 * ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT
199 * @fc: frame control bytes in little-endian byteorder
200 */
201static inline int ieee80211_is_mgmt(__le16 fc)
202{
203 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
204 cpu_to_le16(IEEE80211_FTYPE_MGMT);
205}
206
207/**
208 * ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL
209 * @fc: frame control bytes in little-endian byteorder
210 */
211static inline int ieee80211_is_ctl(__le16 fc)
212{
213 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
214 cpu_to_le16(IEEE80211_FTYPE_CTL);
215}
216
217/**
218 * ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA
219 * @fc: frame control bytes in little-endian byteorder
220 */
221static inline int ieee80211_is_data(__le16 fc)
222{
223 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
224 cpu_to_le16(IEEE80211_FTYPE_DATA);
225}
226
227/**
228 * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set
229 * @fc: frame control bytes in little-endian byteorder
230 */
231static inline int ieee80211_is_data_qos(__le16 fc)
232{
233 /*
234 * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need
235 * to check the one bit
236 */
237 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) ==
238 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA);
239}
240
241/**
242 * ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data
243 * @fc: frame control bytes in little-endian byteorder
244 */
245static inline int ieee80211_is_data_present(__le16 fc)
246{
247 /*
248 * mask with 0x40 and test that that bit is clear to only return true
249 * for the data-containing substypes.
250 */
251 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) ==
252 cpu_to_le16(IEEE80211_FTYPE_DATA);
253}
254
255/**
256 * ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ
257 * @fc: frame control bytes in little-endian byteorder
258 */
259static inline int ieee80211_is_assoc_req(__le16 fc)
260{
261 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
262 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ);
263}
264
265/**
266 * ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP
267 * @fc: frame control bytes in little-endian byteorder
268 */
269static inline int ieee80211_is_assoc_resp(__le16 fc)
270{
271 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
272 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP);
273}
274
275/**
276 * ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ
277 * @fc: frame control bytes in little-endian byteorder
278 */
279static inline int ieee80211_is_reassoc_req(__le16 fc)
280{
281 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
282 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ);
283}
284
285/**
286 * ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP
287 * @fc: frame control bytes in little-endian byteorder
288 */
289static inline int ieee80211_is_reassoc_resp(__le16 fc)
290{
291 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
292 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP);
293}
294
295/**
296 * ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ
297 * @fc: frame control bytes in little-endian byteorder
298 */
299static inline int ieee80211_is_probe_req(__le16 fc)
300{
301 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
302 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ);
303}
304
305/**
306 * ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP
307 * @fc: frame control bytes in little-endian byteorder
308 */
309static inline int ieee80211_is_probe_resp(__le16 fc)
310{
311 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
312 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
313}
314
315/**
316 * ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON
317 * @fc: frame control bytes in little-endian byteorder
318 */
319static inline int ieee80211_is_beacon(__le16 fc)
320{
321 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
322 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
323}
324
325/**
326 * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM
327 * @fc: frame control bytes in little-endian byteorder
328 */
329static inline int ieee80211_is_atim(__le16 fc)
330{
331 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
332 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM);
333}
334
335/**
336 * ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC
337 * @fc: frame control bytes in little-endian byteorder
338 */
339static inline int ieee80211_is_disassoc(__le16 fc)
340{
341 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
342 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC);
343}
344
345/**
346 * ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH
347 * @fc: frame control bytes in little-endian byteorder
348 */
349static inline int ieee80211_is_auth(__le16 fc)
350{
351 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
352 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
353}
354
355/**
356 * ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH
357 * @fc: frame control bytes in little-endian byteorder
358 */
359static inline int ieee80211_is_deauth(__le16 fc)
360{
361 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
362 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
363}
364
365/**
366 * ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION
367 * @fc: frame control bytes in little-endian byteorder
368 */
369static inline int ieee80211_is_action(__le16 fc)
370{
371 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
372 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
373}
374
375/**
376 * ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ
377 * @fc: frame control bytes in little-endian byteorder
378 */
379static inline int ieee80211_is_back_req(__le16 fc)
380{
381 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
382 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ);
383}
384
385/**
386 * ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK
387 * @fc: frame control bytes in little-endian byteorder
388 */
389static inline int ieee80211_is_back(__le16 fc)
390{
391 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
392 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK);
393}
394
395/**
396 * ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL
397 * @fc: frame control bytes in little-endian byteorder
398 */
399static inline int ieee80211_is_pspoll(__le16 fc)
400{
401 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
402 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
403}
404
405/**
406 * ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS
407 * @fc: frame control bytes in little-endian byteorder
408 */
409static inline int ieee80211_is_rts(__le16 fc)
410{
411 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
412 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
413}
414
415/**
416 * ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS
417 * @fc: frame control bytes in little-endian byteorder
418 */
419static inline int ieee80211_is_cts(__le16 fc)
420{
421 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
422 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
423}
424
425/**
426 * ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK
427 * @fc: frame control bytes in little-endian byteorder
428 */
429static inline int ieee80211_is_ack(__le16 fc)
430{
431 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
432 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK);
433}
434
435/**
436 * ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND
437 * @fc: frame control bytes in little-endian byteorder
438 */
439static inline int ieee80211_is_cfend(__le16 fc)
440{
441 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
442 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND);
443}
444
445/**
446 * ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK
447 * @fc: frame control bytes in little-endian byteorder
448 */
449static inline int ieee80211_is_cfendack(__le16 fc)
450{
451 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
452 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK);
453}
454
455/**
456 * ieee80211_is_nullfunc - check if FTYPE=IEEE80211_FTYPE_DATA and STYPE=IEEE80211_STYPE_NULLFUNC
457 * @fc: frame control bytes in little-endian byteorder
458 */
459static inline int ieee80211_is_nullfunc(__le16 fc)
460{
461 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
462 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC);
463}
Jiri Benca9de8ce2007-05-05 11:43:04 -0700464
Luis Carlos Cobo37c57982008-02-23 15:17:04 +0100465struct ieee80211s_hdr {
466 u8 flags;
467 u8 ttl;
Luis Carlos Cobo51cedda2008-04-23 12:15:29 -0700468 __le32 seqnum;
Luis Carlos Cobo37c57982008-02-23 15:17:04 +0100469 u8 eaddr1[6];
470 u8 eaddr2[6];
471 u8 eaddr3[6];
472} __attribute__ ((packed));
473
YanBo79617de2008-09-22 13:30:32 +0800474/* Mesh flags */
475#define MESH_FLAGS_AE_A4 0x1
476#define MESH_FLAGS_AE_A5_A6 0x2
477#define MESH_FLAGS_PS_DEEP 0x4
478
Assaf Kraussf2df3852008-06-15 18:23:29 +0300479/**
480 * struct ieee80211_quiet_ie
481 *
482 * This structure refers to "Quiet information element"
483 */
484struct ieee80211_quiet_ie {
485 u8 count;
486 u8 period;
487 __le16 duration;
488 __le16 offset;
489} __attribute__ ((packed));
490
491/**
492 * struct ieee80211_msrment_ie
493 *
494 * This structure refers to "Measurement Request/Report information element"
495 */
496struct ieee80211_msrment_ie {
497 u8 token;
498 u8 mode;
499 u8 type;
500 u8 request[0];
501} __attribute__ ((packed));
502
503/**
504 * struct ieee80211_channel_sw_ie
505 *
506 * This structure refers to "Channel Switch Announcement information element"
507 */
508struct ieee80211_channel_sw_ie {
509 u8 mode;
510 u8 new_ch_num;
511 u8 count;
512} __attribute__ ((packed));
Luis Carlos Cobo37c57982008-02-23 15:17:04 +0100513
Emmanuel Grumbach98f7dfd2008-07-18 13:52:59 +0800514/**
515 * struct ieee80211_tim
516 *
517 * This structure refers to "Traffic Indication Map information element"
518 */
519struct ieee80211_tim_ie {
520 u8 dtim_count;
521 u8 dtim_period;
522 u8 bitmap_ctrl;
523 /* variable size: 1 - 251 bytes */
524 u8 virtual_map[0];
525} __attribute__ ((packed));
526
Jiri Benca9de8ce2007-05-05 11:43:04 -0700527struct ieee80211_mgmt {
528 __le16 frame_control;
529 __le16 duration;
530 u8 da[6];
531 u8 sa[6];
532 u8 bssid[6];
533 __le16 seq_ctrl;
534 union {
535 struct {
536 __le16 auth_alg;
537 __le16 auth_transaction;
538 __le16 status_code;
539 /* possibly followed by Challenge text */
540 u8 variable[0];
541 } __attribute__ ((packed)) auth;
542 struct {
543 __le16 reason_code;
544 } __attribute__ ((packed)) deauth;
545 struct {
546 __le16 capab_info;
547 __le16 listen_interval;
548 /* followed by SSID and Supported rates */
549 u8 variable[0];
550 } __attribute__ ((packed)) assoc_req;
551 struct {
552 __le16 capab_info;
553 __le16 status_code;
554 __le16 aid;
555 /* followed by Supported rates */
556 u8 variable[0];
557 } __attribute__ ((packed)) assoc_resp, reassoc_resp;
558 struct {
559 __le16 capab_info;
560 __le16 listen_interval;
561 u8 current_ap[6];
562 /* followed by SSID and Supported rates */
563 u8 variable[0];
564 } __attribute__ ((packed)) reassoc_req;
565 struct {
566 __le16 reason_code;
567 } __attribute__ ((packed)) disassoc;
568 struct {
569 __le64 timestamp;
570 __le16 beacon_int;
571 __le16 capab_info;
572 /* followed by some of SSID, Supported rates,
573 * FH Params, DS Params, CF Params, IBSS Params, TIM */
574 u8 variable[0];
575 } __attribute__ ((packed)) beacon;
576 struct {
577 /* only variable items: SSID, Supported rates */
578 u8 variable[0];
579 } __attribute__ ((packed)) probe_req;
580 struct {
581 __le64 timestamp;
582 __le16 beacon_int;
583 __le16 capab_info;
584 /* followed by some of SSID, Supported rates,
585 * FH Params, DS Params, CF Params, IBSS Params */
586 u8 variable[0];
587 } __attribute__ ((packed)) probe_resp;
588 struct {
589 u8 category;
590 union {
591 struct {
592 u8 action_code;
593 u8 dialog_token;
594 u8 status_code;
595 u8 variable[0];
596 } __attribute__ ((packed)) wme_action;
597 struct{
598 u8 action_code;
599 u8 element_id;
600 u8 length;
Assaf Kraussf2df3852008-06-15 18:23:29 +0300601 struct ieee80211_channel_sw_ie sw_elem;
Jiri Benca9de8ce2007-05-05 11:43:04 -0700602 } __attribute__((packed)) chan_switch;
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200603 struct{
604 u8 action_code;
605 u8 dialog_token;
Assaf Kraussf2df3852008-06-15 18:23:29 +0300606 u8 element_id;
607 u8 length;
608 struct ieee80211_msrment_ie msr_elem;
609 } __attribute__((packed)) measurement;
610 struct{
611 u8 action_code;
612 u8 dialog_token;
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200613 __le16 capab;
614 __le16 timeout;
615 __le16 start_seq_num;
616 } __attribute__((packed)) addba_req;
617 struct{
618 u8 action_code;
619 u8 dialog_token;
620 __le16 status;
621 __le16 capab;
622 __le16 timeout;
623 } __attribute__((packed)) addba_resp;
624 struct{
625 u8 action_code;
626 __le16 params;
627 __le16 reason_code;
628 } __attribute__((packed)) delba;
Luis Carlos Cobo37c57982008-02-23 15:17:04 +0100629 struct{
630 u8 action_code;
631 /* capab_info for open and confirm,
632 * reason for close
633 */
634 __le16 aux;
635 /* Followed in plink_confirm by status
636 * code, AID and supported rates,
637 * and directly by supported rates in
638 * plink_open and plink_close
639 */
640 u8 variable[0];
641 } __attribute__((packed)) plink_action;
642 struct{
643 u8 action_code;
644 u8 variable[0];
645 } __attribute__((packed)) mesh_action;
Jiri Benca9de8ce2007-05-05 11:43:04 -0700646 } u;
647 } __attribute__ ((packed)) action;
648 } u;
649} __attribute__ ((packed));
650
Johannes Berg44d414d2008-09-08 17:44:28 +0200651/* mgmt header + 1 byte category code */
652#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
653
Jiri Benca9de8ce2007-05-05 11:43:04 -0700654
655/* Control frames */
656struct ieee80211_rts {
657 __le16 frame_control;
658 __le16 duration;
659 u8 ra[6];
660 u8 ta[6];
661} __attribute__ ((packed));
662
663struct ieee80211_cts {
664 __le16 frame_control;
665 __le16 duration;
666 u8 ra[6];
667} __attribute__ ((packed));
668
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200669/**
670 * struct ieee80211_bar - HT Block Ack Request
671 *
672 * This structure refers to "HT BlockAckReq" as
673 * described in 802.11n draft section 7.2.1.7.1
674 */
675struct ieee80211_bar {
676 __le16 frame_control;
677 __le16 duration;
678 __u8 ra[6];
679 __u8 ta[6];
Ron Rindjunskya8b47ea2008-01-21 12:39:11 +0200680 __le16 control;
681 __le16 start_seq_num;
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200682} __attribute__((packed));
683
Ron Rindjunsky429a3802008-07-01 14:16:03 +0300684/* 802.11 BAR control masks */
685#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
686#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
687
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200688
689#define IEEE80211_HT_MCS_MASK_LEN 10
690
691/**
692 * struct ieee80211_mcs_info - MCS information
693 * @rx_mask: RX mask
694 * @rx_highest: highest supported RX rate
695 * @tx_params: TX parameters
696 */
697struct ieee80211_mcs_info {
698 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
699 __le16 rx_highest;
700 u8 tx_params;
701 u8 reserved[3];
702} __attribute__((packed));
703
704/* 802.11n HT capability MSC set */
705#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
706#define IEEE80211_HT_MCS_TX_DEFINED 0x01
707#define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
708/* value 0 == 1 stream etc */
709#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
710#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
711#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
712#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
713
714/*
715 * 802.11n D5.0 20.3.5 / 20.6 says:
716 * - indices 0 to 7 and 32 are single spatial stream
717 * - 8 to 31 are multiple spatial streams using equal modulation
718 * [8..15 for two streams, 16..23 for three and 24..31 for four]
719 * - remainder are multiple spatial streams using unequal modulation
720 */
721#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
722#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
723 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
724
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200725/**
726 * struct ieee80211_ht_cap - HT capabilities
727 *
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200728 * This structure is the "HT capabilities element" as
729 * described in 802.11n D5.0 7.3.2.57
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200730 */
731struct ieee80211_ht_cap {
732 __le16 cap_info;
733 u8 ampdu_params_info;
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200734
735 /* 16 bytes MCS information */
736 struct ieee80211_mcs_info mcs;
737
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200738 __le16 extended_ht_cap_info;
739 __le32 tx_BF_cap_info;
740 u8 antenna_selection_info;
741} __attribute__ ((packed));
742
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200743/* 802.11n HT capabilities masks (for cap_info) */
744#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
745#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
746#define IEEE80211_HT_CAP_SM_PS 0x000C
747#define IEEE80211_HT_CAP_GRN_FLD 0x0010
748#define IEEE80211_HT_CAP_SGI_20 0x0020
749#define IEEE80211_HT_CAP_SGI_40 0x0040
750#define IEEE80211_HT_CAP_TX_STBC 0x0080
751#define IEEE80211_HT_CAP_RX_STBC 0x0300
752#define IEEE80211_HT_CAP_DELAY_BA 0x0400
753#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
754#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
755#define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000
756#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
757#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
758
759/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
760#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
761#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
762
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200763/**
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200764 * struct ieee80211_ht_info - HT information
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200765 *
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200766 * This structure is the "HT information element" as
767 * described in 802.11n D5.0 7.3.2.58
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200768 */
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200769struct ieee80211_ht_info {
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200770 u8 control_chan;
771 u8 ht_param;
772 __le16 operation_mode;
773 __le16 stbc_param;
774 u8 basic_set[16];
775} __attribute__ ((packed));
776
Johannes Bergd9fe60d2008-10-09 12:13:49 +0200777/* for ht_param */
778#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
779#define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
780#define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
781#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
782#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
783#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
784#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
785#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
786
787/* for operation_mode */
788#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
789#define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
790#define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
791#define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
792#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
793#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
794#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
795
796/* for stbc_param */
797#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
798#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
799#define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
800#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
801#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
802#define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
803
Jiri Benca9de8ce2007-05-05 11:43:04 -0700804
Johannes Berg44d414d2008-09-08 17:44:28 +0200805/* block-ack parameters */
806#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
807#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
808#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
809#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
810#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
811
812/*
813 * A-PMDU buffer sizes
814 * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
815 */
816#define IEEE80211_MIN_AMPDU_BUF 0x8
817#define IEEE80211_MAX_AMPDU_BUF 0x40
818
819
Tomas Winkler00c5ae22008-09-03 11:26:42 +0800820/* Spatial Multiplexing Power Save Modes */
821#define WLAN_HT_CAP_SM_PS_STATIC 0
822#define WLAN_HT_CAP_SM_PS_DYNAMIC 1
823#define WLAN_HT_CAP_SM_PS_INVALID 2
824#define WLAN_HT_CAP_SM_PS_DISABLED 3
Tomas Winklere53cfe02008-01-30 22:05:13 -0800825
Jiri Benca9de8ce2007-05-05 11:43:04 -0700826/* Authentication algorithms */
827#define WLAN_AUTH_OPEN 0
828#define WLAN_AUTH_SHARED_KEY 1
829#define WLAN_AUTH_FAST_BSS_TRANSITION 2
830#define WLAN_AUTH_LEAP 128
831
832#define WLAN_AUTH_CHALLENGE_LEN 128
833
834#define WLAN_CAPABILITY_ESS (1<<0)
835#define WLAN_CAPABILITY_IBSS (1<<1)
836#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
837#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
838#define WLAN_CAPABILITY_PRIVACY (1<<4)
839#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
840#define WLAN_CAPABILITY_PBCC (1<<6)
841#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
Assaf Kraussb6623482008-06-16 16:09:49 +0300842
Jiri Benca9de8ce2007-05-05 11:43:04 -0700843/* 802.11h */
844#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
845#define WLAN_CAPABILITY_QOS (1<<9)
846#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
847#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
Assaf Kraussb6623482008-06-16 16:09:49 +0300848/* measurement */
849#define IEEE80211_SPCT_MSR_RPRT_MODE_LATE (1<<0)
850#define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE (1<<1)
851#define IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED (1<<2)
852
853#define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0
854#define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1
855#define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2
856
Jiri Benca9de8ce2007-05-05 11:43:04 -0700857
Daniel Drake56282212007-07-10 19:32:10 +0200858/* 802.11g ERP information element */
859#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
860#define WLAN_ERP_USE_PROTECTION (1<<1)
861#define WLAN_ERP_BARKER_PREAMBLE (1<<2)
862
863/* WLAN_ERP_BARKER_PREAMBLE values */
864enum {
865 WLAN_ERP_PREAMBLE_SHORT = 0,
866 WLAN_ERP_PREAMBLE_LONG = 1,
867};
868
Jiri Benca9de8ce2007-05-05 11:43:04 -0700869/* Status codes */
870enum ieee80211_statuscode {
871 WLAN_STATUS_SUCCESS = 0,
872 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
873 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
874 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
875 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
876 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
877 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
878 WLAN_STATUS_CHALLENGE_FAIL = 15,
879 WLAN_STATUS_AUTH_TIMEOUT = 16,
880 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
881 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
882 /* 802.11b */
883 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
884 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
885 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
886 /* 802.11h */
887 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
888 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
889 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
890 /* 802.11g */
891 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
892 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
893 /* 802.11i */
894 WLAN_STATUS_INVALID_IE = 40,
895 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
896 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
897 WLAN_STATUS_INVALID_AKMP = 43,
898 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
899 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
900 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200901 /* 802.11e */
902 WLAN_STATUS_UNSPECIFIED_QOS = 32,
903 WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
904 WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
905 WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
906 WLAN_STATUS_REQUEST_DECLINED = 37,
907 WLAN_STATUS_INVALID_QOS_PARAM = 38,
908 WLAN_STATUS_CHANGE_TSPEC = 39,
909 WLAN_STATUS_WAIT_TS_DELAY = 47,
910 WLAN_STATUS_NO_DIRECT_LINK = 48,
911 WLAN_STATUS_STA_NOT_PRESENT = 49,
912 WLAN_STATUS_STA_NOT_QSTA = 50,
Jiri Benca9de8ce2007-05-05 11:43:04 -0700913};
914
915
916/* Reason codes */
917enum ieee80211_reasoncode {
918 WLAN_REASON_UNSPECIFIED = 1,
919 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
920 WLAN_REASON_DEAUTH_LEAVING = 3,
921 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
922 WLAN_REASON_DISASSOC_AP_BUSY = 5,
923 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
924 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
925 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
926 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
927 /* 802.11h */
928 WLAN_REASON_DISASSOC_BAD_POWER = 10,
929 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
930 /* 802.11i */
931 WLAN_REASON_INVALID_IE = 13,
932 WLAN_REASON_MIC_FAILURE = 14,
933 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
934 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
935 WLAN_REASON_IE_DIFFERENT = 17,
936 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
937 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
938 WLAN_REASON_INVALID_AKMP = 20,
939 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
940 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
941 WLAN_REASON_IEEE8021X_FAILED = 23,
942 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200943 /* 802.11e */
944 WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
945 WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
946 WLAN_REASON_DISASSOC_LOW_ACK = 34,
947 WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
948 WLAN_REASON_QSTA_LEAVE_QBSS = 36,
949 WLAN_REASON_QSTA_NOT_USE = 37,
950 WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
951 WLAN_REASON_QSTA_TIMEOUT = 39,
952 WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
Jiri Benca9de8ce2007-05-05 11:43:04 -0700953};
954
955
956/* Information Element IDs */
957enum ieee80211_eid {
958 WLAN_EID_SSID = 0,
959 WLAN_EID_SUPP_RATES = 1,
960 WLAN_EID_FH_PARAMS = 2,
961 WLAN_EID_DS_PARAMS = 3,
962 WLAN_EID_CF_PARAMS = 4,
963 WLAN_EID_TIM = 5,
964 WLAN_EID_IBSS_PARAMS = 6,
965 WLAN_EID_CHALLENGE = 16,
966 /* 802.11d */
967 WLAN_EID_COUNTRY = 7,
968 WLAN_EID_HP_PARAMS = 8,
969 WLAN_EID_HP_TABLE = 9,
970 WLAN_EID_REQUEST = 10,
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +0200971 /* 802.11e */
972 WLAN_EID_QBSS_LOAD = 11,
973 WLAN_EID_EDCA_PARAM_SET = 12,
974 WLAN_EID_TSPEC = 13,
975 WLAN_EID_TCLAS = 14,
976 WLAN_EID_SCHEDULE = 15,
977 WLAN_EID_TS_DELAY = 43,
978 WLAN_EID_TCLAS_PROCESSING = 44,
979 WLAN_EID_QOS_CAPA = 46,
Luis Carlos Cobod619ee02008-04-23 12:34:59 -0700980 /* 802.11s
981 *
982 * All mesh EID numbers are pending IEEE 802.11 ANA approval.
983 * The numbers have been incremented from those suggested in
984 * 802.11s/D2.0 so that MESH_CONFIG does not conflict with
985 * EXT_SUPP_RATES.
986 */
987 WLAN_EID_MESH_CONFIG = 51,
988 WLAN_EID_MESH_ID = 52,
989 WLAN_EID_PEER_LINK = 55,
990 WLAN_EID_PREQ = 68,
991 WLAN_EID_PREP = 69,
992 WLAN_EID_PERR = 70,
Jiri Benca9de8ce2007-05-05 11:43:04 -0700993 /* 802.11h */
994 WLAN_EID_PWR_CONSTRAINT = 32,
995 WLAN_EID_PWR_CAPABILITY = 33,
996 WLAN_EID_TPC_REQUEST = 34,
997 WLAN_EID_TPC_REPORT = 35,
998 WLAN_EID_SUPPORTED_CHANNELS = 36,
999 WLAN_EID_CHANNEL_SWITCH = 37,
1000 WLAN_EID_MEASURE_REQUEST = 38,
1001 WLAN_EID_MEASURE_REPORT = 39,
1002 WLAN_EID_QUIET = 40,
1003 WLAN_EID_IBSS_DFS = 41,
1004 /* 802.11g */
1005 WLAN_EID_ERP_INFO = 42,
1006 WLAN_EID_EXT_SUPP_RATES = 50,
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +02001007 /* 802.11n */
1008 WLAN_EID_HT_CAPABILITY = 45,
Johannes Bergd9fe60d2008-10-09 12:13:49 +02001009 WLAN_EID_HT_INFORMATION = 61,
Jiri Benca9de8ce2007-05-05 11:43:04 -07001010 /* 802.11i */
1011 WLAN_EID_RSN = 48,
1012 WLAN_EID_WPA = 221,
1013 WLAN_EID_GENERIC = 221,
1014 WLAN_EID_VENDOR_SPECIFIC = 221,
1015 WLAN_EID_QOS_PARAMETER = 222
1016};
1017
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +02001018/* Action category code */
1019enum ieee80211_category {
1020 WLAN_CATEGORY_SPECTRUM_MGMT = 0,
1021 WLAN_CATEGORY_QOS = 1,
1022 WLAN_CATEGORY_DLS = 2,
1023 WLAN_CATEGORY_BACK = 3,
1024 WLAN_CATEGORY_WMM = 17,
1025};
1026
Assaf Kraussf2df3852008-06-15 18:23:29 +03001027/* SPECTRUM_MGMT action code */
1028enum ieee80211_spectrum_mgmt_actioncode {
1029 WLAN_ACTION_SPCT_MSR_REQ = 0,
1030 WLAN_ACTION_SPCT_MSR_RPRT = 1,
1031 WLAN_ACTION_SPCT_TPC_REQ = 2,
1032 WLAN_ACTION_SPCT_TPC_RPRT = 3,
1033 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
1034};
1035
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +02001036/* BACK action code */
1037enum ieee80211_back_actioncode {
1038 WLAN_ACTION_ADDBA_REQ = 0,
1039 WLAN_ACTION_ADDBA_RESP = 1,
1040 WLAN_ACTION_DELBA = 2,
1041};
1042
Ron Rindjunsky07db2182007-12-25 17:00:33 +02001043/* BACK (block-ack) parties */
1044enum ieee80211_back_parties {
1045 WLAN_BACK_RECIPIENT = 0,
1046 WLAN_BACK_INITIATOR = 1,
1047 WLAN_BACK_TIMER = 2,
1048};
1049
Ron Rindjunsky6b4e3242007-11-14 19:57:38 +02001050/* A-MSDU 802.11n */
1051#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
1052
Jiri Benca9de8ce2007-05-05 11:43:04 -07001053/* cipher suite selectors */
1054#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
1055#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
1056#define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
1057/* reserved: 0x000FAC03 */
1058#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
1059#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1060
1061#define WLAN_MAX_KEY_LEN 32
1062
Johannes Bergf97df022007-09-18 17:29:20 -04001063/**
Harvey Harrisonfd7c8a42008-06-11 14:21:56 -07001064 * ieee80211_get_qos_ctl - get pointer to qos control bytes
1065 * @hdr: the frame
1066 *
1067 * The qos ctrl bytes come after the frame_control, duration, seq_num
1068 * and 3 or 4 addresses of length ETH_ALEN.
1069 * 3 addr: 2 + 2 + 2 + 3*6 = 24
1070 * 4 addr: 2 + 2 + 2 + 4*6 = 30
1071 */
1072static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
1073{
1074 if (ieee80211_has_a4(hdr->frame_control))
1075 return (u8 *)hdr + 30;
1076 else
1077 return (u8 *)hdr + 24;
1078}
1079
1080/**
Johannes Bergf97df022007-09-18 17:29:20 -04001081 * ieee80211_get_SA - get pointer to SA
Harvey Harrisonfd7c8a42008-06-11 14:21:56 -07001082 * @hdr: the frame
Johannes Bergf97df022007-09-18 17:29:20 -04001083 *
1084 * Given an 802.11 frame, this function returns the offset
1085 * to the source address (SA). It does not verify that the
1086 * header is long enough to contain the address, and the
1087 * header must be long enough to contain the frame control
1088 * field.
Johannes Bergf97df022007-09-18 17:29:20 -04001089 */
1090static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
1091{
Harvey Harrisonfd7c8a42008-06-11 14:21:56 -07001092 if (ieee80211_has_a4(hdr->frame_control))
Harvey Harrison5a433b32008-04-21 10:41:10 -07001093 return hdr->addr4;
Harvey Harrisonfd7c8a42008-06-11 14:21:56 -07001094 if (ieee80211_has_fromds(hdr->frame_control))
1095 return hdr->addr3;
1096 return hdr->addr2;
Johannes Bergf97df022007-09-18 17:29:20 -04001097}
1098
1099/**
1100 * ieee80211_get_DA - get pointer to DA
Harvey Harrisonfd7c8a42008-06-11 14:21:56 -07001101 * @hdr: the frame
Johannes Bergf97df022007-09-18 17:29:20 -04001102 *
1103 * Given an 802.11 frame, this function returns the offset
1104 * to the destination address (DA). It does not verify that
1105 * the header is long enough to contain the address, and the
1106 * header must be long enough to contain the frame control
1107 * field.
Johannes Bergf97df022007-09-18 17:29:20 -04001108 */
1109static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1110{
Harvey Harrisonfd7c8a42008-06-11 14:21:56 -07001111 if (ieee80211_has_tods(hdr->frame_control))
Johannes Bergf97df022007-09-18 17:29:20 -04001112 return hdr->addr3;
Harvey Harrison5a433b32008-04-21 10:41:10 -07001113 else
1114 return hdr->addr1;
Johannes Bergf97df022007-09-18 17:29:20 -04001115}
1116
Jiri Benca9de8ce2007-05-05 11:43:04 -07001117#endif /* IEEE80211_H */