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