aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcmdhd/include/proto/p2p.h
blob: 8f7652f0bf9b260ea8dfc2ece8e8371ab8a4372b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
/*
 * Copyright (C) 1999-2012, Broadcom Corporation
 * 
 *      Unless you and Broadcom execute a separate written software license
 * agreement governing use of this software, this software is licensed to you
 * under the terms of the GNU General Public License version 2 (the "GPL"),
 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
 * following added to such license:
 * 
 *      As a special exception, the copyright holders of this software give you
 * permission to link this software with independent modules, and to copy and
 * distribute the resulting executable under terms of your choice, provided that
 * you also meet, for each linked independent module, the terms and conditions of
 * the license of that module.  An independent module is a module which is not
 * derived from this software.  The special exception does not apply to any
 * modifications of the software.
 * 
 *      Notwithstanding the above, under no circumstances may you combine this
 * software in any way with any other Broadcom software provided under a license
 * other than the GPL, without Broadcom's express prior written consent.
 *
 * Fundamental types and constants relating to WFA P2P (aka WiFi Direct)
 *
 * $Id: p2p.h 356416 2012-09-12 16:40:42Z $
 */

#ifndef _P2P_H_
#define _P2P_H_

#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
#include <wlioctl.h>
#include <proto/802.11.h>


#include <packed_section_start.h>



#define P2P_OUI			WFA_OUI			
#define P2P_VER			WFA_OUI_TYPE_P2P	

#define P2P_IE_ID		0xdd			


