]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/common/ieee802_11_defs.h
Fix location of P2P indication flag in BSS ctrl_iface output
[thirdparty/hostap.git] / src / common / ieee802_11_defs.h
CommitLineData
6fc6879b
JM
1/*
2 * IEEE 802.11 Frame type definitions
a49148fd 3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
71b6ae14 4 * Copyright (c) 2007-2008 Intel Corporation
6fc6879b
JM
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Alternatively, this software may be distributed under the terms of BSD
11 * license.
12 *
13 * See README and COPYING for more details.
14 */
15
16#ifndef IEEE802_11_DEFS_H
17#define IEEE802_11_DEFS_H
18
19/* IEEE 802.11 defines */
20
21#define WLAN_FC_PVER 0x0003
22#define WLAN_FC_TODS 0x0100
23#define WLAN_FC_FROMDS 0x0200
24#define WLAN_FC_MOREFRAG 0x0400
25#define WLAN_FC_RETRY 0x0800
26#define WLAN_FC_PWRMGT 0x1000
27#define WLAN_FC_MOREDATA 0x2000
28#define WLAN_FC_ISWEP 0x4000
29#define WLAN_FC_ORDER 0x8000
30
31#define WLAN_FC_GET_TYPE(fc) (((fc) & 0x000c) >> 2)
32#define WLAN_FC_GET_STYPE(fc) (((fc) & 0x00f0) >> 4)
33
34#define WLAN_GET_SEQ_FRAG(seq) ((seq) & (BIT(3) | BIT(2) | BIT(1) | BIT(0)))
35#define WLAN_GET_SEQ_SEQ(seq) \
36 (((seq) & (~(BIT(3) | BIT(2) | BIT(1) | BIT(0)))) >> 4)
37
38#define WLAN_FC_TYPE_MGMT 0
39#define WLAN_FC_TYPE_CTRL 1
40#define WLAN_FC_TYPE_DATA 2
41
42/* management */
43#define WLAN_FC_STYPE_ASSOC_REQ 0
44#define WLAN_FC_STYPE_ASSOC_RESP 1
45#define WLAN_FC_STYPE_REASSOC_REQ 2
46#define WLAN_FC_STYPE_REASSOC_RESP 3
47#define WLAN_FC_STYPE_PROBE_REQ 4
48#define WLAN_FC_STYPE_PROBE_RESP 5
49#define WLAN_FC_STYPE_BEACON 8
50#define WLAN_FC_STYPE_ATIM 9
51#define WLAN_FC_STYPE_DISASSOC 10
52#define WLAN_FC_STYPE_AUTH 11
53#define WLAN_FC_STYPE_DEAUTH 12
54#define WLAN_FC_STYPE_ACTION 13
55
56/* control */
57#define WLAN_FC_STYPE_PSPOLL 10
58#define WLAN_FC_STYPE_RTS 11
59#define WLAN_FC_STYPE_CTS 12
60#define WLAN_FC_STYPE_ACK 13
61#define WLAN_FC_STYPE_CFEND 14
62#define WLAN_FC_STYPE_CFENDACK 15
63
64/* data */
65#define WLAN_FC_STYPE_DATA 0
66#define WLAN_FC_STYPE_DATA_CFACK 1
67#define WLAN_FC_STYPE_DATA_CFPOLL 2
68#define WLAN_FC_STYPE_DATA_CFACKPOLL 3
69#define WLAN_FC_STYPE_NULLFUNC 4
70#define WLAN_FC_STYPE_CFACK 5
71#define WLAN_FC_STYPE_CFPOLL 6
72#define WLAN_FC_STYPE_CFACKPOLL 7
73#define WLAN_FC_STYPE_QOS_DATA 8
a149fcc7
JM
74#define WLAN_FC_STYPE_QOS_DATA_CFACK 9
75#define WLAN_FC_STYPE_QOS_DATA_CFPOLL 10
76#define WLAN_FC_STYPE_QOS_DATA_CFACKPOLL 11
77#define WLAN_FC_STYPE_QOS_NULL 12
78#define WLAN_FC_STYPE_QOS_CFPOLL 14
79#define WLAN_FC_STYPE_QOS_CFACKPOLL 15
6fc6879b
JM
80
81/* Authentication algorithms */
82#define WLAN_AUTH_OPEN 0
83#define WLAN_AUTH_SHARED_KEY 1
84#define WLAN_AUTH_FT 2
85#define WLAN_AUTH_LEAP 128
86
87#define WLAN_AUTH_CHALLENGE_LEN 128
88
89#define WLAN_CAPABILITY_ESS BIT(0)
90#define WLAN_CAPABILITY_IBSS BIT(1)
91#define WLAN_CAPABILITY_CF_POLLABLE BIT(2)
92#define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3)
93#define WLAN_CAPABILITY_PRIVACY BIT(4)
94#define WLAN_CAPABILITY_SHORT_PREAMBLE BIT(5)
95#define WLAN_CAPABILITY_PBCC BIT(6)
96#define WLAN_CAPABILITY_CHANNEL_AGILITY BIT(7)
97#define WLAN_CAPABILITY_SPECTRUM_MGMT BIT(8)
98#define WLAN_CAPABILITY_SHORT_SLOT_TIME BIT(10)
99#define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
100
0b60b0aa 101/* Status codes (IEEE 802.11-2007, 7.3.1.9, Table 7-23) */
6fc6879b
JM
102#define WLAN_STATUS_SUCCESS 0
103#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
281ff0aa
GP
104#define WLAN_STATUS_TDLS_WAKEUP_ALTERNATE 2
105#define WLAN_STATUS_TDLS_WAKEUP_REJECT 3
106#define WLAN_STATUS_SECURITY_DISABLED 5
107#define WLAN_STATUS_UNACCEPTABLE_LIFETIME 6
108#define WLAN_STATUS_NOT_IN_SAME_BSS 7
6fc6879b
JM
109#define WLAN_STATUS_CAPS_UNSUPPORTED 10
110#define WLAN_STATUS_REASSOC_NO_ASSOC 11
111#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
112#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
113#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
114#define WLAN_STATUS_CHALLENGE_FAIL 15
115#define WLAN_STATUS_AUTH_TIMEOUT 16
116#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
117#define WLAN_STATUS_ASSOC_DENIED_RATES 18
118/* IEEE 802.11b */
119#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
120#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
121#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
122/* IEEE 802.11h */
123#define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
124#define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
125#define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
0b60b0aa 126/* IEEE 802.11g */
b0194fe0 127#define WLAN_STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME 25
29448243
JM
128#define WLAN_STATUS_ASSOC_DENIED_NO_DSSS_OFDM 26
129#define WLAN_STATUS_ASSOC_DENIED_NO_HT 27
f238cf9f 130#define WLAN_STATUS_R0KH_UNREACHABLE 28
29448243 131#define WLAN_STATUS_ASSOC_DENIED_NO_PCO 29
0b60b0aa
JM
132/* IEEE 802.11w */
133#define WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY 30
9a9876bf 134#define WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION 31
f238cf9f
JM
135#define WLAN_STATUS_UNSPECIFIED_QOS_FAILURE 32
136#define WLAN_STATUS_REQUEST_DECLINED 37
137#define WLAN_STATUS_INVALID_PARAMETERS 38
6fc6879b
JM
138/* IEEE 802.11i */
139#define WLAN_STATUS_INVALID_IE 40
140#define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41
141#define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42
142#define WLAN_STATUS_AKMP_NOT_VALID 43
143#define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44
144#define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45
145#define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46
b0194fe0
JM
146#define WLAN_STATUS_TS_NOT_CREATED 47
147#define WLAN_STATUS_DIRECT_LINK_NOT_ALLOWED 48
148#define WLAN_STATUS_DEST_STA_NOT_PRESENT 49
149#define WLAN_STATUS_DEST_STA_NOT_QOS_STA 50
150#define WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE 51
6fc6879b
JM
151/* IEEE 802.11r */
152#define WLAN_STATUS_INVALID_FT_ACTION_FRAME_COUNT 52
86f4deb6
JM
153#define WLAN_STATUS_INVALID_PMKID 53
154#define WLAN_STATUS_INVALID_MDIE 54
155#define WLAN_STATUS_INVALID_FTIE 55
281ff0aa 156#define WLAN_STATUS_INVALID_RSNIE 72
6fc6879b 157
0b60b0aa 158/* Reason codes (IEEE 802.11-2007, 7.3.1.7, Table 7-22) */
6fc6879b
JM
159#define WLAN_REASON_UNSPECIFIED 1
160#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
161#define WLAN_REASON_DEAUTH_LEAVING 3
162#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
163#define WLAN_REASON_DISASSOC_AP_BUSY 5
164#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
165#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
166#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
167#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
0b60b0aa 168/* IEEE 802.11h */
6fc6879b
JM
169#define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
170#define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
171/* IEEE 802.11i */
172#define WLAN_REASON_INVALID_IE 13
173#define WLAN_REASON_MICHAEL_MIC_FAILURE 14
174#define WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT 15
175#define WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT 16
176#define WLAN_REASON_IE_IN_4WAY_DIFFERS 17
177#define WLAN_REASON_GROUP_CIPHER_NOT_VALID 18
178#define WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID 19
179#define WLAN_REASON_AKMP_NOT_VALID 20
180#define WLAN_REASON_UNSUPPORTED_RSN_IE_VERSION 21
181#define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
182#define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
183#define WLAN_REASON_CIPHER_SUITE_REJECTED 24
281ff0aa
GP
184#define WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE 25
185#define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26
0d7e5a3a
JB
186/* IEEE 802.11e */
187#define WLAN_REASON_DISASSOC_LOW_ACK 34
6fc6879b
JM
188
189
190/* Information Element IDs */
191#define WLAN_EID_SSID 0
192#define WLAN_EID_SUPP_RATES 1
193#define WLAN_EID_FH_PARAMS 2
194#define WLAN_EID_DS_PARAMS 3
195#define WLAN_EID_CF_PARAMS 4
196#define WLAN_EID_TIM 5
197#define WLAN_EID_IBSS_PARAMS 6
198#define WLAN_EID_COUNTRY 7
199#define WLAN_EID_CHALLENGE 16
200/* EIDs defined by IEEE 802.11h - START */
201#define WLAN_EID_PWR_CONSTRAINT 32
202#define WLAN_EID_PWR_CAPABILITY 33
203#define WLAN_EID_TPC_REQUEST 34
204#define WLAN_EID_TPC_REPORT 35
205#define WLAN_EID_SUPPORTED_CHANNELS 36
206#define WLAN_EID_CHANNEL_SWITCH 37
207#define WLAN_EID_MEASURE_REQUEST 38
208#define WLAN_EID_MEASURE_REPORT 39
209#define WLAN_EID_QUITE 40
210#define WLAN_EID_IBSS_DFS 41
211/* EIDs defined by IEEE 802.11h - END */
212#define WLAN_EID_ERP_INFO 42
de9289c8 213#define WLAN_EID_HT_CAP 45
6fc6879b
JM
214#define WLAN_EID_RSN 48
215#define WLAN_EID_EXT_SUPP_RATES 50
216#define WLAN_EID_MOBILITY_DOMAIN 54
217#define WLAN_EID_FAST_BSS_TRANSITION 55
218#define WLAN_EID_TIMEOUT_INTERVAL 56
219#define WLAN_EID_RIC_DATA 57
de9289c8
JM
220#define WLAN_EID_HT_OPERATION 61
221#define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
222#define WLAN_EID_20_40_BSS_COEXISTENCE 72
223#define WLAN_EID_20_40_BSS_INTOLERANT 73
224#define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
0b60b0aa 225#define WLAN_EID_MMIE 76
b39f5834 226#define WLAN_EID_LINK_ID 101
950388f7 227#define WLAN_EID_ADV_PROTO 108
1161ff1e 228#define WLAN_EID_EXT_CAPAB 127
6fc6879b
JM
229#define WLAN_EID_VENDOR_SPECIFIC 221
230
231
0b60b0aa 232/* Action frame categories (IEEE 802.11-2007, 7.3.1.11, Table 7-24) */
6fc6879b
JM
233#define WLAN_ACTION_SPECTRUM_MGMT 0
234#define WLAN_ACTION_QOS 1
235#define WLAN_ACTION_DLS 2
236#define WLAN_ACTION_BLOCK_ACK 3
c4e281fd 237#define WLAN_ACTION_PUBLIC 4
6fc6879b
JM
238#define WLAN_ACTION_RADIO_MEASUREMENT 5
239#define WLAN_ACTION_FT 6
c4e281fd 240#define WLAN_ACTION_HT 7
c3469d15 241#define WLAN_ACTION_SA_QUERY 8
b39f5834 242#define WLAN_ACTION_TDLS 12
3ae0800c 243#define WLAN_ACTION_WMM 17 /* WMM Specification 1.1 */
950388f7
JM
244#define WLAN_ACTION_VENDOR_SPECIFIC 127
245
246/* Public action codes */
247#define WLAN_PA_VENDOR_SPECIFIC 9
248#define WLAN_PA_GAS_INITIAL_REQ 10
249#define WLAN_PA_GAS_INITIAL_RESP 11
250#define WLAN_PA_GAS_COMEBACK_REQ 12
251#define WLAN_PA_GAS_COMEBACK_RESP 13
6fc6879b 252
4209a95d 253/* SA Query Action frame (IEEE 802.11w/D8.0, 7.4.9) */
93b76319
JM
254#define WLAN_SA_QUERY_REQUEST 0
255#define WLAN_SA_QUERY_RESPONSE 1
5d22a1d5 256
4209a95d 257#define WLAN_SA_QUERY_TR_ID_LEN 2
5d22a1d5 258
b39f5834
JM
259/* TDLS action codes */
260#define WLAN_TDLS_SETUP_REQUEST 0
261#define WLAN_TDLS_SETUP_RESPONSE 1
262#define WLAN_TDLS_SETUP_CONFIRM 2
263#define WLAN_TDLS_TEARDOWN 3
264#define WLAN_TDLS_PEER_TRAFFIC_INDICATION 4
265#define WLAN_TDLS_CHANNEL_SWITCH_REQUEST 5
266#define WLAN_TDLS_CHANNEL_SWITCH_RESPONSE 6
267#define WLAN_TDLS_PEER_PSM_REQUEST 7
268#define WLAN_TDLS_PEER_PSM_RESPONSE 8
269#define WLAN_TDLS_PEER_TRAFFIC_RESPONSE 9
270#define WLAN_TDLS_DISCOVERY_REQUEST 10
271
adddffd1
JM
272/* Timeout Interval Type */
273#define WLAN_TIMEOUT_REASSOC_DEADLINE 1
274#define WLAN_TIMEOUT_KEY_LIFETIME 2
275#define WLAN_TIMEOUT_ASSOC_COMEBACK 3
276
daa30c23 277/* Advertisement Protocol ID definitions (IEEE Std 802.11u-2011) */
950388f7 278enum adv_proto_id {
daa30c23 279 ACCESS_NETWORK_QUERY_PROTOCOL = 0,
950388f7
JM
280 MIH_INFO_SERVICE = 1,
281 MIH_CMD_AND_EVENT_DISCOVERY = 2,
282 EMERGENCY_ALERT_SYSTEM = 3,
950388f7
JM
283 ADV_PROTO_VENDOR_SPECIFIC = 221
284};
285
daa30c23
JM
286/* Access Network Query Protocol info ID definitions (IEEE Std 802.11u-2011) */
287enum anqp_info_id {
288 ANQP_QUERY_LIST = 256,
289 ANQP_CAPABILITY_LIST = 257,
290 ANQP_VENUE_NAME = 258,
291 ANQP_EMERGENCY_CALL_NUMBER = 259,
292 ANQP_NETWORK_AUTH_TYPE = 260,
293 ANQP_ROAMING_CONSORTIUM = 261,
294 ANQP_IP_ADDR_TYPE_AVAILABILITY = 262,
295 ANQP_NAI_REALM = 263,
296 ANQP_3GPP_CELLULAR_NETWORK = 264,
297 ANQP_AP_GEOSPATIAL_LOCATION = 265,
298 ANQP_AP_CIVIC_LOCATION = 266,
299 ANQP_AP_LOCATION_PUBLIC_URI = 267,
300 ANQP_DOMAIN_NAME = 268,
301 ANQP_EMERGENCY_ALERT_URI = 269,
302 ANQP_EMERGENCY_NAI = 271,
303 ANQP_VENDOR_SPECIFIC = 56797
950388f7
JM
304};
305
6fc6879b
JM
306
307#ifdef _MSC_VER
308#pragma pack(push, 1)
309#endif /* _MSC_VER */
310
d994a9b5
JM
311struct ieee80211_hdr {
312 le16 frame_control;
313 le16 duration_id;
314 u8 addr1[6];
315 u8 addr2[6];
316 u8 addr3[6];
317 le16 seq_ctrl;
318 /* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
319 */
320} STRUCT_PACKED;
321
322#define IEEE80211_DA_FROMDS addr1
323#define IEEE80211_BSSID_FROMDS addr2
324#define IEEE80211_SA_FROMDS addr3
325
326#define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
327
328#define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
329
6fc6879b
JM
330struct ieee80211_mgmt {
331 le16 frame_control;
332 le16 duration;
333 u8 da[6];
334 u8 sa[6];
335 u8 bssid[6];
336 le16 seq_ctrl;
337 union {
338 struct {
339 le16 auth_alg;
340 le16 auth_transaction;
341 le16 status_code;
342 /* possibly followed by Challenge text */
343 u8 variable[0];
344 } STRUCT_PACKED auth;
345 struct {
346 le16 reason_code;
75bde05d 347 u8 variable[0];
6fc6879b
JM
348 } STRUCT_PACKED deauth;
349 struct {
350 le16 capab_info;
351 le16 listen_interval;
352 /* followed by SSID and Supported rates */
353 u8 variable[0];
354 } STRUCT_PACKED assoc_req;
355 struct {
356 le16 capab_info;
357 le16 status_code;
358 le16 aid;
359 /* followed by Supported rates */
360 u8 variable[0];
361 } STRUCT_PACKED assoc_resp, reassoc_resp;
362 struct {
363 le16 capab_info;
364 le16 listen_interval;
365 u8 current_ap[6];
366 /* followed by SSID and Supported rates */
367 u8 variable[0];
368 } STRUCT_PACKED reassoc_req;
369 struct {
370 le16 reason_code;
75bde05d 371 u8 variable[0];
6fc6879b
JM
372 } STRUCT_PACKED disassoc;
373 struct {
374 u8 timestamp[8];
375 le16 beacon_int;
376 le16 capab_info;
377 /* followed by some of SSID, Supported rates,
378 * FH Params, DS Params, CF Params, IBSS Params, TIM */
379 u8 variable[0];
380 } STRUCT_PACKED beacon;
381 struct {
382 /* only variable items: SSID, Supported rates */
383 u8 variable[0];
384 } STRUCT_PACKED probe_req;
385 struct {
386 u8 timestamp[8];
387 le16 beacon_int;
388 le16 capab_info;
389 /* followed by some of SSID, Supported rates,
390 * FH Params, DS Params, CF Params, IBSS Params */
391 u8 variable[0];
392 } STRUCT_PACKED probe_resp;
393 struct {
394 u8 category;
395 union {
396 struct {
397 u8 action_code;
398 u8 dialog_token;
399 u8 status_code;
400 u8 variable[0];
3ae0800c 401 } STRUCT_PACKED wmm_action;
6fc6879b
JM
402 struct{
403 u8 action_code;
404 u8 element_id;
405 u8 length;
406 u8 switch_mode;
407 u8 new_chan;
408 u8 switch_count;
409 } STRUCT_PACKED chan_switch;
410 struct {
411 u8 action;
412 u8 sta_addr[ETH_ALEN];
413 u8 target_ap_addr[ETH_ALEN];
414 u8 variable[0]; /* FT Request */
415 } STRUCT_PACKED ft_action_req;
416 struct {
417 u8 action;
418 u8 sta_addr[ETH_ALEN];
419 u8 target_ap_addr[ETH_ALEN];
420 le16 status_code;
421 u8 variable[0]; /* FT Request */
422 } STRUCT_PACKED ft_action_resp;
0b60b0aa
JM
423 struct {
424 u8 action;
93b76319
JM
425 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
426 } STRUCT_PACKED sa_query_req;
0b60b0aa 427 struct {
5d22a1d5 428 u8 action; /* */
93b76319
JM
429 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
430 } STRUCT_PACKED sa_query_resp;
b3b2da77
JM
431 struct {
432 u8 action;
433 u8 variable[0];
434 } STRUCT_PACKED public_action;
435 struct {
436 u8 action; /* 9 */
437 u8 oui[3];
438 /* Vendor-specific content */
439 u8 variable[0];
440 } STRUCT_PACKED vs_public_action;
6fc6879b
JM
441 } u;
442 } STRUCT_PACKED action;
443 } u;
444} STRUCT_PACKED;
445
de9289c8 446
a49148fd
JM
447struct ieee80211_ht_capabilities {
448 le16 ht_capabilities_info;
449 u8 a_mpdu_params;
de9289c8 450 u8 supported_mcs_set[16];
a49148fd
JM
451 le16 ht_extended_capabilities;
452 le32 tx_bf_capability_info;
453 u8 asel_capabilities;
de9289c8
JM
454} STRUCT_PACKED;
455
456
457struct ieee80211_ht_operation {
458 u8 control_chan;
459 u8 ht_param;
460 le16 operation_mode;
461 le16 stbc_param;
462 u8 basic_set[16];
463} STRUCT_PACKED;
464
3a328c81
JM
465#ifdef _MSC_VER
466#pragma pack(pop)
467#endif /* _MSC_VER */
de9289c8 468
3a328c81
JM
469#define ERP_INFO_NON_ERP_PRESENT BIT(0)
470#define ERP_INFO_USE_PROTECTION BIT(1)
471#define ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
de9289c8
JM
472
473
ba4dc6be 474#define HT_CAP_INFO_LDPC_CODING_CAP ((u16) BIT(0))
de9289c8 475#define HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET ((u16) BIT(1))
fc14f567
JM
476#define HT_CAP_INFO_SMPS_MASK ((u16) (BIT(2) | BIT(3)))
477#define HT_CAP_INFO_SMPS_STATIC ((u16) 0)
478#define HT_CAP_INFO_SMPS_DYNAMIC ((u16) BIT(2))
479#define HT_CAP_INFO_SMPS_DISABLED ((u16) (BIT(2) | BIT(3)))
de9289c8
JM
480#define HT_CAP_INFO_GREEN_FIELD ((u16) BIT(4))
481#define HT_CAP_INFO_SHORT_GI20MHZ ((u16) BIT(5))
482#define HT_CAP_INFO_SHORT_GI40MHZ ((u16) BIT(6))
483#define HT_CAP_INFO_TX_STBC ((u16) BIT(7))
fc14f567
JM
484#define HT_CAP_INFO_RX_STBC_MASK ((u16) (BIT(8) | BIT(9)))
485#define HT_CAP_INFO_RX_STBC_1 ((u16) BIT(8))
486#define HT_CAP_INFO_RX_STBC_12 ((u16) BIT(9))
487#define HT_CAP_INFO_RX_STBC_123 ((u16) (BIT(8) | BIT(9)))
de9289c8
JM
488#define HT_CAP_INFO_DELAYED_BA ((u16) BIT(10))
489#define HT_CAP_INFO_MAX_AMSDU_SIZE ((u16) BIT(11))
490#define HT_CAP_INFO_DSSS_CCK40MHZ ((u16) BIT(12))
491#define HT_CAP_INFO_PSMP_SUPP ((u16) BIT(13))
ba4dc6be 492#define HT_CAP_INFO_40MHZ_INTOLERANT ((u16) BIT(14))
de9289c8
JM
493#define HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT ((u16) BIT(15))
494
495
de9289c8
JM
496#define EXT_HT_CAP_INFO_PCO ((u16) BIT(0))
497#define EXT_HT_CAP_INFO_TRANS_TIME_OFFSET 1
498#define EXT_HT_CAP_INFO_MCS_FEEDBACK_OFFSET 8
499#define EXT_HT_CAP_INFO_HTC_SUPPORTED ((u16) BIT(10))
500#define EXT_HT_CAP_INFO_RD_RESPONDER ((u16) BIT(11))
501
502
503#define TX_BEAMFORM_CAP_TXBF_CAP ((u32) BIT(0))
504#define TX_BEAMFORM_CAP_RX_STAGGERED_SOUNDING_CAP ((u32) BIT(1))
505#define TX_BEAMFORM_CAP_TX_STAGGERED_SOUNDING_CAP ((u32) BIT(2))
506#define TX_BEAMFORM_CAP_RX_ZLF_CAP ((u32) BIT(3))
507#define TX_BEAMFORM_CAP_TX_ZLF_CAP ((u32) BIT(4))
508#define TX_BEAMFORM_CAP_IMPLICIT_ZLF_CAP ((u32) BIT(5))
509#define TX_BEAMFORM_CAP_CALIB_OFFSET 6
510#define TX_BEAMFORM_CAP_EXPLICIT_CSI_TXBF_CAP ((u32) BIT(8))
511#define TX_BEAMFORM_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_CAP ((u32) BIT(9))
512#define TX_BEAMFORM_CAP_EXPLICIT_BF_CSI_FEEDBACK_CAP ((u32) BIT(10))
513#define TX_BEAMFORM_CAP_EXPLICIT_BF_CSI_FEEDBACK_OFFSET 11
514#define TX_BEAMFORM_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_FEEDBACK_OFFSET 13
515#define TX_BEAMFORM_CAP_EXPLICIT_COMPRESSED_STEERING_MATRIX_FEEDBACK_OFFSET 15
516#define TX_BEAMFORM_CAP_MINIMAL_GROUPING_OFFSET 17
517#define TX_BEAMFORM_CAP_CSI_NUM_BEAMFORMER_ANT_OFFSET 19
518#define TX_BEAMFORM_CAP_UNCOMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 21
519#define TX_BEAMFORM_CAP_COMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 23
520#define TX_BEAMFORM_CAP_SCI_MAX_OF_ROWS_BEANFORMER_SUPPORTED_OFFSET 25
521
522
523#define ASEL_CAPABILITY_ASEL_CAPABLE ((u8) BIT(0))
524#define ASEL_CAPABILITY_EXPLICIT_CSI_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(1))
525#define ASEL_CAPABILITY_ANT_INDICES_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(2))
526#define ASEL_CAPABILITY_EXPLICIT_CSI_FEEDBACK_CAP ((u8) BIT(3))
527#define ASEL_CAPABILITY_ANT_INDICES_FEEDBACK_CAP ((u8) BIT(4))
528#define ASEL_CAPABILITY_RX_AS_CAP ((u8) BIT(5))
529#define ASEL_CAPABILITY_TX_SOUND_PPDUS_CAP ((u8) BIT(6))
530
a8d8410e
JM
531#define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK ((u8) BIT(0) | BIT(1))
532#define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE ((u8) BIT(0))
533#define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW ((u8) BIT(0) | BIT(1))
de9289c8
JM
534#define HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH ((u8) BIT(2))
535#define HT_INFO_HT_PARAM_RIFS_MODE ((u8) BIT(3))
536#define HT_INFO_HT_PARAM_CTRL_ACCESS_ONLY ((u8) BIT(4))
537#define HT_INFO_HT_PARAM_SRV_INTERVAL_GRANULARITY ((u8) BIT(5))
538
3a328c81
JM
539
540#define OP_MODE_PURE 0
541#define OP_MODE_MAY_BE_LEGACY_STAS 1
542#define OP_MODE_20MHZ_HT_STA_ASSOCED 2
543#define OP_MODE_MIXED 3
544
de9289c8
JM
545#define HT_INFO_OPERATION_MODE_OP_MODE_MASK \
546 ((le16) (0x0001 | 0x0002))
547#define HT_INFO_OPERATION_MODE_OP_MODE_OFFSET 0
548#define HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT ((u8) BIT(2))
549#define HT_INFO_OPERATION_MODE_TRANSMIT_BURST_LIMIT ((u8) BIT(3))
550#define HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT ((u8) BIT(4))
551
552#define HT_INFO_STBC_PARAM_DUAL_BEACON ((u16) BIT(6))
553#define HT_INFO_STBC_PARAM_DUAL_STBC_PROTECT ((u16) BIT(7))
554#define HT_INFO_STBC_PARAM_SECONDARY_BCN ((u16) BIT(8))
555#define HT_INFO_STBC_PARAM_LSIG_TXOP_PROTECT_ALLOWED ((u16) BIT(9))
556#define HT_INFO_STBC_PARAM_PCO_ACTIVE ((u16) BIT(10))
557#define HT_INFO_STBC_PARAM_PCO_PHASE ((u16) BIT(11))
558
29448243 559#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
de9289c8 560
cb7b04c8
JM
561#define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
562 * 00:50:F2 */
6fe82961
JM
563#define WPA_IE_VENDOR_TYPE 0x0050f201
564#define WPS_IE_VENDOR_TYPE 0x0050f204
dd6cc5a2
JM
565#define OUI_WFA 0x506f9a
566#define P2P_IE_VENDOR_TYPE 0x506f9a09
cb7b04c8 567
3ae0800c
JM
568#define WMM_OUI_TYPE 2
569#define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
570#define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
571#define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
572#define WMM_VERSION 1
573
574#define WMM_ACTION_CODE_ADDTS_REQ 0
575#define WMM_ACTION_CODE_ADDTS_RESP 1
576#define WMM_ACTION_CODE_DELTS 2
577
578#define WMM_ADDTS_STATUS_ADMISSION_ACCEPTED 0
579#define WMM_ADDTS_STATUS_INVALID_PARAMETERS 1
580/* 2 - Reserved */
581#define WMM_ADDTS_STATUS_REFUSED 3
582/* 4-255 - Reserved */
583
584/* WMM TSPEC Direction Field Values */
585#define WMM_TSPEC_DIRECTION_UPLINK 0
586#define WMM_TSPEC_DIRECTION_DOWNLINK 1
587/* 2 - Reserved */
588#define WMM_TSPEC_DIRECTION_BI_DIRECTIONAL 3
cb7b04c8 589
ed843aaa
JM
590/*
591 * WMM Information Element (used in (Re)Association Request frames; may also be
592 * used in Beacon frames)
593 */
594struct wmm_information_element {
595 /* Element ID: 221 (0xdd); Length: 7 */
596 /* required fields for WMM version 1 */
597 u8 oui[3]; /* 00:50:f2 */
598 u8 oui_type; /* 2 */
599 u8 oui_subtype; /* 0 */
600 u8 version; /* 1 for WMM version 1.0 */
601 u8 qos_info; /* AP/STA specific QoS info */
602
603} STRUCT_PACKED;
604
605#define WMM_AC_AIFSN_MASK 0x0f
606#define WMM_AC_AIFNS_SHIFT 0
607#define WMM_AC_ACM 0x10
608#define WMM_AC_ACI_MASK 0x60
609#define WMM_AC_ACI_SHIFT 5
610
611#define WMM_AC_ECWMIN_MASK 0x0f
612#define WMM_AC_ECWMIN_SHIFT 0
613#define WMM_AC_ECWMAX_MASK 0xf0
614#define WMM_AC_ECWMAX_SHIFT 4
615
616struct wmm_ac_parameter {
617 u8 aci_aifsn; /* AIFSN, ACM, ACI */
618 u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
619 le16 txop_limit;
620} STRUCT_PACKED;
621
622/*
623 * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
624 * Response frmaes)
625 */
626struct wmm_parameter_element {
627 /* Element ID: 221 (0xdd); Length: 24 */
628 /* required fields for WMM version 1 */
629 u8 oui[3]; /* 00:50:f2 */
630 u8 oui_type; /* 2 */
631 u8 oui_subtype; /* 1 */
632 u8 version; /* 1 for WMM version 1.0 */
ffbf1eaa 633 u8 qos_info; /* AP/STA specific QoS info */
ed843aaa
JM
634 u8 reserved; /* 0 */
635 struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
636
637} STRUCT_PACKED;
638
639/* WMM TSPEC Element */
640struct wmm_tspec_element {
641 u8 eid; /* 221 = 0xdd */
642 u8 length; /* 6 + 55 = 61 */
643 u8 oui[3]; /* 00:50:f2 */
644 u8 oui_type; /* 2 */
645 u8 oui_subtype; /* 2 */
646 u8 version; /* 1 */
647 /* WMM TSPEC body (55 octets): */
648 u8 ts_info[3];
649 le16 nominal_msdu_size;
650 le16 maximum_msdu_size;
651 le32 minimum_service_interval;
652 le32 maximum_service_interval;
653 le32 inactivity_interval;
654 le32 suspension_interval;
655 le32 service_start_time;
656 le32 minimum_data_rate;
657 le32 mean_data_rate;
658 le32 peak_data_rate;
659 le32 maximum_burst_size;
660 le32 delay_bound;
661 le32 minimum_phy_rate;
662 le16 surplus_bandwidth_allowance;
663 le16 medium_time;
664} STRUCT_PACKED;
665
666
667/* Access Categories / ACI to AC coding */
668enum {
669 WMM_AC_BE = 0 /* Best Effort */,
670 WMM_AC_BK = 1 /* Background */,
671 WMM_AC_VI = 2 /* Video */,
672 WMM_AC_VO = 3 /* Voice */
673};
674
15828ba8 675
dd6cc5a2
JM
676/* Wi-Fi Direct (P2P) */
677
678#define P2P_OUI_TYPE 9
679
680enum p2p_attr_id {
681 P2P_ATTR_STATUS = 0,
682 P2P_ATTR_MINOR_REASON_CODE = 1,
683 P2P_ATTR_CAPABILITY = 2,
684 P2P_ATTR_DEVICE_ID = 3,
685 P2P_ATTR_GROUP_OWNER_INTENT = 4,
686 P2P_ATTR_CONFIGURATION_TIMEOUT = 5,
687 P2P_ATTR_LISTEN_CHANNEL = 6,
688 P2P_ATTR_GROUP_BSSID = 7,
689 P2P_ATTR_EXT_LISTEN_TIMING = 8,
690 P2P_ATTR_INTENDED_INTERFACE_ADDR = 9,
691 P2P_ATTR_MANAGEABILITY = 10,
692 P2P_ATTR_CHANNEL_LIST = 11,
693 P2P_ATTR_NOTICE_OF_ABSENCE = 12,
694 P2P_ATTR_DEVICE_INFO = 13,
695 P2P_ATTR_GROUP_INFO = 14,
696 P2P_ATTR_GROUP_ID = 15,
697 P2P_ATTR_INTERFACE = 16,
698 P2P_ATTR_OPERATING_CHANNEL = 17,
699 P2P_ATTR_INVITATION_FLAGS = 18,
700 P2P_ATTR_VENDOR_SPECIFIC = 221
701};
702
703#define P2P_MAX_GO_INTENT 15
704
705/* P2P Capability - Device Capability bitmap */
706#define P2P_DEV_CAPAB_SERVICE_DISCOVERY BIT(0)
707#define P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY BIT(1)
708#define P2P_DEV_CAPAB_CONCURRENT_OPER BIT(2)
709#define P2P_DEV_CAPAB_INFRA_MANAGED BIT(3)
710#define P2P_DEV_CAPAB_DEVICE_LIMIT BIT(4)
711#define P2P_DEV_CAPAB_INVITATION_PROCEDURE BIT(5)
712
713/* P2P Capability - Group Capability bitmap */
714#define P2P_GROUP_CAPAB_GROUP_OWNER BIT(0)
715#define P2P_GROUP_CAPAB_PERSISTENT_GROUP BIT(1)
716#define P2P_GROUP_CAPAB_GROUP_LIMIT BIT(2)
717#define P2P_GROUP_CAPAB_INTRA_BSS_DIST BIT(3)
718#define P2P_GROUP_CAPAB_CROSS_CONN BIT(4)
719#define P2P_GROUP_CAPAB_PERSISTENT_RECONN BIT(5)
720#define P2P_GROUP_CAPAB_GROUP_FORMATION BIT(6)
721
722/* Invitation Flags */
723#define P2P_INVITATION_FLAGS_TYPE BIT(0)
724
6c6915f3
JM
725/* P2P Manageability */
726#define P2P_MAN_DEVICE_MANAGEMENT BIT(0)
b74c19fa 727#define P2P_MAN_CROSS_CONNECTION_PERMITTED BIT(1)
6c6915f3
JM
728#define P2P_MAN_COEXISTENCE_OPTIONAL BIT(2)
729
dd6cc5a2
JM
730enum p2p_status_code {
731 P2P_SC_SUCCESS = 0,
732 P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE = 1,
733 P2P_SC_FAIL_INCOMPATIBLE_PARAMS = 2,
734 P2P_SC_FAIL_LIMIT_REACHED = 3,
735 P2P_SC_FAIL_INVALID_PARAMS = 4,
736 P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE = 5,
737 P2P_SC_FAIL_PREV_PROTOCOL_ERROR = 6,
738 P2P_SC_FAIL_NO_COMMON_CHANNELS = 7,
739 P2P_SC_FAIL_UNKNOWN_GROUP = 8,
740 P2P_SC_FAIL_BOTH_GO_INTENT_15 = 9,
741 P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD = 10,
742 P2P_SC_FAIL_REJECTED_BY_USER = 11,
743};
744
745#define P2P_WILDCARD_SSID "DIRECT-"
746#define P2P_WILDCARD_SSID_LEN 7
747
748/* P2P action frames */
749enum p2p_act_frame_type {
750 P2P_NOA = 0,
751 P2P_PRESENCE_REQ = 1,
752 P2P_PRESENCE_RESP = 2,
753 P2P_GO_DISC_REQ = 3
754};
755
756/* P2P public action frames */
757enum p2p_action_frame_type {
758 P2P_GO_NEG_REQ = 0,
759 P2P_GO_NEG_RESP = 1,
760 P2P_GO_NEG_CONF = 2,
761 P2P_INVITATION_REQ = 3,
762 P2P_INVITATION_RESP = 4,
763 P2P_DEV_DISC_REQ = 5,
764 P2P_DEV_DISC_RESP = 6,
765 P2P_PROV_DISC_REQ = 7,
766 P2P_PROV_DISC_RESP = 8
767};
768
769enum p2p_service_protocol_type {
770 P2P_SERV_ALL_SERVICES = 0,
771 P2P_SERV_BONJOUR = 1,
772 P2P_SERV_UPNP = 2,
773 P2P_SERV_WS_DISCOVERY = 3,
774 P2P_SERV_VENDOR_SPECIFIC = 255
775};
776
777enum p2p_sd_status {
778 P2P_SD_SUCCESS = 0,
779 P2P_SD_PROTO_NOT_AVAILABLE = 1,
bf608cad 780 P2P_SD_REQUESTED_INFO_NOT_AVAILABLE = 2,
dd6cc5a2
JM
781 P2P_SD_BAD_REQUEST = 3
782};
783
784
15828ba8
JM
785#define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
786
787#define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
788
8d6ca178
ZY
789/* cipher suite selectors */
790#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
791#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
792#define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
793/* reserved: 0x000FAC03 */
794#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
795#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
796#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
797
798/* AKM suite selectors */
799#define WLAN_AKM_SUITE_8021X 0x000FAC01
800#define WLAN_AKM_SUITE_PSK 0x000FAC02
801
6fc6879b 802#endif /* IEEE802_11_DEFS_H */