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