BWL_PRE_PACKED_STRUCT struct wifi_p2p_ie {
	uint8	id;		
	uint8	len;		
	uint8	OUI[3];		
	uint8	oui_type;	
	uint8	subelts[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_ie wifi_p2p_ie_t;

#define P2P_IE_FIXED_LEN	6

#define P2P_ATTR_ID_OFF		0
#define P2P_ATTR_LEN_OFF	1
#define P2P_ATTR_DATA_OFF	3

#define P2P_ATTR_ID_LEN		1	
#define P2P_ATTR_LEN_LEN	2	
#define P2P_ATTR_HDR_LEN	3 


#define P2P_SEID_STATUS			0	
#define P2P_SEID_MINOR_RC		1	
#define P2P_SEID_P2P_INFO		2	
#define P2P_SEID_DEV_ID			3	
#define P2P_SEID_INTENT			4	
#define P2P_SEID_CFG_TIMEOUT		5	
#define P2P_SEID_CHANNEL		6	
#define P2P_SEID_GRP_BSSID		7	
#define P2P_SEID_XT_TIMING		8	
#define P2P_SEID_INTINTADDR		9	
#define P2P_SEID_P2P_MGBTY		10	
#define P2P_SEID_CHAN_LIST		11	
#define P2P_SEID_ABSENCE		12	
#define P2P_SEID_DEV_INFO		13	
#define P2P_SEID_GROUP_INFO		14	
#define P2P_SEID_GROUP_ID		15	
#define P2P_SEID_P2P_IF			16	
#define P2P_SEID_OP_CHANNEL		17	
#define P2P_SEID_INVITE_FLAGS		18	
#define P2P_SEID_VNDR			221	

#define P2P_SE_VS_ID_SERVICES	0x1b 



BWL_PRE_PACKED_STRUCT struct wifi_p2p_info_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	dev;		
	uint8	group;		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_info_se_s wifi_p2p_info_se_t;


#define P2P_CAPSE_DEV_SERVICE_DIS	0x1 
#define P2P_CAPSE_DEV_CLIENT_DIS	0x2 
#define P2P_CAPSE_DEV_CONCURRENT	0x4 
#define P2P_CAPSE_DEV_INFRA_MAN		0x8 
#define P2P_CAPSE_DEV_LIMIT			0x10 
#define P2P_CAPSE_INVITE_PROC		0x20 


#define P2P_CAPSE_GRP_OWNER			0x1 
#define P2P_CAPSE_PERSIST_GRP		0x2 
#define P2P_CAPSE_GRP_LIMIT			0x4 
#define P2P_CAPSE_GRP_INTRA_BSS		0x8 
#define P2P_CAPSE_GRP_X_CONNECT		0x10 
#define P2P_CAPSE_GRP_PERSISTENT	0x20 
#define P2P_CAPSE_GRP_FORMATION		0x40 



BWL_PRE_PACKED_STRUCT struct wifi_p2p_intent_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	intent;		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_intent_se_s wifi_p2p_intent_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_cfg_tmo_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	go_tmo;		
	uint8	client_tmo;	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_cfg_tmo_se_s wifi_p2p_cfg_tmo_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_listen_channel_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	country[3];	
	uint8	op_class;	
	uint8	channel;	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_listen_channel_se_s wifi_p2p_listen_channel_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_bssid_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	mac[6];		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_grp_bssid_se_s wifi_p2p_grp_bssid_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_grp_id_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	mac[6];		
	uint8	ssid[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_grp_id_se_s wifi_p2p_grp_id_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_intf_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	mac[6];		
	uint8	ifaddrs;	
	uint8	ifaddr[1][6];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_intf_se_s wifi_p2p_intf_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_status_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	status;		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_status_se_s wifi_p2p_status_se_t;


#define P2P_STATSE_SUCCESS			0
				
#define P2P_STATSE_FAIL_INFO_CURR_UNAVAIL	1
				
#define P2P_STATSE_PASSED_UP			P2P_STATSE_FAIL_INFO_CURR_UNAVAIL
				
#define P2P_STATSE_FAIL_INCOMPAT_PARAMS		2
				
#define P2P_STATSE_FAIL_LIMIT_REACHED		3
				
#define P2P_STATSE_FAIL_INVALID_PARAMS		4
				
#define P2P_STATSE_FAIL_UNABLE_TO_ACCOM		5
				
#define P2P_STATSE_FAIL_PROTO_ERROR		6
				
#define P2P_STATSE_FAIL_NO_COMMON_CHAN		7
				
#define P2P_STATSE_FAIL_UNKNOWN_GROUP		8
				
#define P2P_STATSE_FAIL_INTENT			9
				
#define P2P_STATSE_FAIL_INCOMPAT_PROVIS		10
				
#define P2P_STATSE_FAIL_USER_REJECT		11
				


BWL_PRE_PACKED_STRUCT struct wifi_p2p_ext_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	avail[2];	
	uint8	interval[2];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_ext_se_s wifi_p2p_ext_se_t;

#define P2P_EXT_MIN	10	


BWL_PRE_PACKED_STRUCT struct wifi_p2p_intintad_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	mac[6];		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_intintad_se_s wifi_p2p_intintad_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_channel_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	band;		
	uint8	channel;	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_channel_se_s wifi_p2p_channel_se_t;



BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_entry_s {
	uint8	band;						
	uint8	num_channels;				
	uint8	channels[WL_NUMCHANNELS];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_chanlist_entry_s wifi_p2p_chanlist_entry_t;
#define WIFI_P2P_CHANLIST_SE_MAX_ENTRIES 2


BWL_PRE_PACKED_STRUCT struct wifi_p2p_chanlist_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	country[3];	
	uint8	num_entries;	
	wifi_p2p_chanlist_entry_t	entries[WIFI_P2P_CHANLIST_SE_MAX_ENTRIES];
						
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_chanlist_se_s wifi_p2p_chanlist_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_pri_devtype_s {
	uint16	cat_id;		
	uint8	OUI[3];		
	uint8	oui_type;	
	uint16	sub_cat_id;	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_pri_devtype_s wifi_p2p_pri_devtype_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_devinfo_se_s {
	uint8	eltId;			
	uint8	len[2];			
	uint8	mac[6];			
	uint16	wps_cfg_meths;		
	uint8	pri_devtype[8];		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_devinfo_se_s wifi_p2p_devinfo_se_t;

#define P2P_DEV_TYPE_LEN	8


BWL_PRE_PACKED_STRUCT struct wifi_p2p_cid_fixed_s {
	uint8	len;
	uint8	devaddr[ETHER_ADDR_LEN];	
	uint8	ifaddr[ETHER_ADDR_LEN];		
	uint8	devcap;				
	uint8	cfg_meths[2];			
	uint8	pridt[P2P_DEV_TYPE_LEN];	
	uint8	secdts;				
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_cid_fixed_s wifi_p2p_cid_fixed_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_devid_se_s {
	uint8	eltId;
	uint8	len[2];
	struct ether_addr	addr;			
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_devid_se_s wifi_p2p_devid_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_mgbt_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	mg_bitmap;	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_mgbt_se_s wifi_p2p_mgbt_se_t;

#define P2P_MGBTSE_P2PDEVMGMT_FLAG   0x1 


BWL_PRE_PACKED_STRUCT struct wifi_p2p_grpinfo_se_s {
	uint8	eltId;			
	uint8	len[2];			
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_grpinfo_se_s wifi_p2p_grpinfo_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_op_channel_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	country[3];	
	uint8	op_class;	
	uint8	channel;	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_op_channel_se_s wifi_p2p_op_channel_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_invite_flags_se_s {
	uint8	eltId;		
	uint8	len[2];		
	uint8	flags;		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_invite_flags_se_s wifi_p2p_invite_flags_se_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2p_action_frame {
	uint8	category;	
	uint8	OUI[3];		
	uint8	type;		
	uint8	subtype;	
	uint8	dialog_token;	
	uint8	elts[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_action_frame wifi_p2p_action_frame_t;
#define P2P_AF_CATEGORY		0x7f

#define P2P_AF_FIXED_LEN	7


#define P2P_AF_NOTICE_OF_ABSENCE	0	
#define P2P_AF_PRESENCE_REQ		1	
#define P2P_AF_PRESENCE_RSP		2	
#define P2P_AF_GO_DISC_REQ		3	



BWL_PRE_PACKED_STRUCT struct wifi_p2p_pub_act_frame {
	uint8	category;	
	uint8	action;		
	uint8	oui[3];		
	uint8	oui_type;	
	uint8	subtype;	
	uint8	dialog_token;	
	uint8	elts[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_pub_act_frame wifi_p2p_pub_act_frame_t;
#define P2P_PUB_AF_FIXED_LEN	8
#define P2P_PUB_AF_CATEGORY	0x04
#define P2P_PUB_AF_ACTION	0x09


#define P2P_PAF_GON_REQ		0	
#define P2P_PAF_GON_RSP		1	
#define P2P_PAF_GON_CONF	2	
#define P2P_PAF_INVITE_REQ	3	
#define P2P_PAF_INVITE_RSP	4	
#define P2P_PAF_DEVDIS_REQ	5	
#define P2P_PAF_DEVDIS_RSP	6	
#define P2P_PAF_PROVDIS_REQ	7	
#define P2P_PAF_PROVDIS_RSP	8	
#define P2P_PAF_SUBTYPE_INVALID	255	


#define P2P_TYPE_MNREQ		P2P_PAF_GON_REQ
#define P2P_TYPE_MNRSP		P2P_PAF_GON_RSP
#define P2P_TYPE_MNCONF		P2P_PAF_GON_CONF


BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_desc {
	uint8	cnt_type;	
	uint32	duration;	
	uint32	interval;	
	uint32	start;		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_noa_desc wifi_p2p_noa_desc_t;

BWL_PRE_PACKED_STRUCT struct wifi_p2p_noa_se {
	uint8	eltId;		
	uint8	len[2];		
	uint8	index;		
	uint8	ops_ctw_parms;	
	wifi_p2p_noa_desc_t	desc[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2p_noa_se wifi_p2p_noa_se_t;

#define P2P_NOA_SE_FIXED_LEN	5


#define P2P_NOA_DESC_CNT_RESERVED	0	
#define P2P_NOA_DESC_CNT_REPEAT		255	
#define P2P_NOA_DESC_TYPE_PREFERRED	1	
#define P2P_NOA_DESC_TYPE_ACCEPTABLE	2	


#define P2P_NOA_CTW_MASK	0x7f
#define P2P_NOA_OPS_MASK	0x80
#define P2P_NOA_OPS_SHIFT	7

#define P2P_CTW_MIN	10	


#define	P2PSD_ACTION_CATEGORY		0x04
				
#define	P2PSD_ACTION_ID_GAS_IREQ	0x0a
				
#define	P2PSD_ACTION_ID_GAS_IRESP	0x0b
				
#define	P2PSD_ACTION_ID_GAS_CREQ	0x0c
				
#define	P2PSD_ACTION_ID_GAS_CRESP	0x0d
				
#define P2PSD_AD_EID				0x6c
				
#define P2PSD_ADP_TUPLE_QLMT_PAMEBI	0x00
				
#define P2PSD_ADP_PROTO_ID			0x00
				
#define P2PSD_GAS_OUI				P2P_OUI
				
#define P2PSD_GAS_OUI_SUBTYPE		P2P_VER
				
#define P2PSD_GAS_NQP_INFOID		0xDDDD
				
#define P2PSD_GAS_COMEBACKDEALY		0x00
				


typedef enum p2psd_svc_protype {
	SVC_RPOTYPE_ALL = 0,
	SVC_RPOTYPE_BONJOUR = 1,
	SVC_RPOTYPE_UPNP = 2,
	SVC_RPOTYPE_WSD = 3,
	SVC_RPOTYPE_VENDOR = 255
} p2psd_svc_protype_t;


typedef enum {
	P2PSD_RESP_STATUS_SUCCESS = 0,
	P2PSD_RESP_STATUS_PROTYPE_NA = 1,
	P2PSD_RESP_STATUS_DATA_NA = 2,
	P2PSD_RESP_STATUS_BAD_REQUEST = 3
} p2psd_resp_status_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_tpl {
	uint8	llm_pamebi;	
	uint8	adp_id;		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_adp_tpl wifi_p2psd_adp_tpl_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_adp_ie {
	uint8	id;		
	uint8	len;	
	wifi_p2psd_adp_tpl_t adp_tpl;  
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_adp_ie wifi_p2psd_adp_ie_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_nqp_query_vsc {
	uint8	oui_subtype;	
	uint16	svc_updi;		
	uint8	svc_tlvs[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_nqp_query_vsc wifi_p2psd_nqp_query_vsc_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_tlv {
	uint16	len;			
	uint8	svc_prot;		
	uint8	svc_tscid;		
	uint8	query_data[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_qreq_tlv wifi_p2psd_qreq_tlv_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qreq_frame {
	uint16	info_id;	
	uint16	len;		
	uint8	oui[3];		
	uint8	qreq_vsc[1]; 

} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_qreq_frame wifi_p2psd_qreq_frame_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_ireq_frame {
	wifi_p2psd_adp_ie_t		adp_ie;		
	uint16					qreq_len;	
	uint8	qreq_frm[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_gas_ireq_frame wifi_p2psd_gas_ireq_frame_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_tlv {
	uint16	len;				
	uint8	svc_prot;			
	uint8	svc_tscid;			
	uint8	status;				
	uint8	query_data[1];		
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_qresp_tlv wifi_p2psd_qresp_tlv_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_qresp_frame {
	uint16	info_id;	
	uint16	len;		
	uint8	oui[3];		
	uint8	qresp_vsc[1]; 

} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_qresp_frame wifi_p2psd_qresp_frame_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_iresp_frame {
	uint16	status;			
	uint16	cb_delay;		
	wifi_p2psd_adp_ie_t	adp_ie;		
	uint16		qresp_len;	
	uint8	qresp_frm[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_gas_iresp_frame wifi_p2psd_gas_iresp_frame_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_cresp_frame {
	uint16	status;			
	uint8	fragment_id;	
	uint16	cb_delay;		
	wifi_p2psd_adp_ie_t	adp_ie;		
	uint16	qresp_len;		
	uint8	qresp_frm[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_gas_cresp_frame wifi_p2psd_gas_cresp_frame_t;


BWL_PRE_PACKED_STRUCT struct wifi_p2psd_gas_pub_act_frame {
	uint8	category;		
	uint8	action;			
	uint8	dialog_token;	
	uint8	query_data[1];	
} BWL_POST_PACKED_STRUCT;
typedef struct wifi_p2psd_gas_pub_act_frame wifi_p2psd_gas_pub_act_frame_t;


#include <packed_section_end.h>

#endif