Moep Library  2.0-nc
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
ieee80211_frametypes.h
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 
15 #ifndef __MOEP80211_IEEE80211_FRAMETYPES_H
16 #define __MOEP80211_IEEE80211_FRAMETYPES_H
17 
18 #include <stddef.h>
19 #include <stdbool.h>
20 #include <endian.h>
21 
22 #include <linux/types.h>
23 
24 #include <moep/types.h>
25 #include <moep/ieee80211_addr.h>
26 
27 
28 /*
29  * DS bit usage
30  *
31  * TA = transmitter address
32  * RA = receiver address
33  * DA = destination address
34  * SA = source address
35  *
36  * ToDS FromDS A1(RA) A2(TA) A3 A4 Use
37  * -----------------------------------------------------------------
38  * 0 0 DA SA BSSID - IBSS/DLS
39  * 0 1 DA BSSID SA - AP -> STA
40  * 1 0 BSSID SA DA - AP <- STA
41  * 1 1 RA TA DA SA unspecified (WDS)
42  */
43 
44 #define FCS_LEN 4
45 
46 #define IEEE80211_FCTL_VERS 0x0003
47 #define IEEE80211_FCTL_FTYPE 0x000c
48 #define IEEE80211_FCTL_STYPE 0x00f0
49 #define IEEE80211_FCTL_TODS 0x0100
50 #define IEEE80211_FCTL_FROMDS 0x0200
51 #define IEEE80211_FCTL_MOREFRAGS 0x0400
52 #define IEEE80211_FCTL_RETRY 0x0800
53 #define IEEE80211_FCTL_PM 0x1000
54 #define IEEE80211_FCTL_MOREDATA 0x2000
55 #define IEEE80211_FCTL_PROTECTED 0x4000
56 #define IEEE80211_FCTL_ORDER 0x8000
57 #define IEEE80211_FCTL_CTL_EXT 0x0f00
58 
59 #define IEEE80211_SCTL_FRAG 0x000F
60 #define IEEE80211_SCTL_SEQ 0xFFF0
61 
62 #define IEEE80211_FTYPE_MGMT 0x0000
63 #define IEEE80211_FTYPE_CTL 0x0004
64 #define IEEE80211_FTYPE_DATA 0x0008
65 #define IEEE80211_FTYPE_EXT 0x000c
66 
67 /* management */
68 #define IEEE80211_STYPE_ASSOC_REQ 0x0000
69 #define IEEE80211_STYPE_ASSOC_RESP 0x0010
70 #define IEEE80211_STYPE_REASSOC_REQ 0x0020
71 #define IEEE80211_STYPE_REASSOC_RESP 0x0030
72 #define IEEE80211_STYPE_PROBE_REQ 0x0040
73 #define IEEE80211_STYPE_PROBE_RESP 0x0050
74 #define IEEE80211_STYPE_BEACON 0x0080
75 #define IEEE80211_STYPE_ATIM 0x0090
76 #define IEEE80211_STYPE_DISASSOC 0x00A0
77 #define IEEE80211_STYPE_AUTH 0x00B0
78 #define IEEE80211_STYPE_DEAUTH 0x00C0
79 #define IEEE80211_STYPE_ACTION 0x00D0
80 
81 /* control */
82 #define IEEE80211_STYPE_CTL_EXT 0x0060
83 #define IEEE80211_STYPE_BACK_REQ 0x0080
84 #define IEEE80211_STYPE_BACK 0x0090
85 #define IEEE80211_STYPE_PSPOLL 0x00A0
86 #define IEEE80211_STYPE_RTS 0x00B0
87 #define IEEE80211_STYPE_CTS 0x00C0
88 #define IEEE80211_STYPE_ACK 0x00D0
89 #define IEEE80211_STYPE_CFEND 0x00E0
90 #define IEEE80211_STYPE_CFENDACK 0x00F0
91 
92 /* data */
93 #define IEEE80211_STYPE_DATA 0x0000
94 #define IEEE80211_STYPE_DATA_CFACK 0x0010
95 #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
96 #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
97 #define IEEE80211_STYPE_NULLFUNC 0x0040
98 #define IEEE80211_STYPE_CFACK 0x0050
99 #define IEEE80211_STYPE_CFPOLL 0x0060
100 #define IEEE80211_STYPE_CFACKPOLL 0x0070
101 #define IEEE80211_STYPE_QOS_DATA 0x0080
102 #define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
103 #define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
104 #define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0
105 #define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0
106 #define IEEE80211_STYPE_QOS_CFACK 0x00D0
107 #define IEEE80211_STYPE_QOS_CFPOLL 0x00E0
108 #define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0
109 
110 /* extension, added by 802.11ad */
111 #define IEEE80211_STYPE_DMG_BEACON 0x0000
112 
113 /* control extension - for IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTL_EXT */
114 #define IEEE80211_CTL_EXT_POLL 0x2000
115 #define IEEE80211_CTL_EXT_SPR 0x3000
116 #define IEEE80211_CTL_EXT_GRANT 0x4000
117 #define IEEE80211_CTL_EXT_DMG_CTS 0x5000
118 #define IEEE80211_CTL_EXT_DMG_DTS 0x6000
119 #define IEEE80211_CTL_EXT_SSW 0x8000
120 #define IEEE80211_CTL_EXT_SSW_FBACK 0x9000
121 #define IEEE80211_CTL_EXT_SSW_ACK 0xa000
122 
123 
124 #define IEEE80211_SN_MASK ((IEEE80211_SCTL_SEQ) >> 4)
125 #define IEEE80211_MAX_SN IEEE80211_SN_MASK
126 #define IEEE80211_SN_MODULO (IEEE80211_MAX_SN + 1)
127 
128 static inline int ieee80211_sn_less(u16 sn1, u16 sn2)
129 {
130  return ((sn1 - sn2) & IEEE80211_SN_MASK) > (IEEE80211_SN_MODULO >> 1);
131 }
132 
133 static inline u16 ieee80211_sn_add(u16 sn1, u16 sn2)
134 {
135  return (sn1 + sn2) & IEEE80211_SN_MASK;
136 }
137 
138 static inline u16 ieee80211_sn_inc(u16 sn)
139 {
140  return ieee80211_sn_add(sn, 1);
141 }
142 
143 static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
144 {
145  return (sn1 - sn2) & IEEE80211_SN_MASK;
146 }
147 
148 #define IEEE80211_SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
149 #define IEEE80211_SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
150 
151 /* miscellaneous IEEE 802.11 constants */
152 #define IEEE80211_MAX_FRAG_THRESHOLD 2352
153 #define IEEE80211_MAX_RTS_THRESHOLD 2353
154 #define IEEE80211_MAX_AID 2007
155 #define IEEE80211_MAX_TIM_LEN 251
156 #define IEEE80211_MAX_MESH_PEERINGS 63
157 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
158  6.2.1.1.2.
159 
160  802.11e clarifies the figure in section 7.1.2. The frame body is
161  up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
162 #define IEEE80211_MAX_DATA_LEN 2304
163 /* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
164 #define IEEE80211_MAX_FRAME_LEN 2352
165 
166 #define IEEE80211_MAX_SSID_LEN 32
167 
168 #define IEEE80211_MAX_MESH_ID_LEN 32
169 
170 #define IEEE80211_NUM_TIDS 16
171 
172 #define IEEE80211_QOS_CTL_LEN 2
173 /* 1d tag mask */
174 #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
175 /* TID mask */
176 #define IEEE80211_QOS_CTL_TID_MASK 0x000f
177 /* EOSP */
178 #define IEEE80211_QOS_CTL_EOSP 0x0010
179 /* ACK policy */
180 #define IEEE80211_QOS_CTL_ACK_POLICY_NORMAL 0x0000
181 #define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020
182 #define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040
183 #define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060
184 #define IEEE80211_QOS_CTL_ACK_POLICY_MASK 0x0060
185 /* A-MSDU 802.11n */
186 #define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080
187 /* Mesh Control 802.11s */
188 #define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100
189 
190 /* Mesh Power Save Level */
191 #define IEEE80211_QOS_CTL_MESH_PS_LEVEL 0x0200
192 /* Mesh Receiver Service Period Initiated */
193 #define IEEE80211_QOS_CTL_RSPI 0x0400
194 
195 /* U-APSD queue for WMM IEs sent by AP */
196 #define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7)
197 #define IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK 0x0f
198 
199 /* U-APSD queues for WMM IEs sent by STA */
200 #define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO (1<<0)
201 #define IEEE80211_WMM_IE_STA_QOSINFO_AC_VI (1<<1)
202 #define IEEE80211_WMM_IE_STA_QOSINFO_AC_BK (1<<2)
203 #define IEEE80211_WMM_IE_STA_QOSINFO_AC_BE (1<<3)
204 #define IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK 0x0f
205 
206 /* U-APSD max SP length for WMM IEs sent by STA */
207 #define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 0x00
208 #define IEEE80211_WMM_IE_STA_QOSINFO_SP_2 0x01
209 #define IEEE80211_WMM_IE_STA_QOSINFO_SP_4 0x02
210 #define IEEE80211_WMM_IE_STA_QOSINFO_SP_6 0x03
211 #define IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK 0x03
212 #define IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT 5
213 
214 #define IEEE80211_HT_CTL_LEN 4
215 
217  __le16 frame_control;
218  __le16 duration_id;
219  u8 addr1[IEEE80211_ALEN];
220  u8 addr2[IEEE80211_ALEN];
221  u8 addr3[IEEE80211_ALEN];
222  __le16 seq_ctrl;
223  u8 addr4[IEEE80211_ALEN];
224 } __attribute__((packed));
225 
227  __le16 frame_control;
228  __le16 duration_id;
229  u8 addr1[IEEE80211_ALEN];
230  u8 addr2[IEEE80211_ALEN];
231  u8 addr3[IEEE80211_ALEN];
232  __le16 seq_ctrl;
233 } __attribute__((packed));
234 
236  __le16 frame_control;
237  __le16 duration_id;
238  u8 addr1[IEEE80211_ALEN];
239  u8 addr2[IEEE80211_ALEN];
240  u8 addr3[IEEE80211_ALEN];
241  __le16 seq_ctrl;
242  __le16 qos_ctrl;
243 } __attribute__((packed));
244 
249 static inline int ieee80211_has_tods(__le16 fc)
250 {
251  return (fc & htole16(IEEE80211_FCTL_TODS)) != 0;
252 }
253 
258 static inline int ieee80211_has_fromds(__le16 fc)
259 {
260  return (fc & htole16(IEEE80211_FCTL_FROMDS)) != 0;
261 }
262 
267 static inline int ieee80211_has_a4(__le16 fc)
268 {
269  __le16 tmp = htole16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
270  return (fc & tmp) == tmp;
271 }
272 
277 static inline int ieee80211_has_morefrags(__le16 fc)
278 {
279  return (fc & htole16(IEEE80211_FCTL_MOREFRAGS)) != 0;
280 }
281 
286 static inline int ieee80211_has_retry(__le16 fc)
287 {
288  return (fc & htole16(IEEE80211_FCTL_RETRY)) != 0;
289 }
290 
295 static inline int ieee80211_has_pm(__le16 fc)
296 {
297  return (fc & htole16(IEEE80211_FCTL_PM)) != 0;
298 }
299 
304 static inline int ieee80211_has_moredata(__le16 fc)
305 {
306  return (fc & htole16(IEEE80211_FCTL_MOREDATA)) != 0;
307 }
308 
313 static inline int ieee80211_has_protected(__le16 fc)
314 {
315  return (fc & htole16(IEEE80211_FCTL_PROTECTED)) != 0;
316 }
317 
322 static inline int ieee80211_has_order(__le16 fc)
323 {
324  return (fc & htole16(IEEE80211_FCTL_ORDER)) != 0;
325 }
326 
331 static inline int ieee80211_is_mgmt(__le16 fc)
332 {
333  return (fc & htole16(IEEE80211_FCTL_FTYPE)) ==
334  htole16(IEEE80211_FTYPE_MGMT);
335 }
336 
341 static inline int ieee80211_is_ctl(__le16 fc)
342 {
343  return (fc & htole16(IEEE80211_FCTL_FTYPE)) ==
344  htole16(IEEE80211_FTYPE_CTL);
345 }
346 
351 static inline int ieee80211_is_data(__le16 fc)
352 {
353  return (fc & htole16(IEEE80211_FCTL_FTYPE)) ==
354  htole16(IEEE80211_FTYPE_DATA);
355 }
356 
361 static inline int ieee80211_is_data_qos(__le16 fc)
362 {
363  /*
364  * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need
365  * to check the one bit
366  */
367  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) ==
368  htole16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA);
369 }
370 
375 static inline int ieee80211_is_data_present(__le16 fc)
376 {
377  /*
378  * mask with 0x40 and test that that bit is clear to only return true
379  * for the data-containing substypes.
380  */
381  return (fc & htole16(IEEE80211_FCTL_FTYPE | 0x40)) ==
382  htole16(IEEE80211_FTYPE_DATA);
383 }
384 
389 static inline int ieee80211_is_assoc_req(__le16 fc)
390 {
391  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
392  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ);
393 }
394 
399 static inline int ieee80211_is_assoc_resp(__le16 fc)
400 {
401  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
402  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP);
403 }
404 
409 static inline int ieee80211_is_reassoc_req(__le16 fc)
410 {
411  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
412  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ);
413 }
414 
419 static inline int ieee80211_is_reassoc_resp(__le16 fc)
420 {
421  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
422  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP);
423 }
424 
429 static inline int ieee80211_is_probe_req(__le16 fc)
430 {
431  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
432  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ);
433 }
434 
439 static inline int ieee80211_is_probe_resp(__le16 fc)
440 {
441  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
442  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
443 }
444 
449 static inline int ieee80211_is_beacon(__le16 fc)
450 {
451  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
452  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
453 }
454 
459 static inline int ieee80211_is_atim(__le16 fc)
460 {
461  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
462  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM);
463 }
464 
469 static inline int ieee80211_is_disassoc(__le16 fc)
470 {
471  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
472  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC);
473 }
474 
479 static inline int ieee80211_is_auth(__le16 fc)
480 {
481  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
482  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
483 }
484 
489 static inline int ieee80211_is_deauth(__le16 fc)
490 {
491  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
492  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
493 }
494 
499 static inline int ieee80211_is_action(__le16 fc)
500 {
501  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
502  htole16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
503 }
504 
509 static inline int ieee80211_is_back_req(__le16 fc)
510 {
511  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
512  htole16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ);
513 }
514 
519 static inline int ieee80211_is_back(__le16 fc)
520 {
521  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
522  htole16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK);
523 }
524 
529 static inline int ieee80211_is_pspoll(__le16 fc)
530 {
531  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
532  htole16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
533 }
534 
539 static inline int ieee80211_is_rts(__le16 fc)
540 {
541  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
542  htole16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
543 }
544 
549 static inline int ieee80211_is_cts(__le16 fc)
550 {
551  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
552  htole16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
553 }
554 
559 static inline int ieee80211_is_ack(__le16 fc)
560 {
561  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
562  htole16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK);
563 }
564 
569 static inline int ieee80211_is_cfend(__le16 fc)
570 {
571  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
572  htole16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND);
573 }
574 
579 static inline int ieee80211_is_cfendack(__le16 fc)
580 {
581  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
582  htole16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK);
583 }
584 
589 static inline int ieee80211_is_nullfunc(__le16 fc)
590 {
591  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
592  htole16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC);
593 }
594 
599 static inline int ieee80211_is_qos_nullfunc(__le16 fc)
600 {
601  return (fc & htole16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
602  htole16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
603 }
604 
609 static inline int ieee80211_is_first_frag(__le16 seq_ctrl)
610 {
611  return (seq_ctrl & htole16(IEEE80211_SCTL_FRAG)) == 0;
612 }
613 
615  u8 flags;
616  u8 ttl;
617  __le32 seqnum;
618  u8 eaddr1[IEEE80211_ALEN];
619  u8 eaddr2[IEEE80211_ALEN];
620 } __attribute__((packed));
621 
622 /* Mesh flags */
623 #define MESH_FLAGS_AE_A4 0x1
624 #define MESH_FLAGS_AE_A5_A6 0x2
625 #define MESH_FLAGS_AE 0x3
626 #define MESH_FLAGS_PS_DEEP 0x4
627 
633 enum ieee80211_preq_flags {
634  IEEE80211_PREQ_PROACTIVE_PREP_FLAG = 1<<2,
635 };
636 
643 enum ieee80211_preq_target_flags {
644  IEEE80211_PREQ_TO_FLAG = 1<<0,
645  IEEE80211_PREQ_USN_FLAG = 1<<2,
646 };
647 
654  u8 count;
655  u8 period;
656  __le16 duration;
657  __le16 offset;
658 } __attribute__((packed));
659 
666  u8 token;
667  u8 mode;
668  u8 type;
669  u8 request[0];
670 } __attribute__((packed));
671 
678  u8 mode;
679  u8 new_ch_num;
680  u8 count;
681 } __attribute__((packed));
682 
689  u8 mode;
690  u8 new_operating_class;
691  u8 new_ch_num;
692  u8 count;
693 } __attribute__((packed));
694 
702  u8 sec_chan_offs;
703 } __attribute__((packed));
704 
709  u8 new_channel_width;
710  u8 new_center_freq_seg0, new_center_freq_seg1;
711 } __attribute__((packed));
712 
719  u8 dtim_count;
720  u8 dtim_period;
721  u8 bitmap_ctrl;
722  /* variable size: 1 - 251 bytes */
723  u8 virtual_map[1];
724 } __attribute__((packed));
725 
732  u8 meshconf_psel;
733  u8 meshconf_pmetric;
734  u8 meshconf_congest;
735  u8 meshconf_synch;
736  u8 meshconf_auth;
737  u8 meshconf_form;
738  u8 meshconf_cap;
739 } __attribute__((packed));
740 
752 enum mesh_config_capab_flags {
753  IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01,
754  IEEE80211_MESHCONF_CAPAB_FORWARDING = 0x08,
755  IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING = 0x20,
756  IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL = 0x40,
757 };
758 
765  u8 rann_flags;
766  u8 rann_hopcount;
767  u8 rann_ttl;
768  u8 rann_addr[IEEE80211_ALEN];
769  __le32 rann_seq;
770  __le32 rann_interval;
771  __le32 rann_metric;
772 } __attribute__((packed));
773 
774 enum ieee80211_rann_flags {
775  RANN_FLAG_IS_GATE = 1 << 0,
776 };
777 
778 enum ieee80211_ht_chanwidth_values {
779  IEEE80211_HT_CHANWIDTH_20MHZ = 0,
780  IEEE80211_HT_CHANWIDTH_ANY = 1,
781 };
782 
796 enum ieee80211_vht_opmode_bits {
797  IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK = 3,
798  IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ = 0,
799  IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ = 1,
800  IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ = 2,
801  IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ = 3,
802  IEEE80211_OPMODE_NOTIF_RX_NSS_MASK = 0x70,
803  IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4,
804  IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF = 0x80,
805 };
806 
807 #define WLAN_SA_QUERY_TR_ID_LEN 2
808 
810  __le16 frame_control;
811  __le16 duration;
812  u8 da[IEEE80211_ALEN];
813  u8 sa[IEEE80211_ALEN];
814  u8 bssid[IEEE80211_ALEN];
815  __le16 seq_ctrl;
816  union {
817  struct {
818  __le16 auth_alg;
819  __le16 auth_transaction;
820  __le16 status_code;
821  /* possibly followed by Challenge text */
822  u8 variable[0];
823  } __attribute__((packed)) auth;
824  struct {
825  __le16 reason_code;
826  } __attribute__((packed)) deauth;
827  struct {
828  __le16 capab_info;
829  __le16 listen_interval;
830  /* followed by SSID and Supported rates */
831  u8 variable[0];
832  } __attribute__((packed)) assoc_req;
833  struct {
834  __le16 capab_info;
835  __le16 status_code;
836  __le16 aid;
837  /* followed by Supported rates */
838  u8 variable[0];
839  } __attribute__((packed)) assoc_resp, reassoc_resp;
840  struct {
841  __le16 capab_info;
842  __le16 listen_interval;
843  u8 current_ap[IEEE80211_ALEN];
844  /* followed by SSID and Supported rates */
845  u8 variable[0];
846  } __attribute__((packed)) reassoc_req;
847  struct {
848  __le16 reason_code;
849  } __attribute__((packed)) disassoc;
850  struct {
851  __le64 timestamp;
852  __le16 beacon_int;
853  __le16 capab_info;
854  /* followed by some of SSID, Supported rates,
855  * FH Params, DS Params, CF Params, IBSS Params, TIM */
856  u8 variable[0];
857  } __attribute__((packed)) beacon;
858  struct {
859  /* only variable items: SSID, Supported rates */
860  u8 variable[0];
861  } __attribute__((packed)) probe_req;
862  struct {
863  __le64 timestamp;
864  __le16 beacon_int;
865  __le16 capab_info;
866  /* followed by some of SSID, Supported rates,
867  * FH Params, DS Params, CF Params, IBSS Params */
868  u8 variable[0];
869  } __attribute__((packed)) probe_resp;
870  struct {
871  u8 category;
872  union {
873  struct {
874  u8 action_code;
875  u8 dialog_token;
876  u8 status_code;
877  u8 variable[0];
878  } __attribute__((packed)) wme_action;
879  struct{
880  u8 action_code;
881  u8 variable[0];
882  } __attribute__((packed)) chan_switch;
883  struct{
884  u8 action_code;
885  struct ieee80211_ext_chansw_ie data;
886  u8 variable[0];
887  } __attribute__((packed)) ext_chan_switch;
888  struct{
889  u8 action_code;
890  u8 dialog_token;
891  u8 element_id;
892  u8 length;
893  struct ieee80211_msrment_ie msr_elem;
894  } __attribute__((packed)) measurement;
895  struct{
896  u8 action_code;
897  u8 dialog_token;
898  __le16 capab;
899  __le16 timeout;
900  __le16 start_seq_num;
901  } __attribute__((packed)) addba_req;
902  struct{
903  u8 action_code;
904  u8 dialog_token;
905  __le16 status;
906  __le16 capab;
907  __le16 timeout;
908  } __attribute__((packed)) addba_resp;
909  struct{
910  u8 action_code;
911  __le16 params;
912  __le16 reason_code;
913  } __attribute__((packed)) delba;
914  struct {
915  u8 action_code;
916  u8 variable[0];
917  } __attribute__((packed)) self_prot;
918  struct{
919  u8 action_code;
920  u8 variable[0];
921  } __attribute__((packed)) mesh_action;
922  struct {
923  u8 action;
924  u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
925  } __attribute__((packed)) sa_query;
926  struct {
927  u8 action;
928  u8 smps_control;
929  } __attribute__((packed)) ht_smps;
930  struct {
931  u8 action_code;
932  u8 chanwidth;
933  } __attribute__((packed)) ht_notify_cw;
934  struct {
935  u8 action_code;
936  u8 dialog_token;
937  __le16 capability;
938  u8 variable[0];
939  } __attribute__((packed)) tdls_discover_resp;
940  struct {
941  u8 action_code;
942  u8 operating_mode;
943  } __attribute__((packed)) vht_opmode_notif;
944  } u;
945  } __attribute__((packed)) action;
946  } u;
947 } __attribute__((packed));
948 
949 /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
950 #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
951 
952 /* mgmt header + 1 byte category code */
953 #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
954 
955 
956 /* Management MIC information element (IEEE 802.11w) */
958  u8 element_id;
959  u8 length;
960  __le16 key_id;
961  u8 sequence_number[6];
962  u8 mic[8];
963 } __attribute__((packed));
964 
966  u8 element_id;
967  u8 len;
968  u8 oui[3];
969  u8 oui_type;
970 } __attribute__((packed));
971 
972 /* Control frames */
974  __le16 frame_control;
975  __le16 duration;
976  u8 ra[IEEE80211_ALEN];
977  u8 ta[IEEE80211_ALEN];
978 } __attribute__((packed));
979 
981  __le16 frame_control;
982  __le16 duration;
983  u8 ra[IEEE80211_ALEN];
984 } __attribute__((packed));
985 
987  __le16 frame_control;
988  __le16 aid;
989  u8 bssid[IEEE80211_ALEN];
990  u8 ta[IEEE80211_ALEN];
991 } __attribute__((packed));
992 
993 /* TDLS */
994 
995 /* Link-id information element */
997  u8 ie_type; /* Link Identifier IE */
998  u8 ie_len;
999  u8 bssid[IEEE80211_ALEN];
1000  u8 init_sta[IEEE80211_ALEN];
1001  u8 resp_sta[IEEE80211_ALEN];
1002 } __attribute__((packed));
1003 
1005  u8 da[IEEE80211_ALEN];
1006  u8 sa[IEEE80211_ALEN];
1007  __be16 ether_type;
1008  u8 payload_type;
1009  u8 category;
1010  u8 action_code;
1011  union {
1012  struct {
1013  u8 dialog_token;
1014  __le16 capability;
1015  u8 variable[0];
1016  } __attribute__((packed)) setup_req;
1017  struct {
1018  __le16 status_code;
1019  u8 dialog_token;
1020  __le16 capability;
1021  u8 variable[0];
1022  } __attribute__((packed)) setup_resp;
1023  struct {
1024  __le16 status_code;
1025  u8 dialog_token;
1026  u8 variable[0];
1027  } __attribute__((packed)) setup_cfm;
1028  struct {
1029  __le16 reason_code;
1030  u8 variable[0];
1031  } __attribute__((packed)) teardown;
1032  struct {
1033  u8 dialog_token;
1034  u8 variable[0];
1035  } __attribute__((packed)) discover_req;
1036  } u;
1037 } __attribute__((packed));
1038 
1039 /*
1040  * Peer-to-Peer IE attribute related definitions.
1041  */
1045 enum ieee80211_p2p_attr_id {
1046  IEEE80211_P2P_ATTR_STATUS = 0,
1047  IEEE80211_P2P_ATTR_MINOR_REASON,
1048  IEEE80211_P2P_ATTR_CAPABILITY,
1049  IEEE80211_P2P_ATTR_DEVICE_ID,
1050  IEEE80211_P2P_ATTR_GO_INTENT,
1051  IEEE80211_P2P_ATTR_GO_CONFIG_TIMEOUT,
1052  IEEE80211_P2P_ATTR_LISTEN_CHANNEL,
1053  IEEE80211_P2P_ATTR_GROUP_BSSID,
1054  IEEE80211_P2P_ATTR_EXT_LISTEN_TIMING,
1055  IEEE80211_P2P_ATTR_INTENDED_IFACE_ADDR,
1056  IEEE80211_P2P_ATTR_MANAGABILITY,
1057  IEEE80211_P2P_ATTR_CHANNEL_LIST,
1058  IEEE80211_P2P_ATTR_ABSENCE_NOTICE,
1059  IEEE80211_P2P_ATTR_DEVICE_INFO,
1060  IEEE80211_P2P_ATTR_GROUP_INFO,
1061  IEEE80211_P2P_ATTR_GROUP_ID,
1062  IEEE80211_P2P_ATTR_INTERFACE,
1063  IEEE80211_P2P_ATTR_OPER_CHANNEL,
1064  IEEE80211_P2P_ATTR_INVITE_FLAGS,
1065  /* 19 - 220: Reserved */
1066  IEEE80211_P2P_ATTR_VENDOR_SPECIFIC = 221,
1067 
1068  IEEE80211_P2P_ATTR_MAX
1069 };
1070 
1071 /* Notice of Absence attribute - described in P2P spec 4.1.14 */
1072 /* Typical max value used here */
1073 #define IEEE80211_P2P_NOA_DESC_MAX 4
1074 
1076  u8 count;
1077  __le32 duration;
1078  __le32 interval;
1079  __le32 start_time;
1080 } __attribute__((packed));
1081 
1083  u8 index;
1084  u8 oppps_ctwindow;
1085  struct ieee80211_p2p_noa_desc desc[IEEE80211_P2P_NOA_DESC_MAX];
1086 } __attribute__((packed));
1087 
1088 #define IEEE80211_P2P_OPPPS_ENABLE_BIT BIT(7)
1089 #define IEEE80211_P2P_OPPPS_CTWINDOW_MASK 0x7F
1090 
1098  __le16 frame_control;
1099  __le16 duration;
1100  __u8 ra[IEEE80211_ALEN];
1101  __u8 ta[IEEE80211_ALEN];
1102  __le16 control;
1103  __le16 start_seq_num;
1104 } __attribute__((packed));
1105 
1106 /* 802.11 BAR control masks */
1107 #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
1108 #define IEEE80211_BAR_CTRL_MULTI_TID 0x0002
1109 #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
1110 #define IEEE80211_BAR_CTRL_TID_INFO_MASK 0xf000
1111 #define IEEE80211_BAR_CTRL_TID_INFO_SHIFT 12
1112 
1113 #define IEEE80211_HT_MCS_MASK_LEN 10
1114 
1125  u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
1126  __le16 rx_highest;
1127  u8 tx_params;
1128  u8 reserved[3];
1129 } __attribute__((packed));
1130 
1131 /* 802.11n HT capability MSC set */
1132 #define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
1133 #define IEEE80211_HT_MCS_TX_DEFINED 0x01
1134 #define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
1135 /* value 0 == 1 stream etc */
1136 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
1137 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
1138 #define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
1139 #define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
1140 
1141 /*
1142  * 802.11n D5.0 20.3.5 / 20.6 says:
1143  * - indices 0 to 7 and 32 are single spatial stream
1144  * - 8 to 31 are multiple spatial streams using equal modulation
1145  * [8..15 for two streams, 16..23 for three and 24..31 for four]
1146  * - remainder are multiple spatial streams using unequal modulation
1147  */
1148 #define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
1149 #define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
1150  (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
1151 
1159  __le16 cap_info;
1160  u8 ampdu_params_info;
1161 
1162  /* 16 bytes MCS information */
1163  struct ieee80211_mcs_info mcs;
1164 
1165  __le16 extended_ht_cap_info;
1166  __le32 tx_BF_cap_info;
1167  u8 antenna_selection_info;
1168 } __attribute__((packed));
1169 
1170 /* 802.11n HT capabilities masks (for cap_info) */
1171 #define IEEE80211_HT_CAP_LDPC_CODING 0x0001
1172 #define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
1173 #define IEEE80211_HT_CAP_SM_PS 0x000C
1174 #define IEEE80211_HT_CAP_SM_PS_SHIFT 2
1175 #define IEEE80211_HT_CAP_GRN_FLD 0x0010
1176 #define IEEE80211_HT_CAP_SGI_20 0x0020
1177 #define IEEE80211_HT_CAP_SGI_40 0x0040
1178 #define IEEE80211_HT_CAP_TX_STBC 0x0080
1179 #define IEEE80211_HT_CAP_RX_STBC 0x0300
1180 #define IEEE80211_HT_CAP_RX_STBC_SHIFT 8
1181 #define IEEE80211_HT_CAP_DELAY_BA 0x0400
1182 #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
1183 #define IEEE80211_HT_CAP_DSSSCCK40 0x1000
1184 #define IEEE80211_HT_CAP_RESERVED 0x2000
1185 #define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
1186 #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
1187 
1188 /* 802.11n HT extended capabilities masks (for extended_ht_cap_info) */
1189 #define IEEE80211_HT_EXT_CAP_PCO 0x0001
1190 #define IEEE80211_HT_EXT_CAP_PCO_TIME 0x0006
1191 #define IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT 1
1192 #define IEEE80211_HT_EXT_CAP_MCS_FB 0x0300
1193 #define IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT 8
1194 #define IEEE80211_HT_EXT_CAP_HTC_SUP 0x0400
1195 #define IEEE80211_HT_EXT_CAP_RD_RESPONDER 0x0800
1196 
1197 /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
1198 #define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
1199 #define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
1200 #define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2
1201 
1202 /*
1203  * Maximum length of AMPDU that the STA can receive.
1204  * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
1205  */
1206 enum ieee80211_max_ampdu_length_exp {
1207  IEEE80211_HT_MAX_AMPDU_8K = 0,
1208  IEEE80211_HT_MAX_AMPDU_16K = 1,
1209  IEEE80211_HT_MAX_AMPDU_32K = 2,
1210  IEEE80211_HT_MAX_AMPDU_64K = 3
1211 };
1212 
1213 #define IEEE80211_HT_MAX_AMPDU_FACTOR 13
1214 
1215 /* Minimum MPDU start spacing */
1216 enum ieee80211_min_mpdu_spacing {
1217  IEEE80211_HT_MPDU_DENSITY_NONE = 0, /* No restriction */
1218  IEEE80211_HT_MPDU_DENSITY_0_25 = 1, /* 1/4 usec */
1219  IEEE80211_HT_MPDU_DENSITY_0_5 = 2, /* 1/2 usec */
1220  IEEE80211_HT_MPDU_DENSITY_1 = 3, /* 1 usec */
1221  IEEE80211_HT_MPDU_DENSITY_2 = 4, /* 2 usec */
1222  IEEE80211_HT_MPDU_DENSITY_4 = 5, /* 4 usec */
1223  IEEE80211_HT_MPDU_DENSITY_8 = 6, /* 8 usec */
1224  IEEE80211_HT_MPDU_DENSITY_16 = 7 /* 16 usec */
1225 };
1226 
1234  u8 primary_chan;
1235  u8 ht_param;
1236  __le16 operation_mode;
1237  __le16 stbc_param;
1238  u8 basic_set[16];
1239 } __attribute__((packed));
1240 
1241 /* for ht_param */
1242 #define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
1243 #define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
1244 #define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
1245 #define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
1246 #define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
1247 #define IEEE80211_HT_PARAM_RIFS_MODE 0x08
1248 
1249 /* for operation_mode */
1250 #define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
1251 #define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
1252 #define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
1253 #define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
1254 #define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
1255 #define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
1256 #define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
1257 
1258 /* for stbc_param */
1259 #define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
1260 #define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
1261 #define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
1262 #define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
1263 #define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
1264 #define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
1265 
1266 
1267 /* block-ack parameters */
1268 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
1269 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
1270 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
1271 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
1272 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
1273 
1274 /*
1275  * A-PMDU buffer sizes
1276  * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
1277  */
1278 #define IEEE80211_MIN_AMPDU_BUF 0x8
1279 #define IEEE80211_MAX_AMPDU_BUF 0x40
1280 
1281 
1282 /* Spatial Multiplexing Power Save Modes (for capability) */
1283 #define WLAN_HT_CAP_SM_PS_STATIC 0
1284 #define WLAN_HT_CAP_SM_PS_DYNAMIC 1
1285 #define WLAN_HT_CAP_SM_PS_INVALID 2
1286 #define WLAN_HT_CAP_SM_PS_DISABLED 3
1287 
1288 /* for SM power control field lower two bits */
1289 #define WLAN_HT_SMPS_CONTROL_DISABLED 0
1290 #define WLAN_HT_SMPS_CONTROL_STATIC 1
1291 #define WLAN_HT_SMPS_CONTROL_DYNAMIC 3
1292 
1309  __le16 rx_mcs_map;
1310  __le16 rx_highest;
1311  __le16 tx_mcs_map;
1312  __le16 tx_highest;
1313 } __attribute__((packed));
1314 
1329 enum ieee80211_vht_mcs_support {
1330  IEEE80211_VHT_MCS_SUPPORT_0_7 = 0,
1331  IEEE80211_VHT_MCS_SUPPORT_0_8 = 1,
1332  IEEE80211_VHT_MCS_SUPPORT_0_9 = 2,
1333  IEEE80211_VHT_MCS_NOT_SUPPORTED = 3,
1334 };
1335 
1345  __le32 vht_cap_info;
1346  struct ieee80211_vht_mcs_info supp_mcs;
1347 } __attribute__((packed));
1348 
1357 enum ieee80211_vht_chanwidth {
1358  IEEE80211_VHT_CHANWIDTH_USE_HT = 0,
1359  IEEE80211_VHT_CHANWIDTH_80MHZ = 1,
1360  IEEE80211_VHT_CHANWIDTH_160MHZ = 2,
1361  IEEE80211_VHT_CHANWIDTH_80P80MHZ = 3,
1362 };
1363 
1375  u8 chan_width;
1376  u8 center_freq_seg1_idx;
1377  u8 center_freq_seg2_idx;
1378  __le16 basic_mcs_set;
1379 } __attribute__((packed));
1380 
1381 
1382 /* 802.11ac VHT Capabilities */
1383 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000
1384 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001
1385 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002
1386 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
1387 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008
1388 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000C
1389 #define IEEE80211_VHT_CAP_RXLDPC 0x00000010
1390 #define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020
1391 #define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040
1392 #define IEEE80211_VHT_CAP_TXSTBC 0x00000080
1393 #define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100
1394 #define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200
1395 #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
1396 #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
1397 #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
1398 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
1399 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
1400 #define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000
1401 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX 0x00030000
1402 #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000
1403 #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000
1404 #define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000
1405 #define IEEE80211_VHT_CAP_HTC_VHT 0x00400000
1406 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23
1407 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
1408  (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT)
1409 #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000
1410 #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000
1411 #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000
1412 #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000
1413 
1414 /* Authentication algorithms */
1415 #define WLAN_AUTH_OPEN 0
1416 #define WLAN_AUTH_SHARED_KEY 1
1417 #define WLAN_AUTH_FT 2
1418 #define WLAN_AUTH_SAE 3
1419 #define WLAN_AUTH_LEAP 128
1420 
1421 #define WLAN_AUTH_CHALLENGE_LEN 128
1422 
1423 #define WLAN_CAPABILITY_ESS (1<<0)
1424 #define WLAN_CAPABILITY_IBSS (1<<1)
1425 
1426 /*
1427  * A mesh STA sets the ESS and IBSS capability bits to zero.
1428  * however, this holds true for p2p probe responses (in the p2p_find
1429  * phase) as well.
1430  */
1431 #define WLAN_CAPABILITY_IS_STA_BSS(cap) \
1432  (!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)))
1433 
1434 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
1435 #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
1436 #define WLAN_CAPABILITY_PRIVACY (1<<4)
1437 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
1438 #define WLAN_CAPABILITY_PBCC (1<<6)
1439 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
1440 
1441 /* 802.11h */
1442 #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
1443 #define WLAN_CAPABILITY_QOS (1<<9)
1444 #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
1445 #define WLAN_CAPABILITY_APSD (1<<11)
1446 #define WLAN_CAPABILITY_RADIO_MEASURE (1<<12)
1447 #define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
1448 #define WLAN_CAPABILITY_DEL_BACK (1<<14)
1449 #define WLAN_CAPABILITY_IMM_BACK (1<<15)
1450 
1451 /* DMG (60gHz) 802.11ad */
1452 /* type - bits 0..1 */
1453 #define WLAN_CAPABILITY_DMG_TYPE_MASK (3<<0)
1454 #define WLAN_CAPABILITY_DMG_TYPE_IBSS (1<<0) /* Tx by: STA */
1455 #define WLAN_CAPABILITY_DMG_TYPE_PBSS (2<<0) /* Tx by: PCP */
1456 #define WLAN_CAPABILITY_DMG_TYPE_AP (3<<0) /* Tx by: AP */
1457 
1458 #define WLAN_CAPABILITY_DMG_CBAP_ONLY (1<<2)
1459 #define WLAN_CAPABILITY_DMG_CBAP_SOURCE (1<<3)
1460 #define WLAN_CAPABILITY_DMG_PRIVACY (1<<4)
1461 #define WLAN_CAPABILITY_DMG_ECPAC (1<<5)
1462 
1463 #define WLAN_CAPABILITY_DMG_SPECTRUM_MGMT (1<<8)
1464 #define WLAN_CAPABILITY_DMG_RADIO_MEASURE (1<<12)
1465 
1466 /* measurement */
1467 #define IEEE80211_SPCT_MSR_RPRT_MODE_LATE (1<<0)
1468 #define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE (1<<1)
1469 #define IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED (1<<2)
1470 
1471 #define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0
1472 #define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1
1473 #define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2
1474 
1475 /* 802.11g ERP information element */
1476 #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
1477 #define WLAN_ERP_USE_PROTECTION (1<<1)
1478 #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
1479 
1480 /* WLAN_ERP_BARKER_PREAMBLE values */
1481 enum {
1482  WLAN_ERP_PREAMBLE_SHORT = 0,
1483  WLAN_ERP_PREAMBLE_LONG = 1,
1484 };
1485 
1486 /* Band ID, 802.11ad #8.4.1.45 */
1487 enum {
1488  IEEE80211_BANDID_TV_WS = 0, /* TV white spaces */
1489  IEEE80211_BANDID_SUB1 = 1, /* Sub-1 GHz (excluding TV white spaces) */
1490  IEEE80211_BANDID_2G = 2, /* 2.4 GHz */
1491  IEEE80211_BANDID_3G = 3, /* 3.6 GHz */
1492  IEEE80211_BANDID_5G = 4, /* 4.9 and 5 GHz */
1493  IEEE80211_BANDID_60G = 5, /* 60 GHz */
1494 };
1495 
1496 /* Status codes */
1497 enum ieee80211_statuscode {
1498  WLAN_STATUS_SUCCESS = 0,
1499  WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
1500  WLAN_STATUS_CAPS_UNSUPPORTED = 10,
1501  WLAN_STATUS_REASSOC_NO_ASSOC = 11,
1502  WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
1503  WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
1504  WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
1505  WLAN_STATUS_CHALLENGE_FAIL = 15,
1506  WLAN_STATUS_AUTH_TIMEOUT = 16,
1507  WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
1508  WLAN_STATUS_ASSOC_DENIED_RATES = 18,
1509  /* 802.11b */
1510  WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
1511  WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
1512  WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
1513  /* 802.11h */
1514  WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
1515  WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
1516  WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
1517  /* 802.11g */
1518  WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
1519  WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
1520  /* 802.11w */
1521  WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
1522  WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
1523  /* 802.11i */
1524  WLAN_STATUS_INVALID_IE = 40,
1525  WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
1526  WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
1527  WLAN_STATUS_INVALID_AKMP = 43,
1528  WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
1529  WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
1530  WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
1531  /* 802.11e */
1532  WLAN_STATUS_UNSPECIFIED_QOS = 32,
1533  WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
1534  WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
1535  WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
1536  WLAN_STATUS_REQUEST_DECLINED = 37,
1537  WLAN_STATUS_INVALID_QOS_PARAM = 38,
1538  WLAN_STATUS_CHANGE_TSPEC = 39,
1539  WLAN_STATUS_WAIT_TS_DELAY = 47,
1540  WLAN_STATUS_NO_DIRECT_LINK = 48,
1541  WLAN_STATUS_STA_NOT_PRESENT = 49,
1542  WLAN_STATUS_STA_NOT_QSTA = 50,
1543  /* 802.11s */
1544  WLAN_STATUS_ANTI_CLOG_REQUIRED = 76,
1545  WLAN_STATUS_FCG_NOT_SUPP = 78,
1546  WLAN_STATUS_STA_NO_TBTT = 78,
1547  /* 802.11ad */
1548  WLAN_STATUS_REJECTED_WITH_SUGGESTED_CHANGES = 39,
1549  WLAN_STATUS_REJECTED_FOR_DELAY_PERIOD = 47,
1550  WLAN_STATUS_REJECT_WITH_SCHEDULE = 83,
1551  WLAN_STATUS_PENDING_ADMITTING_FST_SESSION = 86,
1552  WLAN_STATUS_PERFORMING_FST_NOW = 87,
1553  WLAN_STATUS_PENDING_GAP_IN_BA_WINDOW = 88,
1554  WLAN_STATUS_REJECT_U_PID_SETTING = 89,
1555  WLAN_STATUS_REJECT_DSE_BAND = 96,
1556  WLAN_STATUS_DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL = 99,
1557  WLAN_STATUS_DENIED_DUE_TO_SPECTRUM_MANAGEMENT = 103,
1558 };
1559 
1560 
1561 /* Reason codes */
1562 enum ieee80211_reasoncode {
1563  WLAN_REASON_UNSPECIFIED = 1,
1564  WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
1565  WLAN_REASON_DEAUTH_LEAVING = 3,
1566  WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
1567  WLAN_REASON_DISASSOC_AP_BUSY = 5,
1568  WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
1569  WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
1570  WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
1571  WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
1572  /* 802.11h */
1573  WLAN_REASON_DISASSOC_BAD_POWER = 10,
1574  WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
1575  /* 802.11i */
1576  WLAN_REASON_INVALID_IE = 13,
1577  WLAN_REASON_MIC_FAILURE = 14,
1578  WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
1579  WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
1580  WLAN_REASON_IE_DIFFERENT = 17,
1581  WLAN_REASON_INVALID_GROUP_CIPHER = 18,
1582  WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
1583  WLAN_REASON_INVALID_AKMP = 20,
1584  WLAN_REASON_UNSUPP_RSN_VERSION = 21,
1585  WLAN_REASON_INVALID_RSN_IE_CAP = 22,
1586  WLAN_REASON_IEEE8021X_FAILED = 23,
1587  WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
1588  /* 802.11e */
1589  WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
1590  WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
1591  WLAN_REASON_DISASSOC_LOW_ACK = 34,
1592  WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
1593  WLAN_REASON_QSTA_LEAVE_QBSS = 36,
1594  WLAN_REASON_QSTA_NOT_USE = 37,
1595  WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
1596  WLAN_REASON_QSTA_TIMEOUT = 39,
1597  WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
1598  /* 802.11s */
1599  WLAN_REASON_MESH_PEER_CANCELED = 52,
1600  WLAN_REASON_MESH_MAX_PEERS = 53,
1601  WLAN_REASON_MESH_CONFIG = 54,
1602  WLAN_REASON_MESH_CLOSE = 55,
1603  WLAN_REASON_MESH_MAX_RETRIES = 56,
1604  WLAN_REASON_MESH_CONFIRM_TIMEOUT = 57,
1605  WLAN_REASON_MESH_INVALID_GTK = 58,
1606  WLAN_REASON_MESH_INCONSISTENT_PARAM = 59,
1607  WLAN_REASON_MESH_INVALID_SECURITY = 60,
1608  WLAN_REASON_MESH_PATH_ERROR = 61,
1609  WLAN_REASON_MESH_PATH_NOFORWARD = 62,
1610  WLAN_REASON_MESH_PATH_DEST_UNREACHABLE = 63,
1611  WLAN_REASON_MAC_EXISTS_IN_MBSS = 64,
1612  WLAN_REASON_MESH_CHAN_REGULATORY = 65,
1613  WLAN_REASON_MESH_CHAN = 66,
1614 };
1615 
1616 
1617 /* Information Element IDs */
1618 enum ieee80211_eid {
1619  WLAN_EID_SSID = 0,
1620  WLAN_EID_SUPP_RATES = 1,
1621  WLAN_EID_FH_PARAMS = 2,
1622  WLAN_EID_DS_PARAMS = 3,
1623  WLAN_EID_CF_PARAMS = 4,
1624  WLAN_EID_TIM = 5,
1625  WLAN_EID_IBSS_PARAMS = 6,
1626  WLAN_EID_CHALLENGE = 16,
1627 
1628  WLAN_EID_COUNTRY = 7,
1629  WLAN_EID_HP_PARAMS = 8,
1630  WLAN_EID_HP_TABLE = 9,
1631  WLAN_EID_REQUEST = 10,
1632 
1633  WLAN_EID_QBSS_LOAD = 11,
1634  WLAN_EID_EDCA_PARAM_SET = 12,
1635  WLAN_EID_TSPEC = 13,
1636  WLAN_EID_TCLAS = 14,
1637  WLAN_EID_SCHEDULE = 15,
1638  WLAN_EID_TS_DELAY = 43,
1639  WLAN_EID_TCLAS_PROCESSING = 44,
1640  WLAN_EID_QOS_CAPA = 46,
1641  /* 802.11z */
1642  WLAN_EID_LINK_ID = 101,
1643  /* 802.11s */
1644  WLAN_EID_MESH_CONFIG = 113,
1645  WLAN_EID_MESH_ID = 114,
1646  WLAN_EID_LINK_METRIC_REPORT = 115,
1647  WLAN_EID_CONGESTION_NOTIFICATION = 116,
1648  WLAN_EID_PEER_MGMT = 117,
1649  WLAN_EID_CHAN_SWITCH_PARAM = 118,
1650  WLAN_EID_MESH_AWAKE_WINDOW = 119,
1651  WLAN_EID_BEACON_TIMING = 120,
1652  WLAN_EID_MCCAOP_SETUP_REQ = 121,
1653  WLAN_EID_MCCAOP_SETUP_RESP = 122,
1654  WLAN_EID_MCCAOP_ADVERT = 123,
1655  WLAN_EID_MCCAOP_TEARDOWN = 124,
1656  WLAN_EID_GANN = 125,
1657  WLAN_EID_RANN = 126,
1658  WLAN_EID_PREQ = 130,
1659  WLAN_EID_PREP = 131,
1660  WLAN_EID_PERR = 132,
1661  WLAN_EID_PXU = 137,
1662  WLAN_EID_PXUC = 138,
1663  WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
1664  WLAN_EID_MIC = 140,
1665 
1666  WLAN_EID_PWR_CONSTRAINT = 32,
1667  WLAN_EID_PWR_CAPABILITY = 33,
1668  WLAN_EID_TPC_REQUEST = 34,
1669  WLAN_EID_TPC_REPORT = 35,
1670  WLAN_EID_SUPPORTED_CHANNELS = 36,
1671  WLAN_EID_CHANNEL_SWITCH = 37,
1672  WLAN_EID_MEASURE_REQUEST = 38,
1673  WLAN_EID_MEASURE_REPORT = 39,
1674  WLAN_EID_QUIET = 40,
1675  WLAN_EID_IBSS_DFS = 41,
1676 
1677  WLAN_EID_ERP_INFO = 42,
1678  WLAN_EID_EXT_SUPP_RATES = 50,
1679 
1680  WLAN_EID_HT_CAPABILITY = 45,
1681  WLAN_EID_HT_OPERATION = 61,
1682  WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62,
1683 
1684  WLAN_EID_RSN = 48,
1685  WLAN_EID_MMIE = 76,
1686  WLAN_EID_VENDOR_SPECIFIC = 221,
1687  WLAN_EID_QOS_PARAMETER = 222,
1688 
1689  WLAN_EID_AP_CHAN_REPORT = 51,
1690  WLAN_EID_NEIGHBOR_REPORT = 52,
1691  WLAN_EID_RCPI = 53,
1692  WLAN_EID_BSS_AVG_ACCESS_DELAY = 63,
1693  WLAN_EID_ANTENNA_INFO = 64,
1694  WLAN_EID_RSNI = 65,
1695  WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66,
1696  WLAN_EID_BSS_AVAILABLE_CAPACITY = 67,
1697  WLAN_EID_BSS_AC_ACCESS_DELAY = 68,
1698  WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
1699  WLAN_EID_MULTIPLE_BSSID = 71,
1700  WLAN_EID_BSS_COEX_2040 = 72,
1701  WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74,
1702  WLAN_EID_EXT_CAPABILITY = 127,
1703 
1704  WLAN_EID_MOBILITY_DOMAIN = 54,
1705  WLAN_EID_FAST_BSS_TRANSITION = 55,
1706  WLAN_EID_TIMEOUT_INTERVAL = 56,
1707  WLAN_EID_RIC_DATA = 57,
1708  WLAN_EID_RIC_DESCRIPTOR = 75,
1709 
1710  WLAN_EID_DSE_REGISTERED_LOCATION = 58,
1711  WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59,
1712  WLAN_EID_EXT_CHANSWITCH_ANN = 60,
1713 
1714  WLAN_EID_VHT_CAPABILITY = 191,
1715  WLAN_EID_VHT_OPERATION = 192,
1716  WLAN_EID_OPMODE_NOTIF = 199,
1717  WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1718  WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1719 
1720  /* 802.11ad */
1721  WLAN_EID_NON_TX_BSSID_CAP = 83,
1722  WLAN_EID_WAKEUP_SCHEDULE = 143,
1723  WLAN_EID_EXT_SCHEDULE = 144,
1724  WLAN_EID_STA_AVAILABILITY = 145,
1725  WLAN_EID_DMG_TSPEC = 146,
1726  WLAN_EID_DMG_AT = 147,
1727  WLAN_EID_DMG_CAP = 148,
1728  WLAN_EID_DMG_OPERATION = 151,
1729  WLAN_EID_DMG_BSS_PARAM_CHANGE = 152,
1730  WLAN_EID_DMG_BEAM_REFINEMENT = 153,
1731  WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154,
1732  WLAN_EID_AWAKE_WINDOW = 157,
1733  WLAN_EID_MULTI_BAND = 158,
1734  WLAN_EID_ADDBA_EXT = 159,
1735  WLAN_EID_NEXT_PCP_LIST = 160,
1736  WLAN_EID_PCP_HANDOVER = 161,
1737  WLAN_EID_DMG_LINK_MARGIN = 162,
1738  WLAN_EID_SWITCHING_STREAM = 163,
1739  WLAN_EID_SESSION_TRANSITION = 164,
1740  WLAN_EID_DYN_TONE_PAIRING_REPORT = 165,
1741  WLAN_EID_CLUSTER_REPORT = 166,
1742  WLAN_EID_RELAY_CAP = 167,
1743  WLAN_EID_RELAY_XFER_PARAM_SET = 168,
1744  WLAN_EID_BEAM_LINK_MAINT = 169,
1745  WLAN_EID_MULTIPLE_MAC_ADDR = 170,
1746  WLAN_EID_U_PID = 171,
1747  WLAN_EID_DMG_LINK_ADAPT_ACK = 172,
1748  WLAN_EID_QUIET_PERIOD_REQ = 175,
1749  WLAN_EID_QUIET_PERIOD_RESP = 177,
1750  WLAN_EID_EPAC_POLICY = 182,
1751  WLAN_EID_CLISTER_TIME_OFF = 183,
1752  WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190,
1753 };
1754 
1755 /* Action category code */
1756 enum ieee80211_category {
1757  WLAN_CATEGORY_SPECTRUM_MGMT = 0,
1758  WLAN_CATEGORY_QOS = 1,
1759  WLAN_CATEGORY_DLS = 2,
1760  WLAN_CATEGORY_BACK = 3,
1761  WLAN_CATEGORY_PUBLIC = 4,
1762  WLAN_CATEGORY_HT = 7,
1763  WLAN_CATEGORY_SA_QUERY = 8,
1764  WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1765  WLAN_CATEGORY_TDLS = 12,
1766  WLAN_CATEGORY_MESH_ACTION = 13,
1767  WLAN_CATEGORY_MULTIHOP_ACTION = 14,
1768  WLAN_CATEGORY_SELF_PROTECTED = 15,
1769  WLAN_CATEGORY_DMG = 16,
1770  WLAN_CATEGORY_WMM = 17,
1771  WLAN_CATEGORY_FST = 18,
1772  WLAN_CATEGORY_UNPROT_DMG = 20,
1773  WLAN_CATEGORY_VHT = 21,
1774  WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1775  WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1776 };
1777 
1778 /* SPECTRUM_MGMT action code */
1779 enum ieee80211_spectrum_mgmt_actioncode {
1780  WLAN_ACTION_SPCT_MSR_REQ = 0,
1781  WLAN_ACTION_SPCT_MSR_RPRT = 1,
1782  WLAN_ACTION_SPCT_TPC_REQ = 2,
1783  WLAN_ACTION_SPCT_TPC_RPRT = 3,
1784  WLAN_ACTION_SPCT_CHL_SWITCH = 4,
1785 };
1786 
1787 /* HT action codes */
1788 enum ieee80211_ht_actioncode {
1789  WLAN_HT_ACTION_NOTIFY_CHANWIDTH = 0,
1790  WLAN_HT_ACTION_SMPS = 1,
1791  WLAN_HT_ACTION_PSMP = 2,
1792  WLAN_HT_ACTION_PCO_PHASE = 3,
1793  WLAN_HT_ACTION_CSI = 4,
1794  WLAN_HT_ACTION_NONCOMPRESSED_BF = 5,
1795  WLAN_HT_ACTION_COMPRESSED_BF = 6,
1796  WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7,
1797 };
1798 
1799 /* VHT action codes */
1800 enum ieee80211_vht_actioncode {
1801  WLAN_VHT_ACTION_COMPRESSED_BF = 0,
1802  WLAN_VHT_ACTION_GROUPID_MGMT = 1,
1803  WLAN_VHT_ACTION_OPMODE_NOTIF = 2,
1804 };
1805 
1806 /* Self Protected Action codes */
1807 enum ieee80211_self_protected_actioncode {
1808  WLAN_SP_RESERVED = 0,
1809  WLAN_SP_MESH_PEERING_OPEN = 1,
1810  WLAN_SP_MESH_PEERING_CONFIRM = 2,
1811  WLAN_SP_MESH_PEERING_CLOSE = 3,
1812  WLAN_SP_MGK_INFORM = 4,
1813  WLAN_SP_MGK_ACK = 5,
1814 };
1815 
1816 /* Mesh action codes */
1817 enum ieee80211_mesh_actioncode {
1818  WLAN_MESH_ACTION_LINK_METRIC_REPORT,
1819  WLAN_MESH_ACTION_HWMP_PATH_SELECTION,
1820  WLAN_MESH_ACTION_GATE_ANNOUNCEMENT,
1821  WLAN_MESH_ACTION_CONGESTION_CONTROL_NOTIFICATION,
1822  WLAN_MESH_ACTION_MCCA_SETUP_REQUEST,
1823  WLAN_MESH_ACTION_MCCA_SETUP_REPLY,
1824  WLAN_MESH_ACTION_MCCA_ADVERTISEMENT_REQUEST,
1825  WLAN_MESH_ACTION_MCCA_ADVERTISEMENT,
1826  WLAN_MESH_ACTION_MCCA_TEARDOWN,
1827  WLAN_MESH_ACTION_TBTT_ADJUSTMENT_REQUEST,
1828  WLAN_MESH_ACTION_TBTT_ADJUSTMENT_RESPONSE,
1829 };
1830 
1831 /* Security key length */
1832 enum ieee80211_key_len {
1833  WLAN_KEY_LEN_WEP40 = 5,
1834  WLAN_KEY_LEN_WEP104 = 13,
1835  WLAN_KEY_LEN_CCMP = 16,
1836  WLAN_KEY_LEN_TKIP = 32,
1837  WLAN_KEY_LEN_AES_CMAC = 16,
1838 };
1839 
1840 #define IEEE80211_WEP_IV_LEN 4
1841 #define IEEE80211_WEP_ICV_LEN 4
1842 #define IEEE80211_CCMP_HDR_LEN 8
1843 #define IEEE80211_CCMP_MIC_LEN 8
1844 #define IEEE80211_CCMP_PN_LEN 6
1845 #define IEEE80211_TKIP_IV_LEN 8
1846 #define IEEE80211_TKIP_ICV_LEN 4
1847 #define IEEE80211_CMAC_PN_LEN 6
1848 
1849 /* Public action codes */
1850 enum ieee80211_pub_actioncode {
1851  WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
1852  WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14,
1853 };
1854 
1855 /* TDLS action codes */
1856 enum ieee80211_tdls_actioncode {
1857  WLAN_TDLS_SETUP_REQUEST = 0,
1858  WLAN_TDLS_SETUP_RESPONSE = 1,
1859  WLAN_TDLS_SETUP_CONFIRM = 2,
1860  WLAN_TDLS_TEARDOWN = 3,
1861  WLAN_TDLS_PEER_TRAFFIC_INDICATION = 4,
1862  WLAN_TDLS_CHANNEL_SWITCH_REQUEST = 5,
1863  WLAN_TDLS_CHANNEL_SWITCH_RESPONSE = 6,
1864  WLAN_TDLS_PEER_PSM_REQUEST = 7,
1865  WLAN_TDLS_PEER_PSM_RESPONSE = 8,
1866  WLAN_TDLS_PEER_TRAFFIC_RESPONSE = 9,
1867  WLAN_TDLS_DISCOVERY_REQUEST = 10,
1868 };
1869 
1870 /*
1871  * TDLS capabililites to be enabled in the 5th byte of the
1872  * @WLAN_EID_EXT_CAPABILITY information element
1873  */
1874 #define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5)
1875 #define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6)
1876 
1877 #define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6)
1878 
1879 /* TDLS specific payload type in the LLC/SNAP header */
1880 #define WLAN_TDLS_SNAP_RFTYPE 0x2
1881 
1889 enum {
1890  IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1,
1891  IEEE80211_SYNC_METHOD_VENDOR = 255,
1892 };
1893 
1901 enum {
1902  IEEE80211_PATH_PROTOCOL_HWMP = 1,
1903  IEEE80211_PATH_PROTOCOL_VENDOR = 255,
1904 };
1905 
1913 enum {
1914  IEEE80211_PATH_METRIC_AIRTIME = 1,
1915  IEEE80211_PATH_METRIC_VENDOR = 255,
1916 };
1917 
1933 enum ieee80211_root_mode_identifier {
1934  IEEE80211_ROOTMODE_NO_ROOT = 0,
1935  IEEE80211_ROOTMODE_ROOT = 1,
1936  IEEE80211_PROACTIVE_PREQ_NO_PREP = 2,
1937  IEEE80211_PROACTIVE_PREQ_WITH_PREP = 3,
1938  IEEE80211_PROACTIVE_RANN = 4,
1939 };
1940 
1941 /*
1942  * IEEE 802.11-2007 7.3.2.9 Country information element
1943  *
1944  * Minimum length is 8 octets, ie len must be evenly
1945  * divisible by 2
1946  */
1947 
1948 /* Although the spec says 8 I'm seeing 6 in practice */
1949 #define IEEE80211_COUNTRY_IE_MIN_LEN 6
1950 
1951 /* The Country String field of the element shall be 3 octets in length */
1952 #define IEEE80211_COUNTRY_STRING_LEN 3
1953 
1954 /*
1955  * For regulatory extension stuff see IEEE 802.11-2007
1956  * Annex I (page 1141) and Annex J (page 1147). Also
1957  * review 7.3.2.9.
1958  *
1959  * When dot11RegulatoryClassesRequired is true and the
1960  * first_channel/reg_extension_id is >= 201 then the IE
1961  * compromises of the 'ext' struct represented below:
1962  *
1963  * - Regulatory extension ID - when generating IE this just needs
1964  * to be monotonically increasing for each triplet passed in
1965  * the IE
1966  * - Regulatory class - index into set of rules
1967  * - Coverage class - index into air propagation time (Table 7-27),
1968  * in microseconds, you can compute the air propagation time from
1969  * the index by multiplying by 3, so index 10 yields a propagation
1970  * of 10 us. Valid values are 0-31, values 32-255 are not defined
1971  * yet. A value of 0 inicates air propagation of <= 1 us.
1972  *
1973  * See also Table I.2 for Emission limit sets and table
1974  * I.3 for Behavior limit sets. Table J.1 indicates how to map
1975  * a reg_class to an emission limit set and behavior limit set.
1976  */
1977 #define IEEE80211_COUNTRY_EXTENSION_ID 201
1978 
1979 /*
1980  * Channels numbers in the IE must be monotonically increasing
1981  * if dot11RegulatoryClassesRequired is not true.
1982  *
1983  * If dot11RegulatoryClassesRequired is true consecutive
1984  * subband triplets following a regulatory triplet shall
1985  * have monotonically increasing first_channel number fields.
1986  *
1987  * Channel numbers shall not overlap.
1988  *
1989  * Note that max_power is signed.
1990  */
1992  union {
1993  struct {
1994  u8 first_channel;
1995  u8 num_channels;
1996  s8 max_power;
1997  } __attribute__((packed)) chans;
1998  struct {
1999  u8 reg_extension_id;
2000  u8 reg_class;
2001  u8 coverage_class;
2002  } __attribute__((packed)) ext;
2003  };
2004 } __attribute__((packed));
2005 
2006 enum ieee80211_timeout_interval_type {
2007  WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
2008  WLAN_TIMEOUT_KEY_LIFETIME = 2 /* 802.11r */,
2009  WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,
2010 };
2011 
2018  u8 type;
2019  __le32 value;
2020 } __attribute__((packed));
2021 
2022 /* BACK action code */
2023 enum ieee80211_back_actioncode {
2024  WLAN_ACTION_ADDBA_REQ = 0,
2025  WLAN_ACTION_ADDBA_RESP = 1,
2026  WLAN_ACTION_DELBA = 2,
2027 };
2028 
2029 /* BACK (block-ack) parties */
2030 enum ieee80211_back_parties {
2031  WLAN_BACK_RECIPIENT = 0,
2032  WLAN_BACK_INITIATOR = 1,
2033 };
2034 
2035 /* SA Query action */
2036 enum ieee80211_sa_query_action {
2037  WLAN_ACTION_SA_QUERY_REQUEST = 0,
2038  WLAN_ACTION_SA_QUERY_RESPONSE = 1,
2039 };
2040 
2041 
2042 /* cipher suite selectors */
2043 #define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
2044 #define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
2045 #define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
2046 /* reserved: 0x000FAC03 */
2047 #define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
2048 #define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
2049 #define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
2050 #define WLAN_CIPHER_SUITE_GCMP 0x000FAC08
2051 
2052 #define WLAN_CIPHER_SUITE_SMS4 0x00147201
2053 
2054 /* AKM suite selectors */
2055 #define WLAN_AKM_SUITE_8021X 0x000FAC01
2056 #define WLAN_AKM_SUITE_PSK 0x000FAC02
2057 #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05
2058 #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06
2059 #define WLAN_AKM_SUITE_TDLS 0x000FAC07
2060 #define WLAN_AKM_SUITE_SAE 0x000FAC08
2061 #define WLAN_AKM_SUITE_FT_OVER_SAE 0x000FAC09
2062 
2063 #define WLAN_MAX_KEY_LEN 32
2064 
2065 #define WLAN_PMKID_LEN 16
2066 
2067 #define WLAN_OUI_WFA 0x506f9a
2068 #define WLAN_OUI_TYPE_WFA_P2P 9
2069 #define WLAN_OUI_MICROSOFT 0x0050f2
2070 #define WLAN_OUI_TYPE_MICROSOFT_WPA 1
2071 #define WLAN_OUI_TYPE_MICROSOFT_WMM 2
2072 #define WLAN_OUI_TYPE_MICROSOFT_WPS 4
2073 
2074 /*
2075  * WMM/802.11e Tspec Element
2076  */
2077 #define IEEE80211_WMM_IE_TSPEC_TID_MASK 0x0F
2078 #define IEEE80211_WMM_IE_TSPEC_TID_SHIFT 1
2079 
2080 enum ieee80211_tspec_status_code {
2081  IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED = 0,
2082  IEEE80211_TSPEC_STATUS_ADDTS_INVAL_PARAMS = 0x1,
2083 };
2084 
2086  u8 element_id;
2087  u8 len;
2088  u8 oui[3];
2089  u8 oui_type;
2090  u8 oui_subtype;
2091  u8 version;
2092  __le16 tsinfo;
2093  u8 tsinfo_resvd;
2094  __le16 nominal_msdu;
2095  __le16 max_msdu;
2096  __le32 min_service_int;
2097  __le32 max_service_int;
2098  __le32 inactivity_int;
2099  __le32 suspension_int;
2100  __le32 service_start_time;
2101  __le32 min_data_rate;
2102  __le32 mean_data_rate;
2103  __le32 peak_data_rate;
2104  __le32 max_burst_size;
2105  __le32 delay_bound;
2106  __le32 min_phy_rate;
2107  __le16 sba;
2108  __le16 medium_time;
2109 } __attribute__((packed));
2110 
2120 static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
2121 {
2122  if (ieee80211_has_a4(hdr->frame_control))
2123  return (u8 *)hdr + 30;
2124  else
2125  return (u8 *)hdr + 24;
2126 }
2127 
2138 static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
2139 {
2140  if (ieee80211_has_a4(hdr->frame_control))
2141  return hdr->addr4;
2142  if (ieee80211_has_fromds(hdr->frame_control))
2143  return hdr->addr3;
2144  return hdr->addr2;
2145 }
2146 
2157 static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
2158 {
2159  if (ieee80211_has_tods(hdr->frame_control))
2160  return hdr->addr3;
2161  else
2162  return hdr->addr1;
2163 }
2164 
2169 static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
2170 {
2171  if (ieee80211_is_disassoc(hdr->frame_control) ||
2172  ieee80211_is_deauth(hdr->frame_control))
2173  return true;
2174 
2175  if (ieee80211_is_action(hdr->frame_control)) {
2176  u8 *category;
2177 
2178  /*
2179  * Action frames, excluding Public Action frames, are Robust
2180  * Management Frames. However, if we are looking at a Protected
2181  * frame, skip the check since the data may be encrypted and
2182  * the frame has already been found to be a Robust Management
2183  * Frame (by the other end).
2184  */
2185  if (ieee80211_has_protected(hdr->frame_control))
2186  return true;
2187  category = ((u8 *) hdr) + 24;
2188  return *category != WLAN_CATEGORY_PUBLIC &&
2189  *category != WLAN_CATEGORY_HT &&
2190  *category != WLAN_CATEGORY_SELF_PROTECTED &&
2191  *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
2192  }
2193 
2194  return false;
2195 }
2196 
2202 static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
2203  size_t len)
2204 {
2205  struct ieee80211_mgmt *mgmt = (void *)hdr;
2206 
2207  if (len < IEEE80211_MIN_ACTION_SIZE)
2208  return false;
2209  if (!ieee80211_is_action(hdr->frame_control))
2210  return false;
2211  return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
2212 }
2213 
2221 static inline int ieee80211_dsss_chan_to_freq(int channel)
2222 {
2223  if ((channel > 0) && (channel < 14))
2224  return 2407 + (channel * 5);
2225  else if (channel == 14)
2226  return 2484;
2227  else
2228  return -1;
2229 }
2230 
2240 static inline int ieee80211_freq_to_dsss_chan(int freq)
2241 {
2242  if ((freq >= 2410) && (freq < 2475))
2243  return (freq - 2405) / 5;
2244  else if ((freq >= 2482) && (freq < 2487))
2245  return 14;
2246  else
2247  return -1;
2248 }
2249 
2254 static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
2255 {
2256  return 1024 * tu;
2257 }
2258 
2265 static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2266  u8 tim_len, u16 aid)
2267 {
2268  u8 mask;
2269  u8 index, indexn1, indexn2;
2270 
2271  if (!tim || tim_len < sizeof(*tim))
2272  return false;
2273 
2274  aid &= 0x3fff;
2275  index = aid / 8;
2276  mask = 1 << (aid & 7);
2277 
2278  indexn1 = tim->bitmap_ctrl & 0xfe;
2279  indexn2 = tim_len + indexn1 - 4;
2280 
2281  if (index < indexn1 || index > indexn2)
2282  return false;
2283 
2284  index -= indexn1;
2285 
2286  return !!(tim->virtual_map[index] & mask);
2287 }
2288 
2289 #endif /* __MOEP80211_IEEE80211_FRAMETYPES_H */
Definition: ieee80211_frametypes.h:1004
Definition: ieee80211_frametypes.h:731
Definition: ieee80211_frametypes.h:235
Definition: ieee80211_frametypes.h:653
Definition: ieee80211_frametypes.h:1082
Definition: ieee80211_frametypes.h:665
Definition: ieee80211_frametypes.h:677
Definition: ieee80211_frametypes.h:1308
Definition: ieee80211_frametypes.h:718
Definition: ieee80211_frametypes.h:996
Definition: ieee80211_frametypes.h:226
Definition: ieee80211_frametypes.h:688
Definition: ieee80211_frametypes.h:1124
Definition: ieee80211_frametypes.h:986
Definition: ieee80211_frametypes.h:216
Definition: ieee80211_frametypes.h:965
Definition: ieee80211_frametypes.h:973
Definition: ieee80211_frametypes.h:980
Definition: ieee80211_frametypes.h:1233
Definition: ieee80211_frametypes.h:2017
Definition: ieee80211_frametypes.h:809
Definition: ieee80211_frametypes.h:1344
Definition: ieee80211_frametypes.h:1158
Definition: ieee80211_frametypes.h:701
Definition: ieee80211_frametypes.h:1097
Definition: ieee80211_frametypes.h:1075
Definition: ieee80211_frametypes.h:1991
Definition: ieee80211_frametypes.h:614
Definition: ieee80211_frametypes.h:957
Definition: ieee80211_frametypes.h:2085
Definition: ieee80211_frametypes.h:764
Definition: ieee80211_frametypes.h:708
Definition: ieee80211_frametypes.h:1374