Commit | Line | Data |
---|---|---|
03a4389c | 1 | /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
66101de1 PM |
2 | // MAC_Structures.h |
3 | // | |
4 | // This file contains the definitions and data structures used by SW-MAC. | |
5 | // | |
6 | // Revision Histoy | |
7 | //================= | |
8 | // 0.1 2002 UN00 | |
9 | // 0.2 20021004 PD43 CCLiu6 | |
10 | // 20021018 PD43 CCLiu6 | |
11 | // Add enum_TxRate type | |
12 | // Modify enum_STAState type | |
13 | // 0.3 20021023 PE23 CYLiu update MAC session struct | |
14 | // 20021108 | |
15 | // 20021122 PD43 Austin | |
16 | // Deleted some unused. | |
17 | // 20021129 PD43 Austin | |
18 | // 20030617 increase the 802.11g definition | |
03a4389c | 19 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
66101de1 PM |
20 | |
21 | #ifndef _MAC_Structures_H_ | |
22 | #define _MAC_Structures_H_ | |
23 | ||
80aba536 | 24 | #include <linux/skbuff.h> |
66101de1 | 25 | |
03a4389c | 26 | /*========================================================= |
66101de1 | 27 | // Some miscellaneous definitions |
03a4389c | 28 | //-----*/ |
66101de1 PM |
29 | #define MAX_CHANNELS 30 |
30 | #define MAC_ADDR_LENGTH 6 | |
03a4389c RP |
31 | #define MAX_WEP_KEY_SIZE 16 /* 128 bits */ |
32 | #define MAX_802_11_FRAGMENT_NUMBER 10 /* By spec */ | |
66101de1 | 33 | |
03a4389c | 34 | /* ======================================================== |
66101de1 | 35 | // 802.11 Frame define |
03a4389c | 36 | //----- */ |
66101de1 PM |
37 | #define MASK_PROTOCOL_VERSION_TYPE 0x0F |
38 | #define MASK_FRAGMENT_NUMBER 0x000F | |
39 | #define SEQUENCE_NUMBER_SHIFT 4 | |
40 | #define DIFFER_11_TO_3 18 | |
41 | #define DOT_11_MAC_HEADER_SIZE 24 | |
42 | #define DOT_11_SNAP_SIZE 6 | |
43 | #define DOT_11_DURATION_OFFSET 2 | |
07bbf350 AL |
44 | /* Sequence control offset */ |
45 | #define DOT_11_SEQUENCE_OFFSET 22 | |
46 | /* The start offset of 802.11 Frame// */ | |
47 | #define DOT_11_TYPE_OFFSET 30 | |
66101de1 PM |
48 | #define DOT_11_DATA_OFFSET 24 |
49 | #define DOT_11_DA_OFFSET 4 | |
50 | #define DOT_3_TYPE_ARP 0x80F3 | |
51 | #define DOT_3_TYPE_IPX 0x8137 | |
52 | #define DOT_3_TYPE_OFFSET 12 | |
53 | ||
54 | ||
55 | #define ETHERNET_HEADER_SIZE 14 | |
56 | #define MAX_ETHERNET_PACKET_SIZE 1514 | |
57 | ||
58 | ||
03a4389c | 59 | /* ----- management : Type of Bits (2, 3) and Subtype of Bits (4, 5, 6, 7) */ |
66101de1 PM |
60 | #define MAC_SUBTYPE_MNGMNT_ASSOC_REQUEST 0x00 |
61 | #define MAC_SUBTYPE_MNGMNT_ASSOC_RESPONSE 0x10 | |
62 | #define MAC_SUBTYPE_MNGMNT_REASSOC_REQUEST 0x20 | |
63 | #define MAC_SUBTYPE_MNGMNT_REASSOC_RESPONSE 0x30 | |
64 | #define MAC_SUBTYPE_MNGMNT_PROBE_REQUEST 0x40 | |
65 | #define MAC_SUBTYPE_MNGMNT_PROBE_RESPONSE 0x50 | |
66 | #define MAC_SUBTYPE_MNGMNT_BEACON 0x80 | |
67 | #define MAC_SUBTYPE_MNGMNT_ATIM 0x90 | |
68 | #define MAC_SUBTYPE_MNGMNT_DISASSOCIATION 0xA0 | |
69 | #define MAC_SUBTYPE_MNGMNT_AUTHENTICATION 0xB0 | |
70 | #define MAC_SUBTYPE_MNGMNT_DEAUTHENTICATION 0xC0 | |
71 | ||
03a4389c | 72 | /* ----- control : Type of Bits (2, 3) and Subtype of Bits (4, 5, 6, 7) */ |
66101de1 PM |
73 | #define MAC_SUBTYPE_CONTROL_PSPOLL 0xA4 |
74 | #define MAC_SUBTYPE_CONTROL_RTS 0xB4 | |
75 | #define MAC_SUBTYPE_CONTROL_CTS 0xC4 | |
76 | #define MAC_SUBTYPE_CONTROL_ACK 0xD4 | |
77 | #define MAC_SUBTYPE_CONTROL_CFEND 0xE4 | |
78 | #define MAC_SUBTYPE_CONTROL_CFEND_CFACK 0xF4 | |
79 | ||
03a4389c | 80 | /* ----- data : Type of Bits (2, 3) and Subtype of Bits (4, 5, 6, 7) */ |
66101de1 PM |
81 | #define MAC_SUBTYPE_DATA 0x08 |
82 | #define MAC_SUBTYPE_DATA_CFACK 0x18 | |
83 | #define MAC_SUBTYPE_DATA_CFPOLL 0x28 | |
84 | #define MAC_SUBTYPE_DATA_CFACK_CFPOLL 0x38 | |
85 | #define MAC_SUBTYPE_DATA_NULL 0x48 | |
86 | #define MAC_SUBTYPE_DATA_CFACK_NULL 0x58 | |
87 | #define MAC_SUBTYPE_DATA_CFPOLL_NULL 0x68 | |
88 | #define MAC_SUBTYPE_DATA_CFACK_CFPOLL_NULL 0x78 | |
89 | ||
03a4389c | 90 | /* ----- Frame Type of Bits (2, 3) */ |
66101de1 PM |
91 | #define MAC_TYPE_MANAGEMENT 0x00 |
92 | #define MAC_TYPE_CONTROL 0x04 | |
93 | #define MAC_TYPE_DATA 0x08 | |
94 | ||
03a4389c | 95 | /* ----- definitions for Management Frame Element ID (1 BYTE) */ |
66101de1 PM |
96 | #define ELEMENT_ID_SSID 0 |
97 | #define ELEMENT_ID_SUPPORTED_RATES 1 | |
98 | #define ELEMENT_ID_FH_PARAMETER_SET 2 | |
99 | #define ELEMENT_ID_DS_PARAMETER_SET 3 | |
100 | #define ELEMENT_ID_CF_PARAMETER_SET 4 | |
101 | #define ELEMENT_ID_TIM 5 | |
102 | #define ELEMENT_ID_IBSS_PARAMETER_SET 6 | |
cb016cc4 | 103 | /* 7~15 reserverd */ |
66101de1 | 104 | #define ELEMENT_ID_CHALLENGE_TEXT 16 |
cb016cc4 AL |
105 | /* 17~31 reserved for challenge text extension */ |
106 | /* 32~255 reserved */ | |
107 | /*-- 11G -- */ | |
66101de1 PM |
108 | #define ELEMENT_ID_ERP_INFORMATION 42 |
109 | #define ELEMENT_ID_EXTENDED_SUPPORTED_RATES 50 | |
110 | ||
cb016cc4 | 111 | /* -- WPA -- */ |
66101de1 PM |
112 | |
113 | #define ELEMENT_ID_RSN_WPA 221 | |
114 | #ifdef _WPA2_ | |
115 | #define ELEMENT_ID_RSN_WPA2 48 | |
cb016cc4 | 116 | #endif /* endif WPA2 */ |
66101de1 PM |
117 | |
118 | #define WLAN_MAX_PAIRWISE_CIPHER_SUITE_COUNT ((u16) 6) | |
119 | #define WLAN_MAX_AUTH_KEY_MGT_SUITE_LIST_COUNT ((u16) 2) | |
120 | ||
cb016cc4 AL |
121 | /* =================================================================== |
122 | * Reason Code (Table 18): indicate the reason of DisAssoc, DeAuthen | |
123 | * length of ReasonCode is 2 Octs. | |
124 | * =================================================================== */ | |
66101de1 PM |
125 | #define REASON_REASERED 0 |
126 | #define REASON_UNSPECIDIED 1 | |
127 | #define REASON_PREAUTH_INVALID 2 | |
128 | #define DEAUTH_REASON_LEFT_BSS 3 | |
129 | #define DISASS_REASON_AP_INACTIVE 4 | |
130 | #define DISASS_REASON_AP_BUSY 5 | |
131 | #define REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6 | |
132 | #define REASON_CLASS3_FRAME_FROM_NONASSO_STA 7 | |
133 | #define DISASS_REASON_LEFT_BSS 8 | |
134 | #define REASON_NOT_AUTH_YET 9 | |
03a4389c | 135 | /* 802.11i define */ |
66101de1 PM |
136 | #define REASON_INVALID_IE 13 |
137 | #define REASON_MIC_ERROR 14 | |
138 | #define REASON_4WAY_HANDSHAKE_TIMEOUT 15 | |
139 | #define REASON_GROUPKEY_UPDATE_TIMEOUT 16 | |
140 | #define REASON_IE_DIFF_4WAY_ASSOC 17 | |
141 | #define REASON_INVALID_MULTICAST_CIPHER 18 | |
142 | #define REASON_INVALID_UNICAST_CIPHER 19 | |
143 | #define REASON_INVALID_AKMP 20 | |
144 | #define REASON_UNSUPPORTED_RSNIE_VERSION 21 | |
145 | #define REASON_INVALID_RSNIE_CAPABILITY 22 | |
146 | #define REASON_802_1X_AUTH_FAIL 23 | |
147 | #define REASON_CIPHER_REJECT_PER_SEC_POLICY 14 | |
148 | ||
149 | /* | |
150 | //=========================================================== | |
151 | // enum_MMPDUResultCode -- | |
152 | // Status code (2 Octs) in the MMPDU's frame body. Table.19 | |
153 | // | |
154 | //=========================================================== | |
155 | enum enum_MMPDUResultCode | |
156 | { | |
157 | // SUCCESS = 0, // Redefined | |
158 | UNSPECIFIED_FAILURE = 1, | |
159 | ||
160 | // 2 - 9 Reserved | |
161 | ||
162 | NOT_SUPPROT_CAPABILITIES = 10, | |
163 | ||
164 | //REASSOCIATION_DENIED | |
165 | // | |
166 | REASSOC_DENIED_UNABLE_CFM_ASSOC_EXIST = 11, | |
167 | ||
168 | //ASSOCIATION_DENIED_NOT_IN_STANDARD | |
169 | // | |
170 | ASSOC_DENIED_REASON_NOT_IN_STANDARD = 12, | |
171 | PEER_NOT_SUPPORT_AUTH_ALGORITHM = 13, | |
172 | AUTH_SEQNUM_OUT_OF_EXPECT = 14, | |
173 | AUTH_REJECT_REASON_CHALLENGE_FAIL = 15, | |
174 | AUTH_REJECT_REASON_WAIT_TIMEOUT = 16, | |
175 | ASSOC_DENIED_REASON_AP_BUSY = 17, | |
176 | ASSOC_DENIED_REASON_NOT_SUPPORT_BASIC_RATE = 18 | |
177 | } WB_MMPDURESULTCODE, *PWB_MMPDURESULTCODE; | |
178 | */ | |
179 | ||
03a4389c | 180 | /*=========================================================== |
66101de1 PM |
181 | // enum_TxRate -- |
182 | // Define the transmission constants based on W89C32 MAC | |
183 | // target specification. | |
03a4389c | 184 | //===========================================================*/ |
d20279d7 | 185 | typedef enum enum_TxRate { |
66101de1 PM |
186 | TXRATE_1M = 0, |
187 | TXRATE_2MLONG = 2, | |
188 | TXRATE_2MSHORT = 3, | |
189 | TXRATE_55MLONG = 4, | |
190 | TXRATE_55MSHORT = 5, | |
191 | TXRATE_11MLONG = 6, | |
192 | TXRATE_11MSHORT = 7, | |
03a4389c | 193 | TXRATE_AUTO = 255 /* PD43 20021108 */ |
66101de1 PM |
194 | } WB_TXRATE, *PWB_TXRATE; |
195 | ||
196 | ||
197 | #define RATE_BITMAP_1M 1 | |
198 | #define RATE_BITMAP_2M 2 | |
199 | #define RATE_BITMAP_5dot5M 5 | |
200 | #define RATE_BITMAP_6M 6 | |
201 | #define RATE_BITMAP_9M 9 | |
202 | #define RATE_BITMAP_11M 11 | |
203 | #define RATE_BITMAP_12M 12 | |
204 | #define RATE_BITMAP_18M 18 | |
205 | #define RATE_BITMAP_22M 22 | |
206 | #define RATE_BITMAP_24M 24 | |
207 | #define RATE_BITMAP_33M 17 | |
208 | #define RATE_BITMAP_36M 19 | |
209 | #define RATE_BITMAP_48M 25 | |
210 | #define RATE_BITMAP_54M 28 | |
211 | ||
212 | #define RATE_AUTO 0 | |
213 | #define RATE_1M 2 | |
214 | #define RATE_2M 4 | |
215 | #define RATE_5dot5M 11 | |
216 | #define RATE_6M 12 | |
217 | #define RATE_9M 18 | |
218 | #define RATE_11M 22 | |
219 | #define RATE_12M 24 | |
220 | #define RATE_18M 36 | |
221 | #define RATE_22M 44 | |
222 | #define RATE_24M 48 | |
223 | #define RATE_33M 66 | |
224 | #define RATE_36M 72 | |
225 | #define RATE_48M 96 | |
226 | #define RATE_54M 108 | |
227 | #define RATE_MAX 255 | |
228 | ||
03a4389c | 229 | /* CAPABILITY */ |
66101de1 PM |
230 | #define CAPABILITY_ESS_BIT 0x0001 |
231 | #define CAPABILITY_IBSS_BIT 0x0002 | |
232 | #define CAPABILITY_CF_POLL_BIT 0x0004 | |
233 | #define CAPABILITY_CF_POLL_REQ_BIT 0x0008 | |
234 | #define CAPABILITY_PRIVACY_BIT 0x0010 | |
235 | #define CAPABILITY_SHORT_PREAMBLE_BIT 0x0020 | |
236 | #define CAPABILITY_PBCC_BIT 0x0040 | |
237 | #define CAPABILITY_CHAN_AGILITY_BIT 0x0080 | |
238 | #define CAPABILITY_SHORT_SLOT_TIME_BIT 0x0400 | |
239 | #define CAPABILITY_DSSS_OFDM_BIT 0x2000 | |
240 | ||
241 | ||
d20279d7 RP |
242 | struct Capability_Information_Element { |
243 | union { | |
244 | u16 __attribute__ ((packed)) wValue; | |
03a4389c | 245 | #ifdef _BIG_ENDIAN_ /* 20060926 add by anson's endian */ |
d20279d7 RP |
246 | struct _Capability { |
247 | /* -- 11G -- */ | |
248 | u8 Reserved3:2; | |
249 | u8 DSSS_OFDM:1; | |
250 | u8 Reserved2:2; | |
251 | u8 Short_Slot_Time:1; | |
252 | u8 Reserved1:2; | |
253 | u8 Channel_Agility:1; | |
254 | u8 PBCC:1; | |
255 | u8 ShortPreamble:1; | |
256 | u8 CF_Privacy:1; | |
257 | u8 CF_Poll_Request:1; | |
258 | u8 CF_Pollable:1; | |
259 | u8 IBSS:1; | |
260 | u8 ESS:1; | |
66101de1 PM |
261 | } __attribute__ ((packed)) Capability; |
262 | #else | |
d20279d7 RP |
263 | struct _Capability { |
264 | u8 ESS:1; | |
265 | u8 IBSS:1; | |
266 | u8 CF_Pollable:1; | |
267 | u8 CF_Poll_Request:1; | |
268 | u8 CF_Privacy:1; | |
269 | u8 ShortPreamble:1; | |
270 | u8 PBCC:1; | |
271 | u8 Channel_Agility:1; | |
272 | u8 Reserved1:2; | |
03a4389c | 273 | /* -- 11G -- */ |
d20279d7 RP |
274 | u8 Short_Slot_Time:1; |
275 | u8 Reserved2:2; | |
276 | u8 DSSS_OFDM:1; | |
277 | u8 Reserved3:2; | |
66101de1 PM |
278 | } __attribute__ ((packed)) Capability; |
279 | #endif | |
d20279d7 RP |
280 | } __attribute__ ((packed)) ; |
281 | } __attribute__ ((packed)); | |
66101de1 | 282 | |
d20279d7 | 283 | struct FH_Parameter_Set_Element { |
66101de1 PM |
284 | u8 Element_ID; |
285 | u8 Length; | |
286 | u8 Dwell_Time[2]; | |
287 | u8 Hop_Set; | |
288 | u8 Hop_Pattern; | |
289 | u8 Hop_Index; | |
290 | }; | |
291 | ||
d20279d7 | 292 | struct DS_Parameter_Set_Element { |
66101de1 PM |
293 | u8 Element_ID; |
294 | u8 Length; | |
295 | u8 Current_Channel; | |
296 | }; | |
297 | ||
d20279d7 | 298 | struct Supported_Rates_Element { |
66101de1 PM |
299 | u8 Element_ID; |
300 | u8 Length; | |
301 | u8 SupportedRates[8]; | |
d20279d7 | 302 | } __attribute__ ((packed)); |
66101de1 | 303 | |
d20279d7 | 304 | struct SSID_Element { |
66101de1 PM |
305 | u8 Element_ID; |
306 | u8 Length; | |
307 | u8 SSID[32]; | |
d20279d7 | 308 | } __attribute__ ((packed)) ; |
66101de1 | 309 | |
d20279d7 | 310 | struct CF_Parameter_Set_Element { |
66101de1 PM |
311 | u8 Element_ID; |
312 | u8 Length; | |
313 | u8 CFP_Count; | |
314 | u8 CFP_Period; | |
03a4389c RP |
315 | u8 CFP_MaxDuration[2]; /* in Time Units */ |
316 | u8 CFP_DurRemaining[2]; /* in time units */ | |
66101de1 PM |
317 | }; |
318 | ||
d20279d7 | 319 | struct TIM_Element { |
66101de1 PM |
320 | u8 Element_ID; |
321 | u8 Length; | |
322 | u8 DTIM_Count; | |
323 | u8 DTIM_Period; | |
324 | u8 Bitmap_Control; | |
325 | u8 Partial_Virtual_Bitmap[251]; | |
326 | }; | |
327 | ||
d20279d7 | 328 | struct IBSS_Parameter_Set_Element { |
66101de1 PM |
329 | u8 Element_ID; |
330 | u8 Length; | |
331 | u8 ATIM_Window[2]; | |
332 | }; | |
333 | ||
d20279d7 | 334 | struct Challenge_Text_Element { |
66101de1 PM |
335 | u8 Element_ID; |
336 | u8 Length; | |
337 | u8 Challenge_Text[253]; | |
338 | }; | |
339 | ||
d20279d7 | 340 | struct PHY_Parameter_Set_Element { |
03a4389c RP |
341 | /* int aSlotTime; */ |
342 | /* int aSifsTime; */ | |
66101de1 PM |
343 | s32 aCCATime; |
344 | s32 aRxTxTurnaroundTime; | |
345 | s32 aTxPLCPDelay; | |
346 | s32 RxPLCPDelay; | |
347 | s32 aRxTxSwitchTime; | |
348 | s32 aTxRampOntime; | |
349 | s32 aTxRampOffTime; | |
350 | s32 aTxRFDelay; | |
351 | s32 aRxRFDelay; | |
352 | s32 aAirPropagationTime; | |
353 | s32 aMACProcessingDelay; | |
354 | s32 aPreambleLength; | |
355 | s32 aPLCPHeaderLength; | |
356 | s32 aMPDUDurationFactor; | |
357 | s32 aMPDUMaxLength; | |
03a4389c RP |
358 | /* int aCWmin; */ |
359 | /* int aCWmax; */ | |
66101de1 PM |
360 | }; |
361 | ||
03a4389c | 362 | /* -- 11G -- */ |
d20279d7 | 363 | struct ERP_Information_Element { |
66101de1 PM |
364 | u8 Element_ID; |
365 | u8 Length; | |
03a4389c | 366 | #ifdef _BIG_ENDIAN_ /* 20060926 add by anson's endian */ |
d20279d7 RP |
367 | u8 Reserved:5; /* 20060926 add by anson */ |
368 | u8 Barker_Preamble_Mode:1; | |
66101de1 PM |
369 | u8 Use_Protection:1; |
370 | u8 NonERP_Present:1; | |
371 | #else | |
372 | u8 NonERP_Present:1; | |
373 | u8 Use_Protection:1; | |
374 | u8 Barker_Preamble_Mode:1; | |
375 | u8 Reserved:5; | |
376 | #endif | |
377 | }; | |
378 | ||
d20279d7 | 379 | struct Extended_Supported_Rates_Element { |
66101de1 PM |
380 | u8 Element_ID; |
381 | u8 Length; | |
382 | u8 ExtendedSupportedRates[255]; | |
d20279d7 | 383 | } __attribute__ ((packed)); |
66101de1 | 384 | |
03a4389c | 385 | /* WPA(802.11i draft 3.0) */ |
66101de1 PM |
386 | #define VERSION_WPA 1 |
387 | #ifdef _WPA2_ | |
388 | #define VERSION_WPA2 1 | |
03a4389c | 389 | #endif /* end def _WPA2_ */ |
07bbf350 AL |
390 | /* WPA2.0 OUI=00:50:F2, the MSB is reserved for suite type */ |
391 | #define OUI_WPA 0x00F25000 | |
66101de1 | 392 | #ifdef _WPA2_ |
07bbf350 AL |
393 | /* for wpa2 change to 0x00ACOF04 by Ws 26/04/04 */ |
394 | #define OUI_WPA2 0x00AC0F00 | |
03a4389c | 395 | #endif /* end def _WPA2_ */ |
66101de1 PM |
396 | |
397 | #define OUI_WPA_ADDITIONAL 0x01 | |
03a4389c | 398 | #define WLAN_MIN_RSN_WPA_LENGTH 6 /* added by ws 09/10/04 */ |
66101de1 | 399 | #ifdef _WPA2_ |
03a4389c RP |
400 | #define WLAN_MIN_RSN_WPA2_LENGTH 2 /* Fix to 2 09/14/05 */ |
401 | #endif /* end def _WPA2_ */ | |
66101de1 PM |
402 | |
403 | #define oui_wpa (u32)(OUI_WPA|OUI_WPA_ADDITIONAL) | |
404 | ||
03a4389c RP |
405 | #define WPA_OUI_BIG ((u32) 0x01F25000)/* added by ws 09/23/04 */ |
406 | #define WPA_OUI_LITTLE ((u32) 0x01F25001)/* added by ws 09/23/04 */ | |
07bbf350 AL |
407 | /* 20061108 For WPS. It's little endian. Big endian is 0x0050F204 */ |
408 | #define WPA_WPS_OUI cpu_to_le32(0x04F25000) | |
66101de1 | 409 | |
03a4389c | 410 | /* -----WPA2----- */ |
66101de1 PM |
411 | #ifdef _WPA2_ |
412 | #define WPA2_OUI_BIG ((u32)0x01AC0F00) | |
413 | #define WPA2_OUI_LITTLE ((u32)0x01AC0F01) | |
03a4389c | 414 | #endif /* end def _WPA2_ */ |
66101de1 | 415 | |
03a4389c RP |
416 | /* Authentication suite */ |
417 | #define OUI_AUTH_WPA_NONE 0x00 /* for WPA_NONE */ | |
66101de1 PM |
418 | #define OUI_AUTH_8021X 0x01 |
419 | #define OUI_AUTH_PSK 0x02 | |
03a4389c RP |
420 | /* Cipher suite */ |
421 | #define OUI_CIPHER_GROUP_KEY 0x00 /* added by ws 05/21/04 */ | |
66101de1 PM |
422 | #define OUI_CIPHER_WEP_40 0x01 |
423 | #define OUI_CIPHER_TKIP 0x02 | |
424 | #define OUI_CIPHER_CCMP 0x04 | |
425 | #define OUI_CIPHER_WEP_104 0x05 | |
426 | ||
07bbf350 AL |
427 | struct suite_selector{ |
428 | union{ | |
66101de1 | 429 | u8 Value[4]; |
07bbf350 | 430 | struct _SUIT_ { |
66101de1 PM |
431 | u8 OUI[3]; |
432 | u8 Type; | |
07bbf350 | 433 | } SuitSelector; |
66101de1 | 434 | }; |
2de97533 | 435 | }; |
66101de1 | 436 | |
cb016cc4 | 437 | /* -- WPA -- */ |
07bbf350 | 438 | struct RSN_Information_Element{ |
66101de1 PM |
439 | u8 Element_ID; |
440 | u8 Length; | |
07bbf350 AL |
441 | /* WPA version 2.0 additional field, and should be 00:50:F2:01 */ |
442 | struct suite_selector OuiWPAAdditional; | |
66101de1 | 443 | u16 Version; |
2de97533 | 444 | struct suite_selector GroupKeySuite; |
66101de1 | 445 | u16 PairwiseKeySuiteCount; |
2de97533 | 446 | struct suite_selector PairwiseKeySuite[1]; |
07bbf350 AL |
447 | } __attribute__ ((packed)); |
448 | struct RSN_Auth_Sub_Information_Element { | |
66101de1 | 449 | u16 AuthKeyMngtSuiteCount; |
2de97533 | 450 | struct suite_selector AuthKeyMngtSuite[1]; |
07bbf350 | 451 | } __attribute__ ((packed)); |
66101de1 | 452 | |
03a4389c | 453 | /* -- WPA2 -- */ |
07bbf350 AL |
454 | struct RSN_Capability_Element { |
455 | union { | |
66101de1 | 456 | u16 __attribute__ ((packed)) wValue; |
03a4389c | 457 | #ifdef _BIG_ENDIAN_ /* 20060927 add by anson's endian */ |
07bbf350 AL |
458 | struct _RSN_Capability { |
459 | u16 __attribute__ ((packed)) Reserved2:8; /* 20051201 */ | |
460 | u16 __attribute__ ((packed)) Reserved1:2; | |
461 | u16 __attribute__ ((packed)) GTK_Replay_Counter:2; | |
462 | u16 __attribute__ ((packed)) PTK_Replay_Counter:2; | |
463 | u16 __attribute__ ((packed)) No_Pairwise:1; | |
464 | u16 __attribute__ ((packed)) Pre_Auth:1; | |
465 | } __attribute__ ((packed)) RSN_Capability; | |
66101de1 | 466 | #else |
07bbf350 AL |
467 | struct _RSN_Capability { |
468 | u16 __attribute__ ((packed)) Pre_Auth:1; | |
469 | u16 __attribute__ ((packed)) No_Pairwise:1; | |
470 | u16 __attribute__ ((packed)) PTK_Replay_Counter:2; | |
471 | u16 __attribute__ ((packed)) GTK_Replay_Counter:2; | |
472 | u16 __attribute__ ((packed)) Reserved1:2; | |
473 | u16 __attribute__ ((packed)) Reserved2:8; /* 20051201 */ | |
474 | } __attribute__ ((packed)) RSN_Capability; | |
66101de1 PM |
475 | #endif |
476 | ||
07bbf350 AL |
477 | } __attribute__ ((packed)) ; |
478 | } __attribute__ ((packed)) ; | |
66101de1 PM |
479 | |
480 | #ifdef _WPA2_ | |
07bbf350 | 481 | struct pmkid { |
66101de1 | 482 | u8 pValue[16]; |
649f0650 | 483 | }; |
66101de1 | 484 | |
07bbf350 | 485 | struct WPA2_RSN_Information_Element { |
66101de1 PM |
486 | u8 Element_ID; |
487 | u8 Length; | |
488 | u16 Version; | |
2de97533 | 489 | struct suite_selector GroupKeySuite; |
66101de1 | 490 | u16 PairwiseKeySuiteCount; |
2de97533 | 491 | struct suite_selector PairwiseKeySuite[1]; |
66101de1 | 492 | |
07bbf350 | 493 | } __attribute__ ((packed)); |
66101de1 | 494 | |
07bbf350 | 495 | struct WPA2_RSN_Auth_Sub_Information_Element { |
66101de1 | 496 | u16 AuthKeyMngtSuiteCount; |
2de97533 | 497 | struct suite_selector AuthKeyMngtSuite[1]; |
07bbf350 | 498 | } __attribute__ ((packed)); |
66101de1 PM |
499 | |
500 | ||
07bbf350 | 501 | struct PMKID_Information_Element { |
66101de1 | 502 | u16 PMKID_Count; |
649f0650 | 503 | struct pmkid pmkid[16]; |
07bbf350 | 504 | } __attribute__ ((packed)); |
66101de1 | 505 | |
03a4389c RP |
506 | #endif /* enddef _WPA2_ */ |
507 | /*============================================================ | |
66101de1 | 508 | // MAC Frame structure (different type) and subfield structure |
03a4389c | 509 | //============================================================*/ |
07bbf350 AL |
510 | struct MAC_frame_control { |
511 | /* a combination of the [Protocol Version, Control Type, Control Subtype]*/ | |
512 | u8 mac_frame_info; | |
513 | /* 20060927 add by anson's endian */ | |
514 | #ifdef _BIG_ENDIAN_ | |
66101de1 PM |
515 | u8 order:1; |
516 | u8 WEP:1; | |
517 | u8 more_data:1; | |
518 | u8 pwr_mgt:1; | |
519 | u8 retry:1; | |
520 | u8 more_frag:1; | |
521 | u8 from_ds:1; | |
522 | u8 to_ds:1; | |
523 | #else | |
524 | u8 to_ds:1; | |
525 | u8 from_ds:1; | |
526 | u8 more_frag:1; | |
527 | u8 retry:1; | |
528 | u8 pwr_mgt:1; | |
529 | u8 more_data:1; | |
530 | u8 WEP:1; | |
531 | u8 order:1; | |
532 | #endif | |
533 | } __attribute__ ((packed)); | |
534 | ||
535 | struct Management_Frame { | |
07bbf350 AL |
536 | /* 2B, ToDS,FromDS,MoreFrag,MoreData,Order=0 */ |
537 | struct MAC_frame_control frame_control; | |
66101de1 | 538 | u16 duration; |
03a4389c RP |
539 | u8 DA[MAC_ADDR_LENGTH]; /* Addr1 */ |
540 | u8 SA[MAC_ADDR_LENGTH]; /* Addr2 */ | |
541 | u8 BSSID[MAC_ADDR_LENGTH]; /* Addr3 */ | |
66101de1 | 542 | u16 Sequence_Control; |
03a4389c RP |
543 | /* Management Frame Body <= 325 bytes */ |
544 | /* FCS 4 bytes */ | |
d20279d7 | 545 | } __attribute__ ((packed)); |
66101de1 | 546 | |
03a4389c | 547 | /* SW-MAC don't Tx/Rx Control-Frame, HW-MAC do it. */ |
66101de1 | 548 | struct Control_Frame { |
07bbf350 AL |
549 | /* ToDS,FromDS,MoreFrag,Retry,MoreData,WEP,Order=0 */ |
550 | struct MAC_frame_control frame_control; | |
66101de1 PM |
551 | u16 duration; |
552 | u8 RA[MAC_ADDR_LENGTH]; | |
553 | u8 TA[MAC_ADDR_LENGTH]; | |
554 | u16 FCS; | |
d20279d7 | 555 | } __attribute__ ((packed)); |
66101de1 PM |
556 | |
557 | struct Data_Frame { | |
558 | struct MAC_frame_control frame_control; | |
559 | u16 duration; | |
560 | u8 Addr1[MAC_ADDR_LENGTH]; | |
561 | u8 Addr2[MAC_ADDR_LENGTH]; | |
562 | u8 Addr3[MAC_ADDR_LENGTH]; | |
563 | u16 Sequence_Control; | |
03a4389c RP |
564 | u8 Addr4[MAC_ADDR_LENGTH]; /* only exist when ToDS=FromDS=1 */ |
565 | /* Data Frame Body <= 2312 */ | |
566 | /* FCS */ | |
d20279d7 | 567 | } __attribute__ ((packed)); |
66101de1 | 568 | |
d20279d7 | 569 | struct Disassociation_Frame_Body { |
66101de1 | 570 | u16 reasonCode; |
d20279d7 | 571 | } __attribute__ ((packed)); |
66101de1 | 572 | |
d20279d7 | 573 | struct Association_Request_Frame_Body { |
66101de1 PM |
574 | u16 capability_information; |
575 | u16 listenInterval; | |
03a4389c RP |
576 | u8 Current_AP_Address[MAC_ADDR_LENGTH];/* for reassociation only */ |
577 | /* SSID (2+32 bytes) */ | |
578 | /* Supported_Rates (2+8 bytes) */ | |
d20279d7 | 579 | } __attribute__ ((packed)); |
66101de1 | 580 | |
d20279d7 | 581 | struct Association_Response_Frame_Body { |
66101de1 PM |
582 | u16 capability_information; |
583 | u16 statusCode; | |
584 | u16 Association_ID; | |
585 | struct Supported_Rates_Element supportedRates; | |
d20279d7 | 586 | } __attribute__ ((packed)); |
66101de1 PM |
587 | |
588 | /*struct Reassociation_Request_Frame_Body | |
589 | { | |
590 | u16 capability_information; | |
591 | u16 listenInterval; | |
592 | u8 Current_AP_Address[MAC_ADDR_LENGTH]; | |
593 | // SSID (2+32 bytes) | |
594 | // Supported_Rates (2+8 bytes) | |
595 | };*/ | |
03a4389c | 596 | /* eliminated by WS 07/22/04 comboined with associateion request frame. */ |
66101de1 | 597 | |
d20279d7 | 598 | struct Reassociation_Response_Frame_Body { |
66101de1 PM |
599 | u16 capability_information; |
600 | u16 statusCode; | |
601 | u16 Association_ID; | |
602 | struct Supported_Rates_Element supportedRates; | |
d20279d7 | 603 | } __attribute__ ((packed)); |
66101de1 | 604 | |
d20279d7 | 605 | struct Deauthentication_Frame_Body { |
66101de1 | 606 | u16 reasonCode; |
d20279d7 | 607 | } __attribute__ ((packed)); |
66101de1 PM |
608 | |
609 | ||
d20279d7 | 610 | struct Probe_Response_Frame_Body { |
66101de1 PM |
611 | u16 Timestamp; |
612 | u16 Beacon_Interval; | |
613 | u16 Capability_Information; | |
03a4389c | 614 | /* SSID |
66101de1 PM |
615 | // Supported_Rates |
616 | // PHY parameter Set (DS Parameters) | |
617 | // CF parameter Set | |
03a4389c | 618 | // IBSS parameter Set */ |
d20279d7 | 619 | } __attribute__ ((packed)); |
66101de1 | 620 | |
d20279d7 | 621 | struct Authentication_Frame_Body { |
66101de1 PM |
622 | u16 algorithmNumber; |
623 | u16 sequenceNumber; | |
624 | u16 statusCode; | |
07bbf350 AL |
625 | /* NB: don't include ChallengeText in this structure |
626 | // struct Challenge_Text_Element sChallengeTextElement; | |
627 | // wkchen added */ | |
d20279d7 | 628 | } __attribute__ ((packed)); |
66101de1 PM |
629 | |
630 | ||
03a4389c | 631 | #endif /* _MAC_Structure_H_ */ |
66101de1 PM |
632 | |
633 |