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