audit: complex interfield comparison helper
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / vt6656 / 80211mgr.c
blob39f98423dc02299bca9272c4af70bb23252f79da
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
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.
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.
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.
19 * File: 80211mgr.c
21 * Purpose: Handles the 802.11 management support functions
23 * Author: Lyndon Chen
25 * Date: May 8, 2002
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
51 * Revision History:
55 #include "tmacro.h"
56 #include "tether.h"
57 #include "80211mgr.h"
58 #include "80211hdr.h"
59 #include "device.h"
60 #include "wpa.h"
62 /*--------------------- Static Definitions -------------------------*/
66 /*--------------------- Static Classes ----------------------------*/
68 /*--------------------- Static Variables --------------------------*/
70 static int msglevel = MSG_LEVEL_INFO;
71 /*static int msglevel =MSG_LEVEL_DEBUG;*/
72 /*--------------------- Static Functions --------------------------*/
76 /*--------------------- Export Variables --------------------------*/
79 /*--------------------- Export Functions --------------------------*/
82 /*+
84 * Routine Description:
85 * Encode Beacon frame body offset
87 * Return Value:
88 * None.
90 -*/
92 void
93 vMgrEncodeBeacon(
94 PWLAN_FR_BEACON pFrame
97 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
99 /* Fixed Fields */
100 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);
107 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID;
109 return;
114 * Routine Description:
115 * Decode Beacon frame body offset
118 * Return Value:
119 * None.
124 void
125 vMgrDecodeBeacon(
126 PWLAN_FR_BEACON pFrame
129 PWLAN_IE pItem;
131 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
133 /* Fixed Fields */
134 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);
141 /* Information elements */
142 pItem = (PWLAN_IE)((PBYTE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)))
143 + WLAN_BEACON_OFF_SSID);
144 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
146 switch (pItem->byElementID) {
147 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;
175 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;
184 break;
186 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;
195 case WLAN_EID_COUNTRY: /* 7 */
196 if (pFrame->pIE_Country == NULL)
197 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
198 break;
200 case WLAN_EID_PWR_CONSTRAINT: /* 32 */
201 if (pFrame->pIE_PowerConstraint == NULL)
202 pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem;
203 break;
205 case WLAN_EID_CH_SWITCH: /* 37 */
206 if (pFrame->pIE_CHSW == NULL)
207 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
208 break;
210 case WLAN_EID_QUIET: /* 40 */
211 if (pFrame->pIE_Quiet == NULL)
212 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
213 break;
215 case WLAN_EID_IBSS_DFS:
216 if (pFrame->pIE_IBSSDFS == NULL)
217 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
218 break;
220 default:
221 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", pItem->byElementID);
222 break;
225 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
232 * Routine Description:
233 * Encode IBSS ATIM
236 * Return Value:
237 * None.
242 void
243 vMgrEncodeIBSSATIM(
244 PWLAN_FR_IBSSATIM pFrame
247 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
248 pFrame->len = WLAN_HDR_ADDR3_LEN;
254 * Routine Description:
255 * Decode IBSS ATIM
258 * Return Value:
259 * None.
263 void
264 vMgrDecodeIBSSATIM(
265 PWLAN_FR_IBSSATIM pFrame
268 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
274 * Routine Description:
275 * Encode Disassociation
278 * Return Value:
279 * None.
283 void
284 vMgrEncodeDisassociation(
285 PWLAN_FR_DISASSOC pFrame
288 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
291 /* Fixed Fields */
292 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));
300 * Routine Description:
301 * Decode Disassociation
304 * Return Value:
305 * None.
309 void
310 vMgrDecodeDisassociation(
311 PWLAN_FR_DISASSOC pFrame
314 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
316 /* Fixed Fields */
317 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
318 + WLAN_DISASSOC_OFF_REASON);
323 * Routine Description:
324 * Encode Association Request
327 * Return Value:
328 * None.
333 void
334 vMgrEncodeAssocRequest(
335 PWLAN_FR_ASSOCREQ pFrame
338 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
339 /* Fixed Fields */
340 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));
350 * Routine Description: (AP)
351 * Decode Association Request
354 * Return Value:
355 * None.
359 void
360 vMgrDecodeAssocRequest(
361 PWLAN_FR_ASSOCREQ pFrame
364 PWLAN_IE pItem;
366 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
367 /* Fixed Fields */
368 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);
373 /* Information elements */
374 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
375 + WLAN_ASSOCREQ_OFF_SSID);
377 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
378 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;
388 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;
397 break;
398 case WLAN_EID_EXTSUPP_RATES:
399 if (pFrame->pExtSuppRates == NULL)
400 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
401 break;
403 default:
404 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n",
405 pItem->byElementID);
406 break;
408 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
414 * Routine Description: (AP)
415 * Encode Association Response
418 * Return Value:
419 * None.
423 void
424 vMgrEncodeAssocResponse(
425 PWLAN_FR_ASSOCRESP pFrame
428 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
430 /* Fixed Fields */
431 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));
444 * Routine Description:
445 * Decode Association Response
448 * Return Value:
449 * None.
453 void
454 vMgrDecodeAssocResponse(
455 PWLAN_FR_ASSOCRESP pFrame
458 PWLAN_IE pItem;
460 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
462 /* Fixed Fields */
463 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);
470 /* Information elements */
471 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
472 + WLAN_ASSOCRESP_OFF_SUPP_RATES);
474 pItem = (PWLAN_IE)(pFrame->pSuppRates);
475 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
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);
480 } else
481 pFrame->pExtSuppRates = NULL;
487 * Routine Description:
488 * Encode Reassociation Request
491 * Return Value:
492 * None.
496 void
497 vMgrEncodeReassocRequest(
498 PWLAN_FR_REASSOCREQ pFrame
501 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
503 /* Fixed Fields */
504 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));
516 * Routine Description: (AP)
517 * Decode Reassociation Request
520 * Return Value:
521 * None.
526 void
527 vMgrDecodeReassocRequest(
528 PWLAN_FR_REASSOCREQ pFrame
531 PWLAN_IE pItem;
532 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
534 /* Fixed Fields */
535 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);
542 /* Information elements */
543 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
544 + WLAN_REASSOCREQ_OFF_SSID);
546 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
548 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;
558 case WLAN_EID_RSN:
559 if (pFrame->pRSN == NULL)
560 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
561 break;
562 case WLAN_EID_RSN_WPA:
563 if (pFrame->pRSNWPA == NULL)
564 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE)
565 pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem;
566 break;
568 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;
577 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
585 * Routine Description:
586 * Encode Probe Request
589 * Return Value:
590 * None.
595 void
596 vMgrEncodeProbeRequest(
597 PWLAN_FR_PROBEREQ pFrame
600 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
601 pFrame->len = WLAN_HDR_ADDR3_LEN;
606 * Routine Description:
607 * Decode Probe Request
610 * Return Value:
611 * None.
615 void
616 vMgrDecodeProbeRequest(
617 PWLAN_FR_PROBEREQ pFrame
620 PWLAN_IE pItem;
622 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
624 /* Information elements */
625 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)));
627 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
629 switch (pItem->byElementID) {
630 case WLAN_EID_SSID:
631 if (pFrame->pSSID == NULL)
632 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
633 break;
635 case WLAN_EID_SUPP_RATES:
636 if (pFrame->pSuppRates == NULL)
637 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
638 break;
640 case WLAN_EID_EXTSUPP_RATES:
641 if (pFrame->pExtSuppRates == NULL)
642 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
643 break;
645 default:
646 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in probereq\n", pItem->byElementID);
647 break;
650 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
657 * Routine Description:
658 * Encode Probe Response
661 * Return Value:
662 * None.
667 void
668 vMgrEncodeProbeResponse(
669 PWLAN_FR_PROBERESP pFrame
672 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
674 /* Fixed Fields */
675 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);
682 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO +
683 sizeof(*(pFrame->pwCapInfo));
690 * Routine Description:
691 * Decode Probe Response
694 * Return Value:
695 * None.
699 void
700 vMgrDecodeProbeResponse(
701 PWLAN_FR_PROBERESP pFrame
704 PWLAN_IE pItem;
707 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
709 /* Fixed Fields */
710 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);
717 /* Information elements */
718 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
719 + WLAN_PROBERESP_OFF_SSID);
721 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
722 switch (pItem->byElementID) {
723 case WLAN_EID_SSID:
724 if (pFrame->pSSID == NULL)
725 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
726 break;
727 case WLAN_EID_SUPP_RATES:
728 if (pFrame->pSuppRates == NULL)
729 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
730 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;
746 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;
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;
765 case WLAN_EID_COUNTRY: /* 7 */
766 if (pFrame->pIE_Country == NULL)
767 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
768 break;
770 case WLAN_EID_PWR_CONSTRAINT: /* 32 */
771 if (pFrame->pIE_PowerConstraint == NULL)
772 pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem;
773 break;
775 case WLAN_EID_CH_SWITCH: /* 37 */
776 if (pFrame->pIE_CHSW == NULL)
777 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
778 break;
780 case WLAN_EID_QUIET: /* 40 */
781 if (pFrame->pIE_Quiet == NULL)
782 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
783 break;
785 case WLAN_EID_IBSS_DFS:
786 if (pFrame->pIE_IBSSDFS == NULL)
787 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
788 break;
790 default:
791 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in proberesp\n", pItem->byElementID);
792 break;
795 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
802 * Routine Description:
803 * Encode Authentication frame
806 * Return Value:
807 * None.
811 void
812 vMgrEncodeAuthen(
813 PWLAN_FR_AUTHEN pFrame
816 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
818 /* Fixed Fields */
819 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));
831 * Routine Description:
832 * Decode Authentication
835 * Return Value:
836 * None.
840 void
841 vMgrDecodeAuthen(
842 PWLAN_FR_AUTHEN pFrame
845 PWLAN_IE pItem;
847 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
849 /* Fixed Fields */
850 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);
857 /* Information elements */
858 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
859 + WLAN_AUTHEN_OFF_CHALLENGE);
861 if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE))
862 pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
868 * Routine Description:
869 * Encode Authentication
872 * Return Value:
873 * None.
877 void
878 vMgrEncodeDeauthen(
879 PWLAN_FR_DEAUTHEN pFrame
882 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
884 /* Fixed Fields */
885 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));
893 * Routine Description:
894 * Decode Deauthentication
897 * Return Value:
898 * None.
902 void
903 vMgrDecodeDeauthen(
904 PWLAN_FR_DEAUTHEN pFrame
907 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
909 /* Fixed Fields */
910 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
911 + WLAN_DEAUTHEN_OFF_REASON);
917 * Routine Description: (AP)
918 * Encode Reassociation Response
921 * Return Value:
922 * None.
926 void
927 vMgrEncodeReassocResponse(
928 PWLAN_FR_REASSOCRESP pFrame
931 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
933 /* Fixed Fields */
934 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);
941 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid));
947 * Routine Description:
948 * Decode Reassociation Response
951 * Return Value:
952 * None.
957 void
958 vMgrDecodeReassocResponse(
959 PWLAN_FR_REASSOCRESP pFrame
962 PWLAN_IE pItem;
964 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
966 /* Fixed Fields */
967 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);
974 /* Information elements */
975 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
976 + WLAN_REASSOCRESP_OFF_SUPP_RATES);
978 pItem = (PWLAN_IE)(pFrame->pSuppRates);
979 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
981 if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES))
982 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;