Blame view

drivers/staging/vt6655/80211mgr.c 23.1 KB
5449c685a   Forest Bond   Staging: Add pris...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  /*
   * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
   * All rights reserved.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation; either version 2 of the License, or
   * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License along
   * with this program; if not, write to the Free Software Foundation, Inc.,
   * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   *
5449c685a   Forest Bond   Staging: Add pris...
19
20
   * File: 80211mgr.c
   *
658ce9d65   Uwe Kleine-König   Staging: fix typo...
21
   * Purpose: Handles the 802.11 management support functions
5449c685a   Forest Bond   Staging: Add pris...
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
   *
   * Author: Lyndon Chen
   *
   * Date: May 8, 2002
   *
   * Functions:
   *      vMgrEncodeBeacon - Encode the Beacon frame
   *      vMgrDecodeBeacon - Decode the Beacon frame
   *      vMgrEncodeIBSSATIM - Encode the IBSS ATIM frame
   *      vMgrDecodeIBSSATIM - Decode the IBSS ATIM frame
   *      vMgrEncodeDisassociation - Encode the Disassociation frame
   *      vMgrDecodeDisassociation - Decode the Disassociation frame
   *      vMgrEncodeAssocRequest - Encode the Association request frame
   *      vMgrDecodeAssocRequest - Decode the Association request frame
   *      vMgrEncodeAssocResponse - Encode the Association response frame
   *      vMgrDecodeAssocResponse - Decode the Association response frame
   *      vMgrEncodeReAssocRequest - Encode the ReAssociation request frame
   *      vMgrDecodeReAssocRequest - Decode the ReAssociation request frame
   *      vMgrEncodeProbeRequest - Encode the Probe request frame
   *      vMgrDecodeProbeRequest - Decode the Probe request frame
   *      vMgrEncodeProbeResponse - Encode the Probe response frame
   *      vMgrDecodeProbeResponse - Decode the Probe response frame
   *      vMgrEncodeAuthen - Encode the Authentication frame
   *      vMgrDecodeAuthen - Decode the Authentication frame
   *      vMgrEncodeDeauthen - Encode the DeAuthentication frame
   *      vMgrDecodeDeauthen - Decode the DeAuthentication frame
   *      vMgrEncodeReassocResponse - Encode the Reassociation response frame
   *      vMgrDecodeReassocResponse - Decode the Reassociation response frame
   *
   * Revision History:
   *
   */
5449c685a   Forest Bond   Staging: Add pris...
54
  #include "tmacro.h"
5449c685a   Forest Bond   Staging: Add pris...
55
  #include "tether.h"
5449c685a   Forest Bond   Staging: Add pris...
56
  #include "80211mgr.h"
5449c685a   Forest Bond   Staging: Add pris...
57
  #include "80211hdr.h"
5449c685a   Forest Bond   Staging: Add pris...
58
  #include "device.h"
5449c685a   Forest Bond   Staging: Add pris...
59
  #include "wpa.h"
5449c685a   Forest Bond   Staging: Add pris...
60
61
  
  /*---------------------  Static Definitions -------------------------*/
5449c685a   Forest Bond   Staging: Add pris...
62
  /*---------------------  Static Classes  ----------------------------*/
5449c685a   Forest Bond   Staging: Add pris...
63
  /*---------------------  Static Functions  --------------------------*/
5449c685a   Forest Bond   Staging: Add pris...
64
  /*---------------------  Export Variables  --------------------------*/
5449c685a   Forest Bond   Staging: Add pris...
65
  /*---------------------  Export Functions  --------------------------*/
5449c685a   Forest Bond   Staging: Add pris...
66
67
68
69
70
71
72
73
  /*+
   *
   * Routine Description:
   * Encode Beacon frame body offset
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
74
   -*/
5449c685a   Forest Bond   Staging: Add pris...
75

6b35b7b37   Charles Clément   Staging: vt6655: ...
76
  void
5449c685a   Forest Bond   Staging: Add pris...
77
  vMgrEncodeBeacon(
ab4622cca   Joe Perches   staging:vt6655:80...
78
79
  	PWLAN_FR_BEACON  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
80
  {
ab4622cca   Joe Perches   staging:vt6655:80...
81
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
82

1b37f2949   Tülin İzer   Staging: vt6655: ...
83
  	/* Fixed Fields */
0fc2a76ee   Malcolm Priestley   staging: vt6655: ...
84
  	pFrame->pqwTimestamp = (__le64 *)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
85
86
87
88
89
90
91
92
  				(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				 WLAN_BEACON_OFF_TS);
  	pFrame->pwBeaconInterval = (unsigned short *)
  				(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				 WLAN_BEACON_OFF_BCN_INT);
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_BEACON_OFF_CAPINFO);
5449c685a   Forest Bond   Staging: Add pris...
93

ab4622cca   Joe Perches   staging:vt6655:80...
94
  	pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID;
5449c685a   Forest Bond   Staging: Add pris...
95
96
97
98
99
100
101
102
103
104
105
  }
  
  /*+
   *
   * Routine Description:
   * Decode Beacon frame body offset
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
106
   -*/
5449c685a   Forest Bond   Staging: Add pris...
107

6b35b7b37   Charles Clément   Staging: vt6655: ...
108
  void
