2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
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.
21 * Purpose: Handles the 802.11 management support 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
62 /*--------------------- Static Definitions -------------------------*/
64 /*--------------------- Static Classes ----------------------------*/
66 /*--------------------- Static Variables --------------------------*/
68 static int msglevel = MSG_LEVEL_INFO;
69 /* static int msglevel =MSG_LEVEL_DEBUG; */
70 /*--------------------- Static Functions --------------------------*/
72 /*--------------------- Export Variables --------------------------*/
74 /*--------------------- Export Functions --------------------------*/
78 * Routine Description:
79 * Encode Beacon frame body offset
88 PWLAN_FR_BEACON pFrame
91 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
94 pFrame->pqwTimestamp = (__le64 *)
95 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
97 pFrame->pwBeaconInterval = (unsigned short *)
98 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
99 WLAN_BEACON_OFF_BCN_INT);
100 pFrame->pwCapInfo = (unsigned short *)
101 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
102 WLAN_BEACON_OFF_CAPINFO);
104 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID;
109 * Routine Description:
110 * Decode Beacon frame body offset
120 PWLAN_FR_BEACON pFrame
125 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
128 pFrame->pqwTimestamp = (__le64 *)
129 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
131 pFrame->pwBeaconInterval = (unsigned short *)
132 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
133 WLAN_BEACON_OFF_BCN_INT);
134 pFrame->pwCapInfo = (unsigned short *)
135 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
136 WLAN_BEACON_OFF_CAPINFO);
138 /* Information elements */
139 pItem = (PWLAN_IE)((unsigned char *)
140 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))) +
141 WLAN_BEACON_OFF_SSID);
142 while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
143 switch (pItem->byElementID) {
145 if (pFrame->pSSID == NULL)
146 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
148 case WLAN_EID_SUPP_RATES:
149 if (pFrame->pSuppRates == NULL)
150 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
152 case WLAN_EID_FH_PARMS:
153 /* pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem; */
155 case WLAN_EID_DS_PARMS:
156 if (pFrame->pDSParms == NULL)
157 pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
159 case WLAN_EID_CF_PARMS:
160 if (pFrame->pCFParms == NULL)
161 pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
163 case WLAN_EID_IBSS_PARMS:
164 if (pFrame->pIBSSParms == NULL)
165 pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem;
168 if (pFrame->pTIM == NULL)
169 pFrame->pTIM = (PWLAN_IE_TIM)pItem;
173 if (pFrame->pRSN == NULL)
174 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
176 case WLAN_EID_RSN_WPA:
177 if (pFrame->pRSNWPA == NULL) {
178 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true)
180 (PWLAN_IE_RSN_EXT)pItem;
185 if (pFrame->pERP == NULL)
186 pFrame->pERP = (PWLAN_IE_ERP)pItem;
188 case WLAN_EID_EXTSUPP_RATES:
189 if (pFrame->pExtSuppRates == NULL)
190 pFrame->pExtSuppRates =
191 (PWLAN_IE_SUPP_RATES)pItem;
194 case WLAN_EID_COUNTRY: /* 7 */
195 if (pFrame->pIE_Country == NULL)
196 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
199 case WLAN_EID_PWR_CONSTRAINT: /* 32 */
200 if (pFrame->pIE_PowerConstraint == NULL)
201 pFrame->pIE_PowerConstraint =
202 (PWLAN_IE_PW_CONST)pItem;
205 case WLAN_EID_CH_SWITCH: /* 37 */
206 if (pFrame->pIE_CHSW == NULL)
207 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
210 case WLAN_EID_QUIET: /* 40 */
211 if (pFrame->pIE_Quiet == NULL)
212 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
215 case WLAN_EID_IBSS_DFS:
216 if (pFrame->pIE_IBSSDFS == NULL)
217 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
221 DBG_PRT(MSG_LEVEL_DEBUG,
222 KERN_INFO "Unrecognized EID=%dd in beacon decode.\n",
227 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
233 * Routine Description:
244 PWLAN_FR_IBSSATIM pFrame
247 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
248 pFrame->len = WLAN_HDR_ADDR3_LEN;
253 * Routine Description:
264 PWLAN_FR_IBSSATIM pFrame
267 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
272 * Routine Description:
273 * Encode Disassociation
282 vMgrEncodeDisassociation(
283 PWLAN_FR_DISASSOC pFrame
286 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
289 pFrame->pwReason = (unsigned short *)
290 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
291 WLAN_DISASSOC_OFF_REASON);
292 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON +
293 sizeof(*(pFrame->pwReason));
298 * Routine Description:
299 * Decode Disassociation
308 vMgrDecodeDisassociation(
309 PWLAN_FR_DISASSOC pFrame
312 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
315 pFrame->pwReason = (unsigned short *)
316 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
317 WLAN_DISASSOC_OFF_REASON);
322 * Routine Description:
323 * Encode Association Request
332 vMgrEncodeAssocRequest(
333 PWLAN_FR_ASSOCREQ pFrame
336 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
338 pFrame->pwCapInfo = (unsigned short *)
339 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
340 WLAN_ASSOCREQ_OFF_CAP_INFO);
341 pFrame->pwListenInterval = (unsigned short *)
342 (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 +
345 sizeof(*(pFrame->pwListenInterval));
350 * Routine Description: (AP)
351 * Decode Association Request
360 vMgrDecodeAssocRequest(
361 PWLAN_FR_ASSOCREQ pFrame
366 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
368 pFrame->pwCapInfo = (unsigned short *)
369 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
370 WLAN_ASSOCREQ_OFF_CAP_INFO);
371 pFrame->pwListenInterval = (unsigned short *)
372 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
373 WLAN_ASSOCREQ_OFF_LISTEN_INT);
375 /* Information elements */
376 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
377 + WLAN_ASSOCREQ_OFF_SSID);
379 while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
380 switch (pItem->byElementID) {
382 if (pFrame->pSSID == NULL)
383 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
385 case WLAN_EID_SUPP_RATES:
386 if (pFrame->pSuppRates == NULL)
388 (PWLAN_IE_SUPP_RATES)pItem;
392 if (pFrame->pRSN == NULL)
393 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
395 case WLAN_EID_RSN_WPA:
396 if (pFrame->pRSNWPA == NULL) {
397 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true)
399 (PWLAN_IE_RSN_EXT)pItem;
402 case WLAN_EID_EXTSUPP_RATES:
403 if (pFrame->pExtSuppRates == NULL)
404 pFrame->pExtSuppRates =
405 (PWLAN_IE_SUPP_RATES)pItem;
409 DBG_PRT(MSG_LEVEL_DEBUG,
410 KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n",
414 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
420 * Routine Description: (AP)
421 * Encode Association Response
430 vMgrEncodeAssocResponse(
431 PWLAN_FR_ASSOCRESP pFrame
434 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
437 pFrame->pwCapInfo = (unsigned short *)
438 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
439 WLAN_ASSOCRESP_OFF_CAP_INFO);
440 pFrame->pwStatus = (unsigned short *)
441 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
442 WLAN_ASSOCRESP_OFF_STATUS);
443 pFrame->pwAid = (unsigned short *)
444 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
445 WLAN_ASSOCRESP_OFF_AID);
446 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCRESP_OFF_AID +
447 sizeof(*(pFrame->pwAid));
452 * Routine Description:
453 * Decode Association Response
462 vMgrDecodeAssocResponse(
463 PWLAN_FR_ASSOCRESP pFrame
468 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
471 pFrame->pwCapInfo = (unsigned short *)
472 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
473 WLAN_ASSOCRESP_OFF_CAP_INFO);
474 pFrame->pwStatus = (unsigned short *)
475 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
476 WLAN_ASSOCRESP_OFF_STATUS);
477 pFrame->pwAid = (unsigned short *)
478 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
479 WLAN_ASSOCRESP_OFF_AID);
481 /* Information elements */
482 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)
483 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
484 WLAN_ASSOCRESP_OFF_SUPP_RATES);
486 pItem = (PWLAN_IE)(pFrame->pSuppRates);
487 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
489 if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) &&
490 (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
491 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
492 DBG_PRT(MSG_LEVEL_DEBUG,
493 KERN_INFO "pFrame->pExtSuppRates=[%p].\n",
496 pFrame->pExtSuppRates = NULL;
502 * Routine Description:
503 * Encode Reassociation Request
512 vMgrEncodeReassocRequest(
513 PWLAN_FR_REASSOCREQ pFrame
516 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
519 pFrame->pwCapInfo = (unsigned short *)
520 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
521 WLAN_REASSOCREQ_OFF_CAP_INFO);
522 pFrame->pwListenInterval = (unsigned short *)
523 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
524 WLAN_REASSOCREQ_OFF_LISTEN_INT);
525 pFrame->pAddrCurrAP = (PIEEE_ADDR)
526 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
527 WLAN_REASSOCREQ_OFF_CURR_AP);
528 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP +
529 sizeof(*(pFrame->pAddrCurrAP));
534 * Routine Description: (AP)
535 * Decode Reassociation Request
544 vMgrDecodeReassocRequest(
545 PWLAN_FR_REASSOCREQ pFrame
550 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
553 pFrame->pwCapInfo = (unsigned short *)
554 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
555 WLAN_REASSOCREQ_OFF_CAP_INFO);
556 pFrame->pwListenInterval = (unsigned short *)
557 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
558 WLAN_REASSOCREQ_OFF_LISTEN_INT);
559 pFrame->pAddrCurrAP = (PIEEE_ADDR)
560 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
561 WLAN_REASSOCREQ_OFF_CURR_AP);
563 /* Information elements */
564 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
565 + WLAN_REASSOCREQ_OFF_SSID);
567 while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
568 switch (pItem->byElementID) {
570 if (pFrame->pSSID == NULL)
571 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
573 case WLAN_EID_SUPP_RATES:
574 if (pFrame->pSuppRates == NULL)
576 (PWLAN_IE_SUPP_RATES)pItem;
580 if (pFrame->pRSN == NULL)
581 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
583 case WLAN_EID_RSN_WPA:
584 if (pFrame->pRSNWPA == NULL) {
585 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true)
587 (PWLAN_IE_RSN_EXT)pItem;
591 case WLAN_EID_EXTSUPP_RATES:
592 if (pFrame->pExtSuppRates == NULL)
593 pFrame->pExtSuppRates =
594 (PWLAN_IE_SUPP_RATES)pItem;
597 DBG_PRT(MSG_LEVEL_DEBUG,
598 KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n",
602 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
608 * Routine Description:
609 * Encode Probe Request
618 vMgrEncodeProbeRequest(
619 PWLAN_FR_PROBEREQ pFrame
622 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
623 pFrame->len = WLAN_HDR_ADDR3_LEN;
628 * Routine Description:
629 * Decode Probe Request
638 vMgrDecodeProbeRequest(
639 PWLAN_FR_PROBEREQ pFrame
644 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
646 /* Information elements */
647 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)));
649 while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
650 switch (pItem->byElementID) {
652 if (pFrame->pSSID == NULL)
653 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
656 case WLAN_EID_SUPP_RATES:
657 if (pFrame->pSuppRates == NULL)
659 (PWLAN_IE_SUPP_RATES)pItem;
662 case WLAN_EID_EXTSUPP_RATES:
663 if (pFrame->pExtSuppRates == NULL)
664 pFrame->pExtSuppRates =
665 (PWLAN_IE_SUPP_RATES)pItem;
669 DBG_PRT(MSG_LEVEL_DEBUG,
670 KERN_INFO "Bad EID=%dd in probereq\n",
675 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
681 * Routine Description:
682 * Encode Probe Response
691 vMgrEncodeProbeResponse(
692 PWLAN_FR_PROBERESP pFrame
695 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
698 pFrame->pqwTimestamp = (__le64 *)
699 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
700 WLAN_PROBERESP_OFF_TS);
701 pFrame->pwBeaconInterval = (unsigned short *)
702 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
703 WLAN_PROBERESP_OFF_BCN_INT);
704 pFrame->pwCapInfo = (unsigned short *)
705 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
706 WLAN_PROBERESP_OFF_CAP_INFO);
708 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO +
709 sizeof(*(pFrame->pwCapInfo));
714 * Routine Description:
715 * Decode Probe Response
724 vMgrDecodeProbeResponse(
725 PWLAN_FR_PROBERESP pFrame
730 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
733 pFrame->pqwTimestamp = (__le64 *)
734 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
735 WLAN_PROBERESP_OFF_TS);
736 pFrame->pwBeaconInterval = (unsigned short *)
737 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
738 WLAN_PROBERESP_OFF_BCN_INT);
739 pFrame->pwCapInfo = (unsigned short *)
740 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
741 WLAN_PROBERESP_OFF_CAP_INFO);
743 /* Information elements */
744 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
745 + WLAN_PROBERESP_OFF_SSID);
747 while (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) {
748 switch (pItem->byElementID) {
750 if (pFrame->pSSID == NULL)
751 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
753 case WLAN_EID_SUPP_RATES:
754 if (pFrame->pSuppRates == NULL)
756 (PWLAN_IE_SUPP_RATES)pItem;
758 case WLAN_EID_FH_PARMS:
760 case WLAN_EID_DS_PARMS:
761 if (pFrame->pDSParms == NULL)
762 pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
764 case WLAN_EID_CF_PARMS:
765 if (pFrame->pCFParms == NULL)
766 pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
768 case WLAN_EID_IBSS_PARMS:
769 if (pFrame->pIBSSParms == NULL)
771 (PWLAN_IE_IBSS_PARMS)pItem;
775 if (pFrame->pRSN == NULL)
776 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
778 case WLAN_EID_RSN_WPA:
779 if (pFrame->pRSNWPA == NULL) {
780 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == true)
782 (PWLAN_IE_RSN_EXT)pItem;
786 if (pFrame->pERP == NULL)
787 pFrame->pERP = (PWLAN_IE_ERP)pItem;
789 case WLAN_EID_EXTSUPP_RATES:
790 if (pFrame->pExtSuppRates == NULL)
791 pFrame->pExtSuppRates =
792 (PWLAN_IE_SUPP_RATES)pItem;
795 case WLAN_EID_COUNTRY: /* 7 */
796 if (pFrame->pIE_Country == NULL)
797 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
800 case WLAN_EID_PWR_CONSTRAINT: /* 32 */
801 if (pFrame->pIE_PowerConstraint == NULL)
802 pFrame->pIE_PowerConstraint =
803 (PWLAN_IE_PW_CONST)pItem;
806 case WLAN_EID_CH_SWITCH: /* 37 */
807 if (pFrame->pIE_CHSW == NULL)
808 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
811 case WLAN_EID_QUIET: /* 40 */
812 if (pFrame->pIE_Quiet == NULL)
813 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
816 case WLAN_EID_IBSS_DFS:
817 if (pFrame->pIE_IBSSDFS == NULL)
818 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
822 DBG_PRT(MSG_LEVEL_DEBUG,
823 KERN_INFO "Bad EID=%dd in proberesp\n",
828 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
834 * Routine Description:
835 * Encode Authentication frame
845 PWLAN_FR_AUTHEN pFrame
848 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
851 pFrame->pwAuthAlgorithm = (unsigned short *)
852 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
853 WLAN_AUTHEN_OFF_AUTH_ALG);
854 pFrame->pwAuthSequence = (unsigned short *)
855 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
856 WLAN_AUTHEN_OFF_AUTH_SEQ);
857 pFrame->pwStatus = (unsigned short *)
858 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
859 WLAN_AUTHEN_OFF_STATUS);
860 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS +
861 sizeof(*(pFrame->pwStatus));
866 * Routine Description:
867 * Decode Authentication
877 PWLAN_FR_AUTHEN pFrame
882 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
885 pFrame->pwAuthAlgorithm = (unsigned short *)
886 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
887 WLAN_AUTHEN_OFF_AUTH_ALG);
888 pFrame->pwAuthSequence = (unsigned short *)
889 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
890 WLAN_AUTHEN_OFF_AUTH_SEQ);
891 pFrame->pwStatus = (unsigned short *)
892 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
893 WLAN_AUTHEN_OFF_STATUS);
895 /* Information elements */
896 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
897 + WLAN_AUTHEN_OFF_CHALLENGE);
899 if (((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len) &&
900 pItem->byElementID == WLAN_EID_CHALLENGE)
901 pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
906 * Routine Description:
907 * Encode Authentication
917 PWLAN_FR_DEAUTHEN pFrame
920 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
923 pFrame->pwReason = (unsigned short *)
924 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
925 WLAN_DEAUTHEN_OFF_REASON);
926 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON +
927 sizeof(*(pFrame->pwReason));
932 * Routine Description:
933 * Decode Deauthentication
943 PWLAN_FR_DEAUTHEN pFrame
946 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
949 pFrame->pwReason = (unsigned short *)
950 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
951 WLAN_DEAUTHEN_OFF_REASON);
956 * Routine Description: (AP)
957 * Encode Reassociation Response
966 vMgrEncodeReassocResponse(
967 PWLAN_FR_REASSOCRESP pFrame
970 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
973 pFrame->pwCapInfo = (unsigned short *)
974 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
975 WLAN_REASSOCRESP_OFF_CAP_INFO);
976 pFrame->pwStatus = (unsigned short *)
977 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
978 WLAN_REASSOCRESP_OFF_STATUS);
979 pFrame->pwAid = (unsigned short *)
980 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
981 WLAN_REASSOCRESP_OFF_AID);
983 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID +
984 sizeof(*(pFrame->pwAid));
989 * Routine Description:
990 * Decode Reassociation Response
999 vMgrDecodeReassocResponse(
1000 PWLAN_FR_REASSOCRESP pFrame
1005 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1008 pFrame->pwCapInfo = (unsigned short *)
1009 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
1010 WLAN_REASSOCRESP_OFF_CAP_INFO);
1011 pFrame->pwStatus = (unsigned short *)
1012 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
1013 WLAN_REASSOCRESP_OFF_STATUS);
1014 pFrame->pwAid = (unsigned short *)
1015 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
1016 WLAN_REASSOCRESP_OFF_AID);
1018 /* Information elements */
1019 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)
1020 (WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
1021 WLAN_REASSOCRESP_OFF_SUPP_RATES);
1023 pItem = (PWLAN_IE)(pFrame->pSuppRates);
1024 pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
1026 if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) &&
1027 (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
1028 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;