blob: 39f98423dc02299bca9272c4af70bb23252f79da [file] [log] [blame]
Forest Bond92b96792009-06-13 07:38:31 -04001/*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * File: 80211mgr.c
20 *
Uwe Kleine-König0d743952010-06-11 12:17:04 +020021 * Purpose: Handles the 802.11 management support functions
Forest Bond92b96792009-06-13 07:38:31 -040022 *
23 * Author: Lyndon Chen
24 *
25 * Date: May 8, 2002
26 *
27 * Functions:
28 * vMgrEncodeBeacon - Encode the Beacon frame
29 * vMgrDecodeBeacon - Decode the Beacon frame
30 * vMgrEncodeIBSSATIM - Encode the IBSS ATIM frame
31 * vMgrDecodeIBSSATIM - Decode the IBSS ATIM frame
32 * vMgrEncodeDisassociation - Encode the Disassociation frame
33 * vMgrDecodeDisassociation - Decode the Disassociation frame
34 * vMgrEncodeAssocRequest - Encode the Association request frame
35 * vMgrDecodeAssocRequest - Decode the Association request frame
36 * vMgrEncodeAssocResponse - Encode the Association response frame
37 * vMgrDecodeAssocResponse - Decode the Association response frame
38 * vMgrEncodeReAssocRequest - Encode the ReAssociation request frame
39 * vMgrDecodeReAssocRequest - Decode the ReAssociation request frame
40 * vMgrEncodeProbeRequest - Encode the Probe request frame
41 * vMgrDecodeProbeRequest - Decode the Probe request frame
42 * vMgrEncodeProbeResponse - Encode the Probe response frame
43 * vMgrDecodeProbeResponse - Decode the Probe response frame
44 * vMgrEncodeAuthen - Encode the Authentication frame
45 * vMgrDecodeAuthen - Decode the Authentication frame
46 * vMgrEncodeDeauthen - Encode the DeAuthentication frame
47 * vMgrDecodeDeauthen - Decode the DeAuthentication frame
48 * vMgrEncodeReassocResponse - Encode the Reassociation response frame
49 * vMgrDecodeReassocResponse - Decode the Reassociation response frame
50 *
51 * Revision History:
52 *
53 */
54
Forest Bond92b96792009-06-13 07:38:31 -040055#include "tmacro.h"
Forest Bond92b96792009-06-13 07:38:31 -040056#include "tether.h"
Forest Bond92b96792009-06-13 07:38:31 -040057#include "80211mgr.h"
Forest Bond92b96792009-06-13 07:38:31 -040058#include "80211hdr.h"
Forest Bond92b96792009-06-13 07:38:31 -040059#include "device.h"
Forest Bond92b96792009-06-13 07:38:31 -040060#include "wpa.h"
Forest Bond92b96792009-06-13 07:38:31 -040061
62/*--------------------- Static Definitions -------------------------*/
63
64
65
66/*--------------------- Static Classes ----------------------------*/
67
68/*--------------------- Static Variables --------------------------*/
69
Timofey Trofimov2555cd92010-05-22 20:42:54 +040070static int msglevel = MSG_LEVEL_INFO;
71/*static int msglevel =MSG_LEVEL_DEBUG;*/
Forest Bond92b96792009-06-13 07:38:31 -040072/*--------------------- Static Functions --------------------------*/
73
74
75
76/*--------------------- Export Variables --------------------------*/
77
78
79/*--------------------- Export Functions --------------------------*/
80
81
82/*+
83 *
84 * Routine Description:
85 * Encode Beacon frame body offset
86 *
87 * Return Value:
88 * None.
89 *
90-*/
91
Andres More8611a292010-05-01 14:25:00 -030092void
Forest Bond92b96792009-06-13 07:38:31 -040093vMgrEncodeBeacon(
Andres More592ccfe2010-04-17 12:07:42 -030094 PWLAN_FR_BEACON pFrame
Forest Bond92b96792009-06-13 07:38:31 -040095 )
96{
97 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
98
Timofey Trofimov2555cd92010-05-22 20:42:54 +040099 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400100 pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
101 + WLAN_BEACON_OFF_TS);
102 pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
103 + WLAN_BEACON_OFF_BCN_INT);
104 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
105 + WLAN_BEACON_OFF_CAPINFO);
106
107 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID;
108
109 return;
110}
111
112/*+
113 *
114 * Routine Description:
115 * Decode Beacon frame body offset
116 *
117 *
118 * Return Value:
119 * None.
120 *
121-*/
122
123
Andres More8611a292010-05-01 14:25:00 -0300124void
Forest Bond92b96792009-06-13 07:38:31 -0400125vMgrDecodeBeacon(
Andres More592ccfe2010-04-17 12:07:42 -0300126 PWLAN_FR_BEACON pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400127 )
128{
129 PWLAN_IE pItem;
130
131 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
132
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400133 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400134 pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
135 + WLAN_BEACON_OFF_TS);
136 pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
137 + WLAN_BEACON_OFF_BCN_INT);
138 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
139 + WLAN_BEACON_OFF_CAPINFO);
140
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400141 /* Information elements */
Forest Bond92b96792009-06-13 07:38:31 -0400142 pItem = (PWLAN_IE)((PBYTE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)))
143 + WLAN_BEACON_OFF_SSID);
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400144 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
Forest Bond92b96792009-06-13 07:38:31 -0400145
146 switch (pItem->byElementID) {
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400147 case WLAN_EID_SSID:
148 if (pFrame->pSSID == NULL)
149 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
150 break;
151 case WLAN_EID_SUPP_RATES:
152 if (pFrame->pSuppRates == NULL)
153 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
154 break;
155 case WLAN_EID_FH_PARMS:
156 /* pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem; */
157 break;
158 case WLAN_EID_DS_PARMS:
159 if (pFrame->pDSParms == NULL)
160 pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
161 break;
162 case WLAN_EID_CF_PARMS:
163 if (pFrame->pCFParms == NULL)
164 pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
165 break;
166 case WLAN_EID_IBSS_PARMS:
167 if (pFrame->pIBSSParms == NULL)
168 pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem;
169 break;
170 case WLAN_EID_TIM:
171 if (pFrame->pTIM == NULL)
172 pFrame->pTIM = (PWLAN_IE_TIM)pItem;
173 break;
Forest Bond92b96792009-06-13 07:38:31 -0400174
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400175 case WLAN_EID_RSN:
176 if (pFrame->pRSN == NULL)
177 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
178 break;
179 case WLAN_EID_RSN_WPA:
180 if (pFrame->pRSNWPA == NULL) {
181 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE)
182 pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem;
183 }
184 break;
Forest Bond92b96792009-06-13 07:38:31 -0400185
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400186 case WLAN_EID_ERP:
187 if (pFrame->pERP == NULL)
188 pFrame->pERP = (PWLAN_IE_ERP)pItem;
189 break;
190 case WLAN_EID_EXTSUPP_RATES:
191 if (pFrame->pExtSuppRates == NULL)
192 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
193 break;
Forest Bond92b96792009-06-13 07:38:31 -0400194
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400195 case WLAN_EID_COUNTRY: /* 7 */
196 if (pFrame->pIE_Country == NULL)
197 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
198 break;
Forest Bond92b96792009-06-13 07:38:31 -0400199
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400200 case WLAN_EID_PWR_CONSTRAINT: /* 32 */
201 if (pFrame->pIE_PowerConstraint == NULL)
202 pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem;
203 break;
Forest Bond92b96792009-06-13 07:38:31 -0400204
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400205 case WLAN_EID_CH_SWITCH: /* 37 */
206 if (pFrame->pIE_CHSW == NULL)
207 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
208 break;
Forest Bond92b96792009-06-13 07:38:31 -0400209
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400210 case WLAN_EID_QUIET: /* 40 */
211 if (pFrame->pIE_Quiet == NULL)
212 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
213 break;
Forest Bond92b96792009-06-13 07:38:31 -0400214
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400215 case WLAN_EID_IBSS_DFS:
216 if (pFrame->pIE_IBSSDFS == NULL)
217 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
218 break;
Forest Bond92b96792009-06-13 07:38:31 -0400219
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400220 default:
221 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", pItem->byElementID);
Forest Bond92b96792009-06-13 07:38:31 -0400222 break;
223
224 }
225 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
226 }
Forest Bond92b96792009-06-13 07:38:31 -0400227}
228
229
230/*+
231 *
232 * Routine Description:
233 * Encode IBSS ATIM
234 *
235 *
236 * Return Value:
237 * None.
238 *
239-*/
240
241
Andres More8611a292010-05-01 14:25:00 -0300242void
Forest Bond92b96792009-06-13 07:38:31 -0400243vMgrEncodeIBSSATIM(
Andres More592ccfe2010-04-17 12:07:42 -0300244 PWLAN_FR_IBSSATIM pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400245 )
246{
247 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
248 pFrame->len = WLAN_HDR_ADDR3_LEN;
Forest Bond92b96792009-06-13 07:38:31 -0400249}
250
251
252/*+
253 *
254 * Routine Description:
255 * Decode IBSS ATIM
256 *
257 *
258 * Return Value:
259 * None.
260 *
261-*/
262
Andres More8611a292010-05-01 14:25:00 -0300263void
Forest Bond92b96792009-06-13 07:38:31 -0400264vMgrDecodeIBSSATIM(
Andres More592ccfe2010-04-17 12:07:42 -0300265 PWLAN_FR_IBSSATIM pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400266 )
267{
268 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
Forest Bond92b96792009-06-13 07:38:31 -0400269}
270
271
272/*+
273 *
274 * Routine Description:
275 * Encode Disassociation
276 *
277 *
278 * Return Value:
279 * None.
280 *
281-*/
282
Andres More8611a292010-05-01 14:25:00 -0300283void
Forest Bond92b96792009-06-13 07:38:31 -0400284vMgrEncodeDisassociation(
Andres More592ccfe2010-04-17 12:07:42 -0300285 PWLAN_FR_DISASSOC pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400286 )
287{
288 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
289
290
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400291 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400292 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
293 + WLAN_DISASSOC_OFF_REASON);
294 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON + sizeof(*(pFrame->pwReason));
Forest Bond92b96792009-06-13 07:38:31 -0400295}
296
297
298/*+
299 *
300 * Routine Description:
301 * Decode Disassociation
302 *
303 *
304 * Return Value:
305 * None.
306 *
307-*/
308
Andres More8611a292010-05-01 14:25:00 -0300309void
Forest Bond92b96792009-06-13 07:38:31 -0400310vMgrDecodeDisassociation(
Andres More592ccfe2010-04-17 12:07:42 -0300311 PWLAN_FR_DISASSOC pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400312 )
313{
314 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
315
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400316 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400317 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
318 + WLAN_DISASSOC_OFF_REASON);
Forest Bond92b96792009-06-13 07:38:31 -0400319}
320
321/*+
322 *
323 * Routine Description:
324 * Encode Association Request
325 *
326 *
327 * Return Value:
328 * None.
329 *
330-*/
331
332
Andres More8611a292010-05-01 14:25:00 -0300333void
Forest Bond92b96792009-06-13 07:38:31 -0400334vMgrEncodeAssocRequest(
Andres More592ccfe2010-04-17 12:07:42 -0300335 PWLAN_FR_ASSOCREQ pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400336 )
337{
338 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400339 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400340 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
341 + WLAN_ASSOCREQ_OFF_CAP_INFO);
342 pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
343 + WLAN_ASSOCREQ_OFF_LISTEN_INT);
344 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCREQ_OFF_LISTEN_INT + sizeof(*(pFrame->pwListenInterval));
Forest Bond92b96792009-06-13 07:38:31 -0400345}
346
347
348/*+
349 *
350 * Routine Description: (AP)
351 * Decode Association Request
352 *
353 *
354 * Return Value:
355 * None.
356 *
357-*/
358
Andres More8611a292010-05-01 14:25:00 -0300359void
Forest Bond92b96792009-06-13 07:38:31 -0400360vMgrDecodeAssocRequest(
Andres More592ccfe2010-04-17 12:07:42 -0300361 PWLAN_FR_ASSOCREQ pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400362 )
363{
364 PWLAN_IE pItem;
365
366 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400367 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400368 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
369 + WLAN_ASSOCREQ_OFF_CAP_INFO);
370 pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
371 + WLAN_ASSOCREQ_OFF_LISTEN_INT);
372
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400373 /* Information elements */
Forest Bond92b96792009-06-13 07:38:31 -0400374 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
375 + WLAN_ASSOCREQ_OFF_SSID);
376
377 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400378 switch (pItem->byElementID) {
379 case WLAN_EID_SSID:
380 if (pFrame->pSSID == NULL)
381 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
382 break;
383 case WLAN_EID_SUPP_RATES:
384 if (pFrame->pSuppRates == NULL)
385 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
386 break;
Forest Bond92b96792009-06-13 07:38:31 -0400387
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400388 case WLAN_EID_RSN:
389 if (pFrame->pRSN == NULL)
390 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
391 break;
392 case WLAN_EID_RSN_WPA:
393 if (pFrame->pRSNWPA == NULL) {
394 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE)
395 pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem;
396 }
397 break;
398 case WLAN_EID_EXTSUPP_RATES:
399 if (pFrame->pExtSuppRates == NULL)
400 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
401 break;
Forest Bond92b96792009-06-13 07:38:31 -0400402
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400403 default:
404 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n",
405 pItem->byElementID);
406 break;
Forest Bond92b96792009-06-13 07:38:31 -0400407 }
408 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
409 }
Forest Bond92b96792009-06-13 07:38:31 -0400410}
411
412/*+
413 *
414 * Routine Description: (AP)
415 * Encode Association Response
416 *
417 *
418 * Return Value:
419 * None.
420 *
421-*/
422
Andres More8611a292010-05-01 14:25:00 -0300423void
Forest Bond92b96792009-06-13 07:38:31 -0400424vMgrEncodeAssocResponse(
Andres More592ccfe2010-04-17 12:07:42 -0300425 PWLAN_FR_ASSOCRESP pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400426 )
427{
428 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
429
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400430 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400431 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
432 + WLAN_ASSOCRESP_OFF_CAP_INFO);
433 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
434 + WLAN_ASSOCRESP_OFF_STATUS);
435 pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
436 + WLAN_ASSOCRESP_OFF_AID);
437 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCRESP_OFF_AID
438 + sizeof(*(pFrame->pwAid));
Forest Bond92b96792009-06-13 07:38:31 -0400439}
440
441
442/*+
443 *
444 * Routine Description:
445 * Decode Association Response
446 *
447 *
448 * Return Value:
449 * None.
450 *
451-*/
452
Andres More8611a292010-05-01 14:25:00 -0300453void
Forest Bond92b96792009-06-13 07:38:31 -0400454vMgrDecodeAssocResponse(
Andres More592ccfe2010-04-17 12:07:42 -0300455 PWLAN_FR_ASSOCRESP pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400456 )
457{
458 PWLAN_IE pItem;
459
460 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
461
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400462 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400463 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
464 + WLAN_ASSOCRESP_OFF_CAP_INFO);
465 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
466 + WLAN_ASSOCRESP_OFF_STATUS);
467 pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
468 + WLAN_ASSOCRESP_OFF_AID);
469
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400470 /* Information elements */
Forest Bond92b96792009-06-13 07:38:31 -0400471 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
472 + WLAN_ASSOCRESP_OFF_SUPP_RATES);
473
474 pItem = (PWLAN_IE)(pFrame->pSuppRates);
475 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
476
477 if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
478 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
479 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pFrame->pExtSuppRates=[%p].\n", pItem);
Marcos Paulo de Souza63182372011-11-30 00:18:07 -0200480 } else
Forest Bond92b96792009-06-13 07:38:31 -0400481 pFrame->pExtSuppRates = NULL;
Forest Bond92b96792009-06-13 07:38:31 -0400482}
483
484
485/*+
486 *
487 * Routine Description:
488 * Encode Reassociation Request
489 *
490 *
491 * Return Value:
492 * None.
493 *
494-*/
495
Andres More8611a292010-05-01 14:25:00 -0300496void
Forest Bond92b96792009-06-13 07:38:31 -0400497vMgrEncodeReassocRequest(
Andres More592ccfe2010-04-17 12:07:42 -0300498 PWLAN_FR_REASSOCREQ pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400499 )
500{
501 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
502
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400503 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400504 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
505 + WLAN_REASSOCREQ_OFF_CAP_INFO);
506 pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
507 + WLAN_REASSOCREQ_OFF_LISTEN_INT);
508 pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
509 + WLAN_REASSOCREQ_OFF_CURR_AP);
510 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP + sizeof(*(pFrame->pAddrCurrAP));
Forest Bond92b96792009-06-13 07:38:31 -0400511}
512
513
514/*+
515 *
516 * Routine Description: (AP)
517 * Decode Reassociation Request
518 *
519 *
520 * Return Value:
521 * None.
522 *
523-*/
524
525
Andres More8611a292010-05-01 14:25:00 -0300526void
Forest Bond92b96792009-06-13 07:38:31 -0400527vMgrDecodeReassocRequest(
Andres More592ccfe2010-04-17 12:07:42 -0300528 PWLAN_FR_REASSOCREQ pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400529 )
530{
531 PWLAN_IE pItem;
532 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
533
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400534 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400535 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
536 + WLAN_REASSOCREQ_OFF_CAP_INFO);
537 pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
538 + WLAN_REASSOCREQ_OFF_LISTEN_INT);
539 pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
540 + WLAN_REASSOCREQ_OFF_CURR_AP);
541
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400542 /* Information elements */
Forest Bond92b96792009-06-13 07:38:31 -0400543 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
544 + WLAN_REASSOCREQ_OFF_SSID);
545
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400546 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
Forest Bond92b96792009-06-13 07:38:31 -0400547
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400548 switch (pItem->byElementID) {
549 case WLAN_EID_SSID:
550 if (pFrame->pSSID == NULL)
551 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
552 break;
553 case WLAN_EID_SUPP_RATES:
554 if (pFrame->pSuppRates == NULL)
555 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
556 break;
Forest Bond92b96792009-06-13 07:38:31 -0400557
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400558 case WLAN_EID_RSN:
559 if (pFrame->pRSN == NULL)
560 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
561 break;
562 case WLAN_EID_RSN_WPA:
Marcos Paulo de Souza63182372011-11-30 00:18:07 -0200563 if (pFrame->pRSNWPA == NULL)
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400564 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE)
565 pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem;
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400566 break;
Forest Bond92b96792009-06-13 07:38:31 -0400567
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400568 case WLAN_EID_EXTSUPP_RATES:
569 if (pFrame->pExtSuppRates == NULL)
570 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
571 break;
572 default:
573 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n",
574 pItem->byElementID);
575 break;
Forest Bond92b96792009-06-13 07:38:31 -0400576 }
577 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
578 }
Forest Bond92b96792009-06-13 07:38:31 -0400579}
580
581
582
583/*+
584 *
585 * Routine Description:
586 * Encode Probe Request
587 *
588 *
589 * Return Value:
590 * None.
591 *
592-*/
593
594
Andres More8611a292010-05-01 14:25:00 -0300595void
Forest Bond92b96792009-06-13 07:38:31 -0400596vMgrEncodeProbeRequest(
Andres More592ccfe2010-04-17 12:07:42 -0300597 PWLAN_FR_PROBEREQ pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400598 )
599{
600 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
601 pFrame->len = WLAN_HDR_ADDR3_LEN;
Forest Bond92b96792009-06-13 07:38:31 -0400602}
603
604/*+
605 *
606 * Routine Description:
607 * Decode Probe Request
608 *
609 *
610 * Return Value:
611 * None.
612 *
613-*/
614
Andres More8611a292010-05-01 14:25:00 -0300615void
Forest Bond92b96792009-06-13 07:38:31 -0400616vMgrDecodeProbeRequest(
Andres More592ccfe2010-04-17 12:07:42 -0300617 PWLAN_FR_PROBEREQ pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400618 )
619{
620 PWLAN_IE pItem;
621
622 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
623
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400624 /* Information elements */
Forest Bond92b96792009-06-13 07:38:31 -0400625 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)));
626
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400627 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
Forest Bond92b96792009-06-13 07:38:31 -0400628
629 switch (pItem->byElementID) {
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400630 case WLAN_EID_SSID:
631 if (pFrame->pSSID == NULL)
632 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
633 break;
Forest Bond92b96792009-06-13 07:38:31 -0400634
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400635 case WLAN_EID_SUPP_RATES:
636 if (pFrame->pSuppRates == NULL)
637 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
638 break;
Forest Bond92b96792009-06-13 07:38:31 -0400639
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400640 case WLAN_EID_EXTSUPP_RATES:
641 if (pFrame->pExtSuppRates == NULL)
642 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
643 break;
Forest Bond92b96792009-06-13 07:38:31 -0400644
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400645 default:
646 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in probereq\n", pItem->byElementID);
647 break;
Forest Bond92b96792009-06-13 07:38:31 -0400648 }
649
650 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
651 }
Forest Bond92b96792009-06-13 07:38:31 -0400652}
653
654
655/*+
656 *
657 * Routine Description:
658 * Encode Probe Response
659 *
660 *
661 * Return Value:
662 * None.
663 *
664-*/
665
666
Andres More8611a292010-05-01 14:25:00 -0300667void
Forest Bond92b96792009-06-13 07:38:31 -0400668vMgrEncodeProbeResponse(
Andres More592ccfe2010-04-17 12:07:42 -0300669 PWLAN_FR_PROBERESP pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400670 )
671{
672 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
673
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400674 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400675 pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
676 + WLAN_PROBERESP_OFF_TS);
677 pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
678 + WLAN_PROBERESP_OFF_BCN_INT);
679 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
680 + WLAN_PROBERESP_OFF_CAP_INFO);
681
682 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO +
683 sizeof(*(pFrame->pwCapInfo));
Forest Bond92b96792009-06-13 07:38:31 -0400684}
685
686
687
688/*+
689 *
690 * Routine Description:
691 * Decode Probe Response
692 *
693 *
694 * Return Value:
695 * None.
696 *
697-*/
698
Andres More8611a292010-05-01 14:25:00 -0300699void
Forest Bond92b96792009-06-13 07:38:31 -0400700vMgrDecodeProbeResponse(
Andres More592ccfe2010-04-17 12:07:42 -0300701 PWLAN_FR_PROBERESP pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400702 )
703{
704 PWLAN_IE pItem;
Forest Bond92b96792009-06-13 07:38:31 -0400705
706
707 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
708
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400709 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400710 pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
711 + WLAN_PROBERESP_OFF_TS);
712 pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
713 + WLAN_PROBERESP_OFF_BCN_INT);
714 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
715 + WLAN_PROBERESP_OFF_CAP_INFO);
716
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400717 /* Information elements */
Forest Bond92b96792009-06-13 07:38:31 -0400718 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
719 + WLAN_PROBERESP_OFF_SSID);
720
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400721 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
Forest Bond92b96792009-06-13 07:38:31 -0400722 switch (pItem->byElementID) {
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400723 case WLAN_EID_SSID:
724 if (pFrame->pSSID == NULL)
Forest Bond92b96792009-06-13 07:38:31 -0400725 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400726 break;
727 case WLAN_EID_SUPP_RATES:
728 if (pFrame->pSuppRates == NULL)
Forest Bond92b96792009-06-13 07:38:31 -0400729 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400730 break;
731 case WLAN_EID_FH_PARMS:
732 break;
733 case WLAN_EID_DS_PARMS:
734 if (pFrame->pDSParms == NULL)
735 pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
736 break;
737 case WLAN_EID_CF_PARMS:
738 if (pFrame->pCFParms == NULL)
739 pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
740 break;
741 case WLAN_EID_IBSS_PARMS:
742 if (pFrame->pIBSSParms == NULL)
743 pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem;
744 break;
Forest Bond92b96792009-06-13 07:38:31 -0400745
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400746 case WLAN_EID_RSN:
747 if (pFrame->pRSN == NULL)
748 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
749 break;
750 case WLAN_EID_RSN_WPA:
751 if (pFrame->pRSNWPA == NULL) {
752 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE)
753 pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem;
754 }
755 break;
756 case WLAN_EID_ERP:
757 if (pFrame->pERP == NULL)
758 pFrame->pERP = (PWLAN_IE_ERP)pItem;
759 break;
760 case WLAN_EID_EXTSUPP_RATES:
761 if (pFrame->pExtSuppRates == NULL)
762 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
763 break;
Forest Bond92b96792009-06-13 07:38:31 -0400764
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400765 case WLAN_EID_COUNTRY: /* 7 */
766 if (pFrame->pIE_Country == NULL)
767 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
768 break;
Forest Bond92b96792009-06-13 07:38:31 -0400769
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400770 case WLAN_EID_PWR_CONSTRAINT: /* 32 */
771 if (pFrame->pIE_PowerConstraint == NULL)
772 pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem;
773 break;
Forest Bond92b96792009-06-13 07:38:31 -0400774
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400775 case WLAN_EID_CH_SWITCH: /* 37 */
776 if (pFrame->pIE_CHSW == NULL)
777 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
778 break;
Forest Bond92b96792009-06-13 07:38:31 -0400779
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400780 case WLAN_EID_QUIET: /* 40 */
781 if (pFrame->pIE_Quiet == NULL)
782 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
783 break;
Forest Bond92b96792009-06-13 07:38:31 -0400784
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400785 case WLAN_EID_IBSS_DFS:
786 if (pFrame->pIE_IBSSDFS == NULL)
787 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
788 break;
Forest Bond92b96792009-06-13 07:38:31 -0400789
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400790 default:
791 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in proberesp\n", pItem->byElementID);
792 break;
Forest Bond92b96792009-06-13 07:38:31 -0400793 }
794
795 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
796 }
Forest Bond92b96792009-06-13 07:38:31 -0400797}
798
799
800/*+
801 *
802 * Routine Description:
803 * Encode Authentication frame
804 *
805 *
806 * Return Value:
807 * None.
808 *
809-*/
810
Andres More8611a292010-05-01 14:25:00 -0300811void
Forest Bond92b96792009-06-13 07:38:31 -0400812vMgrEncodeAuthen(
Andres More592ccfe2010-04-17 12:07:42 -0300813 PWLAN_FR_AUTHEN pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400814 )
815{
816 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
817
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400818 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400819 pFrame->pwAuthAlgorithm = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
820 + WLAN_AUTHEN_OFF_AUTH_ALG);
821 pFrame->pwAuthSequence = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
822 + WLAN_AUTHEN_OFF_AUTH_SEQ);
823 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
824 + WLAN_AUTHEN_OFF_STATUS);
825 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS + sizeof(*(pFrame->pwStatus));
Forest Bond92b96792009-06-13 07:38:31 -0400826}
827
828
829/*+
830 *
831 * Routine Description:
832 * Decode Authentication
833 *
834 *
835 * Return Value:
836 * None.
837 *
838-*/
839
Andres More8611a292010-05-01 14:25:00 -0300840void
Forest Bond92b96792009-06-13 07:38:31 -0400841vMgrDecodeAuthen(
Andres More592ccfe2010-04-17 12:07:42 -0300842 PWLAN_FR_AUTHEN pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400843 )
844{
845 PWLAN_IE pItem;
846
847 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
848
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400849 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400850 pFrame->pwAuthAlgorithm = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
851 + WLAN_AUTHEN_OFF_AUTH_ALG);
852 pFrame->pwAuthSequence = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
853 + WLAN_AUTHEN_OFF_AUTH_SEQ);
854 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
855 + WLAN_AUTHEN_OFF_STATUS);
856
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400857 /* Information elements */
Forest Bond92b96792009-06-13 07:38:31 -0400858 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
859 + WLAN_AUTHEN_OFF_CHALLENGE);
860
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400861 if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE))
Forest Bond92b96792009-06-13 07:38:31 -0400862 pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
Forest Bond92b96792009-06-13 07:38:31 -0400863}
864
865
866/*+
867 *
868 * Routine Description:
869 * Encode Authentication
870 *
871 *
872 * Return Value:
873 * None.
874 *
875-*/
876
Andres More8611a292010-05-01 14:25:00 -0300877void
Forest Bond92b96792009-06-13 07:38:31 -0400878vMgrEncodeDeauthen(
Andres More592ccfe2010-04-17 12:07:42 -0300879 PWLAN_FR_DEAUTHEN pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400880 )
881{
882 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
883
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400884 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400885 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
886 + WLAN_DEAUTHEN_OFF_REASON);
887 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON + sizeof(*(pFrame->pwReason));
Forest Bond92b96792009-06-13 07:38:31 -0400888}
889
890
891/*+
892 *
893 * Routine Description:
894 * Decode Deauthentication
895 *
896 *
897 * Return Value:
898 * None.
899 *
900-*/
901
Andres More8611a292010-05-01 14:25:00 -0300902void
Forest Bond92b96792009-06-13 07:38:31 -0400903vMgrDecodeDeauthen(
Andres More592ccfe2010-04-17 12:07:42 -0300904 PWLAN_FR_DEAUTHEN pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400905 )
906{
907 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
908
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400909 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400910 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
911 + WLAN_DEAUTHEN_OFF_REASON);
Forest Bond92b96792009-06-13 07:38:31 -0400912}
913
914
915/*+
916 *
917 * Routine Description: (AP)
918 * Encode Reassociation Response
919 *
920 *
921 * Return Value:
922 * None.
923 *
924-*/
925
Andres More8611a292010-05-01 14:25:00 -0300926void
Forest Bond92b96792009-06-13 07:38:31 -0400927vMgrEncodeReassocResponse(
Andres More592ccfe2010-04-17 12:07:42 -0300928 PWLAN_FR_REASSOCRESP pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400929 )
930{
931 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
932
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400933 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400934 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
935 + WLAN_REASSOCRESP_OFF_CAP_INFO);
936 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
937 + WLAN_REASSOCRESP_OFF_STATUS);
938 pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
939 + WLAN_REASSOCRESP_OFF_AID);
940
941 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid));
Forest Bond92b96792009-06-13 07:38:31 -0400942}
943
944
945/*+
946 *
947 * Routine Description:
948 * Decode Reassociation Response
949 *
950 *
951 * Return Value:
952 * None.
953 *
954-*/
955
956
Andres More8611a292010-05-01 14:25:00 -0300957void
Forest Bond92b96792009-06-13 07:38:31 -0400958vMgrDecodeReassocResponse(
Andres More592ccfe2010-04-17 12:07:42 -0300959 PWLAN_FR_REASSOCRESP pFrame
Forest Bond92b96792009-06-13 07:38:31 -0400960 )
961{
962 PWLAN_IE pItem;
963
964 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
965
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400966 /* Fixed Fields */
Forest Bond92b96792009-06-13 07:38:31 -0400967 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
968 + WLAN_REASSOCRESP_OFF_CAP_INFO);
969 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
970 + WLAN_REASSOCRESP_OFF_STATUS);
971 pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
972 + WLAN_REASSOCRESP_OFF_AID);
973
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400974 /* Information elements */
Forest Bond92b96792009-06-13 07:38:31 -0400975 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
976 + WLAN_REASSOCRESP_OFF_SUPP_RATES);
977
978 pItem = (PWLAN_IE)(pFrame->pSuppRates);
979 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
980
Timofey Trofimov2555cd92010-05-22 20:42:54 +0400981 if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES))
Forest Bond92b96792009-06-13 07:38:31 -0400982 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
Forest Bond92b96792009-06-13 07:38:31 -0400983}