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