5449c685a   Forest Bond   Staging: Add pris...
109
  vMgrDecodeBeacon(
ab4622cca   Joe Perches   staging:vt6655:80...
110
111
  	PWLAN_FR_BEACON  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
112
  {
ab4622cca   Joe Perches   staging:vt6655:80...
113
114
115
  	PWLAN_IE        pItem;
  
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
116
  	/* Fixed Fields */
0fc2a76ee   Malcolm Priestley   staging: vt6655: ...
117
  	pFrame->pqwTimestamp = (__le64 *)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
118
119
120
121
122
123
124
125
  				(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				 WLAN_BEACON_OFF_TS);
  	pFrame->pwBeaconInterval = (unsigned short *)
  				   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				    WLAN_BEACON_OFF_BCN_INT);
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_BEACON_OFF_CAPINFO);
ab4622cca   Joe Perches   staging:vt6655:80...
126

1b37f2949   Tülin İzer   Staging: vt6655: ...
127
  	/* Information elements */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
128
129
130
  	pItem = (PWLAN_IE)((unsigned char *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))) +
  			    WLAN_BEACON_OFF_SSID);
ab4622cca   Joe Perches   staging:vt6655:80...
131
  	while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
ab4622cca   Joe Perches   staging:vt6655:80...
132
133
134
135
136
137
138
139
140
141
  		switch (pItem->byElementID) {
  		case WLAN_EID_SSID:
  			if (pFrame->pSSID == NULL)
  				pFrame->pSSID = (PWLAN_IE_SSID)pItem;
  			break;
  		case WLAN_EID_SUPP_RATES:
  			if (pFrame->pSuppRates == NULL)
  				pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
  			break;
  		case WLAN_EID_FH_PARMS:
1b37f2949   Tülin İzer   Staging: vt6655: ...
142
  			/* pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem; */
ab4622cca   Joe Perches   staging:vt6655:80...
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
  			break;
  		case WLAN_EID_DS_PARMS:
  			if (pFrame->pDSParms == NULL)
  				pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
  			break;
  		case WLAN_EID_CF_PARMS:
  			if (pFrame->pCFParms == NULL)
  				pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
  			break;
  		case WLAN_EID_IBSS_PARMS:
  			if (pFrame->pIBSSParms == NULL)
  				pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem;
  			break;
  		case WLAN_EID_TIM:
  			if (pFrame->pTIM == NULL)
  				pFrame->pTIM = (PWLAN_IE_TIM)pItem;
  			break;
  
  		case WLAN_EID_RSN:
6b8c28192   Martin Berglund   Staging: vt6655: ...
162
  			if (pFrame->pRSN == NULL)
ab4622cca   Joe Perches   staging:vt6655:80...
163
  				pFrame->pRSN = (PWLAN_IE_RSN)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
164
165
166
167
  			break;
  		case WLAN_EID_RSN_WPA:
  			if (pFrame->pRSNWPA == NULL) {
  				if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
168
169
  					pFrame->pRSNWPA =
  						       (PWLAN_IE_RSN_EXT)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
170
171
172
173
174
175
176
177
178
  			}
  			break;
  
  		case WLAN_EID_ERP:
  			if (pFrame->pERP == NULL)
  				pFrame->pERP = (PWLAN_IE_ERP)pItem;
  			break;
  		case WLAN_EID_EXTSUPP_RATES:
  			if (pFrame->pExtSuppRates == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
179
180
  				pFrame->pExtSuppRates =
  						    (PWLAN_IE_SUPP_RATES)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
181
  			break;
1b37f2949   Tülin İzer   Staging: vt6655: ...
182
  		case WLAN_EID_COUNTRY:      /* 7 */
ab4622cca   Joe Perches   staging:vt6655:80...
183
184
185
  			if (pFrame->pIE_Country == NULL)
  				pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
  			break;
1b37f2949   Tülin İzer   Staging: vt6655: ...
186
  		case WLAN_EID_PWR_CONSTRAINT:   /* 32 */
ab4622cca   Joe Perches   staging:vt6655:80...
187
  			if (pFrame->pIE_PowerConstraint == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
188
189
  				pFrame->pIE_PowerConstraint =
  						      (PWLAN_IE_PW_CONST)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
190
  			break;
1b37f2949   Tülin İzer   Staging: vt6655: ...
191
  		case WLAN_EID_CH_SWITCH:    /* 37 */
ab4622cca   Joe Perches   staging:vt6655:80...
192
193
194
  			if (pFrame->pIE_CHSW == NULL)
  				pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
  			break;
1b37f2949   Tülin İzer   Staging: vt6655: ...
195
  		case WLAN_EID_QUIET:        /* 40 */
ab4622cca   Joe Perches   staging:vt6655:80...
196
197
198
199
200
201
202
203
204
205
  			if (pFrame->pIE_Quiet == NULL)
  				pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
  			break;
  
  		case WLAN_EID_IBSS_DFS:
  			if (pFrame->pIE_IBSSDFS == NULL)
  				pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
  			break;
  
  		default:
48caf5a06   Joe Perches   staging: vt6655: ...
206
207
208
  			pr_debug("Unrecognized EID=%dd in beacon decode
  ",
  				 pItem->byElementID);
ab4622cca   Joe Perches   staging:vt6655:80...
209
210
211
212
213
  			break;
  
  		}
  		pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
  	}
5449c685a   Forest Bond   Staging: Add pris...
214
  }
5449c685a   Forest Bond   Staging: Add pris...
215
216
217
218
219
220
221
222
223
  /*+
   *
   * Routine Description:
   *  Encode IBSS ATIM
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
224
   -*/
5449c685a   Forest Bond   Staging: Add pris...
225

6b35b7b37   Charles Clément   Staging: vt6655: ...
226
  void
