Home | History | Annotate | Download | only in common
      1 /*
      2  * IEEE 802.11 Frame type definitions
      3  * Copyright (c) 2002-2009, Jouni Malinen <j (at) w1.fi>
      4  * Copyright (c) 2007-2008 Intel Corporation
      5  *
      6  * This software may be distributed under the terms of the BSD license.
      7  * See README for more details.
      8  */
      9 
     10 #ifndef IEEE802_11_DEFS_H
     11 #define IEEE802_11_DEFS_H
     12 
     13 /* IEEE 802.11 defines */
     14 
     15 #define WLAN_FC_PVER		0x0003
     16 #define WLAN_FC_TODS		0x0100
     17 #define WLAN_FC_FROMDS		0x0200
     18 #define WLAN_FC_MOREFRAG	0x0400
     19 #define WLAN_FC_RETRY		0x0800
     20 #define WLAN_FC_PWRMGT		0x1000
     21 #define WLAN_FC_MOREDATA	0x2000
     22 #define WLAN_FC_ISWEP		0x4000
     23 #define WLAN_FC_ORDER		0x8000
     24 
     25 #define WLAN_FC_GET_TYPE(fc)	(((fc) & 0x000c) >> 2)
     26 #define WLAN_FC_GET_STYPE(fc)	(((fc) & 0x00f0) >> 4)
     27 
     28 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & (BIT(3) | BIT(2) | BIT(1) | BIT(0)))
     29 #define WLAN_GET_SEQ_SEQ(seq) \
     30 	(((seq) & (~(BIT(3) | BIT(2) | BIT(1) | BIT(0)))) >> 4)
     31 
     32 #define WLAN_FC_TYPE_MGMT		0
     33 #define WLAN_FC_TYPE_CTRL		1
     34 #define WLAN_FC_TYPE_DATA		2
     35 
     36 /* management */
     37 #define WLAN_FC_STYPE_ASSOC_REQ		0
     38 #define WLAN_FC_STYPE_ASSOC_RESP	1
     39 #define WLAN_FC_STYPE_REASSOC_REQ	2
     40 #define WLAN_FC_STYPE_REASSOC_RESP	3
     41 #define WLAN_FC_STYPE_PROBE_REQ		4
     42 #define WLAN_FC_STYPE_PROBE_RESP	5
     43 #define WLAN_FC_STYPE_BEACON		8
     44 #define WLAN_FC_STYPE_ATIM		9
     45 #define WLAN_FC_STYPE_DISASSOC		10
     46 #define WLAN_FC_STYPE_AUTH		11
     47 #define WLAN_FC_STYPE_DEAUTH		12
     48 #define WLAN_FC_STYPE_ACTION		13
     49 
     50 /* control */
     51 #define WLAN_FC_STYPE_PSPOLL		10
     52 #define WLAN_FC_STYPE_RTS		11
     53 #define WLAN_FC_STYPE_CTS		12
     54 #define WLAN_FC_STYPE_ACK		13
     55 #define WLAN_FC_STYPE_CFEND		14
     56 #define WLAN_FC_STYPE_CFENDACK		15
     57 
     58 /* data */
     59 #define WLAN_FC_STYPE_DATA		0
     60 #define WLAN_FC_STYPE_DATA_CFACK	1
     61 #define WLAN_FC_STYPE_DATA_CFPOLL	2
     62 #define WLAN_FC_STYPE_DATA_CFACKPOLL	3
     63 #define WLAN_FC_STYPE_NULLFUNC		4
     64 #define WLAN_FC_STYPE_CFACK		5
     65 #define WLAN_FC_STYPE_CFPOLL		6
     66 #define WLAN_FC_STYPE_CFACKPOLL		7
     67 #define WLAN_FC_STYPE_QOS_DATA		8
     68 #define WLAN_FC_STYPE_QOS_DATA_CFACK	9
     69 #define WLAN_FC_STYPE_QOS_DATA_CFPOLL	10
     70 #define WLAN_FC_STYPE_QOS_DATA_CFACKPOLL	11
     71 #define WLAN_FC_STYPE_QOS_NULL		12
     72 #define WLAN_FC_STYPE_QOS_CFPOLL	14
     73 #define WLAN_FC_STYPE_QOS_CFACKPOLL	15
     74 
     75 /* Authentication algorithms */
     76 #define WLAN_AUTH_OPEN			0
     77 #define WLAN_AUTH_SHARED_KEY		1
     78 #define WLAN_AUTH_FT			2
     79 #define WLAN_AUTH_SAE			3
     80 #define WLAN_AUTH_LEAP			128
     81 
     82 #define WLAN_AUTH_CHALLENGE_LEN 128
     83 
     84 #define WLAN_CAPABILITY_ESS BIT(0)
     85 #define WLAN_CAPABILITY_IBSS BIT(1)
     86 #define WLAN_CAPABILITY_CF_POLLABLE BIT(2)
     87 #define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3)
     88 #define WLAN_CAPABILITY_PRIVACY BIT(4)
     89 #define WLAN_CAPABILITY_SHORT_PREAMBLE BIT(5)
     90 #define WLAN_CAPABILITY_PBCC BIT(6)
     91 #define WLAN_CAPABILITY_CHANNEL_AGILITY BIT(7)
     92 #define WLAN_CAPABILITY_SPECTRUM_MGMT BIT(8)
     93 #define WLAN_CAPABILITY_SHORT_SLOT_TIME BIT(10)
     94 #define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
     95 
     96 /* Status codes (IEEE 802.11-2007, 7.3.1.9, Table 7-23) */
     97 #define WLAN_STATUS_SUCCESS 0
     98 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
     99 #define WLAN_STATUS_TDLS_WAKEUP_ALTERNATE 2
    100 #define WLAN_STATUS_TDLS_WAKEUP_REJECT 3
    101 #define WLAN_STATUS_SECURITY_DISABLED 5
    102 #define WLAN_STATUS_UNACCEPTABLE_LIFETIME 6
    103 #define WLAN_STATUS_NOT_IN_SAME_BSS 7
    104 #define WLAN_STATUS_CAPS_UNSUPPORTED 10
    105 #define WLAN_STATUS_REASSOC_NO_ASSOC 11
    106 #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
    107 #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
    108 #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
    109 #define WLAN_STATUS_CHALLENGE_FAIL 15
    110 #define WLAN_STATUS_AUTH_TIMEOUT 16
    111 #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
    112 #define WLAN_STATUS_ASSOC_DENIED_RATES 18
    113 /* IEEE 802.11b */
    114 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
    115 #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
    116 #define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
    117 /* IEEE 802.11h */
    118 #define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
    119 #define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
    120 #define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
    121 /* IEEE 802.11g */
    122 #define WLAN_STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME 25
    123 #define WLAN_STATUS_ASSOC_DENIED_NO_DSSS_OFDM 26
    124 #define WLAN_STATUS_ASSOC_DENIED_NO_HT 27
    125 #define WLAN_STATUS_R0KH_UNREACHABLE 28
    126 #define WLAN_STATUS_ASSOC_DENIED_NO_PCO 29
    127 /* IEEE 802.11w */
    128 #define WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY 30
    129 #define WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION 31
    130 #define WLAN_STATUS_UNSPECIFIED_QOS_FAILURE 32
    131 #define WLAN_STATUS_REQUEST_DECLINED 37
    132 #define WLAN_STATUS_INVALID_PARAMETERS 38
    133 /* IEEE 802.11i */
    134 #define WLAN_STATUS_INVALID_IE 40
    135 #define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41
    136 #define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42
    137 #define WLAN_STATUS_AKMP_NOT_VALID 43
    138 #define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44
    139 #define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45
    140 #define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46
    141 #define WLAN_STATUS_TS_NOT_CREATED 47
    142 #define WLAN_STATUS_DIRECT_LINK_NOT_ALLOWED 48
    143 #define WLAN_STATUS_DEST_STA_NOT_PRESENT 49
    144 #define WLAN_STATUS_DEST_STA_NOT_QOS_STA 50
    145 #define WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE 51
    146 /* IEEE 802.11r */
    147 #define WLAN_STATUS_INVALID_FT_ACTION_FRAME_COUNT 52
    148 #define WLAN_STATUS_INVALID_PMKID 53
    149 #define WLAN_STATUS_INVALID_MDIE 54
    150 #define WLAN_STATUS_INVALID_FTIE 55
    151 #define WLAN_STATUS_GAS_ADV_PROTO_NOT_SUPPORTED 59
    152 #define WLAN_STATUS_NO_OUTSTANDING_GAS_REQ 60
    153 #define WLAN_STATUS_GAS_RESP_NOT_RECEIVED 61
    154 #define WLAN_STATUS_STA_TIMED_OUT_WAITING_FOR_GAS_RESP 62
    155 #define WLAN_STATUS_GAS_RESP_LARGER_THAN_LIMIT 63
    156 #define WLAN_STATUS_REQ_REFUSED_HOME 64
    157 #define WLAN_STATUS_ADV_SRV_UNREACHABLE 65
    158 #define WLAN_STATUS_REQ_REFUSED_SSPN 67
    159 #define WLAN_STATUS_REQ_REFUSED_UNAUTH_ACCESS 68
    160 #define WLAN_STATUS_INVALID_RSNIE 72
    161 #define WLAN_STATUS_ANTI_CLOGGING_TOKEN_REQ 76
    162 #define WLAN_STATUS_FINITE_CYCLIC_GROUP_NOT_SUPPORTED 77
    163 #define WLAN_STATUS_TRANSMISSION_FAILURE 79
    164 
    165 /* Reason codes (IEEE 802.11-2007, 7.3.1.7, Table 7-22) */
    166 #define WLAN_REASON_UNSPECIFIED 1
    167 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
    168 #define WLAN_REASON_DEAUTH_LEAVING 3
    169 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
    170 #define WLAN_REASON_DISASSOC_AP_BUSY 5
    171 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
    172 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
    173 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
    174 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
    175 /* IEEE 802.11h */
    176 #define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
    177 #define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
    178 /* IEEE 802.11i */
    179 #define WLAN_REASON_INVALID_IE 13
    180 #define WLAN_REASON_MICHAEL_MIC_FAILURE 14
    181 #define WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT 15
    182 #define WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT 16
    183 #define WLAN_REASON_IE_IN_4WAY_DIFFERS 17
    184 #define WLAN_REASON_GROUP_CIPHER_NOT_VALID 18
    185 #define WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID 19
    186 #define WLAN_REASON_AKMP_NOT_VALID 20
    187 #define WLAN_REASON_UNSUPPORTED_RSN_IE_VERSION 21
    188 #define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
    189 #define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
    190 #define WLAN_REASON_CIPHER_SUITE_REJECTED 24
    191 #define WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE 25
    192 #define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26
    193 /* IEEE 802.11e */
    194 #define WLAN_REASON_DISASSOC_LOW_ACK 34
    195 
    196 
    197 /* Information Element IDs */
    198 #define WLAN_EID_SSID 0
    199 #define WLAN_EID_SUPP_RATES 1
    200 #define WLAN_EID_FH_PARAMS 2
    201 #define WLAN_EID_DS_PARAMS 3
    202 #define WLAN_EID_CF_PARAMS 4
    203 #define WLAN_EID_TIM 5
    204 #define WLAN_EID_IBSS_PARAMS 6
    205 #define WLAN_EID_COUNTRY 7
    206 #define WLAN_EID_CHALLENGE 16
    207 /* EIDs defined by IEEE 802.11h - START */
    208 #define WLAN_EID_PWR_CONSTRAINT 32
    209 #define WLAN_EID_PWR_CAPABILITY 33
    210 #define WLAN_EID_TPC_REQUEST 34
    211 #define WLAN_EID_TPC_REPORT 35
    212 #define WLAN_EID_SUPPORTED_CHANNELS 36
    213 #define WLAN_EID_CHANNEL_SWITCH 37
    214 #define WLAN_EID_MEASURE_REQUEST 38
    215 #define WLAN_EID_MEASURE_REPORT 39
    216 #define WLAN_EID_QUITE 40
    217 #define WLAN_EID_IBSS_DFS 41
    218 /* EIDs defined by IEEE 802.11h - END */
    219 #define WLAN_EID_ERP_INFO 42
    220 #define WLAN_EID_HT_CAP 45
    221 #define WLAN_EID_QOS 46
    222 #define WLAN_EID_RSN 48
    223 #define WLAN_EID_EXT_SUPP_RATES 50
    224 #define WLAN_EID_MOBILITY_DOMAIN 54
    225 #define WLAN_EID_FAST_BSS_TRANSITION 55
    226 #define WLAN_EID_TIMEOUT_INTERVAL 56
    227 #define WLAN_EID_RIC_DATA 57
    228 #define WLAN_EID_HT_OPERATION 61
    229 #define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
    230 #define WLAN_EID_WAPI 68
    231 #define WLAN_EID_TIME_ADVERTISEMENT 69
    232 #define WLAN_EID_20_40_BSS_COEXISTENCE 72
    233 #define WLAN_EID_20_40_BSS_INTOLERANT 73
    234 #define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
    235 #define WLAN_EID_MMIE 76
    236 #define WLAN_EID_SSID_LIST 84
    237 #define WLAN_EID_BSS_MAX_IDLE_PERIOD 90
    238 #define WLAN_EID_TFS_REQ 91
    239 #define WLAN_EID_TFS_RESP 92
    240 #define WLAN_EID_WNMSLEEP 93
    241 #define WLAN_EID_TIME_ZONE 98
    242 #define WLAN_EID_LINK_ID 101
    243 #define WLAN_EID_INTERWORKING 107
    244 #define WLAN_EID_ADV_PROTO 108
    245 #define WLAN_EID_ROAMING_CONSORTIUM 111
    246 #define WLAN_EID_EXT_CAPAB 127
    247 #define WLAN_EID_CCKM 156
    248 #define WLAN_EID_VHT_CAP 191
    249 #define WLAN_EID_VHT_OPERATION 192
    250 #define WLAN_EID_VHT_EXTENDED_BSS_LOAD 193
    251 #define WLAN_EID_VHT_WIDE_BW_CHSWITCH  194
    252 #define WLAN_EID_VHT_TRANSMIT_POWER_ENVELOPE 195
    253 #define WLAN_EID_VHT_CHANNEL_SWITCH_WRAPPER 196
    254 #define WLAN_EID_VHT_AID 197
    255 #define WLAN_EID_VHT_QUIET_CHANNEL 198
    256 #define WLAN_EID_VHT_OPERATING_MODE_NOTIFICATION 199
    257 #define WLAN_EID_VENDOR_SPECIFIC 221
    258 
    259 
    260 /* Action frame categories (IEEE 802.11-2007, 7.3.1.11, Table 7-24) */
    261 #define WLAN_ACTION_SPECTRUM_MGMT 0
    262 #define WLAN_ACTION_QOS 1
    263 #define WLAN_ACTION_DLS 2
    264 #define WLAN_ACTION_BLOCK_ACK 3
    265 #define WLAN_ACTION_PUBLIC 4
    266 #define WLAN_ACTION_RADIO_MEASUREMENT 5
    267 #define WLAN_ACTION_FT 6
    268 #define WLAN_ACTION_HT 7
    269 #define WLAN_ACTION_SA_QUERY 8
    270 #define WLAN_ACTION_WNM 10
    271 #define WLAN_ACTION_UNPROTECTED_WNM 11
    272 #define WLAN_ACTION_TDLS 12
    273 #define WLAN_ACTION_WMM 17 /* WMM Specification 1.1 */
    274 #define WLAN_ACTION_VENDOR_SPECIFIC 127
    275 
    276 /* Public action codes */
    277 #define WLAN_PA_20_40_BSS_COEX 0
    278 #define WLAN_PA_VENDOR_SPECIFIC 9
    279 #define WLAN_PA_GAS_INITIAL_REQ 10
    280 #define WLAN_PA_GAS_INITIAL_RESP 11
    281 #define WLAN_PA_GAS_COMEBACK_REQ 12
    282 #define WLAN_PA_GAS_COMEBACK_RESP 13
    283 #define WLAN_TDLS_DISCOVERY_RESPONSE 14
    284 
    285 /* SA Query Action frame (IEEE 802.11w/D8.0, 7.4.9) */
    286 #define WLAN_SA_QUERY_REQUEST 0
    287 #define WLAN_SA_QUERY_RESPONSE 1
    288 
    289 #define WLAN_SA_QUERY_TR_ID_LEN 2
    290 
    291 /* TDLS action codes */
    292 #define WLAN_TDLS_SETUP_REQUEST 0
    293 #define WLAN_TDLS_SETUP_RESPONSE 1
    294 #define WLAN_TDLS_SETUP_CONFIRM 2
    295 #define WLAN_TDLS_TEARDOWN 3
    296 #define WLAN_TDLS_PEER_TRAFFIC_INDICATION 4
    297 #define WLAN_TDLS_CHANNEL_SWITCH_REQUEST 5
    298 #define WLAN_TDLS_CHANNEL_SWITCH_RESPONSE 6
    299 #define WLAN_TDLS_PEER_PSM_REQUEST 7
    300 #define WLAN_TDLS_PEER_PSM_RESPONSE 8
    301 #define WLAN_TDLS_PEER_TRAFFIC_RESPONSE 9
    302 #define WLAN_TDLS_DISCOVERY_REQUEST 10
    303 
    304 /* Timeout Interval Type */
    305 #define WLAN_TIMEOUT_REASSOC_DEADLINE 1
    306 #define WLAN_TIMEOUT_KEY_LIFETIME 2
    307 #define WLAN_TIMEOUT_ASSOC_COMEBACK 3
    308 
    309 /* Interworking element (IEEE 802.11u) - Access Network Options */
    310 #define INTERWORKING_ANO_ACCESS_NETWORK_MASK 0x0f
    311 #define INTERWORKING_ANO_INTERNET 0x10
    312 #define INTERWORKING_ANO_ASRA 0x20
    313 #define INTERWORKING_ANO_ESR 0x40
    314 #define INTERWORKING_ANO_UESA 0x80
    315 
    316 #define INTERWORKING_ANT_PRIVATE 0
    317 #define INTERWORKING_ANT_PRIVATE_WITH_GUEST 1
    318 #define INTERWORKING_ANT_CHARGEABLE_PUBLIC 2
    319 #define INTERWORKING_ANT_FREE_PUBLIC 3
    320 #define INTERWORKING_ANT_PERSONAL_DEVICE 4
    321 #define INTERWORKING_ANT_EMERGENCY_SERVICES 5
    322 #define INTERWORKING_ANT_TEST 6
    323 #define INTERWORKING_ANT_WILDCARD 15
    324 
    325 /* Advertisement Protocol ID definitions (IEEE Std 802.11u-2011) */
    326 enum adv_proto_id {
    327 	ACCESS_NETWORK_QUERY_PROTOCOL = 0,
    328 	MIH_INFO_SERVICE = 1,
    329 	MIH_CMD_AND_EVENT_DISCOVERY = 2,
    330 	EMERGENCY_ALERT_SYSTEM = 3,
    331 	ADV_PROTO_VENDOR_SPECIFIC = 221
    332 };
    333 
    334 /* Access Network Query Protocol info ID definitions (IEEE Std 802.11u-2011) */
    335 enum anqp_info_id {
    336 	ANQP_QUERY_LIST = 256,
    337 	ANQP_CAPABILITY_LIST = 257,
    338 	ANQP_VENUE_NAME = 258,
    339 	ANQP_EMERGENCY_CALL_NUMBER = 259,
    340 	ANQP_NETWORK_AUTH_TYPE = 260,
    341 	ANQP_ROAMING_CONSORTIUM = 261,
    342 	ANQP_IP_ADDR_TYPE_AVAILABILITY = 262,
    343 	ANQP_NAI_REALM = 263,
    344 	ANQP_3GPP_CELLULAR_NETWORK = 264,
    345 	ANQP_AP_GEOSPATIAL_LOCATION = 265,
    346 	ANQP_AP_CIVIC_LOCATION = 266,
    347 	ANQP_AP_LOCATION_PUBLIC_URI = 267,
    348 	ANQP_DOMAIN_NAME = 268,
    349 	ANQP_EMERGENCY_ALERT_URI = 269,
    350 	ANQP_EMERGENCY_NAI = 271,
    351 	ANQP_VENDOR_SPECIFIC = 56797
    352 };
    353 
    354 /* NAI Realm list - EAP Method subfield - Authentication Parameter ID */
    355 enum nai_realm_eap_auth_param {
    356 	NAI_REALM_EAP_AUTH_EXPANDED_EAP_METHOD = 1,
    357 	NAI_REALM_EAP_AUTH_NON_EAP_INNER_AUTH = 2,
    358 	NAI_REALM_EAP_AUTH_INNER_AUTH_EAP_METHOD = 3,
    359 	NAI_REALM_EAP_AUTH_EXPANDED_INNER_EAP_METHOD = 4,
    360 	NAI_REALM_EAP_AUTH_CRED_TYPE = 5,
    361 	NAI_REALM_EAP_AUTH_TUNNELED_CRED_TYPE = 6,
    362 	NAI_REALM_EAP_AUTH_VENDOR_SPECIFIC = 221
    363 };
    364 
    365 enum nai_realm_eap_auth_inner_non_eap {
    366 	NAI_REALM_INNER_NON_EAP_PAP = 1,
    367 	NAI_REALM_INNER_NON_EAP_CHAP = 2,
    368 	NAI_REALM_INNER_NON_EAP_MSCHAP = 3,
    369 	NAI_REALM_INNER_NON_EAP_MSCHAPV2 = 4
    370 };
    371 
    372 enum nai_realm_eap_cred_type {
    373 	NAI_REALM_CRED_TYPE_SIM = 1,
    374 	NAI_REALM_CRED_TYPE_USIM = 2,
    375 	NAI_REALM_CRED_TYPE_NFC_SECURE_ELEMENT = 3,
    376 	NAI_REALM_CRED_TYPE_HARDWARE_TOKEN = 4,
    377 	NAI_REALM_CRED_TYPE_SOFTOKEN = 5,
    378 	NAI_REALM_CRED_TYPE_CERTIFICATE = 6,
    379 	NAI_REALM_CRED_TYPE_USERNAME_PASSWORD = 7,
    380 	NAI_REALM_CRED_TYPE_NONE = 8,
    381 	NAI_REALM_CRED_TYPE_ANONYMOUS = 9,
    382 	NAI_REALM_CRED_TYPE_VENDOR_SPECIFIC = 10
    383 };
    384 
    385 #ifdef _MSC_VER
    386 #pragma pack(push, 1)
    387 #endif /* _MSC_VER */
    388 
    389 struct ieee80211_hdr {
    390 	le16 frame_control;
    391 	le16 duration_id;
    392 	u8 addr1[6];
    393 	u8 addr2[6];
    394 	u8 addr3[6];
    395 	le16 seq_ctrl;
    396 	/* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
    397 	 */
    398 } STRUCT_PACKED;
    399 
    400 #define IEEE80211_DA_FROMDS addr1
    401 #define IEEE80211_BSSID_FROMDS addr2
    402 #define IEEE80211_SA_FROMDS addr3
    403 
    404 #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
    405 
    406 #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
    407 
    408 struct ieee80211_mgmt {
    409 	le16 frame_control;
    410 	le16 duration;
    411 	u8 da[6];
    412 	u8 sa[6];
    413 	u8 bssid[6];
    414 	le16 seq_ctrl;
    415 	union {
    416 		struct {
    417 			le16 auth_alg;
    418 			le16 auth_transaction;
    419 			le16 status_code;
    420 			/* possibly followed by Challenge text */
    421 			u8 variable[0];
    422 		} STRUCT_PACKED auth;
    423 		struct {
    424 			le16 reason_code;
    425 			u8 variable[0];
    426 		} STRUCT_PACKED deauth;
    427 		struct {
    428 			le16 capab_info;
    429 			le16 listen_interval;
    430 			/* followed by SSID and Supported rates */
    431 			u8 variable[0];
    432 		} STRUCT_PACKED assoc_req;
    433 		struct {
    434 			le16 capab_info;
    435 			le16 status_code;
    436 			le16 aid;
    437 			/* followed by Supported rates */
    438 			u8 variable[0];
    439 		} STRUCT_PACKED assoc_resp, reassoc_resp;
    440 		struct {
    441 			le16 capab_info;
    442 			le16 listen_interval;
    443 			u8 current_ap[6];
    444 			/* followed by SSID and Supported rates */
    445 			u8 variable[0];
    446 		} STRUCT_PACKED reassoc_req;
    447 		struct {
    448 			le16 reason_code;
    449 			u8 variable[0];
    450 		} STRUCT_PACKED disassoc;
    451 		struct {
    452 			u8 timestamp[8];
    453 			le16 beacon_int;
    454 			le16 capab_info;
    455 			/* followed by some of SSID, Supported rates,
    456 			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
    457 			u8 variable[0];
    458 		} STRUCT_PACKED beacon;
    459 		struct {
    460 			/* only variable items: SSID, Supported rates */
    461 			u8 variable[0];
    462 		} STRUCT_PACKED probe_req;
    463 		struct {
    464 			u8 timestamp[8];
    465 			le16 beacon_int;
    466 			le16 capab_info;
    467 			/* followed by some of SSID, Supported rates,
    468 			 * FH Params, DS Params, CF Params, IBSS Params */
    469 			u8 variable[0];
    470 		} STRUCT_PACKED probe_resp;
    471 		struct {
    472 			u8 category;
    473 			union {
    474 				struct {
    475 					u8 action_code;
    476 					u8 dialog_token;
    477 					u8 status_code;
    478 					u8 variable[0];
    479 				} STRUCT_PACKED wmm_action;
    480 				struct{
    481 					u8 action_code;
    482 					u8 element_id;
    483 					u8 length;
    484 					u8 switch_mode;
    485 					u8 new_chan;
    486 					u8 switch_count;
    487 				} STRUCT_PACKED chan_switch;
    488 				struct {
    489 					u8 action;
    490 					u8 sta_addr[ETH_ALEN];
    491 					u8 target_ap_addr[ETH_ALEN];
    492 					u8 variable[0]; /* FT Request */
    493 				} STRUCT_PACKED ft_action_req;
    494 				struct {
    495 					u8 action;
    496 					u8 sta_addr[ETH_ALEN];
    497 					u8 target_ap_addr[ETH_ALEN];
    498 					le16 status_code;
    499 					u8 variable[0]; /* FT Request */
    500 				} STRUCT_PACKED ft_action_resp;
    501 				struct {
    502 					u8 action;
    503 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
    504 				} STRUCT_PACKED sa_query_req;
    505 				struct {
    506 					u8 action; /* */
    507 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
    508 				} STRUCT_PACKED sa_query_resp;
    509 				struct {
    510 					u8 action;
    511 					u8 dialogtoken;
    512 					u8 variable[0];
    513 				} STRUCT_PACKED wnm_sleep_req;
    514 				struct {
    515 					u8 action;
    516 					u8 dialogtoken;
    517 					le16 keydata_len;
    518 					u8 variable[0];
    519 				} STRUCT_PACKED wnm_sleep_resp;
    520 				struct {
    521 					u8 action;
    522 					u8 variable[0];
    523 				} STRUCT_PACKED public_action;
    524 				struct {
    525 					u8 action; /* 9 */
    526 					u8 oui[3];
    527 					/* Vendor-specific content */
    528 					u8 variable[0];
    529 				} STRUCT_PACKED vs_public_action;
    530 				struct {
    531 					u8 action; /* 7 */
    532 					u8 dialog_token;
    533 					u8 req_mode;
    534 					le16 disassoc_timer;
    535 					u8 validity_interval;
    536 					/* BSS Termination Duration (optional),
    537 					 * Session Information URL (optional),
    538 					 * BSS Transition Candidate List
    539 					 * Entries */
    540 					u8 variable[0];
    541 				} STRUCT_PACKED bss_tm_req;
    542 				struct {
    543 					u8 action; /* 8 */
    544 					u8 dialog_token;
    545 					u8 status_code;
    546 					u8 bss_termination_delay;
    547 					/* Target BSSID (optional),
    548 					 * BSS Transition Candidate List
    549 					 * Entries (optional) */
    550 					u8 variable[0];
    551 				} STRUCT_PACKED bss_tm_resp;
    552 				struct {
    553 					u8 action; /* 6 */
    554 					u8 dialog_token;
    555 					u8 query_reason;
    556 					/* BSS Transition Candidate List
    557 					 * Entries (optional) */
    558 					u8 variable[0];
    559 				} STRUCT_PACKED bss_tm_query;
    560 			} u;
    561 		} STRUCT_PACKED action;
    562 	} u;
    563 } STRUCT_PACKED;
    564 
    565 
    566 /* Rx MCS bitmask is in the first 77 bits of supported_mcs_set */
    567 #define IEEE80211_HT_MCS_MASK_LEN 10
    568 
    569 struct ieee80211_ht_capabilities {
    570 	le16 ht_capabilities_info;
    571 	u8 a_mpdu_params;
    572 	u8 supported_mcs_set[16];
    573 	le16 ht_extended_capabilities;
    574 	le32 tx_bf_capability_info;
    575 	u8 asel_capabilities;
    576 } STRUCT_PACKED;
    577 
    578 
    579 struct ieee80211_ht_operation {
    580 	u8 control_chan;
    581 	u8 ht_param;
    582 	le16 operation_mode;
    583 	le16 stbc_param;
    584 	u8 basic_set[16];
    585 } STRUCT_PACKED;
    586 
    587 
    588 struct ieee80211_vht_capabilities {
    589 	le32 vht_capabilities_info;
    590 	struct {
    591 		le16 rx_map;
    592 		le16 rx_highest;
    593 		le16 tx_map;
    594 		le16 tx_highest;
    595 	} vht_supported_mcs_set;
    596 } STRUCT_PACKED;
    597 
    598 struct ieee80211_vht_operation {
    599 	u8 vht_op_info_chwidth;
    600 	u8 vht_op_info_chan_center_freq_seg0_idx;
    601 	u8 vht_op_info_chan_center_freq_seg1_idx;
    602 	le16 vht_basic_mcs_set;
    603 } STRUCT_PACKED;
    604 
    605 #ifdef _MSC_VER
    606 #pragma pack(pop)
    607 #endif /* _MSC_VER */
    608 
    609 #define ERP_INFO_NON_ERP_PRESENT BIT(0)
    610 #define ERP_INFO_USE_PROTECTION BIT(1)
    611 #define ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
    612 
    613 
    614 #define HT_CAP_INFO_LDPC_CODING_CAP		((u16) BIT(0))
    615 #define HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET	((u16) BIT(1))
    616 #define HT_CAP_INFO_SMPS_MASK			((u16) (BIT(2) | BIT(3)))
    617 #define HT_CAP_INFO_SMPS_STATIC			((u16) 0)
    618 #define HT_CAP_INFO_SMPS_DYNAMIC		((u16) BIT(2))
    619 #define HT_CAP_INFO_SMPS_DISABLED		((u16) (BIT(2) | BIT(3)))
    620 #define HT_CAP_INFO_GREEN_FIELD			((u16) BIT(4))
    621 #define HT_CAP_INFO_SHORT_GI20MHZ		((u16) BIT(5))
    622 #define HT_CAP_INFO_SHORT_GI40MHZ		((u16) BIT(6))
    623 #define HT_CAP_INFO_TX_STBC			((u16) BIT(7))
    624 #define HT_CAP_INFO_RX_STBC_MASK		((u16) (BIT(8) | BIT(9)))
    625 #define HT_CAP_INFO_RX_STBC_1			((u16) BIT(8))
    626 #define HT_CAP_INFO_RX_STBC_12			((u16) BIT(9))
    627 #define HT_CAP_INFO_RX_STBC_123			((u16) (BIT(8) | BIT(9)))
    628 #define HT_CAP_INFO_DELAYED_BA			((u16) BIT(10))
    629 #define HT_CAP_INFO_MAX_AMSDU_SIZE		((u16) BIT(11))
    630 #define HT_CAP_INFO_DSSS_CCK40MHZ		((u16) BIT(12))
    631 #define HT_CAP_INFO_PSMP_SUPP			((u16) BIT(13))
    632 #define HT_CAP_INFO_40MHZ_INTOLERANT		((u16) BIT(14))
    633 #define HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT	((u16) BIT(15))
    634 
    635 
    636 #define EXT_HT_CAP_INFO_PCO			((u16) BIT(0))
    637 #define EXT_HT_CAP_INFO_TRANS_TIME_OFFSET	1
    638 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_OFFSET	8
    639 #define EXT_HT_CAP_INFO_HTC_SUPPORTED		((u16) BIT(10))
    640 #define EXT_HT_CAP_INFO_RD_RESPONDER		((u16) BIT(11))
    641 
    642 
    643 #define TX_BEAMFORM_CAP_TXBF_CAP ((u32) BIT(0))
    644 #define TX_BEAMFORM_CAP_RX_STAGGERED_SOUNDING_CAP ((u32) BIT(1))
    645 #define TX_BEAMFORM_CAP_TX_STAGGERED_SOUNDING_CAP ((u32) BIT(2))
    646 #define TX_BEAMFORM_CAP_RX_ZLF_CAP ((u32) BIT(3))
    647 #define TX_BEAMFORM_CAP_TX_ZLF_CAP ((u32) BIT(4))
    648 #define TX_BEAMFORM_CAP_IMPLICIT_ZLF_CAP ((u32) BIT(5))
    649 #define TX_BEAMFORM_CAP_CALIB_OFFSET 6
    650 #define TX_BEAMFORM_CAP_EXPLICIT_CSI_TXBF_CAP ((u32) BIT(8))
    651 #define TX_BEAMFORM_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_CAP ((u32) BIT(9))
    652 #define TX_BEAMFORM_CAP_EXPLICIT_BF_CSI_FEEDBACK_CAP ((u32) BIT(10))
    653 #define TX_BEAMFORM_CAP_EXPLICIT_BF_CSI_FEEDBACK_OFFSET 11
    654 #define TX_BEAMFORM_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_FEEDBACK_OFFSET 13
    655 #define TX_BEAMFORM_CAP_EXPLICIT_COMPRESSED_STEERING_MATRIX_FEEDBACK_OFFSET 15
    656 #define TX_BEAMFORM_CAP_MINIMAL_GROUPING_OFFSET 17
    657 #define TX_BEAMFORM_CAP_CSI_NUM_BEAMFORMER_ANT_OFFSET 19
    658 #define TX_BEAMFORM_CAP_UNCOMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 21
    659 #define TX_BEAMFORM_CAP_COMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 23
    660 #define TX_BEAMFORM_CAP_SCI_MAX_OF_ROWS_BEANFORMER_SUPPORTED_OFFSET 25
    661 
    662 
    663 #define ASEL_CAPABILITY_ASEL_CAPABLE ((u8) BIT(0))
    664 #define ASEL_CAPABILITY_EXPLICIT_CSI_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(1))
    665 #define ASEL_CAPABILITY_ANT_INDICES_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(2))
    666 #define ASEL_CAPABILITY_EXPLICIT_CSI_FEEDBACK_CAP ((u8) BIT(3))
    667 #define ASEL_CAPABILITY_ANT_INDICES_FEEDBACK_CAP ((u8) BIT(4))
    668 #define ASEL_CAPABILITY_RX_AS_CAP ((u8) BIT(5))
    669 #define ASEL_CAPABILITY_TX_SOUND_PPDUS_CAP ((u8) BIT(6))
    670 
    671 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK	((u8) BIT(0) | BIT(1))
    672 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE		((u8) BIT(0))
    673 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW		((u8) BIT(0) | BIT(1))
    674 #define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH		((u8) BIT(2))
    675 #define HT_INFO_HT_PARAM_RIFS_MODE			((u8) BIT(3))
    676 #define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY		((u8) BIT(4))
    677 #define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY	((u8) BIT(5))
    678 
    679 
    680 #define OP_MODE_PURE                    0
    681 #define OP_MODE_MAY_BE_LEGACY_STAS      1
    682 #define OP_MODE_20MHZ_HT_STA_ASSOCED    2
    683 #define OP_MODE_MIXED                   3
    684 
    685 #define HT_INFO_OPERATION_MODE_OP_MODE_MASK	\
    686 		(0x0001 | 0x0002)
    687 #define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET		0
    688 #define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT	((u8) BIT(2))
    689 #define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT	((u8) BIT(3))
    690 #define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT	((u8) BIT(4))
    691 
    692 #define HT_INFO_STBC_PARAM_DUAL_BEACON			((u16) BIT(6))
    693 #define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT		((u16) BIT(7))
    694 #define HT_INFO_STBC_PARAM_SECONDARY_BCN		((u16) BIT(8))
    695 #define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED	((u16) BIT(9))
    696 #define HT_INFO_STBC_PARAM_PCO_ACTIVE			((u16) BIT(10))
    697 #define HT_INFO_STBC_PARAM_PCO_PHASE			((u16) BIT(11))
    698 
    699 #define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126
    700 #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
    701 
    702 /* VHT Defines */
    703 #define VHT_CAP_MAX_MPDU_LENGTH_7991                ((u32) BIT(0))
    704 #define VHT_CAP_MAX_MPDU_LENGTH_11454               ((u32) BIT(1))
    705 #define VHT_CAP_SUPP_CHAN_WIDTH_160MHZ              ((u32) BIT(2))
    706 #define VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ     ((u32) BIT(3))
    707 #define VHT_CAP_RXLDPC                              ((u32) BIT(4))
    708 #define VHT_CAP_SHORT_GI_80                         ((u32) BIT(5))
    709 #define VHT_CAP_SHORT_GI_160                        ((u32) BIT(6))
    710 #define VHT_CAP_TXSTBC                              ((u32) BIT(7))
    711 #define VHT_CAP_RXSTBC_1                            ((u32) BIT(8))
    712 #define VHT_CAP_RXSTBC_2                            ((u32) BIT(9))
    713 #define VHT_CAP_RXSTBC_3                            ((u32) BIT(8) | BIT(9))
    714 #define VHT_CAP_RXSTBC_4                            ((u32) BIT(10))
    715 #define VHT_CAP_SU_BEAMFORMER_CAPABLE               ((u32) BIT(11))
    716 #define VHT_CAP_SU_BEAMFORMEE_CAPABLE               ((u32) BIT(12))
    717 #define VHT_CAP_BEAMFORMER_ANTENNAS_MAX             ((u32) BIT(13) | BIT(14))
    718 #define VHT_CAP_SOUNDING_DIMENTION_MAX              ((u32) BIT(16) | BIT(17))
    719 #define VHT_CAP_MU_BEAMFORMER_CAPABLE               ((u32) BIT(19))
    720 #define VHT_CAP_MU_BEAMFORMEE_CAPABLE               ((u32) BIT(20))
    721 #define VHT_CAP_VHT_TXOP_PS                         ((u32) BIT(21))
    722 #define VHT_CAP_HTC_VHT                             ((u32) BIT(22))
    723 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT          ((u32) BIT(23))
    724 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB   ((u32) BIT(27))
    725 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB     ((u32) BIT(26) | BIT(27))
    726 #define VHT_CAP_RX_ANTENNA_PATTERN                  ((u32) BIT(28))
    727 #define VHT_CAP_TX_ANTENNA_PATTERN                  ((u32) BIT(29))
    728 
    729 /* VHT channel widths */
    730 #define VHT_CHANWIDTH_USE_HT	0
    731 #define VHT_CHANWIDTH_80MHZ	1
    732 #define VHT_CHANWIDTH_160MHZ	2
    733 #define VHT_CHANWIDTH_80P80MHZ	3
    734 
    735 #define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
    736 				* 00:50:F2 */
    737 #define WPA_IE_VENDOR_TYPE 0x0050f201
    738 #define WPS_IE_VENDOR_TYPE 0x0050f204
    739 #define OUI_WFA 0x506f9a
    740 #define P2P_IE_VENDOR_TYPE 0x506f9a09
    741 #define WFD_IE_VENDOR_TYPE 0x506f9a0a
    742 #define WFD_OUI_TYPE 10
    743 #define HS20_IE_VENDOR_TYPE 0x506f9a10
    744 
    745 #define WMM_OUI_TYPE 2
    746 #define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
    747 #define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
    748 #define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
    749 #define WMM_VERSION 1
    750 
    751 #define WMM_ACTION_CODE_ADDTS_REQ 0
    752 #define WMM_ACTION_CODE_ADDTS_RESP 1
    753 #define WMM_ACTION_CODE_DELTS 2
    754 
    755 #define WMM_ADDTS_STATUS_ADMISSION_ACCEPTED 0
    756 #define WMM_ADDTS_STATUS_INVALID_PARAMETERS 1
    757 /* 2 - Reserved */
    758 #define WMM_ADDTS_STATUS_REFUSED 3
    759 /* 4-255 - Reserved */
    760 
    761 /* WMM TSPEC Direction Field Values */
    762 #define WMM_TSPEC_DIRECTION_UPLINK 0
    763 #define WMM_TSPEC_DIRECTION_DOWNLINK 1
    764 /* 2 - Reserved */
    765 #define WMM_TSPEC_DIRECTION_BI_DIRECTIONAL 3
    766 
    767 /*
    768  * WMM Information Element (used in (Re)Association Request frames; may also be
    769  * used in Beacon frames)
    770  */
    771 struct wmm_information_element {
    772 	/* Element ID: 221 (0xdd); Length: 7 */
    773 	/* required fields for WMM version 1 */
    774 	u8 oui[3]; /* 00:50:f2 */
    775 	u8 oui_type; /* 2 */
    776 	u8 oui_subtype; /* 0 */
    777 	u8 version; /* 1 for WMM version 1.0 */
    778 	u8 qos_info; /* AP/STA specific QoS info */
    779 
    780 } STRUCT_PACKED;
    781 
    782 #define WMM_QOSINFO_STA_AC_MASK 0x0f
    783 #define WMM_QOSINFO_STA_SP_MASK 0x03
    784 #define WMM_QOSINFO_STA_SP_SHIFT 5
    785 
    786 #define WMM_AC_AIFSN_MASK 0x0f
    787 #define WMM_AC_AIFNS_SHIFT 0
    788 #define WMM_AC_ACM 0x10
    789 #define WMM_AC_ACI_MASK 0x60
    790 #define WMM_AC_ACI_SHIFT 5
    791 
    792 #define WMM_AC_ECWMIN_MASK 0x0f
    793 #define WMM_AC_ECWMIN_SHIFT 0
    794 #define WMM_AC_ECWMAX_MASK 0xf0
    795 #define WMM_AC_ECWMAX_SHIFT 4
    796 
    797 struct wmm_ac_parameter {
    798 	u8 aci_aifsn; /* AIFSN, ACM, ACI */
    799 	u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
    800 	le16 txop_limit;
    801 }  STRUCT_PACKED;
    802 
    803 /*
    804  * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
    805  * Response frmaes)
    806  */
    807 struct wmm_parameter_element {
    808 	/* Element ID: 221 (0xdd); Length: 24 */
    809 	/* required fields for WMM version 1 */
    810 	u8 oui[3]; /* 00:50:f2 */
    811 	u8 oui_type; /* 2 */
    812 	u8 oui_subtype; /* 1 */
    813 	u8 version; /* 1 for WMM version 1.0 */
    814 	u8 qos_info; /* AP/STA specific QoS info */
    815 	u8 reserved; /* 0 */
    816 	struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
    817 
    818 } STRUCT_PACKED;
    819 
    820 /* WMM TSPEC Element */
    821 struct wmm_tspec_element {
    822 	u8 eid; /* 221 = 0xdd */
    823 	u8 length; /* 6 + 55 = 61 */
    824 	u8 oui[3]; /* 00:50:f2 */
    825 	u8 oui_type; /* 2 */
    826 	u8 oui_subtype; /* 2 */
    827 	u8 version; /* 1 */
    828 	/* WMM TSPEC body (55 octets): */
    829 	u8 ts_info[3];
    830 	le16 nominal_msdu_size;
    831 	le16 maximum_msdu_size;
    832 	le32 minimum_service_interval;
    833 	le32 maximum_service_interval;
    834 	le32 inactivity_interval;
    835 	le32 suspension_interval;
    836 	le32 service_start_time;
    837 	le32 minimum_data_rate;
    838 	le32 mean_data_rate;
    839 	le32 peak_data_rate;
    840 	le32 maximum_burst_size;
    841 	le32 delay_bound;
    842 	le32 minimum_phy_rate;
    843 	le16 surplus_bandwidth_allowance;
    844 	le16 medium_time;
    845 } STRUCT_PACKED;
    846 
    847 
    848 /* Access Categories / ACI to AC coding */
    849 enum {
    850 	WMM_AC_BE = 0 /* Best Effort */,
    851 	WMM_AC_BK = 1 /* Background */,
    852 	WMM_AC_VI = 2 /* Video */,
    853 	WMM_AC_VO = 3 /* Voice */
    854 };
    855 
    856 
    857 #define HS20_INDICATION_OUI_TYPE 16
    858 #define HS20_ANQP_OUI_TYPE 17
    859 #define HS20_STYPE_QUERY_LIST 1
    860 #define HS20_STYPE_CAPABILITY_LIST 2
    861 #define HS20_STYPE_OPERATOR_FRIENDLY_NAME 3
    862 #define HS20_STYPE_WAN_METRICS 4
    863 #define HS20_STYPE_CONNECTION_CAPABILITY 5
    864 #define HS20_STYPE_NAI_HOME_REALM_QUERY 6
    865 #define HS20_STYPE_OPERATING_CLASS 7
    866 
    867 /* Wi-Fi Direct (P2P) */
    868 
    869 #define P2P_OUI_TYPE 9
    870 
    871 enum p2p_attr_id {
    872 	P2P_ATTR_STATUS = 0,
    873 	P2P_ATTR_MINOR_REASON_CODE = 1,
    874 	P2P_ATTR_CAPABILITY = 2,
    875 	P2P_ATTR_DEVICE_ID = 3,
    876 	P2P_ATTR_GROUP_OWNER_INTENT = 4,
    877 	P2P_ATTR_CONFIGURATION_TIMEOUT = 5,
    878 	P2P_ATTR_LISTEN_CHANNEL = 6,
    879 	P2P_ATTR_GROUP_BSSID = 7,
    880 	P2P_ATTR_EXT_LISTEN_TIMING = 8,
    881 	P2P_ATTR_INTENDED_INTERFACE_ADDR = 9,
    882 	P2P_ATTR_MANAGEABILITY = 10,
    883 	P2P_ATTR_CHANNEL_LIST = 11,
    884 	P2P_ATTR_NOTICE_OF_ABSENCE = 12,
    885 	P2P_ATTR_DEVICE_INFO = 13,
    886 	P2P_ATTR_GROUP_INFO = 14,
    887 	P2P_ATTR_GROUP_ID = 15,
    888 	P2P_ATTR_INTERFACE = 16,
    889 	P2P_ATTR_OPERATING_CHANNEL = 17,
    890 	P2P_ATTR_INVITATION_FLAGS = 18,
    891 	P2P_ATTR_VENDOR_SPECIFIC = 221
    892 };
    893 
    894 #define P2P_MAX_GO_INTENT 15
    895 
    896 /* P2P Capability - Device Capability bitmap */
    897 #define P2P_DEV_CAPAB_SERVICE_DISCOVERY BIT(0)
    898 #define P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY BIT(1)
    899 #define P2P_DEV_CAPAB_CONCURRENT_OPER BIT(2)
    900 #define P2P_DEV_CAPAB_INFRA_MANAGED BIT(3)
    901 #define P2P_DEV_CAPAB_DEVICE_LIMIT BIT(4)
    902 #define P2P_DEV_CAPAB_INVITATION_PROCEDURE BIT(5)
    903 
    904 /* P2P Capability - Group Capability bitmap */
    905 #define P2P_GROUP_CAPAB_GROUP_OWNER BIT(0)
    906 #define P2P_GROUP_CAPAB_PERSISTENT_GROUP BIT(1)
    907 #define P2P_GROUP_CAPAB_GROUP_LIMIT BIT(2)
    908 #define P2P_GROUP_CAPAB_INTRA_BSS_DIST BIT(3)
    909 #define P2P_GROUP_CAPAB_CROSS_CONN BIT(4)
    910 #define P2P_GROUP_CAPAB_PERSISTENT_RECONN BIT(5)
    911 #define P2P_GROUP_CAPAB_GROUP_FORMATION BIT(6)
    912 
    913 /* Invitation Flags */
    914 #define P2P_INVITATION_FLAGS_TYPE BIT(0)
    915 
    916 /* P2P Manageability */
    917 #define P2P_MAN_DEVICE_MANAGEMENT BIT(0)
    918 #define P2P_MAN_CROSS_CONNECTION_PERMITTED BIT(1)
    919 #define P2P_MAN_COEXISTENCE_OPTIONAL BIT(2)
    920 
    921 enum p2p_status_code {
    922 	P2P_SC_SUCCESS = 0,
    923 	P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE = 1,
    924 	P2P_SC_FAIL_INCOMPATIBLE_PARAMS = 2,
    925 	P2P_SC_FAIL_LIMIT_REACHED = 3,
    926 	P2P_SC_FAIL_INVALID_PARAMS = 4,
    927 	P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE = 5,
    928 	P2P_SC_FAIL_PREV_PROTOCOL_ERROR = 6,
    929 	P2P_SC_FAIL_NO_COMMON_CHANNELS = 7,
    930 	P2P_SC_FAIL_UNKNOWN_GROUP = 8,
    931 	P2P_SC_FAIL_BOTH_GO_INTENT_15 = 9,
    932 	P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD = 10,
    933 	P2P_SC_FAIL_REJECTED_BY_USER = 11,
    934 };
    935 
    936 #define P2P_WILDCARD_SSID "DIRECT-"
    937 #define P2P_WILDCARD_SSID_LEN 7
    938 
    939 /* P2P action frames */
    940 enum p2p_act_frame_type {
    941 	P2P_NOA = 0,
    942 	P2P_PRESENCE_REQ = 1,
    943 	P2P_PRESENCE_RESP = 2,
    944 	P2P_GO_DISC_REQ = 3
    945 };
    946 
    947 /* P2P public action frames */
    948 enum p2p_action_frame_type {
    949 	P2P_GO_NEG_REQ = 0,
    950 	P2P_GO_NEG_RESP = 1,
    951 	P2P_GO_NEG_CONF = 2,
    952 	P2P_INVITATION_REQ = 3,
    953 	P2P_INVITATION_RESP = 4,
    954 	P2P_DEV_DISC_REQ = 5,
    955 	P2P_DEV_DISC_RESP = 6,
    956 	P2P_PROV_DISC_REQ = 7,
    957 	P2P_PROV_DISC_RESP = 8
    958 };
    959 
    960 enum p2p_service_protocol_type {
    961 	P2P_SERV_ALL_SERVICES = 0,
    962 	P2P_SERV_BONJOUR = 1,
    963 	P2P_SERV_UPNP = 2,
    964 	P2P_SERV_WS_DISCOVERY = 3,
    965 	P2P_SERV_WIFI_DISPLAY = 4,
    966 	P2P_SERV_VENDOR_SPECIFIC = 255
    967 };
    968 
    969 enum p2p_sd_status {
    970 	P2P_SD_SUCCESS = 0,
    971 	P2P_SD_PROTO_NOT_AVAILABLE = 1,
    972 	P2P_SD_REQUESTED_INFO_NOT_AVAILABLE = 2,
    973 	P2P_SD_BAD_REQUEST = 3
    974 };
    975 
    976 
    977 enum wifi_display_subelem {
    978 	WFD_SUBELEM_DEVICE_INFO = 0,
    979 	WFD_SUBELEM_ASSOCIATED_BSSID = 1,
    980 	WFD_SUBELEM_AUDIO_FORMATS = 2,
    981 	WFD_SUBELEM_VIDEO_FORMATS = 3,
    982 	WFD_SUBELEM_3D_VIDEO_FORMATS = 4,
    983 	WFD_SUBELEM_CONTENT_PROTECTION = 5,
    984 	WFD_SUBELEM_COUPLED_SINK = 6,
    985 	WFD_SUBELEM_EXT_CAPAB = 7,
    986 	WFD_SUBELEM_LOCAL_IP_ADDRESS = 8,
    987 	WFD_SUBELEM_SESSION_INFO = 9
    988 };
    989 
    990 
    991 #define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
    992 
    993 #define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
    994 
    995 /* cipher suite selectors */
    996 #define WLAN_CIPHER_SUITE_USE_GROUP	0x000FAC00
    997 #define WLAN_CIPHER_SUITE_WEP40		0x000FAC01
    998 #define WLAN_CIPHER_SUITE_TKIP		0x000FAC02
    999 /* reserved: 				0x000FAC03 */
   1000 #define WLAN_CIPHER_SUITE_CCMP		0x000FAC04
   1001 #define WLAN_CIPHER_SUITE_WEP104	0x000FAC05
   1002 #define WLAN_CIPHER_SUITE_AES_CMAC	0x000FAC06
   1003 #define WLAN_CIPHER_SUITE_NO_GROUP_ADDR	0x000FAC07
   1004 #define WLAN_CIPHER_SUITE_GCMP		0x000FAC08
   1005 
   1006 #define WLAN_CIPHER_SUITE_SMS4		0x00147201
   1007 
   1008 #define WLAN_CIPHER_SUITE_CKIP		0x00409600
   1009 #define WLAN_CIPHER_SUITE_CKIP_CMIC	0x00409601
   1010 #define WLAN_CIPHER_SUITE_CMIC		0x00409602
   1011 #define WLAN_CIPHER_SUITE_KRK		0x004096FF /* for nl80211 use only */
   1012 
   1013 /* AKM suite selectors */
   1014 #define WLAN_AKM_SUITE_8021X		0x000FAC01
   1015 #define WLAN_AKM_SUITE_PSK		0x000FAC02
   1016 #define WLAN_AKM_SUITE_FT_8021X		0x000FAC03
   1017 #define WLAN_AKM_SUITE_FT_PSK		0x000FAC04
   1018 #define WLAN_AKM_SUITE_CCKM		0x00409600
   1019 
   1020 
   1021 /* IEEE 802.11v - WNM Action field values */
   1022 enum wnm_action {
   1023 	WNM_EVENT_REQ = 0,
   1024 	WNM_EVENT_REPORT = 1,
   1025 	WNM_DIAGNOSTIC_REQ = 2,
   1026 	WNM_DIAGNOSTIC_REPORT = 3,
   1027 	WNM_LOCATION_CFG_REQ = 4,
   1028 	WNM_LOCATION_CFG_RESP = 5,
   1029 	WNM_BSS_TRANS_MGMT_QUERY = 6,
   1030 	WNM_BSS_TRANS_MGMT_REQ = 7,
   1031 	WNM_BSS_TRANS_MGMT_RESP = 8,
   1032 	WNM_FMS_REQ = 9,
   1033 	WNM_FMS_RESP = 10,
   1034 	WNM_COLLOCATED_INTERFERENCE_REQ = 11,
   1035 	WNM_COLLOCATED_INTERFERENCE_REPORT = 12,
   1036 	WNM_TFS_REQ = 13,
   1037 	WNM_TFS_RESP = 14,
   1038 	WNM_TFS_NOTIFY = 15,
   1039 	WNM_SLEEP_MODE_REQ = 16,
   1040 	WNM_SLEEP_MODE_RESP = 17,
   1041 	WNM_TIM_BROADCAST_REQ = 18,
   1042 	WNM_TIM_BROADCAST_RESP = 19,
   1043 	WNM_QOS_TRAFFIC_CAPAB_UPDATE = 20,
   1044 	WNM_CHANNEL_USAGE_REQ = 21,
   1045 	WNM_CHANNEL_USAGE_RESP = 22,
   1046 	WNM_DMS_REQ = 23,
   1047 	WNM_DMS_RESP = 24,
   1048 	WNM_TIMING_MEASUREMENT_REQ = 25,
   1049 	WNM_NOTIFICATION_REQ = 26,
   1050 	WNM_NOTIFICATION_RESP = 27
   1051 };
   1052 
   1053 /* IEEE 802.11v - BSS Transition Management Request - Request Mode */
   1054 #define WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED BIT(0)
   1055 #define WNM_BSS_TM_REQ_ABRIDGED BIT(1)
   1056 #define WNM_BSS_TM_REQ_DISASSOC_IMMINENT BIT(2)
   1057 #define WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED BIT(3)
   1058 #define WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT BIT(4)
   1059 
   1060 /* IEEE Std 802.11-2012 - Table 8-253 */
   1061 enum bss_trans_mgmt_status_code {
   1062 	WNM_BSS_TM_ACCEPT = 0,
   1063 	WNM_BSS_TM_REJECT_UNSPECIFIED = 1,
   1064 	WNM_BSS_TM_REJECT_INSUFFICIENT_BEACON = 2,
   1065 	WNM_BSS_TM_REJECT_INSUFFICIENT_CAPABITY = 3,
   1066 	WNM_BSS_TM_REJECT_UNDESIRED = 4,
   1067 	WNM_BSS_TM_REJECT_DELAY_REQUEST = 5,
   1068 	WNM_BSS_TM_REJECT_STA_CANDIDATE_LIST_PROVIDED = 6,
   1069 	WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES = 7,
   1070 	WNM_BSS_TM_REJECT_LEAVING_ESS = 8
   1071 };
   1072 
   1073 #define WNM_NEIGHBOR_TSF                         1
   1074 #define WNM_NEIGHBOR_CONDENSED_COUNTRY_STRING    2
   1075 #define WNM_NEIGHBOR_BSS_TRANSITION_CANDIDATE    3
   1076 #define WNM_NEIGHBOR_BSS_TERMINATION_DURATION    4
   1077 #define WNM_NEIGHBOR_BEARING                     5
   1078 #define WNM_NEIGHBOR_MEASUREMENT_PILOT          66
   1079 #define WNM_NEIGHBOR_RRM_ENABLED_CAPABILITIES   70
   1080 #define WNM_NEIGHBOR_MULTIPLE_BSSID             71
   1081 
   1082 /* IEEE Std 802.11-2012, 8.4.2.62 20/40 BSS Coexistence element */
   1083 #define WLAN_20_40_BSS_COEX_INFO_REQ            BIT(0)
   1084 #define WLAN_20_40_BSS_COEX_40MHZ_INTOL         BIT(1)
   1085 #define WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ     BIT(2)
   1086 #define WLAN_20_40_BSS_COEX_OBSS_EXEMPT_REQ     BIT(3)
   1087 #define WLAN_20_40_BSS_COEX_OBSS_EXEMPT_GRNT    BIT(4)
   1088 
   1089 struct ieee80211_2040_bss_coex_ie {
   1090 	u8 element_id;
   1091 	u8 length;
   1092 	u8 coex_param;
   1093 } STRUCT_PACKED;
   1094 
   1095 struct ieee80211_2040_intol_chan_report {
   1096 	u8 element_id;
   1097 	u8 length;
   1098 	u8 op_class;
   1099 	u8 variable[0];	/* Channel List */
   1100 } STRUCT_PACKED;
   1101 
   1102 /* IEEE 802.11v - WNM-Sleep Mode element */
   1103 struct wnm_sleep_element {
   1104 	u8 eid;     /* WLAN_EID_WNMSLEEP */
   1105 	u8 len;
   1106 	u8 action_type; /* WNM_SLEEP_ENTER/WNM_SLEEP_MODE_EXIT */
   1107 	u8 status;
   1108 	le16 intval;
   1109 } STRUCT_PACKED;
   1110 
   1111 #define WNM_SLEEP_MODE_ENTER 0
   1112 #define WNM_SLEEP_MODE_EXIT 1
   1113 
   1114 enum wnm_sleep_mode_response_status {
   1115 	WNM_STATUS_SLEEP_ACCEPT = 0,
   1116 	WNM_STATUS_SLEEP_EXIT_ACCEPT_GTK_UPDATE = 1,
   1117 	WNM_STATUS_DENIED_ACTION = 2,
   1118 	WNM_STATUS_DENIED_TMP = 3,
   1119 	WNM_STATUS_DENIED_KEY = 4,
   1120 	WNM_STATUS_DENIED_OTHER_WNM_SERVICE = 5
   1121 };
   1122 
   1123 /* WNM-Sleep Mode subelement IDs */
   1124 enum wnm_sleep_mode_subelement_id {
   1125 	WNM_SLEEP_SUBELEM_GTK = 0,
   1126 	WNM_SLEEP_SUBELEM_IGTK = 1
   1127 };
   1128 
   1129 #endif /* IEEE802_11_DEFS_H */
   1130