Go to the documentation of this file.
31 #ifndef __80211HDR_H__
32 #define __80211HDR_H__
38 #define BIT0 0x00000001
39 #define BIT1 0x00000002
40 #define BIT2 0x00000004
41 #define BIT3 0x00000008
42 #define BIT4 0x00000010
43 #define BIT5 0x00000020
44 #define BIT6 0x00000040
45 #define BIT7 0x00000080
46 #define BIT8 0x00000100
47 #define BIT9 0x00000200
48 #define BIT10 0x00000400
49 #define BIT11 0x00000800
50 #define BIT12 0x00001000
51 #define BIT13 0x00002000
52 #define BIT14 0x00004000
53 #define BIT15 0x00008000
54 #define BIT16 0x00010000
55 #define BIT17 0x00020000
56 #define BIT18 0x00040000
57 #define BIT19 0x00080000
58 #define BIT20 0x00100000
59 #define BIT21 0x00200000
60 #define BIT22 0x00400000
61 #define BIT23 0x00800000
62 #define BIT24 0x01000000
63 #define BIT25 0x02000000
64 #define BIT26 0x04000000
65 #define BIT27 0x08000000
66 #define BIT28 0x10000000
67 #define BIT29 0x20000000
68 #define BIT30 0x40000000
69 #define BIT31 0x80000000
72 #define WLAN_ADDR_LEN 6
73 #define WLAN_CRC_LEN 4
74 #define WLAN_CRC32_LEN 4
75 #define WLAN_FCS_LEN 4
76 #define WLAN_BSSID_LEN 6
77 #define WLAN_BSS_TS_LEN 8
78 #define WLAN_HDR_ADDR2_LEN 16
79 #define WLAN_HDR_ADDR3_LEN 24
80 #define WLAN_HDR_ADDR4_LEN 30
81 #define WLAN_IEHDR_LEN 2
82 #define WLAN_SSID_MAXLEN 32
83 #define WLAN_RATES_MAXLEN 16
84 #define WLAN_RATES_MAXLEN_11B 4
85 #define WLAN_RSN_MAXLEN 32
86 #define WLAN_DATA_MAXLEN 2312
87 #define WLAN_A3FR_MAXLEN (WLAN_HDR_ADDR3_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)
90 #define WLAN_BEACON_FR_MAXLEN WLAN_A3FR_MAXLEN
91 #define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0)
92 #define WLAN_NULLDATA_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0)
93 #define WLAN_DISASSOC_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 2)
94 #define WLAN_ASSOCREQ_FR_MAXLEN WLAN_A3FR_MAXLEN
95 #define WLAN_ASSOCRESP_FR_MAXLEN WLAN_A3FR_MAXLEN
96 #define WLAN_REASSOCREQ_FR_MAXLEN WLAN_A3FR_MAXLEN
97 #define WLAN_REASSOCRESP_FR_MAXLEN WLAN_A3FR_MAXLEN
98 #define WLAN_PROBEREQ_FR_MAXLEN WLAN_A3FR_MAXLEN
99 #define WLAN_PROBERESP_FR_MAXLEN WLAN_A3FR_MAXLEN
100 #define WLAN_AUTHEN_FR_MAXLEN WLAN_A3FR_MAXLEN
101 #define WLAN_DEAUTHEN_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 2)
104 #define WLAN_WEP_NKEYS 4
105 #define WLAN_WEP40_KEYLEN 5
106 #define WLAN_WEP104_KEYLEN 13
107 #define WLAN_WEP232_KEYLEN 29
108 #define WLAN_WEPMAX_KEYLEN 32
109 #define WLAN_CHALLENGE_IE_MAXLEN 255
110 #define WLAN_CHALLENGE_IE_LEN 130
111 #define WLAN_CHALLENGE_LEN 128
112 #define WLAN_WEP_IV_LEN 4
113 #define WLAN_WEP_ICV_LEN 4
114 #define WLAN_FRAGS_MAX 16
117 #define WLAN_TYPE_MGR 0x00
118 #define WLAN_TYPE_CTL 0x01
119 #define WLAN_TYPE_DATA 0x02
121 #define WLAN_FTYPE_MGMT 0x00
122 #define WLAN_FTYPE_CTL 0x01
123 #define WLAN_FTYPE_DATA 0x02
127 #define WLAN_FSTYPE_ASSOCREQ 0x00
128 #define WLAN_FSTYPE_ASSOCRESP 0x01
129 #define WLAN_FSTYPE_REASSOCREQ 0x02
130 #define WLAN_FSTYPE_REASSOCRESP 0x03
131 #define WLAN_FSTYPE_PROBEREQ 0x04
132 #define WLAN_FSTYPE_PROBERESP 0x05
133 #define WLAN_FSTYPE_BEACON 0x08
134 #define WLAN_FSTYPE_ATIM 0x09
135 #define WLAN_FSTYPE_DISASSOC 0x0a
136 #define WLAN_FSTYPE_AUTHEN 0x0b
137 #define WLAN_FSTYPE_DEAUTHEN 0x0c
138 #define WLAN_FSTYPE_ACTION 0x0d
141 #define WLAN_FSTYPE_PSPOLL 0x0a
142 #define WLAN_FSTYPE_RTS 0x0b
143 #define WLAN_FSTYPE_CTS 0x0c
144 #define WLAN_FSTYPE_ACK 0x0d
145 #define WLAN_FSTYPE_CFEND 0x0e
146 #define WLAN_FSTYPE_CFENDCFACK 0x0f
149 #define WLAN_FSTYPE_DATAONLY 0x00
150 #define WLAN_FSTYPE_DATA_CFACK 0x01
151 #define WLAN_FSTYPE_DATA_CFPOLL 0x02
152 #define WLAN_FSTYPE_DATA_CFACK_CFPOLL 0x03
153 #define WLAN_FSTYPE_NULL 0x04
154 #define WLAN_FSTYPE_CFACK 0x05
155 #define WLAN_FSTYPE_CFPOLL 0x06
156 #define WLAN_FSTYPE_CFACK_CFPOLL 0x07
162 #define WLAN_GET_FC_PRVER(n) ((((unsigned short)(n) >> 8) & (BIT0 | BIT1))
163 #define WLAN_GET_FC_FTYPE(n) ((((unsigned short)(n) >> 8) & (BIT2 | BIT3)) >> 2)
164 #define WLAN_GET_FC_FSTYPE(n) ((((unsigned short)(n) >> 8) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
165 #define WLAN_GET_FC_TODS(n) ((((unsigned short)(n) << 8) & (BIT8)) >> 8)
166 #define WLAN_GET_FC_FROMDS(n) ((((unsigned short)(n) << 8) & (BIT9)) >> 9)
167 #define WLAN_GET_FC_MOREFRAG(n) ((((unsigned short)(n) << 8) & (BIT10)) >> 10)
168 #define WLAN_GET_FC_RETRY(n) ((((unsigned short)(n) << 8) & (BIT11)) >> 11)
169 #define WLAN_GET_FC_PWRMGT(n) ((((unsigned short)(n) << 8) & (BIT12)) >> 12)
170 #define WLAN_GET_FC_MOREDATA(n) ((((unsigned short)(n) << 8) & (BIT13)) >> 13)
171 #define WLAN_GET_FC_ISWEP(n) ((((unsigned short)(n) << 8) & (BIT14)) >> 14)
172 #define WLAN_GET_FC_ORDER(n) ((((unsigned short)(n) << 8) & (BIT15)) >> 15)
175 #define WLAN_GET_SEQ_FRGNUM(n) (((unsigned short)(n) >> 8) & (BIT0|BIT1|BIT2|BIT3))
176 #define WLAN_GET_SEQ_SEQNUM(n) ((((unsigned short)(n) >> 8) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
180 #define WLAN_GET_CAP_INFO_ESS(n) (((n) >> 8) & BIT0)
181 #define WLAN_GET_CAP_INFO_IBSS(n) ((((n) >> 8) & BIT1) >> 1)
182 #define WLAN_GET_CAP_INFO_CFPOLLABLE(n) ((((n) >> 8) & BIT2) >> 2)
183 #define WLAN_GET_CAP_INFO_CFPOLLREQ(n) ((((n) >> 8) & BIT3) >> 3)
184 #define WLAN_GET_CAP_INFO_PRIVACY(n) ((((n) >> 8) & BIT4) >> 4)
185 #define WLAN_GET_CAP_INFO_SHORTPREAMBLE(n) ((((n) >> 8) & BIT5) >> 5)
186 #define WLAN_GET_CAP_INFO_PBCC(n) ((((n) >> 8) & BIT6) >> 6)
187 #define WLAN_GET_CAP_INFO_AGILITY(n) ((((n) >> 8) & BIT7) >> 7)
188 #define WLAN_GET_CAP_INFO_SPECTRUMMNG(n) ((((n)) & BIT8) >> 10)
189 #define WLAN_GET_CAP_INFO_SHORTSLOTTIME(n) ((((n)) & BIT10) >> 10)
190 #define WLAN_GET_CAP_INFO_DSSSOFDM(n) ((((n)) & BIT13) >> 13)
191 #define WLAN_GET_CAP_INFO_GRPACK(n) ((((n)) & BIT14) >> 14)
197 #define WLAN_GET_FC_PRVER(n) (((unsigned short)(n)) & (BIT0 | BIT1))
198 #define WLAN_GET_FC_FTYPE(n) ((((unsigned short)(n)) & (BIT2 | BIT3)) >> 2)
199 #define WLAN_GET_FC_FSTYPE(n) ((((unsigned short)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
200 #define WLAN_GET_FC_TODS(n) ((((unsigned short)(n)) & (BIT8)) >> 8)
201 #define WLAN_GET_FC_FROMDS(n) ((((unsigned short)(n)) & (BIT9)) >> 9)
202 #define WLAN_GET_FC_MOREFRAG(n) ((((unsigned short)(n)) & (BIT10)) >> 10)
203 #define WLAN_GET_FC_RETRY(n) ((((unsigned short)(n)) & (BIT11)) >> 11)
204 #define WLAN_GET_FC_PWRMGT(n) ((((unsigned short)(n)) & (BIT12)) >> 12)
205 #define WLAN_GET_FC_MOREDATA(n) ((((unsigned short)(n)) & (BIT13)) >> 13)
206 #define WLAN_GET_FC_ISWEP(n) ((((unsigned short)(n)) & (BIT14)) >> 14)
207 #define WLAN_GET_FC_ORDER(n) ((((unsigned short)(n)) & (BIT15)) >> 15)
211 #define WLAN_GET_SEQ_FRGNUM(n) (((unsigned short)(n)) & (BIT0|BIT1|BIT2|BIT3))
212 #define WLAN_GET_SEQ_SEQNUM(n) ((((unsigned short)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
216 #define WLAN_GET_CAP_INFO_ESS(n) ((n) & BIT0)
217 #define WLAN_GET_CAP_INFO_IBSS(n) (((n) & BIT1) >> 1)
218 #define WLAN_GET_CAP_INFO_CFPOLLABLE(n) (((n) & BIT2) >> 2)
219 #define WLAN_GET_CAP_INFO_CFPOLLREQ(n) (((n) & BIT3) >> 3)
220 #define WLAN_GET_CAP_INFO_PRIVACY(n) (((n) & BIT4) >> 4)
221 #define WLAN_GET_CAP_INFO_SHORTPREAMBLE(n) (((n) & BIT5) >> 5)
222 #define WLAN_GET_CAP_INFO_PBCC(n) (((n) & BIT6) >> 6)
223 #define WLAN_GET_CAP_INFO_AGILITY(n) (((n) & BIT7) >> 7)
224 #define WLAN_GET_CAP_INFO_SPECTRUMMNG(n) (((n) & BIT8) >> 10)
225 #define WLAN_GET_CAP_INFO_SHORTSLOTTIME(n) (((n) & BIT10) >> 10)
226 #define WLAN_GET_CAP_INFO_DSSSOFDM(n) (((n) & BIT13) >> 13)
227 #define WLAN_GET_CAP_INFO_GRPACK(n) (((n) & BIT14) >> 14)
233 #define WLAN_SET_CAP_INFO_ESS(n) (n)
234 #define WLAN_SET_CAP_INFO_IBSS(n) ((n) << 1)
235 #define WLAN_SET_CAP_INFO_CFPOLLABLE(n) ((n) << 2)
236 #define WLAN_SET_CAP_INFO_CFPOLLREQ(n) ((n) << 3)
237 #define WLAN_SET_CAP_INFO_PRIVACY(n) ((n) << 4)
238 #define WLAN_SET_CAP_INFO_SHORTPREAMBLE(n) ((n) << 5)
239 #define WLAN_SET_CAP_INFO_SPECTRUMMNG(n) ((n) << 8)
240 #define WLAN_SET_CAP_INFO_PBCC(n) ((n) << 6)
241 #define WLAN_SET_CAP_INFO_AGILITY(n) ((n) << 7)
242 #define WLAN_SET_CAP_INFO_SHORTSLOTTIME(n) ((n) << 10)
243 #define WLAN_SET_CAP_INFO_DSSSOFDM(n) ((n) << 13)
244 #define WLAN_SET_CAP_INFO_GRPACK(n) ((n) << 14)
247 #define WLAN_SET_FC_PRVER(n) ((unsigned short)(n))
248 #define WLAN_SET_FC_FTYPE(n) (((unsigned short)(n)) << 2)
249 #define WLAN_SET_FC_FSTYPE(n) (((unsigned short)(n)) << 4)
250 #define WLAN_SET_FC_TODS(n) (((unsigned short)(n)) << 8)
251 #define WLAN_SET_FC_FROMDS(n) (((unsigned short)(n)) << 9)
252 #define WLAN_SET_FC_MOREFRAG(n) (((unsigned short)(n)) << 10)
253 #define WLAN_SET_FC_RETRY(n) (((unsigned short)(n)) << 11)
254 #define WLAN_SET_FC_PWRMGT(n) (((unsigned short)(n)) << 12)
255 #define WLAN_SET_FC_MOREDATA(n) (((unsigned short)(n)) << 13)
256 #define WLAN_SET_FC_ISWEP(n) (((unsigned short)(n)) << 14)
257 #define WLAN_SET_FC_ORDER(n) (((unsigned short)(n)) << 15)
259 #define WLAN_SET_SEQ_FRGNUM(n) ((unsigned short)(n))
260 #define WLAN_SET_SEQ_SEQNUM(n) (((unsigned short)(n)) << 4)
264 #define WLAN_GET_ERP_NONERP_PRESENT(n) ((n) & BIT0)
265 #define WLAN_GET_ERP_USE_PROTECTION(n) (((n) & BIT1) >> 1)
266 #define WLAN_GET_ERP_BARKER_MODE(n) (((n) & BIT2) >> 2)
268 #define WLAN_SET_ERP_NONERP_PRESENT(n) (n)
269 #define WLAN_SET_ERP_USE_PROTECTION(n) ((n) << 1)
270 #define WLAN_SET_ERP_BARKER_MODE(n) ((n) << 2)
275 #define WLAN_MGMT_IS_BASICRATE(b) ((b) & BIT7)
276 #define WLAN_MGMT_GET_RATE(b) ((b) & ~BIT7)
279 #define WLAN_MGMT_IS_MULTICAST_TIM(b) ((b) & BIT0)
280 #define WLAN_MGMT_GET_TIM_OFFSET(b) (((b) & ~BIT0) >> 1)
283 #define WLAN_HDR_A3_DATA_PTR(p) (((unsigned char *)(p)) + WLAN_HDR_ADDR3_LEN)
284 #define WLAN_HDR_A4_DATA_PTR(p) (((unsigned char *)(p)) + WLAN_HDR_ADDR4_LEN)
287 #define IEEE_ADDR_UNIVERSAL 0x02
288 #define IEEE_ADDR_GROUP 0x01
291 unsigned char abyAddr[6];