5449c685a   Forest Bond   Staging: Add pris...
227
  vMgrEncodeIBSSATIM(
ab4622cca   Joe Perches   staging:vt6655:80...
228
229
  	PWLAN_FR_IBSSATIM   pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
230
  {
ab4622cca   Joe Perches   staging:vt6655:80...
231
232
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
  	pFrame->len = WLAN_HDR_ADDR3_LEN;
5449c685a   Forest Bond   Staging: Add pris...
233
  }
5449c685a   Forest Bond   Staging: Add pris...
234
235
236
237
238
239
240
241
242
  /*+
   *
   * Routine Description:
   *  Decode IBSS ATIM
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
243
   -*/
5449c685a   Forest Bond   Staging: Add pris...
244

6b35b7b37   Charles Clément   Staging: vt6655: ...
245
  void
5449c685a   Forest Bond   Staging: Add pris...
246
  vMgrDecodeIBSSATIM(
ab4622cca   Joe Perches   staging:vt6655:80...
247
248
  	PWLAN_FR_IBSSATIM   pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
249
  {
ab4622cca   Joe Perches   staging:vt6655:80...
250
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
251
  }
5449c685a   Forest Bond   Staging: Add pris...
252
253
254
255
256
257
258
259
260
  /*+
   *
   * Routine Description:
   *  Encode Disassociation
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
261
   -*/
5449c685a   Forest Bond   Staging: Add pris...
262

6b35b7b37   Charles Clément   Staging: vt6655: ...
263
  void
5449c685a   Forest Bond   Staging: Add pris...
264
  vMgrEncodeDisassociation(
ab4622cca   Joe Perches   staging:vt6655:80...
265
266
  	PWLAN_FR_DISASSOC  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
267
  {
ab4622cca   Joe Perches   staging:vt6655:80...
268
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
269

1b37f2949   Tülin İzer   Staging: vt6655: ...
270
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
271
272
273
274
275
  	pFrame->pwReason = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_DISASSOC_OFF_REASON);
  	pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON +
  		      sizeof(*(pFrame->pwReason));
5449c685a   Forest Bond   Staging: Add pris...
276
  }
5449c685a   Forest Bond   Staging: Add pris...
277
278
279
280
281
282
283
284
285
  /*+
   *
   * Routine Description:
   *  Decode Disassociation
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
286
   -*/
5449c685a   Forest Bond   Staging: Add pris...
287

6b35b7b37   Charles Clément   Staging: vt6655: ...
288
  void
5449c685a   Forest Bond   Staging: Add pris...
289
  vMgrDecodeDisassociation(
ab4622cca   Joe Perches   staging:vt6655:80...
290
291
  	PWLAN_FR_DISASSOC  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
292
  {
ab4622cca   Joe Perches   staging:vt6655:80...
293
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
294

1b37f2949   Tülin İzer   Staging: vt6655: ...
295
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
296
297
298
  	pFrame->pwReason = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_DISASSOC_OFF_REASON);
5449c685a   Forest Bond   Staging: Add pris...
299
300
301
302
303
304
305
306
307
308
309
  }
  
  /*+
   *
   * Routine Description:
   *  Encode Association Request
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
310
   -*/
5449c685a   Forest Bond   Staging: Add pris...
311

6b35b7b37   Charles Clément   Staging: vt6655: ...
312
  void
5449c685a   Forest Bond   Staging: Add pris...
313
  vMgrEncodeAssocRequest(
ab4622cca   Joe Perches   staging:vt6655:80...
314
315
  	PWLAN_FR_ASSOCREQ  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
316
  {
ab4622cca   Joe Perches   staging:vt6655:80...
317
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
318
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
319
320
321
322
323
324
325
326
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_ASSOCREQ_OFF_CAP_INFO);
  	pFrame->pwListenInterval = (unsigned short *)
  				   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				    WLAN_ASSOCREQ_OFF_LISTEN_INT);
  	pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCREQ_OFF_LISTEN_INT +
  		      sizeof(*(pFrame->pwListenInterval));
5449c685a   Forest Bond   Staging: Add pris...
327
  }
5449c685a   Forest Bond   Staging: Add pris...
328
329
330
331
332
333
334
335
336
  /*+
   *
   * Routine Description: (AP)
   *  Decode Association Request
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
337
   -*/
5449c685a   Forest Bond   Staging: Add pris...
338

6b35b7b37   Charles Clément   Staging: vt6655: ...
339
  void
5449c685a   Forest Bond   Staging: Add pris...
340
  vMgrDecodeAssocRequest(
ab4622cca   Joe Perches   staging:vt6655:80...
341
342
  	PWLAN_FR_ASSOCREQ  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
343
  {
ab4622cca   Joe Perches   staging:vt6655:80...
344
345
346
  	PWLAN_IE   pItem;
  
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
347
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
348
349
350
351
352
353
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_ASSOCREQ_OFF_CAP_INFO);
  	pFrame->pwListenInterval = (unsigned short *)
  				   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				    WLAN_ASSOCREQ_OFF_LISTEN_INT);
ab4622cca   Joe Perches   staging:vt6655:80...
354

1b37f2949   Tülin İzer   Staging: vt6655: ...
355
  	/* Information elements */
ab4622cca   Joe Perches   staging:vt6655:80...
356
357
358
359
360
361
362
363
364
365
366
  	pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
  			   + WLAN_ASSOCREQ_OFF_SSID);
  
  	while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
  		switch (pItem->byElementID) {
  		case WLAN_EID_SSID:
  			if (pFrame->pSSID == NULL)
  				pFrame->pSSID = (PWLAN_IE_SSID)pItem;
  			break;
  		case WLAN_EID_SUPP_RATES:
  			if (pFrame->pSuppRates == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
367
368
  				pFrame->pSuppRates =
  						   (PWLAN_IE_SUPP_RATES)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
369
370
371
  			break;
  
  		case WLAN_EID_RSN:
6b8c28192   Martin Berglund   Staging: vt6655: ...
372
  			if (pFrame->pRSN == NULL)
ab4622cca   Joe Perches   staging:vt6655:80...
373
  				pFrame->pRSN = (PWLAN_IE_RSN)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
374
375
376
377
  			break;
  		case WLAN_EID_RSN_WPA:
  			if (pFrame->pRSNWPA == NULL) {
  				if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
378
379
  					pFrame->pRSNWPA =
  						       (PWLAN_IE_RSN_EXT)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
380
381
382
383
  			}
  			break;
  		case WLAN_EID_EXTSUPP_RATES:
  			if (pFrame->pExtSuppRates == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
384
385
  				pFrame->pExtSuppRates =
  						    (PWLAN_IE_SUPP_RATES)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
386
387
388
  			break;
  
  		default:
48caf5a06   Joe Perches   staging: vt6655: ...
389
390
391
  			pr_debug("Unrecognized EID=%dd in assocreq decode
  ",
  				 pItem->byElementID);
ab4622cca   Joe Perches   staging:vt6655:80...
392
393
394
395
  			break;
  		}
  		pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
  	}
5449c685a   Forest Bond   Staging: Add pris...
396
397
398
399
400
401
402
403
404
405
406
  }
  
  /*+
   *
   * Routine Description: (AP)
   *  Encode Association Response
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
407
   -*/
