-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path802.11.h
3626 lines (3179 loc) · 136 KB
/
802.11.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
* Fundamental types and constants relating to 802.11
*
* $Id: 802.11.h 386067 2013-02-19 15:24:20Z $
*/
#ifndef _802_11_H_
#define _802_11_H_
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
#ifndef _NET_ETHERNET_H_
#include <proto/ethernet.h>
#endif
#include <proto/wpa.h>
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
#define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */
/* Generic 802.11 frame constants */
#define DOT11_A3_HDR_LEN 24 /* d11 header length with A3 */
#define DOT11_A4_HDR_LEN 30 /* d11 header length with A4 */
#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN /* MAC header length */
#define DOT11_FCS_LEN 4 /* d11 FCS length */
#define DOT11_ICV_LEN 4 /* d11 ICV length */
#define DOT11_ICV_AES_LEN 8 /* d11 ICV/AES length */
#define DOT11_QOS_LEN 2 /* d11 QoS length */
#define DOT11_HTC_LEN 4 /* d11 HT Control field length */
#define DOT11_KEY_INDEX_SHIFT 6 /* d11 key index shift */
#define DOT11_IV_LEN 4 /* d11 IV length */
#define DOT11_IV_TKIP_LEN 8 /* d11 IV TKIP length */
#define DOT11_IV_AES_OCB_LEN 4 /* d11 IV/AES/OCB length */
#define DOT11_IV_AES_CCM_LEN 8 /* d11 IV/AES/CCM length */
#define DOT11_IV_MAX_LEN 8 /* maximum iv len for any encryption */
/* Includes MIC */
#define DOT11_MAX_MPDU_BODY_LEN 2304 /* max MPDU body length */
/* A4 header + QoS + CCMP + PDU + ICV + FCS = 2352 */
#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \
DOT11_QOS_LEN + \
DOT11_IV_AES_CCM_LEN + \
DOT11_MAX_MPDU_BODY_LEN + \
DOT11_ICV_LEN + \
DOT11_FCS_LEN) /* d11 max MPDU length */
#define DOT11_MAX_SSID_LEN 32 /* d11 max ssid length */
/* dot11RTSThreshold */
#define DOT11_DEFAULT_RTS_LEN 2347 /* d11 default RTS length */
#define DOT11_MAX_RTS_LEN 2347 /* d11 max RTS length */
/* dot11FragmentationThreshold */
#define DOT11_MIN_FRAG_LEN 256 /* d11 min fragmentation length */
#define DOT11_MAX_FRAG_LEN 2346 /* Max frag is also limited by aMPDUMaxLength
* of the attached PHY
*/
#define DOT11_DEFAULT_FRAG_LEN 2346 /* d11 default fragmentation length */
/* dot11BeaconPeriod */
#define DOT11_MIN_BEACON_PERIOD 1 /* d11 min beacon period */
#define DOT11_MAX_BEACON_PERIOD 0xFFFF /* d11 max beacon period */
/* dot11DTIMPeriod */
#define DOT11_MIN_DTIM_PERIOD 1 /* d11 min DTIM period */
#define DOT11_MAX_DTIM_PERIOD 0xFF /* d11 max DTIM period */
/* 802.2 LLC/SNAP header used by 802.11 per 802.1H */
#define DOT11_LLC_SNAP_HDR_LEN 8 /* d11 LLC/SNAP header length */
#define DOT11_OUI_LEN 3 /* d11 OUI length */
BWL_PRE_PACKED_STRUCT struct dot11_llc_snap_header {
uint8 dsap; /* always 0xAA */
uint8 ssap; /* always 0xAA */
uint8 ctl; /* always 0x03 */
uint8 oui[DOT11_OUI_LEN]; /* RFC1042: 0x00 0x00 0x00
* Bridge-Tunnel: 0x00 0x00 0xF8
*/
uint16 type; /* ethertype */
} BWL_POST_PACKED_STRUCT;
/* RFC1042 header used by 802.11 per 802.1H */
#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN) /* RCF1042 header length */
/* Generic 802.11 MAC header */
/*
* N.B.: This struct reflects the full 4 address 802.11 MAC header.
* The fields are defined such that the shorter 1, 2, and 3
* address headers just use the first k fields.
*/
BWL_PRE_PACKED_STRUCT struct dot11_header {
uint16 fc; /* frame control */
uint16 durid; /* duration/ID */
struct ether_addr a1; /* address 1 */
struct ether_addr a2; /* address 2 */
struct ether_addr a3; /* address 3 */
uint16 seq; /* sequence control */
struct ether_addr a4; /* address 4 */
} BWL_POST_PACKED_STRUCT;
/* Control frames */
BWL_PRE_PACKED_STRUCT struct dot11_rts_frame {
uint16 fc; /* frame control */
uint16 durid; /* duration/ID */
struct ether_addr ra; /* receiver address */
struct ether_addr ta; /* transmitter address */
} BWL_POST_PACKED_STRUCT;
#define DOT11_RTS_LEN 16 /* d11 RTS frame length */
BWL_PRE_PACKED_STRUCT struct dot11_cts_frame {
uint16 fc; /* frame control */
uint16 durid; /* duration/ID */
struct ether_addr ra; /* receiver address */
} BWL_POST_PACKED_STRUCT;
#define DOT11_CTS_LEN 10 /* d11 CTS frame length */
BWL_PRE_PACKED_STRUCT struct dot11_ack_frame {
uint16 fc; /* frame control */
uint16 durid; /* duration/ID */
struct ether_addr ra; /* receiver address */
} BWL_POST_PACKED_STRUCT;
#define DOT11_ACK_LEN 10 /* d11 ACK frame length */
BWL_PRE_PACKED_STRUCT struct dot11_ps_poll_frame {
uint16 fc; /* frame control */
uint16 durid; /* AID */
struct ether_addr bssid; /* receiver address, STA in AP */
struct ether_addr ta; /* transmitter address */
} BWL_POST_PACKED_STRUCT;
#define DOT11_PS_POLL_LEN 16 /* d11 PS poll frame length */
BWL_PRE_PACKED_STRUCT struct dot11_cf_end_frame {
uint16 fc; /* frame control */
uint16 durid; /* duration/ID */
struct ether_addr ra; /* receiver address */
struct ether_addr bssid; /* transmitter address, STA in AP */
} BWL_POST_PACKED_STRUCT;
#define DOT11_CS_END_LEN 16 /* d11 CF-END frame length */
/* RWL wifi protocol: The Vendor Specific Action frame is defined for vendor-specific signaling
* category+OUI+vendor specific content ( this can be variable)
*/
BWL_PRE_PACKED_STRUCT struct dot11_action_wifi_vendor_specific {
uint8 category;
uint8 OUI[3];
uint8 type;
uint8 subtype;
uint8 data[1040];
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_action_wifi_vendor_specific dot11_action_wifi_vendor_specific_t;
/* generic vender specific action frame with variable length */
BWL_PRE_PACKED_STRUCT struct dot11_action_vs_frmhdr {
uint8 category;
uint8 OUI[3];
uint8 type;
uint8 subtype;
uint8 data[1];
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_action_vs_frmhdr dot11_action_vs_frmhdr_t;
#define DOT11_ACTION_VS_HDR_LEN 6
#define BCM_ACTION_OUI_BYTE0 0x00
#define BCM_ACTION_OUI_BYTE1 0x90
#define BCM_ACTION_OUI_BYTE2 0x4c
/* BA/BAR Control parameters */
#define DOT11_BA_CTL_POLICY_NORMAL 0x0000 /* normal ack */
#define DOT11_BA_CTL_POLICY_NOACK 0x0001 /* no ack */
#define DOT11_BA_CTL_POLICY_MASK 0x0001 /* ack policy mask */
#define DOT11_BA_CTL_MTID 0x0002 /* multi tid BA */
#define DOT11_BA_CTL_COMPRESSED 0x0004 /* compressed bitmap */
#define DOT11_BA_CTL_NUMMSDU_MASK 0x0FC0 /* num msdu in bitmap mask */
#define DOT11_BA_CTL_NUMMSDU_SHIFT 6 /* num msdu in bitmap shift */
#define DOT11_BA_CTL_TID_MASK 0xF000 /* tid mask */
#define DOT11_BA_CTL_TID_SHIFT 12 /* tid shift */
/* control frame header (BA/BAR) */
BWL_PRE_PACKED_STRUCT struct dot11_ctl_header {
uint16 fc; /* frame control */
uint16 durid; /* duration/ID */
struct ether_addr ra; /* receiver address */
struct ether_addr ta; /* transmitter address */
} BWL_POST_PACKED_STRUCT;
#define DOT11_CTL_HDR_LEN 16 /* control frame hdr len */
/* BAR frame payload */
BWL_PRE_PACKED_STRUCT struct dot11_bar {
uint16 bar_control; /* BAR Control */
uint16 seqnum; /* Starting Sequence control */
} BWL_POST_PACKED_STRUCT;
#define DOT11_BAR_LEN 4 /* BAR frame payload length */
#define DOT11_BA_BITMAP_LEN 128 /* bitmap length */
#define DOT11_BA_CMP_BITMAP_LEN 8 /* compressed bitmap length */
/* BA frame payload */
BWL_PRE_PACKED_STRUCT struct dot11_ba {
uint16 ba_control; /* BA Control */
uint16 seqnum; /* Starting Sequence control */
uint8 bitmap[DOT11_BA_BITMAP_LEN]; /* Block Ack Bitmap */
} BWL_POST_PACKED_STRUCT;
#define DOT11_BA_LEN 4 /* BA frame payload len (wo bitmap) */
/* Management frame header */
BWL_PRE_PACKED_STRUCT struct dot11_management_header {
uint16 fc; /* frame control */
uint16 durid; /* duration/ID */
struct ether_addr da; /* receiver address */
struct ether_addr sa; /* transmitter address */
struct ether_addr bssid; /* BSS ID */
uint16 seq; /* sequence control */
} BWL_POST_PACKED_STRUCT;
#define DOT11_MGMT_HDR_LEN 24 /* d11 management header length */
/* Management frame payloads */
BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb {
uint32 timestamp[2];
uint16 beacon_interval;
uint16 capability;
} BWL_POST_PACKED_STRUCT;
#define DOT11_BCN_PRB_LEN 12 /* 802.11 beacon/probe frame fixed length */
#define DOT11_BCN_PRB_FIXED_LEN 12 /* 802.11 beacon/probe frame fixed length */
BWL_PRE_PACKED_STRUCT struct dot11_auth {
uint16 alg; /* algorithm */
uint16 seq; /* sequence control */
uint16 status; /* status code */
} BWL_POST_PACKED_STRUCT;
#define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge IE */
BWL_PRE_PACKED_STRUCT struct dot11_assoc_req {
uint16 capability; /* capability information */
uint16 listen; /* listen interval */
} BWL_POST_PACKED_STRUCT;
#define DOT11_ASSOC_REQ_FIXED_LEN 4 /* length of assoc frame without info elts */
BWL_PRE_PACKED_STRUCT struct dot11_reassoc_req {
uint16 capability; /* capability information */
uint16 listen; /* listen interval */
struct ether_addr ap; /* Current AP address */
} BWL_POST_PACKED_STRUCT;
#define DOT11_REASSOC_REQ_FIXED_LEN 10 /* length of assoc frame without info elts */
BWL_PRE_PACKED_STRUCT struct dot11_assoc_resp {
uint16 capability; /* capability information */
uint16 status; /* status code */
uint16 aid; /* association ID */
} BWL_POST_PACKED_STRUCT;
#define DOT11_ASSOC_RESP_FIXED_LEN 6 /* length of assoc resp frame without info elts */
BWL_PRE_PACKED_STRUCT struct dot11_action_measure {
uint8 category;
uint8 action;
uint8 token;
uint8 data[1];
} BWL_POST_PACKED_STRUCT;
#define DOT11_ACTION_MEASURE_LEN 3 /* d11 action measurement header length */
BWL_PRE_PACKED_STRUCT struct dot11_action_ht_ch_width {
uint8 category;
uint8 action;
uint8 ch_width;
} BWL_POST_PACKED_STRUCT;
BWL_PRE_PACKED_STRUCT struct dot11_action_ht_mimops {
uint8 category;
uint8 action;
uint8 control;
} BWL_POST_PACKED_STRUCT;
BWL_PRE_PACKED_STRUCT struct dot11_action_sa_query {
uint8 category;
uint8 action;
uint16 id;
} BWL_POST_PACKED_STRUCT;
BWL_PRE_PACKED_STRUCT struct dot11_action_vht_oper_mode {
uint8 category;
uint8 action;
uint8 mode;
} BWL_POST_PACKED_STRUCT;
#define SM_PWRSAVE_ENABLE 1
#define SM_PWRSAVE_MODE 2
/* ************* 802.11h related definitions. ************* */
BWL_PRE_PACKED_STRUCT struct dot11_power_cnst {
uint8 id;
uint8 len;
uint8 power;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_power_cnst dot11_power_cnst_t;
BWL_PRE_PACKED_STRUCT struct dot11_power_cap {
uint8 min;
uint8 max;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_power_cap dot11_power_cap_t;
BWL_PRE_PACKED_STRUCT struct dot11_tpc_rep {
uint8 id;
uint8 len;
uint8 tx_pwr;
uint8 margin;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_tpc_rep dot11_tpc_rep_t;
#define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */
BWL_PRE_PACKED_STRUCT struct dot11_supp_channels {
uint8 id;
uint8 len;
uint8 first_channel;
uint8 num_channels;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_supp_channels dot11_supp_channels_t;
/* Extension Channel Offset IE: 802.11n-D1.0 spec. added sideband
* offset for 40MHz operation. The possible 3 values are:
* 1 = above control channel
* 3 = below control channel
* 0 = no extension channel
*/
BWL_PRE_PACKED_STRUCT struct dot11_extch {
uint8 id; /* IE ID, 62, DOT11_MNG_EXT_CHANNEL_OFFSET */
uint8 len; /* IE length */
uint8 extch;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_extch dot11_extch_ie_t;
BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch {
uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
uint8 len; /* IE length */
uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */
uint8 type; /* type inidicates what follows */
uint8 extch;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_brcm_extch dot11_brcm_extch_ie_t;
#define BRCM_EXTCH_IE_LEN 5
#define BRCM_EXTCH_IE_TYPE 53 /* 802.11n ID not yet assigned */
#define DOT11_EXTCH_IE_LEN 1
#define DOT11_EXT_CH_MASK 0x03 /* extension channel mask */
#define DOT11_EXT_CH_UPPER 0x01 /* ext. ch. on upper sb */
#define DOT11_EXT_CH_LOWER 0x03 /* ext. ch. on lower sb */
#define DOT11_EXT_CH_NONE 0x00 /* no extension ch. */
BWL_PRE_PACKED_STRUCT struct dot11_action_frmhdr {
uint8 category;
uint8 action;
uint8 data[1];
} BWL_POST_PACKED_STRUCT;
#define DOT11_ACTION_FRMHDR_LEN 2
/* CSA IE data structure */
BWL_PRE_PACKED_STRUCT struct dot11_channel_switch {
uint8 id; /* id DOT11_MNG_CHANNEL_SWITCH_ID */
uint8 len; /* length of IE */
uint8 mode; /* mode 0 or 1 */
uint8 channel; /* channel switch to */
uint8 count; /* number of beacons before switching */
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_channel_switch dot11_chan_switch_ie_t;
#define DOT11_SWITCH_IE_LEN 3 /* length of IE data, not including 2 byte header */
/* CSA mode - 802.11h-2003 $7.3.2.20 */
#define DOT11_CSA_MODE_ADVISORY 0 /* no DOT11_CSA_MODE_NO_TX restriction imposed */
#define DOT11_CSA_MODE_NO_TX 1 /* no transmission upon receiving CSA frame. */
BWL_PRE_PACKED_STRUCT struct dot11_action_switch_channel {
uint8 category;
uint8 action;
dot11_chan_switch_ie_t chan_switch_ie; /* for switch IE */
dot11_brcm_extch_ie_t extch_ie; /* extension channel offset */
} BWL_POST_PACKED_STRUCT;
BWL_PRE_PACKED_STRUCT struct dot11_csa_body {
uint8 mode; /* mode 0 or 1 */
uint8 reg; /* regulatory class */
uint8 channel; /* channel switch to */
uint8 count; /* number of beacons before switching */
} BWL_POST_PACKED_STRUCT;
/* 11n Extended Channel Switch IE data structure */
BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
uint8 id; /* id DOT11_MNG_EXT_CHANNEL_SWITCH_ID */
uint8 len; /* length of IE */
struct dot11_csa_body b; /* body of the ie */
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_ext_csa dot11_ext_csa_ie_t;
#define DOT11_EXT_CSA_IE_LEN 4 /* length of extended channel switch IE body */
BWL_PRE_PACKED_STRUCT struct dot11_action_ext_csa {
uint8 category;
uint8 action;
dot11_ext_csa_ie_t chan_switch_ie; /* for switch IE */
} BWL_POST_PACKED_STRUCT;
BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa {
uint8 category;
uint8 action;
struct dot11_csa_body b; /* body of the ie */
} BWL_POST_PACKED_STRUCT;
/* Wide Bandwidth Channel Switch IE data structure */
BWL_PRE_PACKED_STRUCT struct dot11_wide_bw_channel_switch {
uint8 id; /* id DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID */
uint8 len; /* length of IE */
uint8 channel_width; /* new channel width */
uint8 center_frequency_segment_0; /* center frequency segment 0 */
uint8 center_frequency_segment_1; /* center frequency segment 1 */
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_wide_bw_channel_switch dot11_wide_bw_chan_switch_ie_t;
#define DOT11_WIDE_BW_SWITCH_IE_LEN 3 /* length of IE data, not including 2 byte header */
/* Channel Switch Wrapper IE data structure */
BWL_PRE_PACKED_STRUCT struct dot11_channel_switch_wrapper {
uint8 id; /* id DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID */
uint8 len; /* length of IE */
dot11_wide_bw_chan_switch_ie_t wb_chan_switch_ie;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_channel_switch_wrapper dot11_chan_switch_wrapper_ie_t;
/* VHT Transmit Power Envelope IE data structure */
BWL_PRE_PACKED_STRUCT struct dot11_vht_transmit_power_envelope {
uint8 id; /* id DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID */
uint8 len; /* length of IE */
uint8 transmit_power_info;
uint8 local_max_transmit_power_20;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_vht_transmit_power_envelope dot11_vht_transmit_power_envelope_ie_t;
BWL_PRE_PACKED_STRUCT struct dot11_obss_coex {
uint8 id;
uint8 len;
uint8 info;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_obss_coex dot11_obss_coex_t;
#define DOT11_OBSS_COEXINFO_LEN 1 /* length of OBSS Coexistence INFO IE */
#define DOT11_OBSS_COEX_INFO_REQ 0x01
#define DOT11_OBSS_COEX_40MHZ_INTOLERANT 0x02
#define DOT11_OBSS_COEX_20MHZ_WIDTH_REQ 0x04
BWL_PRE_PACKED_STRUCT struct dot11_obss_chanlist {
uint8 id;
uint8 len;
uint8 regclass;
uint8 chanlist[1];
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_obss_chanlist dot11_obss_chanlist_t;
#define DOT11_OBSS_CHANLIST_FIXED_LEN 1 /* fixed length of regclass */
BWL_PRE_PACKED_STRUCT struct dot11_extcap_ie {
uint8 id;
uint8 len;
uint8 cap[1];
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_extcap_ie dot11_extcap_ie_t;
#define DOT11_EXTCAP_LEN_MAX 8
#define DOT11_EXTCAP_LEN_COEX 1
#define DOT11_EXTCAP_LEN_BT 3
#define DOT11_EXTCAP_LEN_IW 4
#define DOT11_EXTCAP_LEN_SI 6
#define DOT11_EXTCAP_LEN_TDLS 5
#define DOT11_11AC_EXTCAP_LEN_TDLS 8
#define DOT11_EXTCAP_LEN_FMS 2
#define DOT11_EXTCAP_LEN_PROXY_ARP 2
#define DOT11_EXTCAP_LEN_TFS 3
#define DOT11_EXTCAP_LEN_WNM_SLEEP 3
#define DOT11_EXTCAP_LEN_TIMBC 3
#define DOT11_EXTCAP_LEN_BSSTRANS 3
#define DOT11_EXTCAP_LEN_DMS 4
#define DOT11_EXTCAP_LEN_WNM_NOTIFICATION 6
#define DOT11_EXTCAP_LEN_TDLS_WBW 8
#define DOT11_EXTCAP_LEN_OPMODE_NOTIFICATION 8
BWL_PRE_PACKED_STRUCT struct dot11_extcap {
uint8 extcap[DOT11_EXTCAP_LEN_MAX];
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_extcap dot11_extcap_t;
/* TDLS Capabilities */
#define DOT11_TDLS_CAP_TDLS 37 /* TDLS support */
#define DOT11_TDLS_CAP_PU_BUFFER_STA 28 /* TDLS Peer U-APSD buffer STA support */
#define DOT11_TDLS_CAP_PEER_PSM 20 /* TDLS Peer PSM support */
#define DOT11_TDLS_CAP_CH_SW 30 /* TDLS Channel switch */
#define DOT11_TDLS_CAP_PROH 38 /* TDLS prohibited */
#define DOT11_TDLS_CAP_CH_SW_PROH 39 /* TDLS Channel switch prohibited */
#define DOT11_TDLS_CAP_TDLS_WIDER_BW 61 /* TDLS Wider Band-Width */
#define TDLS_CAP_MAX_BIT 39 /* TDLS max bit defined in ext cap */
/* 802.11h/802.11k Measurement Request/Report IEs */
/* Measurement Type field */
#define DOT11_MEASURE_TYPE_BASIC 0 /* d11 measurement basic type */
#define DOT11_MEASURE_TYPE_CCA 1 /* d11 measurement CCA type */
#define DOT11_MEASURE_TYPE_RPI 2 /* d11 measurement RPI type */
#define DOT11_MEASURE_TYPE_CHLOAD 3 /* d11 measurement Channel Load type */
#define DOT11_MEASURE_TYPE_NOISE 4 /* d11 measurement Noise Histogram type */
#define DOT11_MEASURE_TYPE_BEACON 5 /* d11 measurement Beacon type */
#define DOT11_MEASURE_TYPE_FRAME 6 /* d11 measurement Frame type */
#define DOT11_MEASURE_TYPE_STAT 7 /* d11 measurement STA Statistics type */
#define DOT11_MEASURE_TYPE_LCI 8 /* d11 measurement LCI type */
#define DOT11_MEASURE_TYPE_TXSTREAM 9 /* d11 measurement TX Stream type */
#define DOT11_MEASURE_TYPE_PAUSE 255 /* d11 measurement pause type */
/* Measurement Request Modes */
#define DOT11_MEASURE_MODE_PARALLEL (1<<0) /* d11 measurement parallel */
#define DOT11_MEASURE_MODE_ENABLE (1<<1) /* d11 measurement enable */
#define DOT11_MEASURE_MODE_REQUEST (1<<2) /* d11 measurement request */
#define DOT11_MEASURE_MODE_REPORT (1<<3) /* d11 measurement report */
#define DOT11_MEASURE_MODE_DUR (1<<4) /* d11 measurement dur mandatory */
/* Measurement Report Modes */
#define DOT11_MEASURE_MODE_LATE (1<<0) /* d11 measurement late */
#define DOT11_MEASURE_MODE_INCAPABLE (1<<1) /* d11 measurement incapable */
#define DOT11_MEASURE_MODE_REFUSED (1<<2) /* d11 measurement refuse */
/* Basic Measurement Map bits */
#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0)) /* d11 measurement basic map BSS */
#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1)) /* d11 measurement map OFDM */
#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2)) /* d11 measurement map unknown */
#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3)) /* d11 measurement map radar */
#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4)) /* d11 measurement map unmeasuremnt */
BWL_PRE_PACKED_STRUCT struct dot11_meas_req {
uint8 id;
uint8 len;
uint8 token;
uint8 mode;
uint8 type;
uint8 channel;
uint8 start_time[8];
uint16 duration;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_meas_req dot11_meas_req_t;
#define DOT11_MNG_IE_MREQ_LEN 14 /* d11 measurement request IE length */
/* length of Measure Request IE data not including variable len */
#define DOT11_MNG_IE_MREQ_FIXED_LEN 3 /* d11 measurement request IE fixed length */
BWL_PRE_PACKED_STRUCT struct dot11_meas_rep {
uint8 id;
uint8 len;
uint8 token;
uint8 mode;
uint8 type;
BWL_PRE_PACKED_STRUCT union
{
BWL_PRE_PACKED_STRUCT struct {
uint8 channel;
uint8 start_time[8];
uint16 duration;
uint8 map;
} BWL_POST_PACKED_STRUCT basic;
uint8 data[1];
} BWL_POST_PACKED_STRUCT rep;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_meas_rep dot11_meas_rep_t;
/* length of Measure Report IE data not including variable len */
#define DOT11_MNG_IE_MREP_FIXED_LEN 3 /* d11 measurement response IE fixed length */
BWL_PRE_PACKED_STRUCT struct dot11_meas_rep_basic {
uint8 channel;
uint8 start_time[8];
uint16 duration;
uint8 map;
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
#define DOT11_MEASURE_BASIC_REP_LEN 12 /* d11 measurement basic report length */
BWL_PRE_PACKED_STRUCT struct dot11_quiet {
uint8 id;
uint8 len;
uint8 count; /* TBTTs until beacon interval in quiet starts */
uint8 period; /* Beacon intervals between periodic quiet periods ? */
uint16 duration; /* Length of quiet period, in TU's */
uint16 offset; /* TU's offset from TBTT in Count field */
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_quiet dot11_quiet_t;
BWL_PRE_PACKED_STRUCT struct chan_map_tuple {
uint8 channel;
uint8 map;
} BWL_POST_PACKED_STRUCT;
typedef struct chan_map_tuple chan_map_tuple_t;
BWL_PRE_PACKED_STRUCT struct dot11_ibss_dfs {
uint8 id;
uint8 len;
uint8 eaddr[ETHER_ADDR_LEN];
uint8 interval;
chan_map_tuple_t map[1];
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_ibss_dfs dot11_ibss_dfs_t;
/* WME Elements */
#define WME_OUI "\x00\x50\xf2" /* WME OUI */
#define WME_OUI_LEN 3
#define WME_OUI_TYPE 2 /* WME type */
#define WME_TYPE 2 /* WME type, deprecated */
#define WME_SUBTYPE_IE 0 /* Information Element */
#define WME_SUBTYPE_PARAM_IE 1 /* Parameter Element */
#define WME_SUBTYPE_TSPEC 2 /* Traffic Specification */
#define WME_VER 1 /* WME version */
/* WME Access Category Indices (ACIs) */
#define AC_BE 0 /* Best Effort */
#define AC_BK 1 /* Background */
#define AC_VI 2 /* Video */
#define AC_VO 3 /* Voice */
#define AC_COUNT 4 /* number of ACs */
typedef uint8 ac_bitmap_t; /* AC bitmap of (1 << AC_xx) */
#define AC_BITMAP_NONE 0x0 /* No ACs */
#define AC_BITMAP_ALL 0xf /* All ACs */
#define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0)
#define AC_BITMAP_SET(ab, ac) (((ab) |= (1 << (ac))))
#define AC_BITMAP_RESET(ab, ac) (((ab) &= ~(1 << (ac))))
/* WME Information Element (IE) */
BWL_PRE_PACKED_STRUCT struct wme_ie {
uint8 oui[3];
uint8 type;
uint8 subtype;
uint8 version;
uint8 qosinfo;
} BWL_POST_PACKED_STRUCT;
typedef struct wme_ie wme_ie_t;
#define WME_IE_LEN 7 /* WME IE length */
BWL_PRE_PACKED_STRUCT struct edcf_acparam {
uint8 ACI;
uint8 ECW;
uint16 TXOP; /* stored in network order (ls octet first) */
} BWL_POST_PACKED_STRUCT;
typedef struct edcf_acparam edcf_acparam_t;
/* WME Parameter Element (PE) */
BWL_PRE_PACKED_STRUCT struct wme_param_ie {
uint8 oui[3];
uint8 type;
uint8 subtype;
uint8 version;
uint8 qosinfo;
uint8 rsvd;
edcf_acparam_t acparam[AC_COUNT];
} BWL_POST_PACKED_STRUCT;
typedef struct wme_param_ie wme_param_ie_t;
#define WME_PARAM_IE_LEN 24 /* WME Parameter IE length */
/* QoS Info field for IE as sent from AP */
#define WME_QI_AP_APSD_MASK 0x80 /* U-APSD Supported mask */
#define WME_QI_AP_APSD_SHIFT 7 /* U-APSD Supported shift */
#define WME_QI_AP_COUNT_MASK 0x0f /* Parameter set count mask */
#define WME_QI_AP_COUNT_SHIFT 0 /* Parameter set count shift */
/* QoS Info field for IE as sent from STA */
#define WME_QI_STA_MAXSPLEN_MASK 0x60 /* Max Service Period Length mask */
#define WME_QI_STA_MAXSPLEN_SHIFT 5 /* Max Service Period Length shift */
#define WME_QI_STA_APSD_ALL_MASK 0xf /* APSD all AC bits mask */
#define WME_QI_STA_APSD_ALL_SHIFT 0 /* APSD all AC bits shift */
#define WME_QI_STA_APSD_BE_MASK 0x8 /* APSD AC_BE mask */
#define WME_QI_STA_APSD_BE_SHIFT 3 /* APSD AC_BE shift */
#define WME_QI_STA_APSD_BK_MASK 0x4 /* APSD AC_BK mask */
#define WME_QI_STA_APSD_BK_SHIFT 2 /* APSD AC_BK shift */
#define WME_QI_STA_APSD_VI_MASK 0x2 /* APSD AC_VI mask */
#define WME_QI_STA_APSD_VI_SHIFT 1 /* APSD AC_VI shift */
#define WME_QI_STA_APSD_VO_MASK 0x1 /* APSD AC_VO mask */
#define WME_QI_STA_APSD_VO_SHIFT 0 /* APSD AC_VO shift */
/* ACI */
#define EDCF_AIFSN_MIN 1 /* AIFSN minimum value */
#define EDCF_AIFSN_MAX 15 /* AIFSN maximum value */
#define EDCF_AIFSN_MASK 0x0f /* AIFSN mask */
#define EDCF_ACM_MASK 0x10 /* ACM mask */
#define EDCF_ACI_MASK 0x60 /* ACI mask */
#define EDCF_ACI_SHIFT 5 /* ACI shift */
#define EDCF_AIFSN_SHIFT 12 /* 4 MSB(0xFFF) in ifs_ctl for AC idx */
/* ECW */
#define EDCF_ECW_MIN 0 /* cwmin/cwmax exponent minimum value */
#define EDCF_ECW_MAX 15 /* cwmin/cwmax exponent maximum value */
#define EDCF_ECW2CW(exp) ((1 << (exp)) - 1)
#define EDCF_ECWMIN_MASK 0x0f /* cwmin exponent form mask */
#define EDCF_ECWMAX_MASK 0xf0 /* cwmax exponent form mask */
#define EDCF_ECWMAX_SHIFT 4 /* cwmax exponent form shift */
/* TXOP */
#define EDCF_TXOP_MIN 0 /* TXOP minimum value */
#define EDCF_TXOP_MAX 65535 /* TXOP maximum value */
#define EDCF_TXOP2USEC(txop) ((txop) << 5)
/* Default BE ACI value for non-WME connection STA */
#define NON_EDCF_AC_BE_ACI_STA 0x02
/* Default EDCF parameters that AP advertises for STA to use; WMM draft Table 12 */
#define EDCF_AC_BE_ACI_STA 0x03 /* STA ACI value for best effort AC */
#define EDCF_AC_BE_ECW_STA 0xA4 /* STA ECW value for best effort AC */
#define EDCF_AC_BE_TXOP_STA 0x0000 /* STA TXOP value for best effort AC */
#define EDCF_AC_BK_ACI_STA 0x27 /* STA ACI value for background AC */
#define EDCF_AC_BK_ECW_STA 0xA4 /* STA ECW value for background AC */
#define EDCF_AC_BK_TXOP_STA 0x0000 /* STA TXOP value for background AC */
#define EDCF_AC_VI_ACI_STA 0x42 /* STA ACI value for video AC */
#define EDCF_AC_VI_ECW_STA 0x43 /* STA ECW value for video AC */
#define EDCF_AC_VI_TXOP_STA 0x005e /* STA TXOP value for video AC */
#define EDCF_AC_VO_ACI_STA 0x62 /* STA ACI value for audio AC */
#define EDCF_AC_VO_ECW_STA 0x32 /* STA ECW value for audio AC */
#define EDCF_AC_VO_TXOP_STA 0x002f /* STA TXOP value for audio AC */
/* Default EDCF parameters that AP uses; WMM draft Table 14 */
#define EDCF_AC_BE_ACI_AP 0x03 /* AP ACI value for best effort AC */
#define EDCF_AC_BE_ECW_AP 0x64 /* AP ECW value for best effort AC */
#define EDCF_AC_BE_TXOP_AP 0x0000 /* AP TXOP value for best effort AC */
#define EDCF_AC_BK_ACI_AP 0x27 /* AP ACI value for background AC */
#define EDCF_AC_BK_ECW_AP 0xA4 /* AP ECW value for background AC */
#define EDCF_AC_BK_TXOP_AP 0x0000 /* AP TXOP value for background AC */
#define EDCF_AC_VI_ACI_AP 0x41 /* AP ACI value for video AC */
#define EDCF_AC_VI_ECW_AP 0x43 /* AP ECW value for video AC */
#define EDCF_AC_VI_TXOP_AP 0x005e /* AP TXOP value for video AC */
#define EDCF_AC_VO_ACI_AP 0x61 /* AP ACI value for audio AC */
#define EDCF_AC_VO_ECW_AP 0x32 /* AP ECW value for audio AC */
#define EDCF_AC_VO_TXOP_AP 0x002f /* AP TXOP value for audio AC */
/* EDCA Parameter IE */
BWL_PRE_PACKED_STRUCT struct edca_param_ie {
uint8 qosinfo;
uint8 rsvd;
edcf_acparam_t acparam[AC_COUNT];
} BWL_POST_PACKED_STRUCT;
typedef struct edca_param_ie edca_param_ie_t;
#define EDCA_PARAM_IE_LEN 18 /* EDCA Parameter IE length */
/* QoS Capability IE */
BWL_PRE_PACKED_STRUCT struct qos_cap_ie {
uint8 qosinfo;
} BWL_POST_PACKED_STRUCT;
typedef struct qos_cap_ie qos_cap_ie_t;
BWL_PRE_PACKED_STRUCT struct dot11_qbss_load_ie {
uint8 id; /* 11, DOT11_MNG_QBSS_LOAD_ID */
uint8 length;
uint16 station_count; /* total number of STAs associated */
uint8 channel_utilization; /* % of time, normalized to 255, QAP sensed medium busy */
uint16 aac; /* available admission capacity */
} BWL_POST_PACKED_STRUCT;
typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t;
#define BSS_LOAD_IE_SIZE 7 /* BSS load IE size */
/* nom_msdu_size */
#define FIXED_MSDU_SIZE 0x8000 /* MSDU size is fixed */
#define MSDU_SIZE_MASK 0x7fff /* (Nominal or fixed) MSDU size */
/* surplus_bandwidth */
/* Represented as 3 bits of integer, binary point, 13 bits fraction */
#define INTEGER_SHIFT 13 /* integer shift */
#define FRACTION_MASK 0x1FFF /* fraction mask */
/* Management Notification Frame */
BWL_PRE_PACKED_STRUCT struct dot11_management_notification {
uint8 category; /* DOT11_ACTION_NOTIFICATION */
uint8 action;
uint8 token;
uint8 status;
uint8 data[1]; /* Elements */
} BWL_POST_PACKED_STRUCT;
#define DOT11_MGMT_NOTIFICATION_LEN 4 /* Fixed length */
/* Timeout Interval IE */
BWL_PRE_PACKED_STRUCT struct ti_ie {
uint8 ti_type;
uint32 ti_val;
} BWL_POST_PACKED_STRUCT;
typedef struct ti_ie ti_ie_t;
#define TI_TYPE_REASSOC_DEADLINE 1
#define TI_TYPE_KEY_LIFETIME 2
/* WME Action Codes */
#define WME_ADDTS_REQUEST 0 /* WME ADDTS request */
#define WME_ADDTS_RESPONSE 1 /* WME ADDTS response */
#define WME_DELTS_REQUEST 2 /* WME DELTS request */
/* WME Setup Response Status Codes */
#define WME_ADMISSION_ACCEPTED 0 /* WME admission accepted */
#define WME_INVALID_PARAMETERS 1 /* WME invalide parameters */
#define WME_ADMISSION_REFUSED 3 /* WME admission refused */
/* Macro to take a pointer to a beacon or probe response
* body and return the char* pointer to the SSID info element
*/
#define BCN_PRB_SSID(body) ((char*)(body) + DOT11_BCN_PRB_LEN)
/* Authentication frame payload constants */
#define DOT11_OPEN_SYSTEM 0 /* d11 open authentication */
#define DOT11_SHARED_KEY 1 /* d11 shared authentication */
#define DOT11_FAST_BSS 2 /* d11 fast bss authentication */
#define DOT11_CHALLENGE_LEN 128 /* d11 challenge text length */
/* Frame control macros */
#define FC_PVER_MASK 0x3 /* PVER mask */
#define FC_PVER_SHIFT 0 /* PVER shift */
#define FC_TYPE_MASK 0xC /* type mask */
#define FC_TYPE_SHIFT 2 /* type shift */
#define FC_SUBTYPE_MASK 0xF0 /* subtype mask */
#define FC_SUBTYPE_SHIFT 4 /* subtype shift */
#define FC_TODS 0x100 /* to DS */
#define FC_TODS_SHIFT 8 /* to DS shift */
#define FC_FROMDS 0x200 /* from DS */
#define FC_FROMDS_SHIFT 9 /* from DS shift */
#define FC_MOREFRAG 0x400 /* more frag. */
#define FC_MOREFRAG_SHIFT 10 /* more frag. shift */
#define FC_RETRY 0x800 /* retry */
#define FC_RETRY_SHIFT 11 /* retry shift */
#define FC_PM 0x1000 /* PM */
#define FC_PM_SHIFT 12 /* PM shift */
#define FC_MOREDATA 0x2000 /* more data */
#define FC_MOREDATA_SHIFT 13 /* more data shift */
#define FC_WEP 0x4000 /* WEP */
#define FC_WEP_SHIFT 14 /* WEP shift */
#define FC_ORDER 0x8000 /* order */
#define FC_ORDER_SHIFT 15 /* order shift */
/* sequence control macros */
#define SEQNUM_SHIFT 4 /* seq. number shift */
#define SEQNUM_MAX 0x1000 /* max seqnum + 1 */
#define FRAGNUM_MASK 0xF /* frag. number mask */
/* Frame Control type/subtype defs */
/* FC Types */
#define FC_TYPE_MNG 0 /* management type */
#define FC_TYPE_CTL 1 /* control type */
#define FC_TYPE_DATA 2 /* data type */
/* Management Subtypes */
#define FC_SUBTYPE_ASSOC_REQ 0 /* assoc. request */
#define FC_SUBTYPE_ASSOC_RESP 1 /* assoc. response */
#define FC_SUBTYPE_REASSOC_REQ 2 /* reassoc. request */
#define FC_SUBTYPE_REASSOC_RESP 3 /* reassoc. response */
#define FC_SUBTYPE_PROBE_REQ 4 /* probe request */
#define FC_SUBTYPE_PROBE_RESP 5 /* probe response */
#define FC_SUBTYPE_BEACON 8 /* beacon */
#define FC_SUBTYPE_ATIM 9 /* ATIM */
#define FC_SUBTYPE_DISASSOC 10 /* disassoc. */
#define FC_SUBTYPE_AUTH 11 /* authentication */
#define FC_SUBTYPE_DEAUTH 12 /* de-authentication */
#define FC_SUBTYPE_ACTION 13 /* action */
#define FC_SUBTYPE_ACTION_NOACK 14 /* action no-ack */
/* Control Subtypes */
#define FC_SUBTYPE_CTL_WRAPPER 7 /* Control Wrapper */
#define FC_SUBTYPE_BLOCKACK_REQ 8 /* Block Ack Req */
#define FC_SUBTYPE_BLOCKACK 9 /* Block Ack */
#define FC_SUBTYPE_PS_POLL 10 /* PS poll */
#define FC_SUBTYPE_RTS 11 /* RTS */
#define FC_SUBTYPE_CTS 12 /* CTS */
#define FC_SUBTYPE_ACK 13 /* ACK */
#define FC_SUBTYPE_CF_END 14 /* CF-END */
#define FC_SUBTYPE_CF_END_ACK 15 /* CF-END ACK */
/* Data Subtypes */
#define FC_SUBTYPE_DATA 0 /* Data */
#define FC_SUBTYPE_DATA_CF_ACK 1 /* Data + CF-ACK */
#define FC_SUBTYPE_DATA_CF_POLL 2 /* Data + CF-Poll */
#define FC_SUBTYPE_DATA_CF_ACK_POLL 3 /* Data + CF-Ack + CF-Poll */
#define FC_SUBTYPE_NULL 4 /* Null */
#define FC_SUBTYPE_CF_ACK 5 /* CF-Ack */
#define FC_SUBTYPE_CF_POLL 6 /* CF-Poll */
#define FC_SUBTYPE_CF_ACK_POLL 7 /* CF-Ack + CF-Poll */
#define FC_SUBTYPE_QOS_DATA 8 /* QoS Data */
#define FC_SUBTYPE_QOS_DATA_CF_ACK 9 /* QoS Data + CF-Ack */
#define FC_SUBTYPE_QOS_DATA_CF_POLL 10 /* QoS Data + CF-Poll */
#define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL 11 /* QoS Data + CF-Ack + CF-Poll */
#define FC_SUBTYPE_QOS_NULL 12 /* QoS Null */
#define FC_SUBTYPE_QOS_CF_POLL 14 /* QoS CF-Poll */
#define FC_SUBTYPE_QOS_CF_ACK_POLL 15 /* QoS CF-Ack + CF-Poll */
/* Data Subtype Groups */
#define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0)
#define FC_SUBTYPE_ANY_NULL(s) (((s) & 4) != 0)
#define FC_SUBTYPE_ANY_CF_POLL(s) (((s) & 2) != 0)
#define FC_SUBTYPE_ANY_CF_ACK(s) (((s) & 1) != 0)
#define FC_SUBTYPE_ANY_PSPOLL(s) (((s) & 10) != 0)
/* Type/Subtype Combos */
#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK) /* FC kind mask */
#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT)) /* FC kind */
#define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT) /* Subtype from FC */
#define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT) /* Type from FC */
#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ) /* assoc. request */
#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP) /* assoc. response */
#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ) /* reassoc. request */
#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP) /* reassoc. response */
#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ) /* probe request */
#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP) /* probe response */
#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON) /* beacon */
#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC) /* disassoc */
#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH) /* authentication */
#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH) /* deauthentication */
#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION) /* action */
#define FC_ACTION_NOACK FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION_NOACK) /* action no-ack */
#define FC_CTL_WRAPPER FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTL_WRAPPER) /* Control Wrapper */
#define FC_BLOCKACK_REQ FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ) /* Block Ack Req */
#define FC_BLOCKACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK) /* Block Ack */
#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL) /* PS poll */
#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS) /* RTS */
#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS) /* CTS */
#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK) /* ACK */
#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END) /* CF-END */
#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK) /* CF-END ACK */
#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA) /* data */
#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL) /* null data */
#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK) /* data CF ACK */
#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA) /* QoS data */
#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL) /* QoS null */
/* QoS Control Field */
/* 802.1D Priority */
#define QOS_PRIO_SHIFT 0 /* QoS priority shift */
#define QOS_PRIO_MASK 0x0007 /* QoS priority mask */
#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT) /* QoS priority */
/* Traffic Identifier */
#define QOS_TID_SHIFT 0 /* QoS TID shift */
#define QOS_TID_MASK 0x000f /* QoS TID mask */
#define QOS_TID(qos) (((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT) /* QoS TID */
/* End of Service Period (U-APSD) */
#define QOS_EOSP_SHIFT 4 /* QoS End of Service Period shift */
#define QOS_EOSP_MASK 0x0010 /* QoS End of Service Period mask */
#define QOS_EOSP(qos) (((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT) /* Qos EOSP */
/* Ack Policy */
#define QOS_ACK_NORMAL_ACK 0 /* Normal Ack */
#define QOS_ACK_NO_ACK 1 /* No Ack (eg mcast) */
#define QOS_ACK_NO_EXP_ACK 2 /* No Explicit Ack */
#define QOS_ACK_BLOCK_ACK 3 /* Block Ack */
#define QOS_ACK_SHIFT 5 /* QoS ACK shift */
#define QOS_ACK_MASK 0x0060 /* QoS ACK mask */
#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT) /* QoS ACK */
/* A-MSDU flag */
#define QOS_AMSDU_SHIFT 7 /* AMSDU shift */
#define QOS_AMSDU_MASK 0x0080 /* AMSDU mask */
/* Management Frames */
/* Management Frame Constants */
/* Fixed fields */
#define DOT11_MNG_AUTH_ALGO_LEN 2 /* d11 management auth. algo. length */
#define DOT11_MNG_AUTH_SEQ_LEN 2 /* d11 management auth. seq. length */
#define DOT11_MNG_BEACON_INT_LEN 2 /* d11 management beacon interval length */
#define DOT11_MNG_CAP_LEN 2 /* d11 management cap. length */
#define DOT11_MNG_AP_ADDR_LEN 6 /* d11 management AP address length */
#define DOT11_MNG_LISTEN_INT_LEN 2 /* d11 management listen interval length */
#define DOT11_MNG_REASON_LEN 2 /* d11 management reason length */
#define DOT11_MNG_AID_LEN 2 /* d11 management AID length */
#define DOT11_MNG_STATUS_LEN 2 /* d11 management status length */