dhd: rename 100.10.315.x to 100.10.545.x
[GitHub/LineageOS/G12/android_hardware_amlogic_kernel-modules_dhd-driver.git] / bcmdhd.100.10.545.x / include / p2p.h
CommitLineData
d2839953
RC
1/*
2 * Fundamental types and constants relating to WFA P2P (aka WiFi Direct)
3 *
965f77c4 4 * Copyright (C) 1999-2019, Broadcom.
d2839953
RC
5 *
6 * Unless you and Broadcom execute a separate written software license
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
11 *
12 * As a special exception, the copyright holders of this software give you
13 * permission to link this software with independent modules, and to copy and
14 * distribute the resulting executable under terms of your choice, provided that
15 * you also meet, for each linked independent module, the terms and conditions of
16 * the license of that module. An independent module is a module which is not
17 * derived from this software. The special exception does not apply to any
18 * modifications of the software.
19 *
20 * Notwithstanding the above, under no circumstances may you combine this
21 * software in any way with any other Broadcom software provided under a license
22 * other than the GPL, without Broadcom's express prior written consent.
23 *
24 *
25 * <<Broadcom-WL-IPTag/Open:>>
26 *
27 * $Id: p2p.h 757905 2018-04-16 23:16:27Z $
28 */
29
30#ifndef _P2P_H_
31#define _P2P_H_
32
33#ifndef _TYPEDEFS_H_
34#include <typedefs.h>
35#endif // endif
36#include <wlioctl.h>
37#include <802.11.h>
38
39/* This marks the start of a packed structure section. */
40#include <packed_section_start.h>
41
42/* WiFi P2P OUI values */
43#define P2P_VER WFA_OUI_TYPE_P2P /* P2P version: 9=WiFi P2P v1.0 */
44
45#define P2P_IE_ID 0xdd /* P2P IE element ID */
46
47/* WiFi P2P IE */
48BWL_PRE_PACKED_STRUCT struct wifi_p2p_ie {
49 uint8 id; /* IE ID: 0xDD */
50 uint8 len; /* IE length */
51 uint8 OUI[3]; /* WiFi P2P specific OUI: P2P_OUI */
52 uint8 oui_type; /* Identifies P2P version: P2P_VER */
53 uint8 subelts[1]; /* variable length subelements */
54} BWL_POST_PACKED_STRUCT;
55typedef struct wifi_p2p_ie wifi_p2p_ie_t;
56
57#define P2P_IE_FIXED_LEN 6
58
59#define P2P_ATTR_ID_OFF 0
60#define P2P_ATTR_LEN_OFF 1
61#define P2P_ATTR_DATA_OFF 3
62
63#define P2P_ATTR_ID_LEN 1 /* ID filed length */
64#define P2P_ATTR_LEN_LEN 2 /* length field length */
65#define P2P_ATTR_HDR_LEN 3 /* ID + 2-byte length field spec 1.02 */
66
67#define P2P_WFDS_HASH_LEN 6
68#define P2P_WFDS_MAX_SVC_NAME_LEN 32
69
70/* P2P IE Subelement IDs from WiFi P2P Technical Spec 1.00 */
71#define P2P_SEID_STATUS 0 /* Status */
72#define P2P_SEID_MINOR_RC 1 /* Minor Reason Code */
73#define P2P_SEID_P2P_INFO 2 /* P2P Capability (capabilities info) */
74#define P2P_SEID_DEV_ID 3 /* P2P Device ID */
75#define P2P_SEID_INTENT 4 /* Group Owner Intent */
76#define P2P_SEID_CFG_TIMEOUT 5 /* Configuration Timeout */
77#define P2P_SEID_CHANNEL 6 /* Listen channel */
78#define P2P_SEID_GRP_BSSID 7 /* P2P Group BSSID */
79#define P2P_SEID_XT_TIMING 8 /* Extended Listen Timing */
80#define P2P_SEID_INTINTADDR 9 /* Intended P2P Interface Address */
81#define P2P_SEID_P2P_MGBTY 10 /* P2P Manageability */
82#define P2P_SEID_CHAN_LIST 11 /* Channel List */
83#define P2P_SEID_ABSENCE 12 /* Notice of Absence */
84#define P2P_SEID_DEV_INFO 13 /* Device Info */
85#define P2P_SEID_GROUP_INFO 14 /* Group Info */
86#define P2P_SEID_GROUP_ID 15 /* Group ID */
87#define P2P_SEID_P2P_IF 16 /* P2P Interface */
88#define P2P_SEID_OP_CHANNEL 17 /* Operating Channel */
89#define P2P_SEID_INVITE_FLAGS 18 /* Invitation Flags */
90#define P2P_SEID_SERVICE_HASH 21 /* Service hash */
91#define P2P_SEID_SESSION 22 /* Session information */
92#define P2P_SEID_CONNECT_CAP 23 /* Connection capability */
93#define P2P_SEID_ADVERTISE_ID 24 /* Advertisement ID */
94#define P2P_SEID_ADVERTISE_SERVICE 25 /* Advertised service */
95#define P2P_SEID_SESSION_ID 26 /* Session ID */
96#define P2P_SEID_FEATURE_CAP 27 /* Feature capability */
97#define P2P_SEID_PERSISTENT_GROUP 28 /* Persistent group */
98#define P2P_SEID_SESSION_INFO_RESP 29 /* Session Information Response */
99#define P2P_SEID_VNDR 221 /* Vendor-specific subelement */
100
101#define P2P_SE_VS_ID_SERVICES 0x1b
102
103/* WiFi P2P IE subelement: P2P Capability (capabilities info) */
104BWL_PRE_PACKED_STRUCT struct wifi_p2p_info_se_s {
105 uint8 eltId; /* SE ID: P2P_SEID_P2P_INFO */
106 uint8 len[2]; /* SE length not including eltId, len fields */
107 uint8 dev; /* Device Capability Bitmap */
108 uint8 group; /* Group Capability Bitmap */
109} BWL_POST_PACKED_STRUCT;
110typedef struct wifi_p2p_info_se_s wifi_p2p_info_se_t;
111
112/* P2P Capability subelement's Device Capability Bitmap bit values */
113#define P2P_CAPSE_DEV_SERVICE_DIS 0x1 /* Service Discovery */
114#define P2P_CAPSE_DEV_CLIENT_DIS 0x2 /* Client Discoverability */
115#define P2P_CAPSE_DEV_CONCURRENT 0x4 /* Concurrent Operation */
116#define P2P_CAPSE_DEV_INFRA_MAN 0x8 /* P2P Infrastructure Managed */
117#define P2P_CAPSE_DEV_LIMIT 0x10 /* P2P Device Limit */
118#define P2P_CAPSE_INVITE_PROC 0x20 /* P2P Invitation Procedure */
119
120/* P2P Capability subelement's Group Capability Bitmap bit values */
121#define P2P_CAPSE_GRP_OWNER 0x1 /* P2P Group Owner */
122#define P2P_CAPSE_PERSIST_GRP 0x2 /* Persistent P2P Group */
123#define P2P_CAPSE_GRP_LIMIT 0x4 /* P2P Group Limit */
124#define P2P_CAPSE_GRP_INTRA_BSS 0x8 /* Intra-BSS Distribution */
125#define P2P_CAPSE_GRP_X_CONNECT 0x10 /* Cross Connection */
126#define P2P_CAPSE_GRP_PERSISTENT 0x20 /* Persistent Reconnect */
127#define P2P_CAPSE_GRP_FORMATION 0x40 /* Group Formation */
128
129/* WiFi P2P IE subelement: Group Owner Intent */
130BWL_PRE_PACKED_STRUCT struct wifi_p2p_intent_se_s {
131 uint8 eltId; /* SE ID: P2P_SEID_INTENT */
132 uint8 len[2]; /* SE length not including eltId, len fields */
133 uint8 intent; /* Intent Value 0...15 (0=legacy 15=master only) */
134} BWL_POST_PACKED_STRUCT;
135typedef struct wifi_p2p_intent_se_s wifi_p2p_intent_se_t;
136
137/* WiFi P2P IE subelement: Configuration Timeout */
138BWL_PRE_PACKED_STRUCT struct wifi_p2p_cfg_tmo_se_s {
139 uint8 eltId; /* SE ID: P2P_SEID_CFG_TIMEOUT */
140 uint8 len[2]; /* SE length not including eltId, len fields */
141 uint8 go_tmo; /* GO config timeout in units of 10 ms */
142 uint8 client_tmo; /* Client config timeout in units of 10 ms */
143} BWL_POST_PACKED_STRUCT;
144typedef struct wifi_p2p_cfg_tmo_se_s wifi_p2p_cfg_tmo_se_t;
145
146/* WiFi P2P IE subelement: Listen Channel */
147BWL_PRE_PACKED_STRUCT struct wifi_p2p_listen_channel_se_s {
148 uint8 eltId; /* SE ID: P2P_SEID_CHANNEL */
149 uint8 len[2]; /* SE length not including eltId, len fields */
150 uint8 country[3]; /* Country String */
151 uint8 op_class; /* Operating Class */
152 uint8 channel; /* Channel */
153} BWL_POST_PACKED_STRUCT;
154typedef struct wifi_p2p_listen_channel_se_s wifi_p2p_listen_channel_se_t;
155
156/* WiFi P2P IE subelement: P2P Group BSSID */
157BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_bssid_se_s {
158 uint8 eltId; /* SE ID: P2P_SEID_GRP_BSSID */
159 uint8 len[2]; /* SE length not including eltId, len fields */
160 uint8 mac[6]; /* P2P group bssid */
161} BWL_POST_PACKED_STRUCT;
162typedef struct wifi_p2p_grp_bssid_se_s wifi_p2p_grp_bssid_se_t;
163
164/* WiFi P2P IE subelement: P2P Group ID */
165BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_id_se_s {
166 uint8 eltId; /* SE ID: P2P_SEID_GROUP_ID */
167 uint8 len[2]; /* SE length not including eltId, len fields */
168 uint8 mac[6]; /* P2P device address */
169 uint8 ssid[1]; /* ssid. device id. variable length */
170} BWL_POST_PACKED_STRUCT;
171typedef struct wifi_p2p_grp_id_se_s wifi_p2p_grp_id_se_t;
172
173/* WiFi P2P IE subelement: P2P Interface */
174BWL_PRE_PACKED_STRUCT struct wifi_p2p_intf_se_s {
175 uint8 eltId; /* SE ID: P2P_SEID_P2P_IF */
176 uint8 len[2]; /* SE length not including eltId, len fields */
177 uint8 mac[6]; /* P2P device address */
178 uint8 ifaddrs; /* P2P Interface Address count */
179 uint8 ifaddr[1][6]; /* P2P Interface Address list */
180} BWL_POST_PACKED_STRUCT;
181typedef struct wifi_p2p_intf_se_s wifi_p2p_intf_se_t;
182
183/* WiFi P2P IE subelement: Status */
184BWL_PRE_PACKED_STRUCT struct wifi_p2p_status_se_s {
185 uint8 eltId; /* SE ID: P2P_SEID_STATUS */
186 uint8 len[2]; /* SE length not including eltId, len fields */
187 uint8 status; /* Status Code: P2P_STATSE_* */
188} BWL_POST_PACKED_STRUCT;
189typedef struct wifi_p2p_status_se_s wifi_p2p_status_se_t;
190
191/* Status subelement Status Code definitions */
192#define P2P_STATSE_SUCCESS 0
193 /* Success */
194#define P2P_STATSE_FAIL_INFO_CURR_UNAVAIL 1
195 /* Failed, information currently unavailable */
196#define P2P_STATSE_PASSED_UP P2P_STATSE_FAIL_INFO_CURR_UNAVAIL
197 /* Old name for above in P2P spec 1.08 and older */
198#define P2P_STATSE_FAIL_INCOMPAT_PARAMS 2
199 /* Failed, incompatible parameters */
200#define P2P_STATSE_FAIL_LIMIT_REACHED 3
201 /* Failed, limit reached */
202#define P2P_STATSE_FAIL_INVALID_PARAMS 4
203 /* Failed, invalid parameters */
204#define P2P_STATSE_FAIL_UNABLE_TO_ACCOM 5
205 /* Failed, unable to accomodate request */
206#define P2P_STATSE_FAIL_PROTO_ERROR 6
207 /* Failed, previous protocol error or disruptive behaviour */
208#define P2P_STATSE_FAIL_NO_COMMON_CHAN 7
209 /* Failed, no common channels */
210#define P2P_STATSE_FAIL_UNKNOWN_GROUP 8
211 /* Failed, unknown P2P Group */
212#define P2P_STATSE_FAIL_INTENT 9
213 /* Failed, both peers indicated Intent 15 in GO Negotiation */
214#define P2P_STATSE_FAIL_INCOMPAT_PROVIS 10
215 /* Failed, incompatible provisioning method */
216#define P2P_STATSE_FAIL_USER_REJECT 11
217 /* Failed, rejected by user */
218#define P2P_STATSE_SUCCESS_USER_ACCEPT 12
219 /* Success, accepted by user */
220
221/* WiFi P2P IE attribute: Extended Listen Timing */
222BWL_PRE_PACKED_STRUCT struct wifi_p2p_ext_se_s {
223 uint8 eltId; /* ID: P2P_SEID_EXT_TIMING */
224 uint8 len[2]; /* length not including eltId, len fields */
225 uint8 avail[2]; /* availibility period */
226 uint8 interval[2]; /* availibility interval */
227} BWL_POST_PACKED_STRUCT;
228typedef struct wifi_p2p_ext_se_s wifi_p2p_ext_se_t;
229
230#define P2P_EXT_MIN 10 /* minimum 10ms */
231
232/* WiFi P2P IE subelement: Intended P2P Interface Address */
233BWL_PRE_PACKED_STRUCT struct wifi_p2p_intintad_se_s {
234 uint8 eltId; /* SE ID: P2P_SEID_INTINTADDR */
235 uint8 len[2]; /* SE length not including eltId, len fields */
236 uint8 mac[6]; /* intended P2P interface MAC address */
237} BWL_POST_PACKED_STRUCT;
238typedef struct wifi_p2p_intintad_se_s wifi_p2p_intintad_se_t;
239
240/* WiFi P2P IE subelement: Channel */
241BWL_PRE_PACKED_STRUCT struct wifi_p2p_channel_se_s {
242 uint8 eltId; /* SE ID: P2P_SEID_STATUS */
243 uint8 len[2]; /* SE length not including eltId, len fields */
244 uint8 band; /* Regulatory Class (band) */
245 uint8 channel; /* Channel */
246} BWL_POST_PACKED_STRUCT;
247typedef struct wifi_p2p_channel_se_s wifi_p2p_channel_se_t;
248
249/* Channel Entry structure within the Channel List SE */
250BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_entry_s {
251 uint8 band; /* Regulatory Class (band) */
252 uint8 num_channels; /* # of channels in the channel list */
253 uint8 channels[WL_NUMCHANNELS]; /* Channel List */
254} BWL_POST_PACKED_STRUCT;
255typedef struct wifi_p2p_chanlist_entry_s wifi_p2p_chanlist_entry_t;
256#define WIFI_P2P_CHANLIST_SE_MAX_ENTRIES 2
257
258/* WiFi P2P IE subelement: Channel List */
259BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_se_s {
260 uint8 eltId; /* SE ID: P2P_SEID_CHAN_LIST */
261 uint8 len[2]; /* SE length not including eltId, len fields */
262 uint8 country[3]; /* Country String */
263 uint8 num_entries; /* # of channel entries */
264 wifi_p2p_chanlist_entry_t entries[WIFI_P2P_CHANLIST_SE_MAX_ENTRIES];
265 /* Channel Entry List */
266} BWL_POST_PACKED_STRUCT;
267typedef struct wifi_p2p_chanlist_se_s wifi_p2p_chanlist_se_t;
268
269/* WiFi Primary Device Type structure */
270BWL_PRE_PACKED_STRUCT struct wifi_p2p_pri_devtype_s {
271 uint16 cat_id; /* Category ID */
272 uint8 OUI[3]; /* WFA OUI: 0x0050F2 */
273 uint8 oui_type; /* WPS_OUI_TYPE */
274 uint16 sub_cat_id; /* Sub Category ID */
275} BWL_POST_PACKED_STRUCT;
276typedef struct wifi_p2p_pri_devtype_s wifi_p2p_pri_devtype_t;
277
278/* WiFi P2P Device Info Sub Element Primary Device Type Sub Category
279 * maximum values for each category
280 */
281#define P2P_DISE_SUBCATEGORY_MINVAL 1
282#define P2P_DISE_CATEGORY_COMPUTER 1
283#define P2P_DISE_SUBCATEGORY_COMPUTER_MAXVAL 8
284#define P2P_DISE_CATEGORY_INPUT_DEVICE 2
285#define P2P_DISE_SUBCATEGORY_INPUT_DEVICE_MAXVAL 9
286#define P2P_DISE_CATEGORY_PRINTER 3
287#define P2P_DISE_SUBCATEGORY_PRINTER_MAXVAL 5
288#define P2P_DISE_CATEGORY_CAMERA 4
289#define P2P_DISE_SUBCATEGORY_CAMERA_MAXVAL 4
290#define P2P_DISE_CATEGORY_STORAGE 5
291#define P2P_DISE_SUBCATEGORY_STORAGE_MAXVAL 1
292#define P2P_DISE_CATEGORY_NETWORK_INFRA 6
293#define P2P_DISE_SUBCATEGORY_NETWORK_INFRA_MAXVAL 4
294#define P2P_DISE_CATEGORY_DISPLAY 7
295#define P2P_DISE_SUBCATEGORY_DISPLAY_MAXVAL 4
296#define P2P_DISE_CATEGORY_MULTIMEDIA 8
297#define P2P_DISE_SUBCATEGORY_MULTIMEDIA_MAXVAL 6
298#define P2P_DISE_CATEGORY_GAMING 9
299#define P2P_DISE_SUBCATEGORY_GAMING_MAXVAL 5
300#define P2P_DISE_CATEGORY_TELEPHONE 10
301#define P2P_DISE_SUBCATEGORY_TELEPHONE_MAXVAL 5
302#define P2P_DISE_CATEGORY_AUDIO 11
303#define P2P_DISE_SUBCATEGORY_AUDIO_MAXVAL 6
304
305/* WiFi P2P IE's Device Info subelement */
306BWL_PRE_PACKED_STRUCT struct wifi_p2p_devinfo_se_s {
307 uint8 eltId; /* SE ID: P2P_SEID_DEVINFO */
308 uint8 len[2]; /* SE length not including eltId, len fields */
309 uint8 mac[6]; /* P2P Device MAC address */
310 uint16 wps_cfg_meths; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */
311 uint8 pri_devtype[8]; /* Primary Device Type */
312} BWL_POST_PACKED_STRUCT;
313typedef struct wifi_p2p_devinfo_se_s wifi_p2p_devinfo_se_t;
314
315#define P2P_DEV_TYPE_LEN 8
316
317/* WiFi P2P IE's Group Info subelement Client Info Descriptor */
318BWL_PRE_PACKED_STRUCT struct wifi_p2p_cid_fixed_s {
319 uint8 len;
320 uint8 devaddr[ETHER_ADDR_LEN]; /* P2P Device Address */
321 uint8 ifaddr[ETHER_ADDR_LEN]; /* P2P Interface Address */
322 uint8 devcap; /* Device Capability */
323 uint8 cfg_meths[2]; /* Config Methods: reg_prototlv.h WPS_CONFMET_* */
324 uint8 pridt[P2P_DEV_TYPE_LEN]; /* Primary Device Type */
325 uint8 secdts; /* Number of Secondary Device Types */
326} BWL_POST_PACKED_STRUCT;
327typedef struct wifi_p2p_cid_fixed_s wifi_p2p_cid_fixed_t;
328
329/* WiFi P2P IE's Device ID subelement */
330BWL_PRE_PACKED_STRUCT struct wifi_p2p_devid_se_s {
331 uint8 eltId;
332 uint8 len[2];
333 struct ether_addr addr; /* P2P Device MAC address */
334} BWL_POST_PACKED_STRUCT;
335typedef struct wifi_p2p_devid_se_s wifi_p2p_devid_se_t;
336
337/* WiFi P2P IE subelement: P2P Manageability */
338BWL_PRE_PACKED_STRUCT struct wifi_p2p_mgbt_se_s {
339 uint8 eltId; /* SE ID: P2P_SEID_P2P_MGBTY */
340 uint8 len[2]; /* SE length not including eltId, len fields */
341 uint8 mg_bitmap; /* manageability bitmap */
342} BWL_POST_PACKED_STRUCT;
343typedef struct wifi_p2p_mgbt_se_s wifi_p2p_mgbt_se_t;
344/* mg_bitmap field bit values */
345#define P2P_MGBTSE_P2PDEVMGMT_FLAG 0x1 /* AP supports Managed P2P Device */
346
347/* WiFi P2P IE subelement: Group Info */
348BWL_PRE_PACKED_STRUCT struct wifi_p2p_grpinfo_se_s {
349 uint8 eltId; /* SE ID: P2P_SEID_GROUP_INFO */
350 uint8 len[2]; /* SE length not including eltId, len fields */
351} BWL_POST_PACKED_STRUCT;
352typedef struct wifi_p2p_grpinfo_se_s wifi_p2p_grpinfo_se_t;
353
354/* WiFi IE subelement: Operating Channel */
355BWL_PRE_PACKED_STRUCT struct wifi_p2p_op_channel_se_s {
356 uint8 eltId; /* SE ID: P2P_SEID_OP_CHANNEL */
357 uint8 len[2]; /* SE length not including eltId, len fields */
358 uint8 country[3]; /* Country String */
359 uint8 op_class; /* Operating Class */
360 uint8 channel; /* Channel */
361} BWL_POST_PACKED_STRUCT;
362typedef struct wifi_p2p_op_channel_se_s wifi_p2p_op_channel_se_t;
363
364/* WiFi IE subelement: INVITATION FLAGS */
365BWL_PRE_PACKED_STRUCT struct wifi_p2p_invite_flags_se_s {
366 uint8 eltId; /* SE ID: P2P_SEID_INVITE_FLAGS */
367 uint8 len[2]; /* SE length not including eltId, len fields */
368 uint8 flags; /* Flags */
369} BWL_POST_PACKED_STRUCT;
370typedef struct wifi_p2p_invite_flags_se_s wifi_p2p_invite_flags_se_t;
371
372/* WiFi P2P IE subelement: Service Hash */
373BWL_PRE_PACKED_STRUCT struct wifi_p2p_serv_hash_se_s {
374 uint8 eltId; /* SE ID: P2P_SEID_SERVICE_HASH */
375 uint8 len[2]; /* SE length not including eltId, len fields
376 * in multiple of 6 Bytes
377 */
378 uint8 hash[1]; /* Variable length - SHA256 hash of
379 * service names (can be more than one hashes)
380 */
381} BWL_POST_PACKED_STRUCT;
382typedef struct wifi_p2p_serv_hash_se_s wifi_p2p_serv_hash_se_t;
383
384/* WiFi P2P IE subelement: Service Instance Data */
385BWL_PRE_PACKED_STRUCT struct wifi_p2p_serv_inst_data_se_s {
386 uint8 eltId; /* SE ID: P2P_SEID_SESSION */
387 uint8 len[2]; /* SE length not including eltId, len */
388 uint8 ssn_info[1]; /* Variable length - Session information as specified by
389 * the service layer, type matches serv. name
390 */
391} BWL_POST_PACKED_STRUCT;
392typedef struct wifi_p2p_serv_inst_data_se_s wifi_p2p_serv_inst_data_se_t;
393
394/* WiFi P2P IE subelement: Connection capability */
395BWL_PRE_PACKED_STRUCT struct wifi_p2p_conn_cap_data_se_s {
396 uint8 eltId; /* SE ID: P2P_SEID_CONNECT_CAP */
397 uint8 len[2]; /* SE length not including eltId, len */
398 uint8 conn_cap; /* 1byte capability as specified by the
399 * service layer, valid bitmask/values
400 */
401} BWL_POST_PACKED_STRUCT;
402typedef struct wifi_p2p_conn_cap_data_se_s wifi_p2p_conn_cap_data_se_t;
403
404/* WiFi P2P IE subelement: Advertisement ID */
405BWL_PRE_PACKED_STRUCT struct wifi_p2p_advt_id_se_s {
406 uint8 eltId; /* SE ID: P2P_SEID_ADVERTISE_ID */
407 uint8 len[2]; /* SE length not including eltId, len fixed 4 Bytes */
408 uint8 advt_id[4]; /* 4byte Advertisement ID of the peer device sent in
409 * PROV Disc in Network byte order
410 */
411 uint8 advt_mac[6]; /* P2P device address of the service advertiser */
412} BWL_POST_PACKED_STRUCT;
413typedef struct wifi_p2p_advt_id_se_s wifi_p2p_advt_id_se_t;
414
415/* WiFi P2P IE subelement: Advertise Service Hash */
416BWL_PRE_PACKED_STRUCT struct wifi_p2p_adv_serv_info_s {
417 uint8 advt_id[4]; /* SE Advertise ID for the service */
418 uint16 nw_cfg_method; /* SE Network Config method for the service */
419 uint8 serv_name_len; /* SE length of the service name */
420 uint8 serv_name[1]; /* Variable length service name field */
421} BWL_POST_PACKED_STRUCT;
422typedef struct wifi_p2p_adv_serv_info_s wifi_p2p_adv_serv_info_t;
423
424/* WiFi P2P IE subelement: Advertise Service Hash */
425BWL_PRE_PACKED_STRUCT struct wifi_p2p_advt_serv_se_s {
426 uint8 eltId; /* SE ID: P2P_SEID_ADVERTISE_SERVICE */
427 uint8 len[2]; /* SE length not including eltId, len fields mutiple len of
428 * wifi_p2p_adv_serv_info_t entries
429 */
430 wifi_p2p_adv_serv_info_t p_advt_serv_info[1]; /* Variable length
431 of multiple instances
432 of the advertise service info
433 */
434} BWL_POST_PACKED_STRUCT;
435typedef struct wifi_p2p_advt_serv_se_s wifi_p2p_advt_serv_se_t;
436
437/* WiFi P2P IE subelement: Session ID */
438BWL_PRE_PACKED_STRUCT struct wifi_p2p_ssn_id_se_s {
439 uint8 eltId; /* SE ID: P2P_SEID_SESSION_ID */
440 uint8 len[2]; /* SE length not including eltId, len fixed 4 Bytes */
441 uint8 ssn_id[4]; /* 4byte Session ID of the peer device sent in
442 * PROV Disc in Network byte order
443 */
444 uint8 ssn_mac[6]; /* P2P device address of the seeker - session mac */
445} BWL_POST_PACKED_STRUCT;
446typedef struct wifi_p2p_ssn_id_se_s wifi_p2p_ssn_id_se_t;
447
448#define P2P_ADVT_SERV_SE_FIXED_LEN 3 /* Includes only the element ID and len */
449#define P2P_ADVT_SERV_INFO_FIXED_LEN 7 /* Per ADV Service Instance advt_id +
450 * nw_config_method + serv_name_len
451 */
452
453/* WiFi P2P Action Frame */
454BWL_PRE_PACKED_STRUCT struct wifi_p2p_action_frame {
455 uint8 category; /* P2P_AF_CATEGORY */
456 uint8 OUI[3]; /* OUI - P2P_OUI */
457 uint8 type; /* OUI Type - P2P_VER */
458 uint8 subtype; /* OUI Subtype - P2P_AF_* */
459 uint8 dialog_token; /* nonzero, identifies req/resp tranaction */
460 uint8 elts[1]; /* Variable length information elements. Max size =
461 * ACTION_FRAME_SIZE - sizeof(this structure) - 1
462 */
463} BWL_POST_PACKED_STRUCT;
464typedef struct wifi_p2p_action_frame wifi_p2p_action_frame_t;
465#define P2P_AF_CATEGORY 0x7f
466
467#define P2P_AF_FIXED_LEN 7
468
469/* WiFi P2P Action Frame OUI Subtypes */
470#define P2P_AF_NOTICE_OF_ABSENCE 0 /* Notice of Absence */
471#define P2P_AF_PRESENCE_REQ 1 /* P2P Presence Request */
472#define P2P_AF_PRESENCE_RSP 2 /* P2P Presence Response */
473#define P2P_AF_GO_DISC_REQ 3 /* GO Discoverability Request */
474
475/* WiFi P2P Public Action Frame */
476BWL_PRE_PACKED_STRUCT struct wifi_p2p_pub_act_frame {
477 uint8 category; /* P2P_PUB_AF_CATEGORY */
478 uint8 action; /* P2P_PUB_AF_ACTION */
479 uint8 oui[3]; /* P2P_OUI */
480 uint8 oui_type; /* OUI type - P2P_VER */
481 uint8 subtype; /* OUI subtype - P2P_TYPE_* */
482 uint8 dialog_token; /* nonzero, identifies req/rsp transaction */
483 uint8 elts[1]; /* Variable length information elements. Max size =
484 * ACTION_FRAME_SIZE - sizeof(this structure) - 1
485 */
486} BWL_POST_PACKED_STRUCT;
487typedef struct wifi_p2p_pub_act_frame wifi_p2p_pub_act_frame_t;
488#define P2P_PUB_AF_FIXED_LEN 8
489#define P2P_PUB_AF_CATEGORY 0x04
490#define P2P_PUB_AF_ACTION 0x09
491
492/* WiFi P2P Public Action Frame OUI Subtypes */
493#define P2P_PAF_GON_REQ 0 /* Group Owner Negotiation Req */
494#define P2P_PAF_GON_RSP 1 /* Group Owner Negotiation Rsp */
495#define P2P_PAF_GON_CONF 2 /* Group Owner Negotiation Confirm */
496#define P2P_PAF_INVITE_REQ 3 /* P2P Invitation Request */
497#define P2P_PAF_INVITE_RSP 4 /* P2P Invitation Response */
498#define P2P_PAF_DEVDIS_REQ 5 /* Device Discoverability Request */
499#define P2P_PAF_DEVDIS_RSP 6 /* Device Discoverability Response */
500#define P2P_PAF_PROVDIS_REQ 7 /* Provision Discovery Request */
501#define P2P_PAF_PROVDIS_RSP 8 /* Provision Discovery Response */
502#define P2P_PAF_SUBTYPE_INVALID 255 /* Invalid Subtype */
503
504/* TODO: Stop using these obsolete aliases for P2P_PAF_GON_* */
505#define P2P_TYPE_MNREQ P2P_PAF_GON_REQ
506#define P2P_TYPE_MNRSP P2P_PAF_GON_RSP
507#define P2P_TYPE_MNCONF P2P_PAF_GON_CONF
508
509/* WiFi P2P IE subelement: Notice of Absence */
510BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_desc {
511 uint8 cnt_type; /* Count/Type */
512 uint32 duration; /* Duration */
513 uint32 interval; /* Interval */
514 uint32 start; /* Start Time */
515} BWL_POST_PACKED_STRUCT;
516typedef struct wifi_p2p_noa_desc wifi_p2p_noa_desc_t;
517
518BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_se {
519 uint8 eltId; /* Subelement ID */
520 uint8 len[2]; /* Length */
521 uint8 index; /* Index */
522 uint8 ops_ctw_parms; /* CTWindow and OppPS Parameters */
523 wifi_p2p_noa_desc_t desc[1]; /* Notice of Absence Descriptor(s) */
524} BWL_POST_PACKED_STRUCT;
525typedef struct wifi_p2p_noa_se wifi_p2p_noa_se_t;
526
527#define P2P_NOA_SE_FIXED_LEN 5
528
529#define P2P_NOA_SE_MAX_DESC 2 /* max NoA descriptors in presence request */
530
531/* cnt_type field values */
532#define P2P_NOA_DESC_CNT_RESERVED 0 /* reserved and should not be used */
533#define P2P_NOA_DESC_CNT_REPEAT 255 /* continuous schedule */
534#define P2P_NOA_DESC_TYPE_PREFERRED 1 /* preferred values */
535#define P2P_NOA_DESC_TYPE_ACCEPTABLE 2 /* acceptable limits */
536
537/* ctw_ops_parms field values */
538#define P2P_NOA_CTW_MASK 0x7f
539#define P2P_NOA_OPS_MASK 0x80
540#define P2P_NOA_OPS_SHIFT 7
541
542#define P2P_CTW_MIN 10 /* minimum 10TU */
543
544/*
545 * P2P Service Discovery related
546 */
547#define P2PSD_ACTION_CATEGORY 0x04
548 /* Public action frame */
549#define P2PSD_ACTION_ID_GAS_IREQ 0x0a
550 /* Action value for GAS Initial Request AF */
551#define P2PSD_ACTION_ID_GAS_IRESP 0x0b
552 /* Action value for GAS Initial Response AF */
553#define P2PSD_ACTION_ID_GAS_CREQ 0x0c
554 /* Action value for GAS Comeback Request AF */
555#define P2PSD_ACTION_ID_GAS_CRESP 0x0d
556 /* Action value for GAS Comeback Response AF */
557#define P2PSD_AD_EID 0x6c
558 /* Advertisement Protocol IE ID */
559#define P2PSD_ADP_TUPLE_QLMT_PAMEBI 0x00
560 /* Query Response Length Limit 7 bits plus PAME-BI 1 bit */
561#define P2PSD_ADP_PROTO_ID 0x00
562 /* Advertisement Protocol ID. Always 0 for P2P SD */
563#define P2PSD_GAS_OUI P2P_OUI
564 /* WFA OUI */
565#define P2PSD_GAS_OUI_SUBTYPE P2P_VER
566 /* OUI Subtype for GAS IE */
567#define P2PSD_GAS_NQP_INFOID 0xDDDD
568 /* NQP Query Info ID: 56797 */
569#define P2PSD_GAS_COMEBACKDEALY 0x00
570 /* Not used in the Native GAS protocol */
571
572/* Service Protocol Type */
573typedef enum p2psd_svc_protype {
574 SVC_RPOTYPE_ALL = 0,
575 SVC_RPOTYPE_BONJOUR = 1,
576 SVC_RPOTYPE_UPNP = 2,
577 SVC_RPOTYPE_WSD = 3,
578 SVC_RPOTYPE_WFDS = 11,
579 SVC_RPOTYPE_VENDOR = 255
580} p2psd_svc_protype_t;
581
582/* Service Discovery response status code */
583typedef enum {
584 P2PSD_RESP_STATUS_SUCCESS = 0,
585 P2PSD_RESP_STATUS_PROTYPE_NA = 1,
586 P2PSD_RESP_STATUS_DATA_NA = 2,
587 P2PSD_RESP_STATUS_BAD_REQUEST = 3
588} p2psd_resp_status_t;
589
590/* Advertisement Protocol IE tuple field */
591BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_tpl {
592 uint8 llm_pamebi; /* Query Response Length Limit bit 0-6, set to 0 plus
593 * Pre-Associated Message Exchange BSSID Independent bit 7, set to 0
594 */
595 uint8 adp_id; /* Advertisement Protocol ID: 0 for NQP Native Query Protocol */
596} BWL_POST_PACKED_STRUCT;
597typedef struct wifi_p2psd_adp_tpl wifi_p2psd_adp_tpl_t;
598
599/* Advertisement Protocol IE */
600BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_ie {
601 uint8 id; /* IE ID: 0x6c - 108 */
602 uint8 len; /* IE length */
603 wifi_p2psd_adp_tpl_t adp_tpl; /* Advertisement Protocol Tuple field. Only one
604 * tuple is defined for P2P Service Discovery
605 */
606} BWL_POST_PACKED_STRUCT;
607typedef struct wifi_p2psd_adp_ie wifi_p2psd_adp_ie_t;
608
609/* NQP Vendor-specific Content */
610BWL_PRE_PACKED_STRUCT struct wifi_p2psd_nqp_query_vsc {
611 uint8 oui_subtype; /* OUI Subtype: 0x09 */
612 uint16 svc_updi; /* Service Update Indicator */
613 uint8 svc_tlvs[1]; /* wifi_p2psd_qreq_tlv_t type for service request,
614 * wifi_p2psd_qresp_tlv_t type for service response
615 */
616} BWL_POST_PACKED_STRUCT;
617typedef struct wifi_p2psd_nqp_query_vsc wifi_p2psd_nqp_query_vsc_t;
618
619/* Service Request TLV */
620BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_tlv {
621 uint16 len; /* Length: 5 plus size of Query Data */
622 uint8 svc_prot; /* Service Protocol Type */
623 uint8 svc_tscid; /* Service Transaction ID */
624 uint8 query_data[1]; /* Query Data, passed in from above Layer 2 */
625} BWL_POST_PACKED_STRUCT;
626typedef struct wifi_p2psd_qreq_tlv wifi_p2psd_qreq_tlv_t;
627
628/* Query Request Frame, defined in generic format, instead of NQP specific */
629BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_frame {
630 uint16 info_id; /* Info ID: 0xDDDD */
631 uint16 len; /* Length of service request TLV, 5 plus the size of request data */
632 uint8 oui[3]; /* WFA OUI: 0x0050F2 */
633 uint8 qreq_vsc[1]; /* Vendor-specific Content: wifi_p2psd_nqp_query_vsc_t type for NQP */
634
635} BWL_POST_PACKED_STRUCT;
636typedef struct wifi_p2psd_qreq_frame wifi_p2psd_qreq_frame_t;
637
638/* GAS Initial Request AF body, "elts" in wifi_p2p_pub_act_frame */
639BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_ireq_frame {
640 wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
641 uint16 qreq_len; /* Query Request Length */
642 uint8 qreq_frm[1]; /* Query Request Frame wifi_p2psd_qreq_frame_t */
643} BWL_POST_PACKED_STRUCT;
644typedef struct wifi_p2psd_gas_ireq_frame wifi_p2psd_gas_ireq_frame_t;
645
646/* Service Response TLV */
647BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_tlv {
648 uint16 len; /* Length: 5 plus size of Query Data */
649 uint8 svc_prot; /* Service Protocol Type */
650 uint8 svc_tscid; /* Service Transaction ID */
651 uint8 status; /* Value defined in Table 57 of P2P spec. */
652 uint8 query_data[1]; /* Response Data, passed in from above Layer 2 */
653} BWL_POST_PACKED_STRUCT;
654typedef struct wifi_p2psd_qresp_tlv wifi_p2psd_qresp_tlv_t;
655
656/* Query Response Frame, defined in generic format, instead of NQP specific */
657BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_frame {
658 uint16 info_id; /* Info ID: 0xDDDD */
659 uint16 len; /* Lenth of service response TLV, 6 plus the size of resp data */
660 uint8 oui[3]; /* WFA OUI: 0x0050F2 */
661 uint8 qresp_vsc[1]; /* Vendor-specific Content: wifi_p2psd_qresp_tlv_t type for NQP */
662
663} BWL_POST_PACKED_STRUCT;
664typedef struct wifi_p2psd_qresp_frame wifi_p2psd_qresp_frame_t;
665
666/* GAS Initial Response AF body, "elts" in wifi_p2p_pub_act_frame */
667BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_iresp_frame {
668 uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */
669 uint16 cb_delay; /* GAS Comeback Delay */
670 wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
671 uint16 qresp_len; /* Query Response Length */
672 uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */
673} BWL_POST_PACKED_STRUCT;
674typedef struct wifi_p2psd_gas_iresp_frame wifi_p2psd_gas_iresp_frame_t;
675
676/* GAS Comeback Response AF body, "elts" in wifi_p2p_pub_act_frame */
677BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_cresp_frame {
678 uint16 status; /* Value defined in Table 7-23 of IEEE P802.11u */
679 uint8 fragment_id; /* Fragmentation ID */
680 uint16 cb_delay; /* GAS Comeback Delay */
681 wifi_p2psd_adp_ie_t adp_ie; /* Advertisement Protocol IE */
682 uint16 qresp_len; /* Query Response Length */
683 uint8 qresp_frm[1]; /* Query Response Frame wifi_p2psd_qresp_frame_t */
684} BWL_POST_PACKED_STRUCT;
685typedef struct wifi_p2psd_gas_cresp_frame wifi_p2psd_gas_cresp_frame_t;
686
687/* Wi-Fi GAS Public Action Frame */
688BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_pub_act_frame {
689 uint8 category; /* 0x04 Public Action Frame */
690 uint8 action; /* 0x6c Advertisement Protocol */
691 uint8 dialog_token; /* nonzero, identifies req/rsp transaction */
692 uint8 query_data[1]; /* Query Data. wifi_p2psd_gas_ireq_frame_t
693 * or wifi_p2psd_gas_iresp_frame_t format
694 */
695} BWL_POST_PACKED_STRUCT;
696typedef struct wifi_p2psd_gas_pub_act_frame wifi_p2psd_gas_pub_act_frame_t;
697
698/* This marks the end of a packed structure section. */
699#include <packed_section_end.h>
700
701#endif /* _P2P_H_ */