5449c685a   Forest Bond   Staging: Add pris...
408

6b35b7b37   Charles Clément   Staging: vt6655: ...
409
  void
5449c685a   Forest Bond   Staging: Add pris...
410
  vMgrEncodeAssocResponse(
ab4622cca   Joe Perches   staging:vt6655:80...
411
412
  	PWLAN_FR_ASSOCRESP  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
413
  {
ab4622cca   Joe Perches   staging:vt6655:80...
414
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
415
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
416
417
418
419
420
421
422
423
424
425
426
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_ASSOCRESP_OFF_CAP_INFO);
  	pFrame->pwStatus = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_ASSOCRESP_OFF_STATUS);
  	pFrame->pwAid = (unsigned short *)
  			(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			 WLAN_ASSOCRESP_OFF_AID);
  	pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCRESP_OFF_AID +
  		      sizeof(*(pFrame->pwAid));
5449c685a   Forest Bond   Staging: Add pris...
427
  }
5449c685a   Forest Bond   Staging: Add pris...
428
429
430
431
432
433
434
435
436
  /*+
   *
   * Routine Description:
   *  Decode Association Response
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
437
   -*/
5449c685a   Forest Bond   Staging: Add pris...
438

6b35b7b37   Charles Clément   Staging: vt6655: ...
439
  void
5449c685a   Forest Bond   Staging: Add pris...
440
  vMgrDecodeAssocResponse(
ab4622cca   Joe Perches   staging:vt6655:80...
441
442
  	PWLAN_FR_ASSOCRESP  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
443
  {
ab4622cca   Joe Perches   staging:vt6655:80...
444
445
446
  	PWLAN_IE   pItem;
  
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
447
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
448
449
450
451
452
453
454
455
456
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_ASSOCRESP_OFF_CAP_INFO);
  	pFrame->pwStatus = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_ASSOCRESP_OFF_STATUS);
  	pFrame->pwAid = (unsigned short *)
  			(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			 WLAN_ASSOCRESP_OFF_AID);
ab4622cca   Joe Perches   staging:vt6655:80...
457

1b37f2949   Tülin İzer   Staging: vt6655: ...
458
  	/* Information elements */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
459
460
461
  	pFrame->pSuppRates  = (PWLAN_IE_SUPP_RATES)
  			      (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			       WLAN_ASSOCRESP_OFF_SUPP_RATES);
ab4622cca   Joe Perches   staging:vt6655:80...
462
463
464
465
466
467
468
  
  	pItem = (PWLAN_IE)(pFrame->pSuppRates);
  	pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
  
  	if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) &&
  	    (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
  		pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
48caf5a06   Joe Perches   staging: vt6655: ...
469
470
  		pr_debug("pFrame->pExtSuppRates=[%p]
  ", pItem);
5e0cc8a23   Joe Perches   staging: vt6655: ...
471
  	} else {
ab4622cca   Joe Perches   staging:vt6655:80...
472
473
  		pFrame->pExtSuppRates = NULL;
  	}
5449c685a   Forest Bond   Staging: Add pris...
474
  }
5449c685a   Forest Bond   Staging: Add pris...
475
476
477
478
479
480
481
482
483
  /*+
   *
   * Routine Description:
   *  Encode Reassociation Request
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
484
   -*/
5449c685a   Forest Bond   Staging: Add pris...
485

6b35b7b37   Charles Clément   Staging: vt6655: ...
486
  void
5449c685a   Forest Bond   Staging: Add pris...
487
  vMgrEncodeReassocRequest(
ab4622cca   Joe Perches   staging:vt6655:80...
488
489
  	PWLAN_FR_REASSOCREQ  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
490
  {
ab4622cca   Joe Perches   staging:vt6655:80...
491
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
492
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
493
494
495
496
497
498
499
500
501
502
503
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_REASSOCREQ_OFF_CAP_INFO);
  	pFrame->pwListenInterval = (unsigned short *)
  				   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				    WLAN_REASSOCREQ_OFF_LISTEN_INT);
  	pFrame->pAddrCurrAP = (PIEEE_ADDR)
  			      (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			       WLAN_REASSOCREQ_OFF_CURR_AP);
  	pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP +
  		      sizeof(*(pFrame->pAddrCurrAP));
5449c685a   Forest Bond   Staging: Add pris...
504
  }
5449c685a   Forest Bond   Staging: Add pris...
505
506
507
508
509
510
511
512
513
  /*+
   *
   * Routine Description: (AP)
   *  Decode Reassociation Request
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
514
   -*/
