• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * IEEE 802.11 Frame type definitions
3  * Copyright (c) 2002-2009, Jouni Malinen <j@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 #define WLAN_STATUS_QUERY_RESP_OUTSTANDING 95
165 #define WLAN_STATUS_ASSOC_DENIED_NO_VHT 104
166 
167 /* Reason codes (IEEE 802.11-2007, 7.3.1.7, Table 7-22) */
168 #define WLAN_REASON_UNSPECIFIED 1
169 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
170 #define WLAN_REASON_DEAUTH_LEAVING 3
171 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
172 #define WLAN_REASON_DISASSOC_AP_BUSY 5
173 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
174 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
175 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
176 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
177 /* IEEE 802.11h */
178 #define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
179 #define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
180 /* IEEE 802.11i */
181 #define WLAN_REASON_INVALID_IE 13
182 #define WLAN_REASON_MICHAEL_MIC_FAILURE 14
183 #define WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT 15
184 #define WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT 16
185 #define WLAN_REASON_IE_IN_4WAY_DIFFERS 17
186 #define WLAN_REASON_GROUP_CIPHER_NOT_VALID 18
187 #define WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID 19
188 #define WLAN_REASON_AKMP_NOT_VALID 20
189 #define WLAN_REASON_UNSUPPORTED_RSN_IE_VERSION 21
190 #define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
191 #define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
192 #define WLAN_REASON_CIPHER_SUITE_REJECTED 24
193 #define WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE 25
194 #define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26
195 /* IEEE 802.11e */
196 #define WLAN_REASON_DISASSOC_LOW_ACK 34
197 
198 
199 /* Information Element IDs */
200 #define WLAN_EID_SSID 0
201 #define WLAN_EID_SUPP_RATES 1
202 #define WLAN_EID_FH_PARAMS 2
203 #define WLAN_EID_DS_PARAMS 3
204 #define WLAN_EID_CF_PARAMS 4
205 #define WLAN_EID_TIM 5
206 #define WLAN_EID_IBSS_PARAMS 6
207 #define WLAN_EID_COUNTRY 7
208 #define WLAN_EID_BSS_LOAD 11
209 #define WLAN_EID_CHALLENGE 16
210 /* EIDs defined by IEEE 802.11h - START */
211 #define WLAN_EID_PWR_CONSTRAINT 32
212 #define WLAN_EID_PWR_CAPABILITY 33
213 #define WLAN_EID_TPC_REQUEST 34
214 #define WLAN_EID_TPC_REPORT 35
215 #define WLAN_EID_SUPPORTED_CHANNELS 36
216 #define WLAN_EID_CHANNEL_SWITCH 37
217 #define WLAN_EID_MEASURE_REQUEST 38
218 #define WLAN_EID_MEASURE_REPORT 39
219 #define WLAN_EID_QUITE 40
220 #define WLAN_EID_IBSS_DFS 41
221 /* EIDs defined by IEEE 802.11h - END */
222 #define WLAN_EID_ERP_INFO 42
223 #define WLAN_EID_HT_CAP 45
224 #define WLAN_EID_QOS 46
225 #define WLAN_EID_RSN 48
226 #define WLAN_EID_EXT_SUPP_RATES 50
227 #define WLAN_EID_NEIGHBOR_REPORT 52
228 #define WLAN_EID_MOBILITY_DOMAIN 54
229 #define WLAN_EID_FAST_BSS_TRANSITION 55
230 #define WLAN_EID_TIMEOUT_INTERVAL 56
231 #define WLAN_EID_RIC_DATA 57
232 #define WLAN_EID_SUPPORTED_OPERATING_CLASSES 59
233 #define WLAN_EID_HT_OPERATION 61
234 #define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
235 #define WLAN_EID_WAPI 68
236 #define WLAN_EID_TIME_ADVERTISEMENT 69
237 #define WLAN_EID_20_40_BSS_COEXISTENCE 72
238 #define WLAN_EID_20_40_BSS_INTOLERANT 73
239 #define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
240 #define WLAN_EID_MMIE 76
241 #define WLAN_EID_SSID_LIST 84
242 #define WLAN_EID_BSS_MAX_IDLE_PERIOD 90
243 #define WLAN_EID_TFS_REQ 91
244 #define WLAN_EID_TFS_RESP 92
245 #define WLAN_EID_WNMSLEEP 93
246 #define WLAN_EID_TIME_ZONE 98
247 #define WLAN_EID_LINK_ID 101
248 #define WLAN_EID_INTERWORKING 107
249 #define WLAN_EID_ADV_PROTO 108
250 #define WLAN_EID_QOS_MAP_SET 110
251 #define WLAN_EID_ROAMING_CONSORTIUM 111
252 #define WLAN_EID_EXT_CAPAB 127
253 #define WLAN_EID_CCKM 156
254 #define WLAN_EID_VHT_CAP 191
255 #define WLAN_EID_VHT_OPERATION 192
256 #define WLAN_EID_VHT_EXTENDED_BSS_LOAD 193
257 #define WLAN_EID_VHT_WIDE_BW_CHSWITCH  194
258 #define WLAN_EID_VHT_TRANSMIT_POWER_ENVELOPE 195
259 #define WLAN_EID_VHT_CHANNEL_SWITCH_WRAPPER 196
260 #define WLAN_EID_VHT_AID 197
261 #define WLAN_EID_VHT_QUIET_CHANNEL 198
262 #define WLAN_EID_VHT_OPERATING_MODE_NOTIFICATION 199
263 #define WLAN_EID_VENDOR_SPECIFIC 221
264 
265 
266 /* Action frame categories (IEEE 802.11-2007, 7.3.1.11, Table 7-24) */
267 #define WLAN_ACTION_SPECTRUM_MGMT 0
268 #define WLAN_ACTION_QOS 1
269 #define WLAN_ACTION_DLS 2
270 #define WLAN_ACTION_BLOCK_ACK 3
271 #define WLAN_ACTION_PUBLIC 4
272 #define WLAN_ACTION_RADIO_MEASUREMENT 5
273 #define WLAN_ACTION_FT 6
274 #define WLAN_ACTION_HT 7
275 #define WLAN_ACTION_SA_QUERY 8
276 #define WLAN_ACTION_PROTECTED_DUAL 9
277 #define WLAN_ACTION_WNM 10
278 #define WLAN_ACTION_UNPROTECTED_WNM 11
279 #define WLAN_ACTION_TDLS 12
280 #define WLAN_ACTION_WMM 17 /* WMM Specification 1.1 */
281 #define WLAN_ACTION_VENDOR_SPECIFIC 127
282 
283 /* Public action codes */
284 #define WLAN_PA_20_40_BSS_COEX 0
285 #define WLAN_PA_VENDOR_SPECIFIC 9
286 #define WLAN_PA_GAS_INITIAL_REQ 10
287 #define WLAN_PA_GAS_INITIAL_RESP 11
288 #define WLAN_PA_GAS_COMEBACK_REQ 12
289 #define WLAN_PA_GAS_COMEBACK_RESP 13
290 #define WLAN_TDLS_DISCOVERY_RESPONSE 14
291 
292 /* Protected Dual of Public Action frames */
293 #define WLAN_PROT_DSE_ENABLEMENT 1
294 #define WLAN_PROT_DSE_DEENABLEMENT 2
295 #define WLAN_PROT_EXT_CSA 4
296 #define WLAN_PROT_MEASUREMENT_REQ 5
297 #define WLAN_PROT_MEASUREMENT_REPORT 6
298 #define WLAN_PROT_DSE_POWER_CONSTRAINT 8
299 #define WLAN_PROT_VENDOR_SPECIFIC 9
300 #define WLAN_PROT_GAS_INITIAL_REQ 10
301 #define WLAN_PROT_GAS_INITIAL_RESP 11
302 #define WLAN_PROT_GAS_COMEBACK_REQ 12
303 #define WLAN_PROT_GAS_COMEBACK_RESP 13
304 
305 /* SA Query Action frame (IEEE 802.11w/D8.0, 7.4.9) */
306 #define WLAN_SA_QUERY_REQUEST 0
307 #define WLAN_SA_QUERY_RESPONSE 1
308 
309 #define WLAN_SA_QUERY_TR_ID_LEN 2
310 
311 /* TDLS action codes */
312 #define WLAN_TDLS_SETUP_REQUEST 0
313 #define WLAN_TDLS_SETUP_RESPONSE 1
314 #define WLAN_TDLS_SETUP_CONFIRM 2
315 #define WLAN_TDLS_TEARDOWN 3
316 #define WLAN_TDLS_PEER_TRAFFIC_INDICATION 4
317 #define WLAN_TDLS_CHANNEL_SWITCH_REQUEST 5
318 #define WLAN_TDLS_CHANNEL_SWITCH_RESPONSE 6
319 #define WLAN_TDLS_PEER_PSM_REQUEST 7
320 #define WLAN_TDLS_PEER_PSM_RESPONSE 8
321 #define WLAN_TDLS_PEER_TRAFFIC_RESPONSE 9
322 #define WLAN_TDLS_DISCOVERY_REQUEST 10
323 
324 /* Timeout Interval Type */
325 #define WLAN_TIMEOUT_REASSOC_DEADLINE 1
326 #define WLAN_TIMEOUT_KEY_LIFETIME 2
327 #define WLAN_TIMEOUT_ASSOC_COMEBACK 3
328 
329 /* Interworking element (IEEE 802.11u) - Access Network Options */
330 #define INTERWORKING_ANO_ACCESS_NETWORK_MASK 0x0f
331 #define INTERWORKING_ANO_INTERNET 0x10
332 #define INTERWORKING_ANO_ASRA 0x20
333 #define INTERWORKING_ANO_ESR 0x40
334 #define INTERWORKING_ANO_UESA 0x80
335 
336 #define INTERWORKING_ANT_PRIVATE 0
337 #define INTERWORKING_ANT_PRIVATE_WITH_GUEST 1
338 #define INTERWORKING_ANT_CHARGEABLE_PUBLIC 2
339 #define INTERWORKING_ANT_FREE_PUBLIC 3
340 #define INTERWORKING_ANT_PERSONAL_DEVICE 4
341 #define INTERWORKING_ANT_EMERGENCY_SERVICES 5
342 #define INTERWORKING_ANT_TEST 6
343 #define INTERWORKING_ANT_WILDCARD 15
344 
345 /* Advertisement Protocol ID definitions (IEEE Std 802.11u-2011) */
346 enum adv_proto_id {
347 	ACCESS_NETWORK_QUERY_PROTOCOL = 0,
348 	MIH_INFO_SERVICE = 1,
349 	MIH_CMD_AND_EVENT_DISCOVERY = 2,
350 	EMERGENCY_ALERT_SYSTEM = 3,
351 	ADV_PROTO_VENDOR_SPECIFIC = 221
352 };
353 
354 /* Access Network Query Protocol info ID definitions (IEEE Std 802.11u-2011) */
355 enum anqp_info_id {
356 	ANQP_QUERY_LIST = 256,
357 	ANQP_CAPABILITY_LIST = 257,
358 	ANQP_VENUE_NAME = 258,
359 	ANQP_EMERGENCY_CALL_NUMBER = 259,
360 	ANQP_NETWORK_AUTH_TYPE = 260,
361 	ANQP_ROAMING_CONSORTIUM = 261,
362 	ANQP_IP_ADDR_TYPE_AVAILABILITY = 262,
363 	ANQP_NAI_REALM = 263,
364 	ANQP_3GPP_CELLULAR_NETWORK = 264,
365 	ANQP_AP_GEOSPATIAL_LOCATION = 265,
366 	ANQP_AP_CIVIC_LOCATION = 266,
367 	ANQP_AP_LOCATION_PUBLIC_URI = 267,
368 	ANQP_DOMAIN_NAME = 268,
369 	ANQP_EMERGENCY_ALERT_URI = 269,
370 	ANQP_EMERGENCY_NAI = 271,
371 	ANQP_VENDOR_SPECIFIC = 56797
372 };
373 
374 /* NAI Realm list - EAP Method subfield - Authentication Parameter ID */
375 enum nai_realm_eap_auth_param {
376 	NAI_REALM_EAP_AUTH_EXPANDED_EAP_METHOD = 1,
377 	NAI_REALM_EAP_AUTH_NON_EAP_INNER_AUTH = 2,
378 	NAI_REALM_EAP_AUTH_INNER_AUTH_EAP_METHOD = 3,
379 	NAI_REALM_EAP_AUTH_EXPANDED_INNER_EAP_METHOD = 4,
380 	NAI_REALM_EAP_AUTH_CRED_TYPE = 5,
381 	NAI_REALM_EAP_AUTH_TUNNELED_CRED_TYPE = 6,
382 	NAI_REALM_EAP_AUTH_VENDOR_SPECIFIC = 221
383 };
384 
385 enum nai_realm_eap_auth_inner_non_eap {
386 	NAI_REALM_INNER_NON_EAP_PAP = 1,
387 	NAI_REALM_INNER_NON_EAP_CHAP = 2,
388 	NAI_REALM_INNER_NON_EAP_MSCHAP = 3,
389 	NAI_REALM_INNER_NON_EAP_MSCHAPV2 = 4
390 };
391 
392 enum nai_realm_eap_cred_type {
393 	NAI_REALM_CRED_TYPE_SIM = 1,
394 	NAI_REALM_CRED_TYPE_USIM = 2,
395 	NAI_REALM_CRED_TYPE_NFC_SECURE_ELEMENT = 3,
396 	NAI_REALM_CRED_TYPE_HARDWARE_TOKEN = 4,
397 	NAI_REALM_CRED_TYPE_SOFTOKEN = 5,
398 	NAI_REALM_CRED_TYPE_CERTIFICATE = 6,
399 	NAI_REALM_CRED_TYPE_USERNAME_PASSWORD = 7,
400 	NAI_REALM_CRED_TYPE_NONE = 8,
401 	NAI_REALM_CRED_TYPE_ANONYMOUS = 9,
402 	NAI_REALM_CRED_TYPE_VENDOR_SPECIFIC = 10
403 };
404 
405 #ifdef _MSC_VER
406 #pragma pack(push, 1)
407 #endif /* _MSC_VER */
408 
409 struct ieee80211_hdr {
410 	le16 frame_control;
411 	le16 duration_id;
412 	u8 addr1[6];
413 	u8 addr2[6];
414 	u8 addr3[6];
415 	le16 seq_ctrl;
416 	/* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
417 	 */
418 } STRUCT_PACKED;
419 
420 #define IEEE80211_DA_FROMDS addr1
421 #define IEEE80211_BSSID_FROMDS addr2
422 #define IEEE80211_SA_FROMDS addr3
423 
424 #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
425 
426 #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
427 
428 struct ieee80211_mgmt {
429 	le16 frame_control;
430 	le16 duration;
431 	u8 da[6];
432 	u8 sa[6];
433 	u8 bssid[6];
434 	le16 seq_ctrl;
435 	union {
436 		struct {
437 			le16 auth_alg;
438 			le16 auth_transaction;
439 			le16 status_code;
440 			/* possibly followed by Challenge text */
441 			u8 variable[0];
442 		} STRUCT_PACKED auth;
443 		struct {
444 			le16 reason_code;
445 			u8 variable[0];
446 		} STRUCT_PACKED deauth;
447 		struct {
448 			le16 capab_info;
449 			le16 listen_interval;
450 			/* followed by SSID and Supported rates */
451 			u8 variable[0];
452 		} STRUCT_PACKED assoc_req;
453 		struct {
454 			le16 capab_info;
455 			le16 status_code;
456 			le16 aid;
457 			/* followed by Supported rates */
458 			u8 variable[0];
459 		} STRUCT_PACKED assoc_resp, reassoc_resp;
460 		struct {
461 			le16 capab_info;
462 			le16 listen_interval;
463 			u8 current_ap[6];
464 			/* followed by SSID and Supported rates */
465 			u8 variable[0];
466 		} STRUCT_PACKED reassoc_req;
467 		struct {
468 			le16 reason_code;
469 			u8 variable[0];
470 		} STRUCT_PACKED disassoc;
471 		struct {
472 			u8 timestamp[8];
473 			le16 beacon_int;
474 			le16 capab_info;
475 			/* followed by some of SSID, Supported rates,
476 			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
477 			u8 variable[0];
478 		} STRUCT_PACKED beacon;
479 		struct {
480 			/* only variable items: SSID, Supported rates */
481 			u8 variable[0];
482 		} STRUCT_PACKED probe_req;
483 		struct {
484 			u8 timestamp[8];
485 			le16 beacon_int;
486 			le16 capab_info;
487 			/* followed by some of SSID, Supported rates,
488 			 * FH Params, DS Params, CF Params, IBSS Params */
489 			u8 variable[0];
490 		} STRUCT_PACKED probe_resp;
491 		struct {
492 			u8 category;
493 			union {
494 				struct {
495 					u8 action_code;
496 					u8 dialog_token;
497 					u8 status_code;
498 					u8 variable[0];
499 				} STRUCT_PACKED wmm_action;
500 				struct{
501 					u8 action_code;
502 					u8 element_id;
503 					u8 length;
504 					u8 switch_mode;
505 					u8 new_chan;
506 					u8 switch_count;
507 				} STRUCT_PACKED chan_switch;
508 				struct {
509 					u8 action;
510 					u8 sta_addr[ETH_ALEN];
511 					u8 target_ap_addr[ETH_ALEN];
512 					u8 variable[0]; /* FT Request */
513 				} STRUCT_PACKED ft_action_req;
514 				struct {
515 					u8 action;
516 					u8 sta_addr[ETH_ALEN];
517 					u8 target_ap_addr[ETH_ALEN];
518 					le16 status_code;
519 					u8 variable[0]; /* FT Request */
520 				} STRUCT_PACKED ft_action_resp;
521 				struct {
522 					u8 action;
523 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
524 				} STRUCT_PACKED sa_query_req;
525 				struct {
526 					u8 action; /* */
527 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
528 				} STRUCT_PACKED sa_query_resp;
529 				struct {
530 					u8 action;
531 					u8 dialogtoken;
532 					u8 variable[0];
533 				} STRUCT_PACKED wnm_sleep_req;
534 				struct {
535 					u8 action;
536 					u8 dialogtoken;
537 					le16 keydata_len;
538 					u8 variable[0];
539 				} STRUCT_PACKED wnm_sleep_resp;
540 				struct {
541 					u8 action;
542 					u8 variable[0];
543 				} STRUCT_PACKED public_action;
544 				struct {
545 					u8 action; /* 9 */
546 					u8 oui[3];
547 					/* Vendor-specific content */
548 					u8 variable[0];
549 				} STRUCT_PACKED vs_public_action;
550 				struct {
551 					u8 action; /* 7 */
552 					u8 dialog_token;
553 					u8 req_mode;
554 					le16 disassoc_timer;
555 					u8 validity_interval;
556 					/* BSS Termination Duration (optional),
557 					 * Session Information URL (optional),
558 					 * BSS Transition Candidate List
559 					 * Entries */
560 					u8 variable[0];
561 				} STRUCT_PACKED bss_tm_req;
562 				struct {
563 					u8 action; /* 8 */
564 					u8 dialog_token;
565 					u8 status_code;
566 					u8 bss_termination_delay;
567 					/* Target BSSID (optional),
568 					 * BSS Transition Candidate List
569 					 * Entries (optional) */
570 					u8 variable[0];
571 				} STRUCT_PACKED bss_tm_resp;
572 				struct {
573 					u8 action; /* 6 */
574 					u8 dialog_token;
575 					u8 query_reason;
576 					/* BSS Transition Candidate List
577 					 * Entries (optional) */
578 					u8 variable[0];
579 				} STRUCT_PACKED bss_tm_query;
580 			} u;
581 		} STRUCT_PACKED action;
582 	} u;
583 } STRUCT_PACKED;
584 
585 
586 /* Rx MCS bitmask is in the first 77 bits of supported_mcs_set */
587 #define IEEE80211_HT_MCS_MASK_LEN 10
588 
589 /* HT Capabilities element */
590 struct ieee80211_ht_capabilities {
591 	le16 ht_capabilities_info;
592 	u8 a_mpdu_params; /* Maximum A-MPDU Length Exponent B0..B1
593 			   * Minimum MPDU Start Spacing B2..B4
594 			   * Reserved B5..B7 */
595 	u8 supported_mcs_set[16];
596 	le16 ht_extended_capabilities;
597 	le32 tx_bf_capability_info;
598 	u8 asel_capabilities;
599 } STRUCT_PACKED;
600 
601 
602 /* HT Operation element */
603 struct ieee80211_ht_operation {
604 	u8 primary_chan;
605 	/* Five octets of HT Operation Information */
606 	u8 ht_param; /* B0..B7 */
607 	le16 operation_mode; /* B8..B23 */
608 	le16 param; /* B24..B39 */
609 	u8 basic_mcs_set[16];
610 } STRUCT_PACKED;
611 
612 
613 struct ieee80211_obss_scan_parameters {
614 	le16 scan_passive_dwell;
615 	le16 scan_active_dwell;
616 	le16 width_trigger_scan_interval;
617 	le16 scan_passive_total_per_channel;
618 	le16 scan_active_total_per_channel;
619 	le16 channel_transition_delay_factor;
620 	le16 scan_activity_threshold;
621 } STRUCT_PACKED;
622 
623 
624 struct ieee80211_vht_capabilities {
625 	le32 vht_capabilities_info;
626 	struct {
627 		le16 rx_map;
628 		le16 rx_highest;
629 		le16 tx_map;
630 		le16 tx_highest;
631 	} vht_supported_mcs_set;
632 } STRUCT_PACKED;
633 
634 struct ieee80211_vht_operation {
635 	u8 vht_op_info_chwidth;
636 	u8 vht_op_info_chan_center_freq_seg0_idx;
637 	u8 vht_op_info_chan_center_freq_seg1_idx;
638 	le16 vht_basic_mcs_set;
639 } STRUCT_PACKED;
640 
641 #ifdef _MSC_VER
642 #pragma pack(pop)
643 #endif /* _MSC_VER */
644 
645 #define ERP_INFO_NON_ERP_PRESENT BIT(0)
646 #define ERP_INFO_USE_PROTECTION BIT(1)
647 #define ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
648 
649 #define OVERLAPPING_BSS_TRANS_DELAY_FACTOR 5
650 
651 /* HT Capabilities Info field within HT Capabilities element */
652 #define HT_CAP_INFO_LDPC_CODING_CAP		((u16) BIT(0))
653 #define HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET	((u16) BIT(1))
654 #define HT_CAP_INFO_SMPS_MASK			((u16) (BIT(2) | BIT(3)))
655 #define HT_CAP_INFO_SMPS_STATIC			((u16) 0)
656 #define HT_CAP_INFO_SMPS_DYNAMIC		((u16) BIT(2))
657 #define HT_CAP_INFO_SMPS_DISABLED		((u16) (BIT(2) | BIT(3)))
658 #define HT_CAP_INFO_GREEN_FIELD			((u16) BIT(4))
659 #define HT_CAP_INFO_SHORT_GI20MHZ		((u16) BIT(5))
660 #define HT_CAP_INFO_SHORT_GI40MHZ		((u16) BIT(6))
661 #define HT_CAP_INFO_TX_STBC			((u16) BIT(7))
662 #define HT_CAP_INFO_RX_STBC_MASK		((u16) (BIT(8) | BIT(9)))
663 #define HT_CAP_INFO_RX_STBC_1			((u16) BIT(8))
664 #define HT_CAP_INFO_RX_STBC_12			((u16) BIT(9))
665 #define HT_CAP_INFO_RX_STBC_123			((u16) (BIT(8) | BIT(9)))
666 #define HT_CAP_INFO_DELAYED_BA			((u16) BIT(10))
667 #define HT_CAP_INFO_MAX_AMSDU_SIZE		((u16) BIT(11))
668 #define HT_CAP_INFO_DSSS_CCK40MHZ		((u16) BIT(12))
669 /* B13 - Reserved (was PSMP support during P802.11n development) */
670 #define HT_CAP_INFO_40MHZ_INTOLERANT		((u16) BIT(14))
671 #define HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT	((u16) BIT(15))
672 
673 /* HT Extended Capabilities field within HT Capabilities element */
674 #define EXT_HT_CAP_INFO_PCO			((u16) BIT(0))
675 #define EXT_HT_CAP_INFO_PCO_TRANS_TIME_MASK	((u16) (BIT(1) | BIT(2)))
676 #define EXT_HT_CAP_INFO_TRANS_TIME_OFFSET	1
677 /* B3..B7 - Reserved */
678 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_MASK	((u16) (BIT(8) | BIT(9)))
679 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_OFFSET	8
680 #define EXT_HT_CAP_INFO_HTC_SUPPORT		((u16) BIT(10))
681 #define EXT_HT_CAP_INFO_RD_RESPONDER		((u16) BIT(11))
682 /* B12..B15 - Reserved */
683 
684 /* Transmit Beanforming Capabilities within HT Capabilities element */
685 #define TX_BF_CAP_IMPLICIT_TXBF_RX_CAP ((u32) BIT(0))
686 #define TX_BF_CAP_RX_STAGGERED_SOUNDING_CAP ((u32) BIT(1))
687 #define TX_BF_CAP_TX_STAGGERED_SOUNDING_CAP ((u32) BIT(2))
688 #define TX_BF_CAP_RX_NDP_CAP ((u32) BIT(3))
689 #define TX_BF_CAP_TX_NDP_CAP ((u32) BIT(4))
690 #define TX_BF_CAP_IMPLICIT_TX_BF_CAP ((u32) BIT(5))
691 #define TX_BF_CAP_CALIBRATION_MASK ((u32) (BIT(6) | BIT(7))
692 #define TX_BF_CAP_CALIB_OFFSET 6
693 #define TX_BF_CAP_EXPLICIT_CSI_TXBF_CAP ((u32) BIT(8))
694 #define TX_BF_CAP_EXPLICIT_NONCOMPR_STEERING_CAP ((u32) BIT(9))
695 #define TX_BF_CAP_EXPLICIT_COMPR_STEERING_CAP ((u32) BIT(10))
696 #define TX_BF_CAP_EXPLICIT_TX_BF_CSI_FEEDBACK_MASK ((u32) (BIT(10) | BIT(11)))
697 #define TX_BF_CAP_EXPLICIT_BF_CSI_FEEDBACK_OFFSET 11
698 #define TX_BF_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_FEEDBACK_OFFSET 13
699 #define TX_BF_CAP_EXPLICIT_COMPRESSED_STEERING_MATRIX_FEEDBACK_OFFSET 15
700 #define TX_BF_CAP_MINIMAL_GROUPING_OFFSET 17
701 #define TX_BF_CAP_CSI_NUM_BEAMFORMER_ANT_OFFSET 19
702 #define TX_BF_CAP_UNCOMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 21
703 #define TX_BF_CAP_COMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 23
704 #define TX_BF_CAP_SCI_MAX_OF_ROWS_BEANFORMER_SUPPORTED_OFFSET 25
705 #define TX_BF_CAP_CHANNEL_ESTIMATION_CAP_MASK ((u32) (BIT(27) | BIT(28)))
706 #define TX_BF_CAP_CHANNEL_ESTIMATION_CAP_OFFSET 27
707 /* B29..B31 - Reserved */
708 
709 /* ASEL Capability field within HT Capabilities element */
710 #define ASEL_CAP_ASEL_CAPABLE ((u8) BIT(0))
711 #define ASEL_CAP_EXPLICIT_CSI_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(1))
712 #define ASEL_CAP_ANT_INDICES_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(2))
713 #define ASEL_CAP_EXPLICIT_CSI_FEEDBACK_CAP ((u8) BIT(3))
714 #define ASEL_CAP_ANT_INDICES_FEEDBACK_CAP ((u8) BIT(4))
715 #define ASEL_CAP_RX_AS_CAP ((u8) BIT(5))
716 #define ASEL_CAP_TX_SOUNDING_PPDUS_CAP ((u8) BIT(6))
717 /* B7 - Reserved */
718 
719 /* First octet of HT Operation Information within HT Operation element */
720 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK	((u8) BIT(0) | BIT(1))
721 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE		((u8) BIT(0))
722 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW		((u8) BIT(0) | BIT(1))
723 #define HT_INFO_HT_PARAM_STA_CHNL_WIDTH			((u8) BIT(2))
724 #define HT_INFO_HT_PARAM_RIFS_MODE			((u8) BIT(3))
725 /* B4..B7 - Reserved */
726 
727 /* HT Protection (B8..B9 of HT Operation Information) */
728 #define HT_PROT_NO_PROTECTION           0
729 #define HT_PROT_NONMEMBER_PROTECTION    1
730 #define HT_PROT_20MHZ_PROTECTION        2
731 #define HT_PROT_NON_HT_MIXED            3
732 /* Bits within ieee80211_ht_operation::operation_mode (BIT(0) maps to B8 in
733  * HT Operation Information) */
734 #define HT_OPER_OP_MODE_HT_PROT_MASK ((u16) (BIT(0) | BIT(1))) /* B8..B9 */
735 #define HT_OPER_OP_MODE_NON_GF_HT_STAS_PRESENT	((u16) BIT(2)) /* B10 */
736 /* BIT(3), i.e., B11 in HT Operation Information field - Reserved */
737 #define HT_OPER_OP_MODE_OBSS_NON_HT_STAS_PRESENT	((u16) BIT(4)) /* B12 */
738 /* BIT(5)..BIT(15), i.e., B13..B23 - Reserved */
739 
740 /* Last two octets of HT Operation Information (BIT(0) = B24) */
741 /* B24..B29 - Reserved */
742 #define HT_OPER_PARAM_DUAL_BEACON			((u16) BIT(6))
743 #define HT_OPER_PARAM_DUAL_CTS_PROTECTION		((u16) BIT(7))
744 #define HT_OPER_PARAM_STBC_BEACON			((u16) BIT(8))
745 #define HT_OPER_PARAM_LSIG_TXOP_PROT_FULL_SUPP		((u16) BIT(9))
746 #define HT_OPER_PARAM_PCO_ACTIVE			((u16) BIT(10))
747 #define HT_OPER_PARAM_PCO_PHASE				((u16) BIT(11))
748 /* B36..B39 - Reserved */
749 
750 #define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126
751 #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
752 
753 /* VHT Defines */
754 #define VHT_CAP_MAX_MPDU_LENGTH_7991                ((u32) BIT(0))
755 #define VHT_CAP_MAX_MPDU_LENGTH_11454               ((u32) BIT(1))
756 #define VHT_CAP_MAX_MPDU_LENGTH_MASK                ((u32) BIT(0) | BIT(1))
757 #define VHT_CAP_SUPP_CHAN_WIDTH_160MHZ              ((u32) BIT(2))
758 #define VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ     ((u32) BIT(3))
759 #define VHT_CAP_SUPP_CHAN_WIDTH_MASK                ((u32) BIT(2) | BIT(3))
760 #define VHT_CAP_RXLDPC                              ((u32) BIT(4))
761 #define VHT_CAP_SHORT_GI_80                         ((u32) BIT(5))
762 #define VHT_CAP_SHORT_GI_160                        ((u32) BIT(6))
763 #define VHT_CAP_TXSTBC                              ((u32) BIT(7))
764 #define VHT_CAP_RXSTBC_1                            ((u32) BIT(8))
765 #define VHT_CAP_RXSTBC_2                            ((u32) BIT(9))
766 #define VHT_CAP_RXSTBC_3                            ((u32) BIT(8) | BIT(9))
767 #define VHT_CAP_RXSTBC_4                            ((u32) BIT(10))
768 #define VHT_CAP_RXSTBC_MASK                         ((u32) BIT(8) | BIT(9) | \
769 							   BIT(10))
770 #define VHT_CAP_SU_BEAMFORMER_CAPABLE               ((u32) BIT(11))
771 #define VHT_CAP_SU_BEAMFORMEE_CAPABLE               ((u32) BIT(12))
772 #define VHT_CAP_BEAMFORMEE_STS_MAX                  ((u32) BIT(13) | \
773 							   BIT(14) | BIT(15))
774 #define VHT_CAP_BEAMFORMEE_STS_OFFSET               13
775 #define VHT_CAP_SOUNDING_DIMENSION_MAX              ((u32) BIT(16) | \
776 							   BIT(17) | BIT(18))
777 #define VHT_CAP_SOUNDING_DIMENSION_OFFSET           16
778 #define VHT_CAP_MU_BEAMFORMER_CAPABLE               ((u32) BIT(19))
779 #define VHT_CAP_MU_BEAMFORMEE_CAPABLE               ((u32) BIT(20))
780 #define VHT_CAP_VHT_TXOP_PS                         ((u32) BIT(21))
781 #define VHT_CAP_HTC_VHT                             ((u32) BIT(22))
782 
783 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_1        ((u32) BIT(23))
784 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_2        ((u32) BIT(24))
785 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_3        ((u32) BIT(23) | BIT(24))
786 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_4        ((u32) BIT(25))
787 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_5        ((u32) BIT(23) | BIT(25))
788 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_6        ((u32) BIT(24) | BIT(25))
789 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX      ((u32) BIT(23) | \
790 							   BIT(24) | BIT(25))
791 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB   ((u32) BIT(27))
792 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB     ((u32) BIT(26) | BIT(27))
793 #define VHT_CAP_RX_ANTENNA_PATTERN                  ((u32) BIT(28))
794 #define VHT_CAP_TX_ANTENNA_PATTERN                  ((u32) BIT(29))
795 
796 #define VHT_OPMODE_CHANNEL_WIDTH_MASK		    ((u8) BIT(0) | BIT(1))
797 #define VHT_OPMODE_CHANNEL_RxNSS_MASK		    ((u8) BIT(4) | BIT(5) | \
798 						     BIT(6))
799 #define VHT_OPMODE_NOTIF_RX_NSS_SHIFT		    4
800 
801 #define VHT_RX_NSS_MAX_STREAMS			    8
802 
803 /* VHT channel widths */
804 #define VHT_CHANWIDTH_USE_HT	0
805 #define VHT_CHANWIDTH_80MHZ	1
806 #define VHT_CHANWIDTH_160MHZ	2
807 #define VHT_CHANWIDTH_80P80MHZ	3
808 
809 #define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
810 				* 00:50:F2 */
811 #define WPA_IE_VENDOR_TYPE 0x0050f201
812 #define WMM_IE_VENDOR_TYPE 0x0050f202
813 #define WPS_IE_VENDOR_TYPE 0x0050f204
814 #define OUI_WFA 0x506f9a
815 #define P2P_IE_VENDOR_TYPE 0x506f9a09
816 #define WFD_IE_VENDOR_TYPE 0x506f9a0a
817 #define WFD_OUI_TYPE 10
818 #define HS20_IE_VENDOR_TYPE 0x506f9a10
819 #define OSEN_IE_VENDOR_TYPE 0x506f9a12
820 
821 #define WMM_OUI_TYPE 2
822 #define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
823 #define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
824 #define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
825 #define WMM_VERSION 1
826 
827 #define WMM_ACTION_CODE_ADDTS_REQ 0
828 #define WMM_ACTION_CODE_ADDTS_RESP 1
829 #define WMM_ACTION_CODE_DELTS 2
830 
831 #define WMM_ADDTS_STATUS_ADMISSION_ACCEPTED 0
832 #define WMM_ADDTS_STATUS_INVALID_PARAMETERS 1
833 /* 2 - Reserved */
834 #define WMM_ADDTS_STATUS_REFUSED 3
835 /* 4-255 - Reserved */
836 
837 /* WMM TSPEC Direction Field Values */
838 #define WMM_TSPEC_DIRECTION_UPLINK 0
839 #define WMM_TSPEC_DIRECTION_DOWNLINK 1
840 /* 2 - Reserved */
841 #define WMM_TSPEC_DIRECTION_BI_DIRECTIONAL 3
842 
843 /*
844  * WMM Information Element (used in (Re)Association Request frames; may also be
845  * used in Beacon frames)
846  */
847 struct wmm_information_element {
848 	/* Element ID: 221 (0xdd); Length: 7 */
849 	/* required fields for WMM version 1 */
850 	u8 oui[3]; /* 00:50:f2 */
851 	u8 oui_type; /* 2 */
852 	u8 oui_subtype; /* 0 */
853 	u8 version; /* 1 for WMM version 1.0 */
854 	u8 qos_info; /* AP/STA specific QoS info */
855 
856 } STRUCT_PACKED;
857 
858 #define WMM_QOSINFO_STA_AC_MASK 0x0f
859 #define WMM_QOSINFO_STA_SP_MASK 0x03
860 #define WMM_QOSINFO_STA_SP_SHIFT 5
861 
862 #define WMM_AC_AIFSN_MASK 0x0f
863 #define WMM_AC_AIFNS_SHIFT 0
864 #define WMM_AC_ACM 0x10
865 #define WMM_AC_ACI_MASK 0x60
866 #define WMM_AC_ACI_SHIFT 5
867 
868 #define WMM_AC_ECWMIN_MASK 0x0f
869 #define WMM_AC_ECWMIN_SHIFT 0
870 #define WMM_AC_ECWMAX_MASK 0xf0
871 #define WMM_AC_ECWMAX_SHIFT 4
872 
873 struct wmm_ac_parameter {
874 	u8 aci_aifsn; /* AIFSN, ACM, ACI */
875 	u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
876 	le16 txop_limit;
877 }  STRUCT_PACKED;
878 
879 /*
880  * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
881  * Response frmaes)
882  */
883 struct wmm_parameter_element {
884 	/* Element ID: 221 (0xdd); Length: 24 */
885 	/* required fields for WMM version 1 */
886 	u8 oui[3]; /* 00:50:f2 */
887 	u8 oui_type; /* 2 */
888 	u8 oui_subtype; /* 1 */
889 	u8 version; /* 1 for WMM version 1.0 */
890 	u8 qos_info; /* AP/STA specific QoS info */
891 	u8 reserved; /* 0 */
892 	struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
893 
894 } STRUCT_PACKED;
895 
896 /* WMM TSPEC Element */
897 struct wmm_tspec_element {
898 	u8 eid; /* 221 = 0xdd */
899 	u8 length; /* 6 + 55 = 61 */
900 	u8 oui[3]; /* 00:50:f2 */
901 	u8 oui_type; /* 2 */
902 	u8 oui_subtype; /* 2 */
903 	u8 version; /* 1 */
904 	/* WMM TSPEC body (55 octets): */
905 	u8 ts_info[3];
906 	le16 nominal_msdu_size;
907 	le16 maximum_msdu_size;
908 	le32 minimum_service_interval;
909 	le32 maximum_service_interval;
910 	le32 inactivity_interval;
911 	le32 suspension_interval;
912 	le32 service_start_time;
913 	le32 minimum_data_rate;
914 	le32 mean_data_rate;
915 	le32 peak_data_rate;
916 	le32 maximum_burst_size;
917 	le32 delay_bound;
918 	le32 minimum_phy_rate;
919 	le16 surplus_bandwidth_allowance;
920 	le16 medium_time;
921 } STRUCT_PACKED;
922 
923 
924 /* Access Categories / ACI to AC coding */
925 enum {
926 	WMM_AC_BE = 0 /* Best Effort */,
927 	WMM_AC_BK = 1 /* Background */,
928 	WMM_AC_VI = 2 /* Video */,
929 	WMM_AC_VO = 3 /* Voice */
930 };
931 
932 
933 #define HS20_INDICATION_OUI_TYPE 16
934 #define HS20_ANQP_OUI_TYPE 17
935 #define HS20_OSEN_OUI_TYPE 18
936 #define HS20_STYPE_QUERY_LIST 1
937 #define HS20_STYPE_CAPABILITY_LIST 2
938 #define HS20_STYPE_OPERATOR_FRIENDLY_NAME 3
939 #define HS20_STYPE_WAN_METRICS 4
940 #define HS20_STYPE_CONNECTION_CAPABILITY 5
941 #define HS20_STYPE_NAI_HOME_REALM_QUERY 6
942 #define HS20_STYPE_OPERATING_CLASS 7
943 #define HS20_STYPE_OSU_PROVIDERS_LIST 8
944 #define HS20_STYPE_ICON_REQUEST 10
945 #define HS20_STYPE_ICON_BINARY_FILE 11
946 
947 #define HS20_DGAF_DISABLED 0x01
948 #define HS20_PPS_MO_ID_PRESENT 0x02
949 #define HS20_ANQP_DOMAIN_ID_PRESENT 0x04
950 #define HS20_VERSION 0x10 /* Release 2 */
951 
952 /* WNM-Notification WFA vendors specific subtypes */
953 #define HS20_WNM_SUB_REM_NEEDED 0
954 #define HS20_WNM_DEAUTH_IMMINENT_NOTICE 1
955 
956 #define HS20_DEAUTH_REASON_CODE_BSS 0
957 #define HS20_DEAUTH_REASON_CODE_ESS 1
958 
959 /* Wi-Fi Direct (P2P) */
960 
961 #define P2P_OUI_TYPE 9
962 
963 enum p2p_attr_id {
964 	P2P_ATTR_STATUS = 0,
965 	P2P_ATTR_MINOR_REASON_CODE = 1,
966 	P2P_ATTR_CAPABILITY = 2,
967 	P2P_ATTR_DEVICE_ID = 3,
968 	P2P_ATTR_GROUP_OWNER_INTENT = 4,
969 	P2P_ATTR_CONFIGURATION_TIMEOUT = 5,
970 	P2P_ATTR_LISTEN_CHANNEL = 6,
971 	P2P_ATTR_GROUP_BSSID = 7,
972 	P2P_ATTR_EXT_LISTEN_TIMING = 8,
973 	P2P_ATTR_INTENDED_INTERFACE_ADDR = 9,
974 	P2P_ATTR_MANAGEABILITY = 10,
975 	P2P_ATTR_CHANNEL_LIST = 11,
976 	P2P_ATTR_NOTICE_OF_ABSENCE = 12,
977 	P2P_ATTR_DEVICE_INFO = 13,
978 	P2P_ATTR_GROUP_INFO = 14,
979 	P2P_ATTR_GROUP_ID = 15,
980 	P2P_ATTR_INTERFACE = 16,
981 	P2P_ATTR_OPERATING_CHANNEL = 17,
982 	P2P_ATTR_INVITATION_FLAGS = 18,
983 	P2P_ATTR_OOB_GO_NEG_CHANNEL = 19,
984 	P2P_ATTR_VENDOR_SPECIFIC = 221
985 };
986 
987 #define P2P_MAX_GO_INTENT 15
988 
989 /* P2P Capability - Device Capability bitmap */
990 #define P2P_DEV_CAPAB_SERVICE_DISCOVERY BIT(0)
991 #define P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY BIT(1)
992 #define P2P_DEV_CAPAB_CONCURRENT_OPER BIT(2)
993 #define P2P_DEV_CAPAB_INFRA_MANAGED BIT(3)
994 #define P2P_DEV_CAPAB_DEVICE_LIMIT BIT(4)
995 #define P2P_DEV_CAPAB_INVITATION_PROCEDURE BIT(5)
996 
997 /* P2P Capability - Group Capability bitmap */
998 #define P2P_GROUP_CAPAB_GROUP_OWNER BIT(0)
999 #define P2P_GROUP_CAPAB_PERSISTENT_GROUP BIT(1)
1000 #define P2P_GROUP_CAPAB_GROUP_LIMIT BIT(2)
1001 #define P2P_GROUP_CAPAB_INTRA_BSS_DIST BIT(3)
1002 #define P2P_GROUP_CAPAB_CROSS_CONN BIT(4)
1003 #define P2P_GROUP_CAPAB_PERSISTENT_RECONN BIT(5)
1004 #define P2P_GROUP_CAPAB_GROUP_FORMATION BIT(6)
1005 #define P2P_GROUP_CAPAB_IP_ADDR_ALLOCATION BIT(7)
1006 
1007 /* Invitation Flags */
1008 #define P2P_INVITATION_FLAGS_TYPE BIT(0)
1009 
1010 /* P2P Manageability */
1011 #define P2P_MAN_DEVICE_MANAGEMENT BIT(0)
1012 #define P2P_MAN_CROSS_CONNECTION_PERMITTED BIT(1)
1013 #define P2P_MAN_COEXISTENCE_OPTIONAL BIT(2)
1014 
1015 enum p2p_status_code {
1016 	P2P_SC_SUCCESS = 0,
1017 	P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE = 1,
1018 	P2P_SC_FAIL_INCOMPATIBLE_PARAMS = 2,
1019 	P2P_SC_FAIL_LIMIT_REACHED = 3,
1020 	P2P_SC_FAIL_INVALID_PARAMS = 4,
1021 	P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE = 5,
1022 	P2P_SC_FAIL_PREV_PROTOCOL_ERROR = 6,
1023 	P2P_SC_FAIL_NO_COMMON_CHANNELS = 7,
1024 	P2P_SC_FAIL_UNKNOWN_GROUP = 8,
1025 	P2P_SC_FAIL_BOTH_GO_INTENT_15 = 9,
1026 	P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD = 10,
1027 	P2P_SC_FAIL_REJECTED_BY_USER = 11,
1028 };
1029 
1030 enum p2p_role_indication {
1031 	P2P_DEVICE_NOT_IN_GROUP = 0x00,
1032 	P2P_CLIENT_IN_A_GROUP = 0x01,
1033 	P2P_GO_IN_A_GROUP = 0x02,
1034 };
1035 
1036 #define P2P_WILDCARD_SSID "DIRECT-"
1037 #define P2P_WILDCARD_SSID_LEN 7
1038 
1039 /* P2P action frames */
1040 enum p2p_act_frame_type {
1041 	P2P_NOA = 0,
1042 	P2P_PRESENCE_REQ = 1,
1043 	P2P_PRESENCE_RESP = 2,
1044 	P2P_GO_DISC_REQ = 3
1045 };
1046 
1047 /* P2P public action frames */
1048 enum p2p_action_frame_type {
1049 	P2P_GO_NEG_REQ = 0,
1050 	P2P_GO_NEG_RESP = 1,
1051 	P2P_GO_NEG_CONF = 2,
1052 	P2P_INVITATION_REQ = 3,
1053 	P2P_INVITATION_RESP = 4,
1054 	P2P_DEV_DISC_REQ = 5,
1055 	P2P_DEV_DISC_RESP = 6,
1056 	P2P_PROV_DISC_REQ = 7,
1057 	P2P_PROV_DISC_RESP = 8
1058 };
1059 
1060 enum p2p_service_protocol_type {
1061 	P2P_SERV_ALL_SERVICES = 0,
1062 	P2P_SERV_BONJOUR = 1,
1063 	P2P_SERV_UPNP = 2,
1064 	P2P_SERV_WS_DISCOVERY = 3,
1065 	P2P_SERV_WIFI_DISPLAY = 4,
1066 	P2P_SERV_VENDOR_SPECIFIC = 255
1067 };
1068 
1069 enum p2p_sd_status {
1070 	P2P_SD_SUCCESS = 0,
1071 	P2P_SD_PROTO_NOT_AVAILABLE = 1,
1072 	P2P_SD_REQUESTED_INFO_NOT_AVAILABLE = 2,
1073 	P2P_SD_BAD_REQUEST = 3
1074 };
1075 
1076 
1077 enum wifi_display_subelem {
1078 	WFD_SUBELEM_DEVICE_INFO = 0,
1079 	WFD_SUBELEM_ASSOCIATED_BSSID = 1,
1080 	WFD_SUBELEM_AUDIO_FORMATS = 2,
1081 	WFD_SUBELEM_VIDEO_FORMATS = 3,
1082 	WFD_SUBELEM_3D_VIDEO_FORMATS = 4,
1083 	WFD_SUBELEM_CONTENT_PROTECTION = 5,
1084 	WFD_SUBELEM_COUPLED_SINK = 6,
1085 	WFD_SUBELEM_EXT_CAPAB = 7,
1086 	WFD_SUBELEM_LOCAL_IP_ADDRESS = 8,
1087 	WFD_SUBELEM_SESSION_INFO = 9
1088 };
1089 
1090 
1091 #define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
1092 
1093 #define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
1094 
1095 /* cipher suite selectors */
1096 #define WLAN_CIPHER_SUITE_USE_GROUP	0x000FAC00
1097 #define WLAN_CIPHER_SUITE_WEP40		0x000FAC01
1098 #define WLAN_CIPHER_SUITE_TKIP		0x000FAC02
1099 /* reserved: 				0x000FAC03 */
1100 #define WLAN_CIPHER_SUITE_CCMP		0x000FAC04
1101 #define WLAN_CIPHER_SUITE_WEP104	0x000FAC05
1102 #define WLAN_CIPHER_SUITE_AES_CMAC	0x000FAC06
1103 #define WLAN_CIPHER_SUITE_NO_GROUP_ADDR	0x000FAC07
1104 #define WLAN_CIPHER_SUITE_GCMP		0x000FAC08
1105 #define WLAN_CIPHER_SUITE_GCMP_256	0x000FAC09
1106 #define WLAN_CIPHER_SUITE_CCMP_256	0x000FAC0A
1107 #define WLAN_CIPHER_SUITE_BIP_GMAC_128	0x000FAC0B
1108 #define WLAN_CIPHER_SUITE_BIP_GMAC_256	0x000FAC0C
1109 #define WLAN_CIPHER_SUITE_BIP_CMAC_256	0x000FAC0D
1110 
1111 #define WLAN_CIPHER_SUITE_SMS4		0x00147201
1112 
1113 #define WLAN_CIPHER_SUITE_CKIP		0x00409600
1114 #define WLAN_CIPHER_SUITE_CKIP_CMIC	0x00409601
1115 #define WLAN_CIPHER_SUITE_CMIC		0x00409602
1116 #define WLAN_CIPHER_SUITE_KRK		0x004096FF /* for nl80211 use only */
1117 
1118 /* AKM suite selectors */
1119 #define WLAN_AKM_SUITE_8021X		0x000FAC01
1120 #define WLAN_AKM_SUITE_PSK		0x000FAC02
1121 #define WLAN_AKM_SUITE_FT_8021X		0x000FAC03
1122 #define WLAN_AKM_SUITE_FT_PSK		0x000FAC04
1123 #define WLAN_AKM_SUITE_8021X_SHA256	0x000FAC05
1124 #define WLAN_AKM_SUITE_PSK_SHA256	0x000FAC06
1125 #define WLAN_AKM_SUITE_CCKM		0x00409600
1126 #define WLAN_AKM_SUITE_OSEN		0x506f9a01
1127 
1128 
1129 /* IEEE 802.11v - WNM Action field values */
1130 enum wnm_action {
1131 	WNM_EVENT_REQ = 0,
1132 	WNM_EVENT_REPORT = 1,
1133 	WNM_DIAGNOSTIC_REQ = 2,
1134 	WNM_DIAGNOSTIC_REPORT = 3,
1135 	WNM_LOCATION_CFG_REQ = 4,
1136 	WNM_LOCATION_CFG_RESP = 5,
1137 	WNM_BSS_TRANS_MGMT_QUERY = 6,
1138 	WNM_BSS_TRANS_MGMT_REQ = 7,
1139 	WNM_BSS_TRANS_MGMT_RESP = 8,
1140 	WNM_FMS_REQ = 9,
1141 	WNM_FMS_RESP = 10,
1142 	WNM_COLLOCATED_INTERFERENCE_REQ = 11,
1143 	WNM_COLLOCATED_INTERFERENCE_REPORT = 12,
1144 	WNM_TFS_REQ = 13,
1145 	WNM_TFS_RESP = 14,
1146 	WNM_TFS_NOTIFY = 15,
1147 	WNM_SLEEP_MODE_REQ = 16,
1148 	WNM_SLEEP_MODE_RESP = 17,
1149 	WNM_TIM_BROADCAST_REQ = 18,
1150 	WNM_TIM_BROADCAST_RESP = 19,
1151 	WNM_QOS_TRAFFIC_CAPAB_UPDATE = 20,
1152 	WNM_CHANNEL_USAGE_REQ = 21,
1153 	WNM_CHANNEL_USAGE_RESP = 22,
1154 	WNM_DMS_REQ = 23,
1155 	WNM_DMS_RESP = 24,
1156 	WNM_TIMING_MEASUREMENT_REQ = 25,
1157 	WNM_NOTIFICATION_REQ = 26,
1158 	WNM_NOTIFICATION_RESP = 27
1159 };
1160 
1161 /* IEEE 802.11v - BSS Transition Management Request - Request Mode */
1162 #define WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED BIT(0)
1163 #define WNM_BSS_TM_REQ_ABRIDGED BIT(1)
1164 #define WNM_BSS_TM_REQ_DISASSOC_IMMINENT BIT(2)
1165 #define WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED BIT(3)
1166 #define WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT BIT(4)
1167 
1168 /* IEEE Std 802.11-2012 - Table 8-253 */
1169 enum bss_trans_mgmt_status_code {
1170 	WNM_BSS_TM_ACCEPT = 0,
1171 	WNM_BSS_TM_REJECT_UNSPECIFIED = 1,
1172 	WNM_BSS_TM_REJECT_INSUFFICIENT_BEACON = 2,
1173 	WNM_BSS_TM_REJECT_INSUFFICIENT_CAPABITY = 3,
1174 	WNM_BSS_TM_REJECT_UNDESIRED = 4,
1175 	WNM_BSS_TM_REJECT_DELAY_REQUEST = 5,
1176 	WNM_BSS_TM_REJECT_STA_CANDIDATE_LIST_PROVIDED = 6,
1177 	WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES = 7,
1178 	WNM_BSS_TM_REJECT_LEAVING_ESS = 8
1179 };
1180 
1181 #define WNM_NEIGHBOR_TSF                         1
1182 #define WNM_NEIGHBOR_CONDENSED_COUNTRY_STRING    2
1183 #define WNM_NEIGHBOR_BSS_TRANSITION_CANDIDATE    3
1184 #define WNM_NEIGHBOR_BSS_TERMINATION_DURATION    4
1185 #define WNM_NEIGHBOR_BEARING                     5
1186 #define WNM_NEIGHBOR_MEASUREMENT_PILOT          66
1187 #define WNM_NEIGHBOR_RRM_ENABLED_CAPABILITIES   70
1188 #define WNM_NEIGHBOR_MULTIPLE_BSSID             71
1189 
1190 /* QoS action */
1191 enum qos_action {
1192 	QOS_ADDTS_REQ = 0,
1193 	QOS_ADDTS_RESP = 1,
1194 	QOS_DELTS = 2,
1195 	QOS_SCHEDULE = 3,
1196 	QOS_QOS_MAP_CONFIG = 4,
1197 };
1198 
1199 /* IEEE Std 802.11-2012, 8.4.2.62 20/40 BSS Coexistence element */
1200 #define WLAN_20_40_BSS_COEX_INFO_REQ            BIT(0)
1201 #define WLAN_20_40_BSS_COEX_40MHZ_INTOL         BIT(1)
1202 #define WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ     BIT(2)
1203 #define WLAN_20_40_BSS_COEX_OBSS_EXEMPT_REQ     BIT(3)
1204 #define WLAN_20_40_BSS_COEX_OBSS_EXEMPT_GRNT    BIT(4)
1205 
1206 struct ieee80211_2040_bss_coex_ie {
1207 	u8 element_id;
1208 	u8 length;
1209 	u8 coex_param;
1210 } STRUCT_PACKED;
1211 
1212 struct ieee80211_2040_intol_chan_report {
1213 	u8 element_id;
1214 	u8 length;
1215 	u8 op_class;
1216 	u8 variable[0];	/* Channel List */
1217 } STRUCT_PACKED;
1218 
1219 /* IEEE 802.11v - WNM-Sleep Mode element */
1220 struct wnm_sleep_element {
1221 	u8 eid;     /* WLAN_EID_WNMSLEEP */
1222 	u8 len;
1223 	u8 action_type; /* WNM_SLEEP_ENTER/WNM_SLEEP_MODE_EXIT */
1224 	u8 status;
1225 	le16 intval;
1226 } STRUCT_PACKED;
1227 
1228 #define WNM_SLEEP_MODE_ENTER 0
1229 #define WNM_SLEEP_MODE_EXIT 1
1230 
1231 enum wnm_sleep_mode_response_status {
1232 	WNM_STATUS_SLEEP_ACCEPT = 0,
1233 	WNM_STATUS_SLEEP_EXIT_ACCEPT_GTK_UPDATE = 1,
1234 	WNM_STATUS_DENIED_ACTION = 2,
1235 	WNM_STATUS_DENIED_TMP = 3,
1236 	WNM_STATUS_DENIED_KEY = 4,
1237 	WNM_STATUS_DENIED_OTHER_WNM_SERVICE = 5
1238 };
1239 
1240 /* WNM-Sleep Mode subelement IDs */
1241 enum wnm_sleep_mode_subelement_id {
1242 	WNM_SLEEP_SUBELEM_GTK = 0,
1243 	WNM_SLEEP_SUBELEM_IGTK = 1
1244 };
1245 
1246 /* Channel Switch modes (802.11h) */
1247 #define CHAN_SWITCH_MODE_ALLOW_TX	0
1248 #define CHAN_SWITCH_MODE_BLOCK_TX	1
1249 
1250 #endif /* IEEE802_11_DEFS_H */
1251