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.
22 * Purpose: Handles the 802.11 managment support functions
29 * vMgrEncodeBeacon - Encode the Beacon frame
30 * vMgrDecodeBeacon - Decode the Beacon frame
31 * vMgrEncodeIBSSATIM - Encode the IBSS ATIM frame
32 * vMgrDecodeIBSSATIM - Decode the IBSS ATIM frame
33 * vMgrEncodeDisassociation - Encode the Disassociation frame
34 * vMgrDecodeDisassociation - Decode the Disassociation frame
35 * vMgrEncodeAssocRequest - Encode the Association request frame
36 * vMgrDecodeAssocRequest - Decode the Association request frame
37 * vMgrEncodeAssocResponse - Encode the Association response frame
38 * vMgrDecodeAssocResponse - Decode the Association response frame
39 * vMgrEncodeReAssocRequest - Encode the ReAssociation request frame
40 * vMgrDecodeReAssocRequest - Decode the ReAssociation request frame
41 * vMgrEncodeProbeRequest - Encode the Probe request frame
42 * vMgrDecodeProbeRequest - Decode the Probe request frame
43 * vMgrEncodeProbeResponse - Encode the Probe response frame
44 * vMgrDecodeProbeResponse - Decode the Probe response frame
45 * vMgrEncodeAuthen - Encode the Authentication frame
46 * vMgrDecodeAuthen - Decode the Authentication frame
47 * vMgrEncodeDeauthen - Encode the DeAuthentication frame
48 * vMgrDecodeDeauthen - Decode the DeAuthentication frame
49 * vMgrEncodeReassocResponse - Encode the Reassociation response frame
50 * vMgrDecodeReassocResponse - Decode the Reassociation response frame
58 #if !defined(__TMACRO_H__)
61 #if !defined(__TETHER_H__)
64 #if !defined(__80211MGR_H__)
67 #if !defined(__80211HDR_H__)
70 #if !defined(__DEVICE_H__)
73 #if !defined(__WPA_H__)
79 /*--------------------- Static Definitions -------------------------*/
83 /*--------------------- Static Classes ----------------------------*/
85 /*--------------------- Static Variables --------------------------*/
87 static int msglevel =MSG_LEVEL_INFO;
88 //static int msglevel =MSG_LEVEL_DEBUG;
89 /*--------------------- Static Functions --------------------------*/
93 /*--------------------- Export Variables --------------------------*/
96 /*--------------------- Export Functions --------------------------*/
101 * Routine Description:
102 * Encode Beacon frame body offset
111 IN PWLAN_FR_BEACON pFrame
114 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
117 pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
118 + WLAN_BEACON_OFF_TS);
119 pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
120 + WLAN_BEACON_OFF_BCN_INT);
121 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
122 + WLAN_BEACON_OFF_CAPINFO);
124 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_BEACON_OFF_SSID;
131 * Routine Description:
132 * Decode Beacon frame body offset
143 IN PWLAN_FR_BEACON pFrame
148 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
151 pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
152 + WLAN_BEACON_OFF_TS);
153 pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
154 + WLAN_BEACON_OFF_BCN_INT);
155 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
156 + WLAN_BEACON_OFF_CAPINFO);
158 // Information elements
159 pItem = (PWLAN_IE)((PBYTE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)))
160 + WLAN_BEACON_OFF_SSID);
161 while( ((PBYTE)pItem) < (pFrame->pBuf + pFrame->len) ){
163 switch (pItem->byElementID) {
165 if (pFrame->pSSID == NULL)
166 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
168 case WLAN_EID_SUPP_RATES:
169 if (pFrame->pSuppRates == NULL)
170 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
172 case WLAN_EID_FH_PARMS:
173 //pFrame->pFHParms = (PWLAN_IE_FH_PARMS)pItem;
175 case WLAN_EID_DS_PARMS:
176 if (pFrame->pDSParms == NULL)
177 pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
179 case WLAN_EID_CF_PARMS:
180 if (pFrame->pCFParms == NULL)
181 pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
183 case WLAN_EID_IBSS_PARMS:
184 if (pFrame->pIBSSParms == NULL)
185 pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem;
188 if (pFrame->pTIM == NULL)
189 pFrame->pTIM = (PWLAN_IE_TIM)pItem;
193 if (pFrame->pRSN == NULL) {
194 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
197 case WLAN_EID_RSN_WPA:
198 if (pFrame->pRSNWPA == NULL) {
199 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE)
200 pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem;
205 if (pFrame->pERP == NULL)
206 pFrame->pERP = (PWLAN_IE_ERP)pItem;
208 case WLAN_EID_EXTSUPP_RATES:
209 if (pFrame->pExtSuppRates == NULL)
210 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
213 case WLAN_EID_COUNTRY: //7
214 if (pFrame->pIE_Country == NULL)
215 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
218 case WLAN_EID_PWR_CONSTRAINT: //32
219 if (pFrame->pIE_PowerConstraint == NULL)
220 pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem;
223 case WLAN_EID_CH_SWITCH: //37
224 if (pFrame->pIE_CHSW == NULL)
225 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
228 case WLAN_EID_QUIET: //40
229 if (pFrame->pIE_Quiet == NULL)
230 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
233 case WLAN_EID_IBSS_DFS:
234 if (pFrame->pIE_IBSSDFS == NULL)
235 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
239 DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in beacon decode.\n", pItem->byElementID);
243 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
252 * Routine Description:
264 IN PWLAN_FR_IBSSATIM pFrame
267 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
268 pFrame->len = WLAN_HDR_ADDR3_LEN;
276 * Routine Description:
287 IN PWLAN_FR_IBSSATIM pFrame
290 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
298 * Routine Description:
299 * Encode Disassociation
308 vMgrEncodeDisassociation(
309 IN PWLAN_FR_DISASSOC pFrame
312 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
316 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
317 + WLAN_DISASSOC_OFF_REASON);
318 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON + sizeof(*(pFrame->pwReason));
326 * Routine Description:
327 * Decode Disassociation
336 vMgrDecodeDisassociation(
337 IN PWLAN_FR_DISASSOC pFrame
340 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
343 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
344 + WLAN_DISASSOC_OFF_REASON);
351 * Routine Description:
352 * Encode Association Request
362 vMgrEncodeAssocRequest(
363 IN PWLAN_FR_ASSOCREQ pFrame
366 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
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);
372 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCREQ_OFF_LISTEN_INT + sizeof(*(pFrame->pwListenInterval));
379 * Routine Description: (AP)
380 * Decode Association Request
389 vMgrDecodeAssocRequest(
390 IN PWLAN_FR_ASSOCREQ pFrame
395 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
397 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
398 + WLAN_ASSOCREQ_OFF_CAP_INFO);
399 pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
400 + WLAN_ASSOCREQ_OFF_LISTEN_INT);
402 // Information elements
403 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
404 + WLAN_ASSOCREQ_OFF_SSID);
406 while (((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
407 switch (pItem->byElementID){
409 if (pFrame->pSSID == NULL)
410 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
412 case WLAN_EID_SUPP_RATES:
413 if (pFrame->pSuppRates == NULL)
414 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
418 if (pFrame->pRSN == NULL) {
419 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
422 case WLAN_EID_RSN_WPA:
423 if (pFrame->pRSNWPA == NULL) {
424 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE)
425 pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem;
428 case WLAN_EID_EXTSUPP_RATES:
429 if (pFrame->pExtSuppRates == NULL)
430 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
434 DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n",
438 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
445 * Routine Description: (AP)
446 * Encode Association Response
455 vMgrEncodeAssocResponse(
456 IN PWLAN_FR_ASSOCRESP pFrame
459 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
462 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
463 + WLAN_ASSOCRESP_OFF_CAP_INFO);
464 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
465 + WLAN_ASSOCRESP_OFF_STATUS);
466 pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
467 + WLAN_ASSOCRESP_OFF_AID);
468 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCRESP_OFF_AID
469 + sizeof(*(pFrame->pwAid));
477 * Routine Description:
478 * Decode Association Response
487 vMgrDecodeAssocResponse(
488 IN PWLAN_FR_ASSOCRESP pFrame
493 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
496 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
497 + WLAN_ASSOCRESP_OFF_CAP_INFO);
498 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
499 + WLAN_ASSOCRESP_OFF_STATUS);
500 pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
501 + WLAN_ASSOCRESP_OFF_AID);
503 // Information elements
504 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
505 + WLAN_ASSOCRESP_OFF_SUPP_RATES);
507 pItem = (PWLAN_IE)(pFrame->pSuppRates);
508 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
510 if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
511 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
512 DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pFrame->pExtSuppRates=[%p].\n", pItem);
515 pFrame->pExtSuppRates = NULL;
523 * Routine Description:
524 * Encode Reassociation Request
533 vMgrEncodeReassocRequest(
534 IN PWLAN_FR_REASSOCREQ pFrame
537 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
540 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
541 + WLAN_REASSOCREQ_OFF_CAP_INFO);
542 pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
543 + WLAN_REASSOCREQ_OFF_LISTEN_INT);
544 pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
545 + WLAN_REASSOCREQ_OFF_CURR_AP);
546 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP + sizeof(*(pFrame->pAddrCurrAP));
554 * Routine Description: (AP)
555 * Decode Reassociation Request
565 vMgrDecodeReassocRequest(
566 IN PWLAN_FR_REASSOCREQ pFrame
570 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
573 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
574 + WLAN_REASSOCREQ_OFF_CAP_INFO);
575 pFrame->pwListenInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
576 + WLAN_REASSOCREQ_OFF_LISTEN_INT);
577 pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
578 + WLAN_REASSOCREQ_OFF_CURR_AP);
580 // Information elements
581 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
582 + WLAN_REASSOCREQ_OFF_SSID);
584 while(((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) {
586 switch (pItem->byElementID){
588 if (pFrame->pSSID == NULL)
589 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
591 case WLAN_EID_SUPP_RATES:
592 if (pFrame->pSuppRates == NULL)
593 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
597 if (pFrame->pRSN == NULL) {
598 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
601 case WLAN_EID_RSN_WPA:
602 if (pFrame->pRSNWPA == NULL) {
603 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE)
604 pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem;
608 case WLAN_EID_EXTSUPP_RATES:
609 if (pFrame->pExtSuppRates == NULL)
610 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
613 DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n",
617 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
626 * Routine Description:
627 * Encode Probe Request
637 vMgrEncodeProbeRequest(
638 IN PWLAN_FR_PROBEREQ pFrame
641 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
642 pFrame->len = WLAN_HDR_ADDR3_LEN;
648 * Routine Description:
649 * Decode Probe Request
658 vMgrDecodeProbeRequest(
659 IN PWLAN_FR_PROBEREQ pFrame
664 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
666 // Information elements
667 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)));
669 while( ((PBYTE)pItem) < (pFrame->pBuf + pFrame->len) ) {
671 switch (pItem->byElementID) {
673 if (pFrame->pSSID == NULL)
674 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
677 case WLAN_EID_SUPP_RATES:
678 if (pFrame->pSuppRates == NULL)
679 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
682 case WLAN_EID_EXTSUPP_RATES:
683 if (pFrame->pExtSuppRates == NULL)
684 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
688 DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in probereq\n", pItem->byElementID);
692 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
700 * Routine Description:
701 * Encode Probe Response
711 vMgrEncodeProbeResponse(
712 IN PWLAN_FR_PROBERESP pFrame
715 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
718 pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
719 + WLAN_PROBERESP_OFF_TS);
720 pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
721 + WLAN_PROBERESP_OFF_BCN_INT);
722 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
723 + WLAN_PROBERESP_OFF_CAP_INFO);
725 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO +
726 sizeof(*(pFrame->pwCapInfo));
735 * Routine Description:
736 * Decode Probe Response
745 vMgrDecodeProbeResponse(
746 IN PWLAN_FR_PROBERESP pFrame
750 // BYTE byCheckEID = 0;
753 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
756 pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
757 + WLAN_PROBERESP_OFF_TS);
758 pFrame->pwBeaconInterval = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
759 + WLAN_PROBERESP_OFF_BCN_INT);
760 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
761 + WLAN_PROBERESP_OFF_CAP_INFO);
763 // Information elements
764 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
765 + WLAN_PROBERESP_OFF_SSID);
767 while( ((PBYTE)pItem) < (pFrame->pBuf + pFrame->len) ) {
769 if (pItem->byElementID < byCheckEID)
772 byCheckEID = pItem->byElementID;
774 switch (pItem->byElementID) {
776 if (pFrame->pSSID == NULL)
777 pFrame->pSSID = (PWLAN_IE_SSID)pItem;
779 case WLAN_EID_SUPP_RATES:
780 if (pFrame->pSuppRates == NULL)
781 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
783 case WLAN_EID_FH_PARMS:
785 case WLAN_EID_DS_PARMS:
786 if (pFrame->pDSParms == NULL)
787 pFrame->pDSParms = (PWLAN_IE_DS_PARMS)pItem;
789 case WLAN_EID_CF_PARMS:
790 if (pFrame->pCFParms == NULL)
791 pFrame->pCFParms = (PWLAN_IE_CF_PARMS)pItem;
793 case WLAN_EID_IBSS_PARMS:
794 if (pFrame->pIBSSParms == NULL)
795 pFrame->pIBSSParms = (PWLAN_IE_IBSS_PARMS)pItem;
799 if (pFrame->pRSN == NULL) {
800 pFrame->pRSN = (PWLAN_IE_RSN)pItem;
803 case WLAN_EID_RSN_WPA:
804 if (pFrame->pRSNWPA == NULL) {
805 if (WPAb_Is_RSN((PWLAN_IE_RSN_EXT)pItem) == TRUE)
806 pFrame->pRSNWPA = (PWLAN_IE_RSN_EXT)pItem;
810 if (pFrame->pERP == NULL)
811 pFrame->pERP = (PWLAN_IE_ERP)pItem;
813 case WLAN_EID_EXTSUPP_RATES:
814 if (pFrame->pExtSuppRates == NULL)
815 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
818 case WLAN_EID_COUNTRY: //7
819 if (pFrame->pIE_Country == NULL)
820 pFrame->pIE_Country = (PWLAN_IE_COUNTRY)pItem;
823 case WLAN_EID_PWR_CONSTRAINT: //32
824 if (pFrame->pIE_PowerConstraint == NULL)
825 pFrame->pIE_PowerConstraint = (PWLAN_IE_PW_CONST)pItem;
828 case WLAN_EID_CH_SWITCH: //37
829 if (pFrame->pIE_CHSW == NULL)
830 pFrame->pIE_CHSW = (PWLAN_IE_CH_SW)pItem;
833 case WLAN_EID_QUIET: //40
834 if (pFrame->pIE_Quiet == NULL)
835 pFrame->pIE_Quiet = (PWLAN_IE_QUIET)pItem;
838 case WLAN_EID_IBSS_DFS:
839 if (pFrame->pIE_IBSSDFS == NULL)
840 pFrame->pIE_IBSSDFS = (PWLAN_IE_IBSS_DFS)pItem;
844 DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Bad EID=%dd in proberesp\n", pItem->byElementID);
848 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
856 * Routine Description:
857 * Encode Authentication frame
867 IN PWLAN_FR_AUTHEN pFrame
870 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
873 pFrame->pwAuthAlgorithm = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
874 + WLAN_AUTHEN_OFF_AUTH_ALG);
875 pFrame->pwAuthSequence = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
876 + WLAN_AUTHEN_OFF_AUTH_SEQ);
877 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
878 + WLAN_AUTHEN_OFF_STATUS);
879 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS + sizeof(*(pFrame->pwStatus));
887 * Routine Description:
888 * Decode Authentication
898 IN PWLAN_FR_AUTHEN pFrame
903 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
906 pFrame->pwAuthAlgorithm = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
907 + WLAN_AUTHEN_OFF_AUTH_ALG);
908 pFrame->pwAuthSequence = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
909 + WLAN_AUTHEN_OFF_AUTH_SEQ);
910 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
911 + WLAN_AUTHEN_OFF_STATUS);
913 // Information elements
914 pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
915 + WLAN_AUTHEN_OFF_CHALLENGE);
917 if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE)) {
918 pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
927 * Routine Description:
928 * Encode Authentication
938 IN PWLAN_FR_DEAUTHEN pFrame
941 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
944 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
945 + WLAN_DEAUTHEN_OFF_REASON);
946 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON + sizeof(*(pFrame->pwReason));
954 * Routine Description:
955 * Decode Deauthentication
965 IN PWLAN_FR_DEAUTHEN pFrame
968 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
971 pFrame->pwReason = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
972 + WLAN_DEAUTHEN_OFF_REASON);
980 * Routine Description: (AP)
981 * Encode Reassociation Response
990 vMgrEncodeReassocResponse(
991 IN PWLAN_FR_REASSOCRESP pFrame
994 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
997 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
998 + WLAN_REASSOCRESP_OFF_CAP_INFO);
999 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
1000 + WLAN_REASSOCRESP_OFF_STATUS);
1001 pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
1002 + WLAN_REASSOCRESP_OFF_AID);
1004 pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid));
1012 * Routine Description:
1013 * Decode Reassociation Response
1023 vMgrDecodeReassocResponse(
1024 IN PWLAN_FR_REASSOCRESP pFrame
1029 pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
1032 pFrame->pwCapInfo = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
1033 + WLAN_REASSOCRESP_OFF_CAP_INFO);
1034 pFrame->pwStatus = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
1035 + WLAN_REASSOCRESP_OFF_STATUS);
1036 pFrame->pwAid = (PWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
1037 + WLAN_REASSOCRESP_OFF_AID);
1039 //Information elements
1040 pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
1041 + WLAN_REASSOCRESP_OFF_SUPP_RATES);
1043 pItem = (PWLAN_IE)(pFrame->pSuppRates);
1044 pItem = (PWLAN_IE)(((PBYTE)pItem) + 2 + pItem->len);
1046 if ((((PBYTE)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
1047 pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;