5449c685a   Forest Bond   Staging: Add pris...
515

6b35b7b37   Charles Clément   Staging: vt6655: ...
516
  void
5449c685a   Forest Bond   Staging: Add pris...
517
  vMgrDecodeReassocRequest(
ab4622cca   Joe Perches   staging:vt6655:80...
518
519
  	PWLAN_FR_REASSOCREQ  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
520
  {
ab4622cca   Joe Perches   staging:vt6655:80...
521
  	PWLAN_IE   pItem;
6b7112719   Guillaume Clement   staging: vt6655: ...
522

ab4622cca   Joe Perches   staging:vt6655:80...
523
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
524
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
525
526
527
528
529
530
531
532
533
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_REASSOCREQ_OFF_CAP_INFO);
  	pFrame->pwListenInterval = (unsigned short *)
  				   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				    WLAN_REASSOCREQ_OFF_LISTEN_INT);
  	pFrame->pAddrCurrAP = (PIEEE_ADDR)
  			      (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			       WLAN_REASSOCREQ_OFF_CURR_AP);
ab4622cca   Joe Perches   staging:vt6655:80...
534

1b37f2949   Tülin İzer   Staging: vt6655: ...
535
  	/* Information elements */
ab4622cca   Joe Perches   staging:vt6655:80...
536
537
538
539
  	pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
  			   + WLAN_REASSOCREQ_OFF_SSID);
  
  	while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
ab4622cca   Joe Perches   staging:vt6655:80...
540
541
542
543
544
545
546
  		switch (pItem->byElementID) {
  		case WLAN_EID_SSID:
  			if (pFrame->pSSID == NULL)
  				pFrame->pSSID = (PWLAN_IE_SSID)pItem;
  			break;
  		case WLAN_EID_SUPP_RATES:
  			if (pFrame->pSuppRates == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
547
548
  				pFrame->pSuppRates =
  						    (PWLAN_IE_SUPP_RATES)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
549
550
551
  			break;
  
  		case WLAN_EID_RSN:
6b8c28192   Martin Berglund   Staging: vt6655: ...
552
  			if (pFrame->pRSN == NULL)
ab4622cca   Joe Perches   staging:vt6655:80...
553
  				pFrame->pRSN = (PWLAN_IE_RSN)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
554
555
556
557
  			break;
  		case WLAN_EID_RSN_WPA:
  			if (pFrame->pRSNWPA == NULL) {
  				if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
558
559
  					pFrame->pRSNWPA =
  						       (PWLAN_IE_RSN_EXT)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
560
561
562
563
564
  			}
  			break;
  
  		case WLAN_EID_EXTSUPP_RATES:
  			if (pFrame->pExtSuppRates == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
565
566
  				pFrame->pExtSuppRates =
  						    (PWLAN_IE_SUPP_RATES)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
567
568
  			break;
  		default:
48caf5a06   Joe Perches   staging: vt6655: ...
569
570
571
  			pr_debug("Unrecognized EID=%dd in reassocreq decode
  ",
  				 pItem->byElementID);
ab4622cca   Joe Perches   staging:vt6655:80...
572
573
574
575
  			break;
  		}
  		pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
  	}
5449c685a   Forest Bond   Staging: Add pris...
576
  }
5449c685a   Forest Bond   Staging: Add pris...
577
578
579
580
581
582
583
584
585
  /*+
   *
   * Routine Description:
   *  Encode Probe Request
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
586
   -*/
5449c685a   Forest Bond   Staging: Add pris...
587

6b35b7b37   Charles Clément   Staging: vt6655: ...
588
  void
5449c685a   Forest Bond   Staging: Add pris...
589
  vMgrEncodeProbeRequest(
ab4622cca   Joe Perches   staging:vt6655:80...
590
591
  	PWLAN_FR_PROBEREQ  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
592
  {
ab4622cca   Joe Perches   staging:vt6655:80...
593
594
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
  	pFrame->len = WLAN_HDR_ADDR3_LEN;
5449c685a   Forest Bond   Staging: Add pris...
595
596
597
598
599
600
601
602
603
604
605
  }
  
  /*+
   *
   * Routine Description:
   *  Decode Probe Request
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
606
   -*/
5449c685a   Forest Bond   Staging: Add pris...
607

6b35b7b37   Charles Clément   Staging: vt6655: ...
608
  void
5449c685a   Forest Bond   Staging: Add pris...
609
  vMgrDecodeProbeRequest(
ab4622cca   Joe Perches   staging:vt6655:80...
610
611
  	PWLAN_FR_PROBEREQ  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
612
  {
ab4622cca   Joe Perches   staging:vt6655:80...
613
  	PWLAN_IE   pItem;
5449c685a   Forest Bond   Staging: Add pris...
614

ab4622cca   Joe Perches   staging:vt6655:80...
615
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
616

1b37f2949   Tülin İzer   Staging: vt6655: ...
617
  	/* Information elements */
ab4622cca   Joe Perches   staging:vt6655:80...
618
  	pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)));
5449c685a   Forest Bond   Staging: Add pris...
619

ab4622cca   Joe Perches   staging:vt6655:80...
620
  	while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
