summaryrefslogtreecommitdiff
path: root/network/wlan/WDI/COMMON/P2P_TempPublic.h
blob: 33d389e311e5effa9f573b8e10aa349305738955 (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
//------------------------------------------------------------------------------
//
// Copyright (c) 2014 Realtek Semiconductor, Inc. All rights reserved.
// 
//------------------------------------------------------------------------------
//
// Description:
//		Definitions shall be internal but put as public because P2P_INFO
//		refers to them.
//		Note that P2P_INFO shall also be internal.
//

#ifndef __INC_TEMP_P2P_PUBLIC_H
#define __INC_TEMP_P2P_PUBLIC_H

#include "P2P_Channel.h" // to be removed because this shall be private
#include "P2P_Synch.h"

typedef struct _P2P_MESSAGE
{
	/* MAC header */
	u1Byte			da[6];
	u1Byte			sa[6];
	u1Byte			bssid[6];

	u1Byte			*devAddr;
	
	/* IE raw data */
	FRAME_BUF		p2pAttributes;			// concatenated P2P attributes
	FRAME_BUF		wpsAttributes;			// concatenated WPS attributes

	/* Action frame specific */
	const u1Byte	*_dialogToken;
	u1Byte			dialogTokenBuf[1];
	u1Byte			dialogToken;

	/* P2P IE, pointers into the raw IE data */
	const u1Byte	*_status;
	u1Byte			status;
	
	const u1Byte	*_minorReasonCode;
	u1Byte			minorReasonCode;
	
	const u1Byte	*_capability;
	u1Byte			grpCap;
	u1Byte			devCap;
	
	const u1Byte	*_devId;
	const u1Byte	*devIdDevAddr;
	
	const u1Byte	*_goIntent;
	u1Byte			goIntent;
	
	const u1Byte	*_configTimeout;
	u1Byte			goConfigTimeout;
	u1Byte			cliConfigTimeout;
	
	const u1Byte	*_listenChannel;
	u1Byte			listenChannel;
	
	const u1Byte	*_grpBssid;
	const u1Byte	*grpBssid;
	
	const u1Byte	*_extListenTiming;
	u2Byte			extListenPeriod;
	u2Byte			extListenInterval;
	
	const u1Byte	*_intendedIntfAddr;
	const u1Byte	*intfAddr;
	
	const u1Byte	*_manageability;
	u1Byte			manageability;
	
	const u1Byte	*_channelList;
	u2Byte			channelListLen;
	const u1Byte	*channelListCountry;
	u2Byte			channelEntryListLen;
	const u1Byte	*channelEntryList;
	
	const u1Byte	*_noa;
	u2Byte			noaLen;
	u1Byte			noaIndex;
	u1Byte			noaCtWindowAndOppPsParam;
	u2Byte			noaDescriptorLen;
	const u1Byte	*noaDescriptors;
	
	const u1Byte	*_devInfo;
	const u1Byte	*devInfoDevAddr;
	u2Byte			configMethod;
	const u1Byte	*primDevType;
	u1Byte			numSecDevType;
	const u1Byte	*secDevTypeList;
	u1Byte			devNameLen;
	const u1Byte	*devName;
	
	const u1Byte	*_grpInfo;
	u2Byte			cliInfoDescListLen;
	const u1Byte	*cliInfoDescList;
	
	const u1Byte	*_grpId;
	const u1Byte	*grpDevAddr;
	u1Byte			grpSsidLen;
	const u1Byte	*grpSsid;
	
	const u1Byte	*_intf;
	const u1Byte	*intfDevAddr;
	u1Byte			intfAddrCount;
	const u1Byte	*intfAddrList;
	
	const u1Byte	*_opChannel;
	u1Byte			opChannel;
	
	const u1Byte	*_invitationFlags;
	u1Byte			invitationFlags;

	/* P2P IE, WFDS addendum */
	const u1Byte	*_svcHash;
	u2Byte			svcHashLen;
	u2Byte			svcHashNum;
	const u1Byte	*svcHashList;
	
	const u1Byte	*_sessionInfoDataInfo;
	u2Byte			sessionInfoLen;
	const u1Byte	*sessionInfo;
	
	const u1Byte	*_connCap;
	u1Byte			connCap;
	
	const u1Byte	*_advId;
	u4Byte			advId;
	const u1Byte	*svcMac;
	
	const u1Byte	*_advSvc;
	u2Byte			advSvcLen;
	u2Byte			advSvcNum;

	const u1Byte	*_sessionId;
	u4Byte			sessionId;
	const u1Byte	*sessionMac;
	
	const u1Byte	*_featureCap;			
	u2Byte			featureCap;

	/* WPS IE */
	const u1Byte	*_wpsConfigMethods; 	// WPS config methods
	u2Byte			wpsConfigMethods;

	const u1Byte	*_wpsDevName;
	u2Byte			wpsDevNameLen;
	
	const u1Byte	*_wpsDevPasswordId;		// Device password id
	u2Byte			wpsDevPasswordId;
	
	const u1Byte	*_wpsManufacturer;		// WPS manufacturer
	u2Byte			wpsManufacturerLen;
	
	const u1Byte	*_wpsModelName;			// WPS model name
	u2Byte			wpsModelNameLen;
	
	const u1Byte	*_wpsModelNumber;		// WPS model number
	u2Byte			wpsModelNumberLen;
	
	const u1Byte	*_wpsSerialNumber;		// WPS serial number
	u2Byte			wpsSerialNumberLen;

	const u1Byte	*_wpsPrimaryDevType;	// WPS primary device type
	u2Byte			wpsPrimaryDevTypeLen;

	const u1Byte	*_wpsSecDevTypeList;
	u2Byte 			wpsSecDevTypeListLen;
	u1Byte			wpsSecDevTypeNum;		// Number of secondary device type
	
	const u1Byte	*_wpsUuidE;
	u2Byte			wpsUuidELen;

	/* SSID IE */
	const u1Byte	*_ssid;
	u1Byte			ssidBuf[32];
	u1Byte			ssidLen;

	/* DS Parameter IE */
	const u1Byte	*_dsParam;
	u1Byte			dsParamBuf[1];
	u1Byte			dsParam;

	/* Debug */
	u4Byte			dbgLevel;
	RT_STATUS		rtStatus;
	
}P2P_MESSAGE;

#define P2P_MAX_DEV_LIST				256
#define P2P_MAX_P2P_DEV_INFO_POOL_ENTRIES 32
#define P2P_MAX_FRAME_POOL_ENTRIES		256	
#define P2P_MAX_FRAME_BUF_SIZE 			640
#define P2P_MAX_MSG_POOL_ENTRIES		32

typedef enum _P2P_DEV_TYPE
{
	P2P_DEV_TYPE_LEGACY,
	P2P_DEV_TYPE_GO,
	P2P_DEV_TYPE_DEV
}P2P_DEV_TYPE;

typedef enum _P2P_FRAME_TYPE
{
	P2P_FID_BEACON = 0,
	P2P_FID_PROBE_REQ,
	P2P_FID_PROBE_RSP,
	P2P_FID_ACTION_START,
	P2P_FID_GO_NEG_REQ = P2P_FID_ACTION_START,
	P2P_FID_GO_NEG_RSP,
	P2P_FID_GO_NEG_CONF,
	P2P_FID_INV_REQ,
	P2P_FID_INV_RSP,
	P2P_FID_PD_REQ,
	P2P_FID_PD_RSP,
	//--------------------------------------------------------------------------
	P2P_FID_MAX
}P2P_FRAME_TYPE;

typedef struct _P2P_FRAME_INFO
{
	RT_LIST_ENTRY		list;
	
	// Contains the raw frame 
	u2Byte				frameLen;
	u1Byte				frame[P2P_MAX_FRAME_BUF_SIZE];
	P2P_FRAME_TYPE 		type;

	// Dialog token, valid only when frame type is action
	u1Byte				token;

	// Parsed message, valid only when this is a rx frame
	P2P_MESSAGE			*msg;

	// Meta data
	u8Byte				time;
	u1Byte				channel;
	s4Byte				sigPower;
	u1Byte				sigStrength;
}P2P_FRAME_INFO;

typedef struct _P2P_DEV_INFO
{
	// Channel list
	P2P_CHANNELS		channels;
	P2P_CHANNELS		commonChannels;

	// Dialog token to be use for action frame tx
	u1Byte				dialogToken;

	// PD Info
	u2Byte				pdConfigMethod;
	u1Byte				pdStatus;
}P2P_DEV_INFO;

/*
 * Contains information of either a legacy AP, a GO or a P2P Device.
 */
typedef struct _P2P_DEV_LIST_ENTRY
{
	RT_LIST_ENTRY		list;

	// TA from the received frame, if from a P2P Device, it is the Device 
	// Address, otherwise it is either the Interface Address or the BSSID
	u1Byte				mac[6];

	// Type of the device
	P2P_DEV_TYPE		type;

	BOOLEAN				bDirty;

	// Rx frames
	P2P_FRAME_INFO 		*rxFrames[P2P_FID_MAX];
	RT_LIST_ENTRY		rxFrameQ;

	// Tx frames
	P2P_FRAME_INFO 		*txFrames[P2P_FID_MAX];

	// P2P Device/GO specific info, valid only when type is not legacy
	P2P_DEV_INFO		*p2p;
}P2P_DEV_LIST_ENTRY;

typedef struct _P2P_DEV_LIST
{
	u4Byte				count;
	RT_LIST_ENTRY		list;
	P2P_LOCK			lock;
	const char			*sig;

	POOL				entryPool;
	P2P_DEV_LIST_ENTRY	entryPoolRsvd[P2P_MAX_DEV_LIST];

	POOL				p2pDevInfoPool;
	P2P_DEV_INFO		p2pDevInfoPoolRsvd[P2P_MAX_P2P_DEV_INFO_POOL_ENTRIES];

	POOL				framePool;
	P2P_FRAME_INFO		framePoolRsvd[P2P_MAX_FRAME_POOL_ENTRIES];

	POOL				rxMsgPool;
	P2P_MESSAGE			rxMsgPoolRsvd[P2P_MAX_MSG_POOL_ENTRIES];
}P2P_DEV_LIST;

#endif	// #ifndef __INC_TEMP_P2P_PUBLIC_H