ab4622cca   Joe Perches   staging:vt6655:80...
621
622
623
624
625
  		switch (pItem->byElementID) {
  		case WLAN_EID_SSID:
  			if (pFrame->pSSID == NULL)
  				pFrame->pSSID = (PWLAN_IE_SSID)pItem;
  			break;
5449c685a   Forest Bond   Staging: Add pris...
626

ab4622cca   Joe Perches   staging:vt6655:80...
627
628
  		case WLAN_EID_SUPP_RATES:
  			if (pFrame->pSuppRates == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
629
630
  				pFrame->pSuppRates =
  						   (PWLAN_IE_SUPP_RATES)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
631
  			break;
5449c685a   Forest Bond   Staging: Add pris...
632

ab4622cca   Joe Perches   staging:vt6655:80...
633
634
  		case WLAN_EID_EXTSUPP_RATES:
  			if (pFrame->pExtSuppRates == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
635
636
  				pFrame->pExtSuppRates =
  						    (PWLAN_IE_SUPP_RATES)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
637
  			break;
5449c685a   Forest Bond   Staging: Add pris...
638

ab4622cca   Joe Perches   staging:vt6655:80...
639
  		default:
48caf5a06   Joe Perches   staging: vt6655: ...
640
641
642
  			pr_debug("Bad EID=%dd in probereq
  ",
  				 pItem->byElementID);
ab4622cca   Joe Perches   staging:vt6655:80...
643
644
  			break;
  		}
5449c685a   Forest Bond   Staging: Add pris...
645

ab4622cca   Joe Perches   staging:vt6655:80...
646
647
  		pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 +  pItem->len);
  	}
5449c685a   Forest Bond   Staging: Add pris...
648
  }
5449c685a   Forest Bond   Staging: Add pris...
649
650
651
652
653
654
655
656
657
  /*+
   *
   * Routine Description:
   *  Encode Probe Response
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
658
   -*/
5449c685a   Forest Bond   Staging: Add pris...
659

6b35b7b37   Charles Clément   Staging: vt6655: ...
660
  void
5449c685a   Forest Bond   Staging: Add pris...
661
  vMgrEncodeProbeResponse(
ab4622cca   Joe Perches   staging:vt6655:80...
662
663
  	PWLAN_FR_PROBERESP  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
664
  {
ab4622cca   Joe Perches   staging:vt6655:80...
665
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
666

1b37f2949   Tülin İzer   Staging: vt6655: ...
667
  	/* Fixed Fields */
0fc2a76ee   Malcolm Priestley   staging: vt6655: ...
668
  	pFrame->pqwTimestamp = (__le64 *)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
669
670
671
672
673
674
675
676
  			       (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				WLAN_PROBERESP_OFF_TS);
  	pFrame->pwBeaconInterval = (unsigned short *)
  				   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				    WLAN_PROBERESP_OFF_BCN_INT);
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_PROBERESP_OFF_CAP_INFO);
5449c685a   Forest Bond   Staging: Add pris...
677

ab4622cca   Joe Perches   staging:vt6655:80...
678
  	pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO +
0a7ba6239   Gulsah Kose   staging: vt6655: ...
679
  		      sizeof(*(pFrame->pwCapInfo));
5449c685a   Forest Bond   Staging: Add pris...
680
  }
5449c685a   Forest Bond   Staging: Add pris...
681
682
683
684
685
686
687
688
689
  /*+
   *
   * Routine Description:
   *  Decode Probe Response
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
690
   -*/
5449c685a   Forest Bond   Staging: Add pris...
691

6b35b7b37   Charles Clément   Staging: vt6655: ...
692
  void
5449c685a   Forest Bond   Staging: Add pris...
693
  vMgrDecodeProbeResponse(
ab4622cca   Joe Perches   staging:vt6655:80...
694
695
  	PWLAN_FR_PROBERESP  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
696
  {
ab4622cca   Joe Perches   staging:vt6655:80...
697
  	PWLAN_IE    pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
698
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
699
  	/* Fixed Fields */
0fc2a76ee   Malcolm Priestley   staging: vt6655: ...
700
  	pFrame->pqwTimestamp = (__le64 *)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
701
702
703
704
705
706
707
708
  			       (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				WLAN_PROBERESP_OFF_TS);
  	pFrame->pwBeaconInterval = (unsigned short *)
  				   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				    WLAN_PROBERESP_OFF_BCN_INT);
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_PROBERESP_OFF_CAP_INFO);
ab4622cca   Joe Perches   staging:vt6655:80...
709

1b37f2949   Tülin İzer   Staging: vt6655: ...
710
  	/* Information elements */
ab4622cca   Joe Perches   staging:vt6655:80...
711
712
713
714
715
716
717
718
719
720
721
  	pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
  			   + WLAN_PROBERESP_OFF_SSID);
  
  	while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
  		switch (pItem->byElementID) {
  		case WLAN_EID_SSID:
  			if (pFrame->pSSID == NULL)
  				pFrame->pSSID = (PWLAN_IE_SSID)pItem;
  			break;
  		case WLAN_EID_SUPP_RATES:
  			if (pFrame->pSuppRates == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
722
723
  				pFrame->pSuppRates =
  						   (PWLAN_IE_SUPP_RATES)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
724
725
726
727
728
729
730
731
732
733
734
735
736
  			break;
  		case WLAN_EID_FH_PARMS:
  			break;
  		case WLAN_EID_DS_PARMS:
  			if (pFrame->pDSParms == NULL)
  				pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
  			break;
  		case WLAN_EID_CF_PARMS:
  			if (pFrame->pCFParms == NULL)
  				pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
  			break;
  		case WLAN_EID_IBSS_PARMS:
  			if (pFrame->pIBSSParms == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
737
738
  				pFrame->pIBSSParms =
  						   (PWLAN_IE_IBSS_PARMS)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
739
740
741
  			break;
  
  		case WLAN_EID_RSN:
6b8c28192   Martin Berglund   Staging: vt6655: ...
742
  			if (pFrame->pRSN == NULL)
ab4622cca   Joe Perches   staging:vt6655:80...
743
  				pFrame->pRSN = (PWLAN_IE_RSN)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
744
745
746
747
  			break;
  		case WLAN_EID_RSN_WPA:
  			if (pFrame->pRSNWPA == NULL) {
  				if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
748
749
  					pFrame->pRSNWPA =
  						       (PWLAN_IE_RSN_EXT)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
750
751
752
753
754
755
756
757
  			}
  			break;
  		case WLAN_EID_ERP:
  			if (pFrame->pERP == NULL)
  				pFrame->pERP = (PWLAN_IE_ERP)pItem;
  			break;
  		case WLAN_EID_EXTSUPP_RATES:
  			if (pFrame->pExtSuppRates == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
758
759
  				pFrame->pExtSuppRates =
  						    (PWLAN_IE_SUPP_RATES)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
760
  			break;
1b37f2949   Tülin İzer   Staging: vt6655: ...
761
  		case WLAN_EID_COUNTRY:      /* 7 */
ab4622cca   Joe Perches   staging:vt6655:80...
762
763
764
  			if (pFrame->pIE_Country == NULL)
  				pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
  			break;
1b37f2949   Tülin İzer   Staging: vt6655: ...
765
  		case WLAN_EID_PWR_CONSTRAINT:   /* 32 */
ab4622cca   Joe Perches   staging:vt6655:80...
766
  			if (pFrame->pIE_PowerConstraint == NULL)
0a7ba6239   Gulsah Kose   staging: vt6655: ...
767
768
  				pFrame->pIE_PowerConstraint =
  						      (PWLAN_IE_PW_CONST)pItem;
ab4622cca   Joe Perches   staging:vt6655:80...
769
  			break;
1b37f2949   Tülin İzer   Staging: vt6655: ...
770
  		case WLAN_EID_CH_SWITCH:    /* 37 */
ab4622cca   Joe Perches   staging:vt6655:80...
771
772
773
  			if (pFrame->pIE_CHSW == NULL)
  				pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
  			break;
1b37f2949   Tülin İzer   Staging: vt6655: ...
774
  		case WLAN_EID_QUIET:        /* 40 */
ab4622cca   Joe Perches   staging:vt6655:80...
775
776
777
778
779
780
781
782
783
784
  			if (pFrame->pIE_Quiet == NULL)
  				pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
  			break;
  
  		case WLAN_EID_IBSS_DFS:
  			if (pFrame->pIE_IBSSDFS == NULL)
  				pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
  			break;
  
  		default:
48caf5a06   Joe Perches   staging: vt6655: ...
785
786
787
  			pr_debug("Bad EID=%dd in proberesp
  ",
  				 pItem->byElementID);
ab4622cca   Joe Perches   staging:vt6655:80...
788
789
790
791
792
  			break;
  		}
  
  		pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 +  pItem->len);
  	}
5449c685a   Forest Bond   Staging: Add pris...
793
  }
5449c685a   Forest Bond   Staging: Add pris...
794
795
796
797
798
799
800
801
802
  /*+
   *
   * Routine Description:
   *     Encode Authentication frame
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
803
   -*/
5449c685a   Forest Bond   Staging: Add pris...
804

6b35b7b37   Charles Clément   Staging: vt6655: ...
805
  void
5449c685a   Forest Bond   Staging: Add pris...
806
  vMgrEncodeAuthen(
ab4622cca   Joe Perches   staging:vt6655:80...
807
808
  	PWLAN_FR_AUTHEN  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
809
  {
ab4622cca   Joe Perches   staging:vt6655:80...
810
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
811
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
812
813
814
815
816
817
818
819
820
821
822
  	pFrame->pwAuthAlgorithm = (unsigned short *)
  				  (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				   WLAN_AUTHEN_OFF_AUTH_ALG);
  	pFrame->pwAuthSequence = (unsigned short *)
  				 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				  WLAN_AUTHEN_OFF_AUTH_SEQ);
  	pFrame->pwStatus = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_AUTHEN_OFF_STATUS);
  	pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS +
  		      sizeof(*(pFrame->pwStatus));
5449c685a   Forest Bond   Staging: Add pris...
823
  }
5449c685a   Forest Bond   Staging: Add pris...
824
825
826
827
828
829
830
831
832
  /*+
   *
   * Routine Description:
   *   Decode Authentication
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
833
   -*/
5449c685a   Forest Bond   Staging: Add pris...
834

6b35b7b37   Charles Clément   Staging: vt6655: ...
835
  void
5449c685a   Forest Bond   Staging: Add pris...
836
  vMgrDecodeAuthen(
ab4622cca   Joe Perches   staging:vt6655:80...
837
838
  	PWLAN_FR_AUTHEN  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
839
  {
ab4622cca   Joe Perches   staging:vt6655:80...
840
  	PWLAN_IE    pItem;
5449c685a   Forest Bond   Staging: Add pris...
841

ab4622cca   Joe Perches   staging:vt6655:80...
842
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
843

1b37f2949   Tülin İzer   Staging: vt6655: ...
844
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
845
846
847
848
849
850
851
852
853
  	pFrame->pwAuthAlgorithm = (unsigned short *)
  				  (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				   WLAN_AUTHEN_OFF_AUTH_ALG);
  	pFrame->pwAuthSequence = (unsigned short *)
  				 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  				  WLAN_AUTHEN_OFF_AUTH_SEQ);
  	pFrame->pwStatus = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_AUTHEN_OFF_STATUS);
5449c685a   Forest Bond   Staging: Add pris...
854

1b37f2949   Tülin İzer   Staging: vt6655: ...
855
  	/* Information elements */
ab4622cca   Joe Perches   staging:vt6655:80...
856
857
  	pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
  			   + WLAN_AUTHEN_OFF_CHALLENGE);
5449c685a   Forest Bond   Staging: Add pris...
858

6b8c28192   Martin Berglund   Staging: vt6655: ...
859
860
  	if (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len) &&
  	    pItem->byElementID == WLAN_EID_CHALLENGE)
ab4622cca   Joe Perches   staging:vt6655:80...
861
  		pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
5449c685a   Forest Bond   Staging: Add pris...
862
  }
5449c685a   Forest Bond   Staging: Add pris...
863
864
865
866
867
868
869
870
871
  /*+
   *
   * Routine Description:
   *   Encode Authentication
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
872
   -*/
5449c685a   Forest Bond   Staging: Add pris...
873

6b35b7b37   Charles Clément   Staging: vt6655: ...
874
  void
5449c685a   Forest Bond   Staging: Add pris...
875
  vMgrEncodeDeauthen(
ab4622cca   Joe Perches   staging:vt6655:80...
876
877
  	PWLAN_FR_DEAUTHEN  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
878
  {
ab4622cca   Joe Perches   staging:vt6655:80...
879
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
880

1b37f2949   Tülin İzer   Staging: vt6655: ...
881
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
882
883
884
885
886
  	pFrame->pwReason = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_DEAUTHEN_OFF_REASON);
  	pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON +
  		      sizeof(*(pFrame->pwReason));
5449c685a   Forest Bond   Staging: Add pris...
887
  }
5449c685a   Forest Bond   Staging: Add pris...
888
889
890
891
892
893
894
895
896
  /*+
   *
   * Routine Description:
   *   Decode Deauthentication
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
897
   -*/
5449c685a   Forest Bond   Staging: Add pris...
898

6b35b7b37   Charles Clément   Staging: vt6655: ...
899
  void
5449c685a   Forest Bond   Staging: Add pris...
900
  vMgrDecodeDeauthen(
ab4622cca   Joe Perches   staging:vt6655:80...
901
902
  	PWLAN_FR_DEAUTHEN  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
903
  {
ab4622cca   Joe Perches   staging:vt6655:80...
904
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
905

1b37f2949   Tülin İzer   Staging: vt6655: ...
906
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
907
908
909
  	pFrame->pwReason = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_DEAUTHEN_OFF_REASON);
5449c685a   Forest Bond   Staging: Add pris...
910
  }
5449c685a   Forest Bond   Staging: Add pris...
911
912
913
914
915
916
917
918
919
  /*+
   *
   * Routine Description: (AP)
   *   Encode Reassociation Response
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
920
   -*/
5449c685a   Forest Bond   Staging: Add pris...
921

6b35b7b37   Charles Clément   Staging: vt6655: ...
922
  void
5449c685a   Forest Bond   Staging: Add pris...
923
  vMgrEncodeReassocResponse(
ab4622cca   Joe Perches   staging:vt6655:80...
924
925
  	PWLAN_FR_REASSOCRESP  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
926
  {
ab4622cca   Joe Perches   staging:vt6655:80...
927
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
5449c685a   Forest Bond   Staging: Add pris...
928

1b37f2949   Tülin İzer   Staging: vt6655: ...
929
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
930
931
932
933
934
935
936
937
938
939
940
941
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_REASSOCRESP_OFF_CAP_INFO);
  	pFrame->pwStatus = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_REASSOCRESP_OFF_STATUS);
  	pFrame->pwAid = (unsigned short *)
  			(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			 WLAN_REASSOCRESP_OFF_AID);
  
  	pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID +
  		      sizeof(*(pFrame->pwAid));
5449c685a   Forest Bond   Staging: Add pris...
942
  }
5449c685a   Forest Bond   Staging: Add pris...
943
944
945
946
947
948
949
950
951
  /*+
   *
   * Routine Description:
   *   Decode Reassociation Response
   *
   *
   * Return Value:
   *    None.
   *
ab4622cca   Joe Perches   staging:vt6655:80...
952
   -*/
5449c685a   Forest Bond   Staging: Add pris...
953

6b35b7b37   Charles Clément   Staging: vt6655: ...
954
  void
5449c685a   Forest Bond   Staging: Add pris...
955
  vMgrDecodeReassocResponse(
ab4622cca   Joe Perches   staging:vt6655:80...
956
957
  	PWLAN_FR_REASSOCRESP  pFrame
  )
5449c685a   Forest Bond   Staging: Add pris...
958
  {
ab4622cca   Joe Perches   staging:vt6655:80...
959
960
961
  	PWLAN_IE   pItem;
  
  	pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1b37f2949   Tülin İzer   Staging: vt6655: ...
962
  	/* Fixed Fields */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
963
964
965
966
967
968
969
970
971
  	pFrame->pwCapInfo = (unsigned short *)
  			    (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			     WLAN_REASSOCRESP_OFF_CAP_INFO);
  	pFrame->pwStatus = (unsigned short *)
  			   (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			    WLAN_REASSOCRESP_OFF_STATUS);
  	pFrame->pwAid = (unsigned short *)
  			(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			 WLAN_REASSOCRESP_OFF_AID);
ab4622cca   Joe Perches   staging:vt6655:80...
972

1b37f2949   Tülin İzer   Staging: vt6655: ...
973
  	/* Information elements */
0a7ba6239   Gulsah Kose   staging: vt6655: ...
974
975
976
  	pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)
  			     (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
  			      WLAN_REASSOCRESP_OFF_SUPP_RATES);
ab4622cca   Joe Perches   staging:vt6655:80...
977
978
979
980
981
982
983
984
  
  	pItem = (PWLAN_IE)(pFrame->pSuppRates);
  	pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
  
  	if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) &&
  	    (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
  		pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
  	}
5449c685a   Forest Bond   Staging: Add pris...
985
  }