w35und: remove unused bssdbase
remove unused bssdbase
---
commit 6627ff26a459db3e792ec4dc194122c133c150a5
tree 254f1861a0ed6aa0f02987ef1775fb95c97aec3c
parent 691a6ec372a481499e882739106864d33ef8f4eb
author Pavel <[email protected]> Sat, 19 Apr 2008 16:15:08 +0200 committer Pavel <[email protected]> Sat, 19 Apr 2008 16:15:08 +0200
.../net/wireless/winbond/winbondport/bssdbase.c | 1395 ----------------------- 1 files changed, 3 insertions(+), 1392 deletions(-)
drivers/net/wireless/winbond/winbondport/bssdbase.c +3 -1392
@@ -12,1409 +12,20 @@#include "os_common.h" -//#include "sme.h" // use SME state defines - -u16 GetElement (PWB32_ADAPTER Adapter,u16 wBssIdx,u8 * ElementAddr,u16 Idx ); - - -//====================== Rate conversion table ========================== -static const u8 Bitmap2RateValue[32 ] = -{0 ,// BIT 0 -RATE_1M ,// BIT 1 -RATE_2M ,// BIT 2 -0 ,// BIT 3 -0 ,// BIT 4 - RATE_5dot5M,// BIT 5 -RATE_6M ,// BIT 6 -0 ,// BIT 7 -0 ,// BIT 8 -RATE_9M ,// BIT 9 -0 ,// BIT 10 -RATE_11M ,// BIT 11 -RATE_12M ,// BIT 12 -0 ,// BIT 13 -0 ,// BIT 14 -0 ,// BIT 15 -0 ,// BIT 16 -RATE_33M ,// BIT 17 -RATE_18M ,// BIT 18 -RATE_36M ,// BIT 19 -0 ,// BIT 20 -0 ,// BIT 21 -RATE_22M ,// BIT 22 -0 ,// BIT 23 -RATE_24M ,// BIT 24 -RATE_48M ,// BIT 25 -0 ,// BIT 26 -0 ,// BIT 27 -RATE_54M ,// BIT 28 -0 ,// BIT 29 -0 ,// BIT 30 -0 ,// BIT 31 -}; -//#endif - -void vBSSdescriptionInit (PWB32_ADAPTER Adapter) -{ -u16 i; - -for (i =0 ; i <MAX_BSS_DESCRIPT_ELEMENT ; i++) - { -psBSS (i)->SlotValid =0 ; -psBSS (i)->wIndex = i; -psBSS (i)->psAdapter = Adapter; -//The other fields will be updated when receiving beacon or probe -//response except to the following fields: -psBSS (i)->wAuthAlgo =OPEN_AUTH ;//default value: OPEN_AUTH = 0 -psBSS (i)->wAuthSeqNum =0 ; - } -//entry 1 is reserved for broadcast address -psBSS (1 )->SlotValid =1 ; -memcpy (psBSS (1 )->abPeerAddress,"\xff\xff\xff\xff\xff\xff" ,MAC_ADDR_LENGTH ); -//MLME_findSTA(psBSS(1)); -} - -//search valid BSS descriptors at the surrounding environment -void vBSSfoundList (PWB32_ADAPTER Adapter) -{ -BUG (); -} - -u8 boChanFilter (PWB32_ADAPTER Adapter,u8 ChanNo) -{ -u8 boFilter = FALSE; - -switch (psLOCAL->region) - { -case REGION_EUROPE : -if (ChanNo >13 ) - boFilter = TRUE; -break ; -case REGION_JAPAN : -case REGION_UNKNOWN : -break ; -case REGION_FRANCE : -if ((ChanNo <10 ) || (ChanNo >13 )) - boFilter = TRUE; -break ; -case REGION_SPAIN : -if ((ChanNo <10 ) || (ChanNo >11 )) - boFilter = TRUE; -break ; -case REGION_ISRAEL : -if ((ChanNo <3 ) || (ChanNo >9 )) - boFilter = TRUE; -break ; -case REGION_USA : -default : -if (ChanNo >11 ) - boFilter = TRUE; -break ; - } -return boFilter; -}//Get an empty BSS descriptor entry u16 wBSSGetEntry (PWB32_ADAPTER Adapter) { -u16 i, ret=0 ; - -OS_SPIN_LOCK_ACQUIRED ( &Adapter->sMlmeFrame.MLMESpinLock ); -//Phase 1 -for (i=2 ; i<MAX_BSS_DESCRIPT_ELEMENT ; i++) - { -if (psBSS (i)->SlotValid !=1 )// - { -psBSS (i)->SlotValid =1 ; - ret = i; -break ; - } - } -//Phase 2 -//=> BSS descriptor is allocated due to the frame receiving. -// The frame may be beacon/probe resp. or others(data frame, meaningless -// frame..). So if it is allocated due to not beacon/probe/resp. frame, -// we will reuse it. -if (0 == ret) - { -#ifdef _PE_STATE_DUMP_ -WBDEBUG (("BSS descriptor allocated phase 2\n" )); -#endif -for (i=2 ; i<MAX_BSS_DESCRIPT_ELEMENT ; i++) - { -//Check BSSID -//if ((0 == ((PMACADDR)psBSS(i)->abBssID)->ll) && -// (0 == ((PMACADDR)psBSS(i)->abBssID)->ss)) -if (!boMLME_FoundSTAinfo (psBSS (i))) - { - ret = i; -break ; - } - } - } -OS_SPIN_LOCK_RELEASED ( &Adapter->sMlmeFrame.MLMESpinLock ); -return ret; -} - -#define PHASE_OUT_TIMER 1000 -//============================================================================ -// vSimpleHouseKeeping -- -// -// Description: -// When receiving a SCAN_REQ msg in SCAN module, set the BSS descriptor entries -// except to the psLOCAL->wConnectedSTAindex one to INACTIVE state if -// psSCAN->boSave is FALSE. -// (1)Set psSCAN->boSave to TRUE when receiving SCAN_REQ from ROAM module -// (2) -// Arguments: -// Adapter - The handle of an adapter bock. -// -//============================================================================ -void vSimpleHouseKeeping (PWB32_ADAPTER Adapter) -{ -BUG (); -} - -u16 wBSShouseKeeping (PWB32_ADAPTER Adapter) -{ -int i, iAvailable; - - iAvailable=0 ; -// Rule1: all STAs in [IDLE_SCAN] and didn't update for a PHASE_OUT time -for (i=0 ;i<MAX_BSS_DESCRIPT_ELEMENT ;i++) - { -if (boMLME_IdleScanState (psBSS (i)))//->wState==IDLE_SCAN) - { -//if ((HWLocalTime-psBSS(i)->dwLocalTime)>PHASE_OUT_TIMER) -//{ -// MLME_initState(psBSS(i)); // MLME: INACTIVE -// iAvailable=i+1; -//} - } - } -if (iAvailable!=0 )return (u16)(iAvailable); -// Rule2: all STAs didn't update for a PHASE_OUT time and its BSSID and SSID are not currently used -for (i=0 ;i<MAX_BSS_DESCRIPT_ELEMENT ;i++) - { -//if ((HWLocalTime-psBSS(i)->dwLocalTime)>PHASE_OUT_TIMER) -//{ -// if (boCmpMacAddr(psBSS(i)->abBssID,local->BSSID) -// { -// MLME_initState(psBSS(i)); -// iAvailable=i+1; -// } -//} - } -return (u16)(iAvailable); -} - -//clear the content of some elements in this bss descriptor -void ClearBSSdescpt (PWB32_ADAPTER Adapter,u16 i) -{ -//TODO : should the SlotValid be cleared to 0 to reuse this entry?? -OS_MEMORY_CLEAR (psBSS (i)->abBssID,MAC_ADDR_LENGTH ); -OS_MEMORY_CLEAR ( &(psBSS (i)->CapabilityInformation),sizeof (struct Capability_Information_Element ) ); -OS_MEMORY_CLEAR ( &(psBSS (i)->SupportedRateSet),sizeof (struct Supported_Rates_Element ) ); -OS_MEMORY_CLEAR ( &(psBSS (i)->ERP_Information_Set),sizeof (struct ERP_Information_Element ) ); -OS_MEMORY_CLEAR ( &(psBSS (i)->ExtendedSupportedRateSet),sizeof (struct Extended_Supported_Rates_Element ) ); -psBSS (i)->dwBasicRateBitmap =0 ; -psBSS (i)->dwOperationalRateBitmap =0 ; -//psBSS(i)->RSN_Capability = 0; - -psBSS (i)->ScanTimeStamp =0 ; -psBSS (i)->BssTimeStamp =0 ; -//psBSS(i)->band = 0; -} -//============================================================================ -// wBSSfindSSID -- -// -// Description: -// Find the BSSDescriptor entry based on the input SSID -// -// Arguments: -// Adapter - The handle of an adapter bock. -// psSsid - The SSID that will be searched in the BSSDescripotr set -// -// Return: -// 0 - not found -// other - the BSSDescriptor entry index of the found STA -//============================================================================ -u16 wBSSfindSSID (PWB32_ADAPTER Adapter,struct SSID_Element *psSsid) -{ -u16 i; - -for (i=2 ; i<MAX_BSS_DESCRIPT_ELEMENT ; i++) - { -if ((boMLME_FoundSTAinfo (psBSS (i))) && - (psSsid->Length ==psBSS (i)->SSID.Length) && -OS_MEMORY_COMPARE ( psSsid->SSID,psBSS (i)->SSID.SSID, psSsid->Length) ) - { -return i; - } - } -return (u16)(0 ); -} - -//============================================================================ -// wBSSfindBssID -- -// -// Description: -// Find the BSSDescriptor entry based on the input BSSID -// -// Arguments: -// Adapter - The handle of an adapter bock. -// psSsid - The BSSID that will be searched in the BSSDescripotr set -// -// Return: -// 0 - not found -// other - the BSSDescriptor entry index of the found STA -//============================================================================ -u16 wBSSfindBssID (PWB32_ADAPTER Adapter,u8 *pbBssid) -{ -u16 i; - -for (i=2 ; i<MAX_BSS_DESCRIPT_ELEMENT ; i++) - { -if (boMLME_FoundSTAinfo (psBSS (i) ) && -boCmpMacAddr ( pbBssid,psBSS (i)->abBssID ) ) - { -return i; - } - } -return (u16)(0 ); -} - -u16 wBSSfindDedicateCandidate (PWB32_ADAPTER Adapter,struct SSID_Element *psSsid,u8 *pbBssid) -{ -u16 i; - -for (i=2 ; i<MAX_BSS_DESCRIPT_ELEMENT ; i++) - { -if (boMLME_FoundSTAinfo (psBSS (i) ) && -boCmpMacAddr ( pbBssid,psBSS (i)->abBssID ) ) - { -if ( (psSsid->Length ==psBSS (i)->SSID.Length) && -OS_MEMORY_COMPARE ( psSsid->SSID,psBSS (i)->SSID.SSID, psSsid->Length) ) -return i; - } - } -return (u16)(0 ); -} - -//============================================================================ -// wBSSfindMACaddr -- -// -// Description: -// Find the BSSDescriptor entry based on the input MAC address -// -// Arguments: -// Adapter - The handle of an adapter bock. -// psSsid - The MAC address that will be searched in the BSSDescripotr set -// -// Return: -// 0 - not found -// other - the BSSDescriptor entry index of the found STA -//============================================================================ -u16 wBSSfindMACaddr (PWB32_ADAPTER Adapter,u8 *pbMacAddr) -{ -u16 i; - -for (i=2 ; i<MAX_BSS_DESCRIPT_ELEMENT ; i++) - { -if (boMLME_FoundSTAinfo (psBSS (i) ) && -boCmpMacAddr ( pbMacAddr,psBSS (i)->abPeerAddress ) ) - { -return i; - } - } -return (u16)(0 ); +BUG ();/* foo */ }u16 wBSSsearchMACaddr (PWB32_ADAPTER Adapter,u8 *pbMacAddr,u8 band) { -u16 i; -u16 ret =0 ; - -for (i=2 ; i<MAX_BSS_DESCRIPT_ELEMENT ; i++) - { -if (psBSS (i)->SlotValid ==1 ) - { -if (boCmpMacAddr ( pbMacAddr,psBSS (i)->abPeerAddress ) && - (band ==psBSS (i)->band) ) - { - ret = i; - } - } - } -return ret; -} - -//============================================================================ -// wBSSaddScanData -- -// -// Description: -// The BSSDescriptor entry of the received beacon does not exist, fill the -// received beacon to the new BSSDescriptor entry. -// -// Arguments: -// Adapter - The handle of an adapter bock. -// wBssIdx - BSSDescriptor entry index that will fill the received beacon -// psRcvData - The received beacon frame -// -// Return: -// 0 - FAIL -// 1 - SUCCESS -//============================================================================ -u16 wBSSaddScanData (PWB32_ADAPTER Adapter,u16 wBssIdx,psRXDATA psRcvData) -{ -BUG (); -} - -static u8 ZeroPattern[32 ]= {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }; - -u16 GetElement (PWB32_ADAPTER Adapter,u16 wBssIdx,u8 * ElementAddr,u16 Idx ) -{ -u8 ElementID = *(ElementAddr+Idx); -u8 ElementLen = *(ElementAddr+Idx+1 ); -u8 * pbElementData = ElementAddr + Idx; -u8 * RsnNum=&psBSS (wBssIdx)->Rsn_Num; -u32 OUI_tmp; -u16 Version_tmp, Pairewise_count, Auth_count; - -switch (ElementID) - { -case ELEMENT_ID_SSID : - { -struct SSID_Element *pSsidTmp; - - pSsidTmp = (struct SSID_Element *)pbElementData; -if ((pSsidTmp->Length ==0 ) || -OS_MEMORY_COMPARE ( pSsidTmp->SSID, ZeroPattern, pSsidTmp->Length ) ) - { -#ifdef _PE_STATE_DUMP_ -WBDEBUG (("It may be a hidden SSID. Don't update it!\n" )); -#endif - } -else -memcpy ( &(psBSS (wBssIdx)->SSID), pbElementData, ElementLen+2 ); - } -break ; -case ELEMENT_ID_SUPPORTED_RATES : -//Buffalo g54 AP put all rates into the SupportedRateSet(don't have -// ExtendedSupportedRateSet -//NOTE: -//If the length of SupportedRateSet is larger then 8, we suppose the peer -//STA puts all the rates into SupportedRateSet and doesn't have -//ExtendedSupportedRateSet -if (ElementLen>8 ) - { -memcpy ( &(psBSS (wBssIdx)->SupportedRateSet), pbElementData,8 +2 ); -psBSS (wBssIdx)->SupportedRateSet.Length =8 ; -//The others will be stored into ExtendedSupportedRateSet -psBSS (wBssIdx)->ExtendedSupportedRateSet.Element_ID =ELEMENT_ID_EXTENDED_SUPPORTED_RATES ; -memcpy (psBSS (wBssIdx)->ExtendedSupportedRateSet.ExtendedSupportedRates, - pbElementData+10 , ElementLen-8 ); -psBSS (wBssIdx)->ExtendedSupportedRateSet.Length = ElementLen-8 ; - } -else -memcpy ( &(psBSS (wBssIdx)->SupportedRateSet), pbElementData, ElementLen+2 ); -break ; -case ELEMENT_ID_FH_PARAMETER_SET : -break ; -case ELEMENT_ID_DS_PARAMETER_SET : -if ((wBssIdx == psLOCAL->wConnectedSTAindex) && - (((struct DS_Parameter_Set_Element *)pbElementData)->Current_Channel - !=psBSS (wBssIdx)->DS_Parameter_Set.Current_Channel)) - { -//TODO: If the band is different, then ??? -#ifdef _PE_STATE_DUMP_ -WBDEBUG (("!!!The channel of AP has been changed.\n" )); -#endif - psLOCAL->boReceiveUncorrectInfo = TRUE; - } -else - { -memcpy ( &(psBSS (wBssIdx)->DS_Parameter_Set), pbElementData, ElementLen+2 ); -//psBSS(wBssIdx)->band = psLOCAL->band;//It has been assigned at Mds_MpduProcess() - } -break ; -case ELEMENT_ID_CF_PARAMETER_SET : -memcpy ( &(psBSS (wBssIdx)->CF_Parameter_Set), pbElementData, ElementLen+2 ); -break ; -case ELEMENT_ID_TIM : -memcpy ( &(psBSS (wBssIdx)->TIM_Element_Set), pbElementData, ElementLen+2 ); -break ; -case ELEMENT_ID_IBSS_PARAMETER_SET : -memcpy ( &(psBSS (wBssIdx)->IBSS_Parameter_Set), pbElementData, ElementLen+2 ); -//20060926 add by anson's endian - *(u16 *)psBSS (wBssIdx)->IBSS_Parameter_Set.ATIM_Window = -cpu_to_le16 (*(u16 *)psBSS (wBssIdx)->IBSS_Parameter_Set.ATIM_Window); -break ; -case ELEMENT_ID_ERP_INFORMATION : -memcpy ( &(psBSS (wBssIdx)->ERP_Information_Set), pbElementData, ElementLen+2 ); -if ((wBssIdx == psLOCAL->wConnectedSTAindex) && - (psBSS (psLOCAL->wConnectedSTAindex)->bBssType ==ESS_NET )) - {//follow the setting of AP - psLOCAL->boNonERPpresent =psBSS (wBssIdx)->ERP_Information_Set.NonERP_Present; - psLOCAL->boProtectMechanism =psBSS (wBssIdx)->ERP_Information_Set.Use_Protection; -if (psLOCAL->bPreambleMode ==AUTO_MODE ) - { -if (psBSS (wBssIdx)->ERP_Information_Set.Barker_Preamble_Mode) - psLOCAL->boShortPreamble =0 ; -else - psLOCAL->boShortPreamble =1 ; - } -//The ShortSlotTime in capability may change during the connection?? Yes! -if (psLOCAL->bSlotTimeMode ==AUTO_MODE ) - { -if (psLOCAL->boShortSlotTime !=psBSS (wBssIdx)->CapabilityInformation.Capability.Short_Slot_Time) - { - psLOCAL->boShortSlotTime =psBSS (wBssIdx)-> - CapabilityInformation.Capability.Short_Slot_Time; -if (psBSS (wBssIdx)->CapabilityInformation.Capability.Short_Slot_Time) -hal_set_slot_time (&Adapter->sHwData,WLAN_SLOT_TIME_TYPE_SHORT ); -else -hal_set_slot_time (&Adapter->sHwData,WLAN_SLOT_TIME_TYPE_LONG ); - } - } - } -break ; -case ELEMENT_ID_EXTENDED_SUPPORTED_RATES : -memcpy ( &(psBSS (wBssIdx)->ExtendedSupportedRateSet), pbElementData, ElementLen+2 ); -break ; -//-------------------------------------------------------------------------------------------- -// modified by ws at 09/14/04. To parse received frame and save avaliable data to -// data descriptor. -//-------------------------------------------------------------------------------------------- -//TODO : [1004] -case ELEMENT_ID_RSN_WPA : -//if wpa rsn and wpa2 rsn are included in the same beacon or probe response, both wpa and wpa2 -//cipher suites will be placed in different place,otherwise the RsnIe_Type will be WPA2 rather than WPA, -//since WPA2 has higher priority. - { -struct RSN_Information_Element * rsnie=(struct RSN_Information_Element *)pbElementData; -struct RSN_Auth_Sub_Information_Element * auth_cipher; -u16 i; -u8 LenTmp =0 ; - -//added a condition for comparing OUI by ws 09/23/04 -if ( rsnie->Length <WLAN_MIN_RSN_WPA_LENGTH ) -break ; - -// 20061108 Modify for WPS -memcpy ( &Version_tmp, &rsnie->Version,sizeof (u16) ); -memcpy ( &OUI_tmp, &rsnie->OuiWPAAdditional,sizeof (u32) ); -//20060926 add by anson's endian - Version_tmp =cpu_to_le16 ( Version_tmp ); - OUI_tmp =cpu_to_le32 ( OUI_tmp ); - -if ( Version_tmp !=1 ) -break ; - -// 20061108 WPS OUI support -if ( ElementAddr[0 ]==0x50 && OUI_tmp==WPA_WPS_OUI )// Storing all field of WPS information of Probe response(0x50) - { -memcpy ( &psBSS (wBssIdx)->WPS_IE_Data, pbElementData, ElementLen +2 ); -psBSS (wBssIdx)->WPS_IE_length_tmp = ElementLen; -break ;// End of WSC IE processing - } - -if ( (OUI_tmp !=WPA_OUI_BIG ) && (OUI_tmp !=WPA_OUI_LITTLE ) ) -break ; - - LenTmp =6 ;//OuiWPAAdditional && version -//802.11i/D4.0 : -//If any optional field is absent, none of the subsequent -//fields shall be included. -do - { -if (rsnie->Length >=10 )// checking group cipher suite are included in rsn - { -memcpy ( &(psBSS (wBssIdx)->group_cipher), &rsnie->GroupKeySuite,sizeof (OUI_WPA ) ); - LenTmp +=4 ; - } -else -break ; -if (rsnie->Length >=12 )//PairwiseKey suite count field exists - { -memcpy ( &Pairewise_count, &rsnie->PairwiseKeySuiteCount,sizeof (u16) ); -//20060926 add by anson's endian - Pairewise_count =cpu_to_le16 ( Pairewise_count ); -if ( (Pairewise_count >WLAN_MAX_PAIRWISE_CIPHER_SUITE_COUNT ) || - (rsnie->Length < (12 + Pairewise_count *4 )) ) - { -break ; - } -else - { -psBSS (wBssIdx)->pairwise_key_cipher_suite_count = Pairewise_count; -memcpy ( &psBSS (wBssIdx)->pairwise_key_cipher_suites[0 ], - rsnie->PairwiseKeySuite, Pairewise_count *4 ); - - LenTmp += (2 +(Pairewise_count<<2 )); -//for multi pairwise key cipher suites, priority of CCMP > TKIP priority -for ( i=0 ; i<Pairewise_count; i++ ) - { -if (psBSS (wBssIdx)->pairwise_key_cipher_suite_selected==0 || -psBSS (wBssIdx)->pairwise_key_cipher_suite_selected < rsnie->PairwiseKeySuite[i].SuitSelector.Type ) -psBSS (wBssIdx)->pairwise_key_cipher_suite_selected=rsnie->PairwiseKeySuite[i].SuitSelector.Type; - } - } - } -else -break ; -if (rsnie->Length >= (LenTmp+2 )) - { -//point to a structure of RSN_authentucation information, included ID and length fields - auth_cipher = (struct RSN_Auth_Sub_Information_Element *)(pbElementData+(LenTmp+2 )); -memcpy ( &Auth_count, &auth_cipher->AuthKeyMngtSuiteCount,sizeof (u16) ); -//20060926 add by anson's endian - Auth_count =cpu_to_le16 ( Auth_count ); -if ( (Auth_count >WLAN_MAX_AUTH_KEY_MGT_SUITE_LIST_COUNT ) || - (rsnie->Length < (LenTmp +2 +(Auth_count<<2 ))) ) - { -break ; - } -else - { -psBSS (wBssIdx)->auth_key_mgt_suite_count = Auth_count; -memcpy ( &psBSS (wBssIdx)->auth_key_mgt_suites, auth_cipher->AuthKeyMngtSuite, - Auth_count *4 ); - LenTmp += (2 +(Auth_count<<2 )); - } - } -else -break ; -if (rsnie->Length >= (LenTmp+2 ))//RSN capability exists - { -//address of RSN capability -memcpy ( &(psBSS (wBssIdx)->rsn_capabilities), pbElementData+(LenTmp+2 ),2 ); -//20060926 add by anson's endian - *(u16 *)&(psBSS (wBssIdx)->rsn_capabilities) = -cpu_to_le16 ( *(u16 *)&(psBSS (wBssIdx)->rsn_capabilities) ); - LenTmp +=2 ; - } - -psBSS (wBssIdx)->RsnIe_Type[*RsnNum] = ElementID; -psBSS (wBssIdx)->RsnIe_len += LenTmp; - (*RsnNum)++; - - }while (FALSE); - } -break ; -#ifdef _WPA2_ -case ELEMENT_ID_RSN_WPA2 : - { -struct WPA2_RSN_Information_Element * wpa2_rsnie = (struct WPA2_RSN_Information_Element *)pbElementData; -struct WPA2_RSN_Auth_Sub_Information_Element * wpa2_auth_cipher; -u8 LenTmp =0 ; -u16 i, Auth_count; - -//added a condition for checking OUI -if ( wpa2_rsnie->Length <WLAN_MIN_RSN_WPA2_LENGTH ) -break ; -else - { -memcpy ( &Version_tmp, &wpa2_rsnie->Version,sizeof (u16) ); -//20060926 add by anson's endian - Version_tmp =cpu_to_le16 ( Version_tmp ); -if ( Version_tmp !=1 ) -break ; - } - LenTmp =2 ;//version - -do - {//measure rsn included the group cipher suite into -if (wpa2_rsnie->Length >=6 ) - { -memcpy ( &(psBSS (wBssIdx)->wpa2_group_cipher), &wpa2_rsnie->GroupKeySuite,sizeof (OUI_WPA2 ) ); - LenTmp +=4 ; - } -else -break ; - -if ( wpa2_rsnie->Length >=8 )//PairwiseKey suite count field exists - { -memcpy ( &Pairewise_count, &wpa2_rsnie->PairwiseKeySuiteCount,sizeof (u16) ); -//20060926 add by anson's endian - Pairewise_count =cpu_to_le16 ( Pairewise_count ); -if ( (Pairewise_count >WLAN_MAX_PAIRWISE_CIPHER_SUITE_COUNT ) || - (wpa2_rsnie->Length < (8 + Pairewise_count *4 )) ) - { -break ; - } -else - { -psBSS (wBssIdx)->wpa2_pairwise_key_cipher_suite_count = Pairewise_count; -memcpy ( &psBSS (wBssIdx)->wpa2_pairwise_key_cipher_suites[0 ], - wpa2_rsnie->PairwiseKeySuite, Pairewise_count *4 ); - - LenTmp += (2 + (Pairewise_count<<2 )); -//for multi pairwise key cipher suite, CCMP>TKIP -for ( i=0 ; i<Pairewise_count; i++ ) - { -if (psBSS (wBssIdx)->wpa2_pairwise_key_cipher_suite_selected==0 || -psBSS (wBssIdx)->wpa2_pairwise_key_cipher_suite_selected < wpa2_rsnie->PairwiseKeySuite[i].SuitSelector.Type ) -psBSS (wBssIdx)->wpa2_pairwise_key_cipher_suite_selected=wpa2_rsnie->PairwiseKeySuite[i].SuitSelector.Type; - } - } - } -else -break ; - -if ( wpa2_rsnie->Length >= (LenTmp+2 ) )//authentication suite count field exists - { -//address of authentication suite -//include ID and length fields - wpa2_auth_cipher = (struct WPA2_RSN_Auth_Sub_Information_Element *)(pbElementData + (LenTmp+2 ) ); -memcpy ( &Auth_count, &wpa2_auth_cipher->AuthKeyMngtSuiteCount,sizeof (u16) ); -//20060926 add by anson's endian - Auth_count =cpu_to_le16 ( Auth_count ); -if ( (Auth_count >WLAN_MAX_AUTH_KEY_MGT_SUITE_LIST_COUNT ) || - (wpa2_rsnie->Length < (LenTmp +2 +(Auth_count<<2 ))) ) - { -break ; - } -else - { -psBSS (wBssIdx)->wpa2_auth_key_mgt_suite_count = Auth_count; -memcpy ( &psBSS (wBssIdx)->wpa2_auth_key_mgt_suites, - wpa2_auth_cipher->AuthKeyMngtSuite, Auth_count *4 ); - - LenTmp += (2 +(Auth_count<<2 )); - } - } -else -break ; - -if (wpa2_rsnie->Length >= (LenTmp+2 ))//RSN capability exists - { -//address of RSN capability -memcpy ( &(psBSS (wBssIdx)->wpa2_rsn_capabilities), pbElementData+(LenTmp+2 ),sizeof (struct RSN_Capability_Element ) ); -//20060926 add by anson's endian - *(u16 *)&(psBSS (wBssIdx)->wpa2_rsn_capabilities) = -cpu_to_le16 ( *(u16 *)&(psBSS (wBssIdx)->wpa2_rsn_capabilities) ); -//to check this AP supports pre authenctication or not -if (psBSS (wBssIdx)->rsn_capabilities.RSN_Capability.Pre_Auth) -psBSS (wBssIdx)->pre_auth=TRUE; -else -psBSS (wBssIdx)->pre_auth=FALSE; - - LenTmp +=2 ; - } - -psBSS (wBssIdx)->RsnIe_Type[*RsnNum]= ElementID; -psBSS (wBssIdx)->RsnIe_len += LenTmp; - (*RsnNum)++; - }while (FALSE); - - } -#endif -default : -break ; - } - - Idx +=(ElementLen+2 ); -return Idx; -} - -//========================================================================== -// modified by WS 09/15/04 -// for solving WWU showed up error message "LIST index out of bounds (5)" -// and "Access violation at address 00407494 in module" when receive csico AP -// beacon.The solution is to filter out useless data and reassemble -// information element send to NDIS. -// -//=========================================================================== -void Assemble_IE (PWB32_ADAPTER Adapter,u16 wBssIdx) -{ -WB_BSSDESCRIPTION *Desc=psBSS (wBssIdx); -struct RSN_Information_Element *rsn_ie; -struct RSN_Auth_Sub_Information_Element *auth_sub_ie; - -#ifdef _WPA2_ -struct WPA2_RSN_Information_Element *WPA2_rsn_ie; -struct WPA2_RSN_Auth_Sub_Information_Element *WPA2_auth_sub_ie; -#endif //end def _WPA2_ - -u8 LenLeft=psBSS (wBssIdx)->RsnIe_len; -u8 RsnNo=0 ; -u8 ies_len=0 ; -u8 *IEs=psBSS (wBssIdx)->ies; -u32 uValue; -u16 Pairwise_count, Auth_count; -u16 Version_tmp; - - Desc->ies_len=0 ; - -vRateToBitmap (Adapter, wBssIdx); -psBSS (wBssIdx)->boERP =boIsERPsta (Adapter, wBssIdx); - -// fix field for ndis -memcpy ( IEs ,&Desc->Timestamp,8 ); - ies_len+=8 ; - IEs+=8 ; - -memcpy ( IEs, &Desc->Beacon_Period,2 ); -//20060926 add by anson's endian - *(u16 *)IEs =cpu_to_le16 ( *(u16 *)IEs ); - ies_len+=2 ; - IEs +=2 ; - -memcpy ( IEs, &Desc->CapabilityInformation,sizeof (struct Capability_Information_Element ) ); -//20060926 add by anson's endian - *(u16 *)IEs =cpu_to_le16 ( *(u16 *)IEs ); - ies_len+=sizeof (struct Capability_Information_Element ); - IEs +=sizeof (struct Capability_Information_Element ); - -if (Desc->SSID.Length!=0 ) - { -memcpy ( IEs, &Desc->SSID, Desc->SSID.Length+2 ); - ies_len+=Desc->SSID.Length+2 ; - IEs += (Desc->SSID.Length+2 ); - } - -if (Desc->SupportedRateSet.Length!=0 ) - { -memcpy ( IEs, &Desc->SupportedRateSet, Desc->SupportedRateSet.Length+2 ); - ies_len+= Desc->SupportedRateSet.Length+2 ; - IEs += (Desc->SupportedRateSet.Length+2 ); - } - -if (Desc->DS_Parameter_Set.Length!=0 ) - { -memcpy ( IEs, &Desc->DS_Parameter_Set, Desc->DS_Parameter_Set.Length+2 ); - ies_len+=Desc->DS_Parameter_Set.Length+2 ; - IEs += (Desc->DS_Parameter_Set.Length+2 ); - } - -if (Desc->TIM_Element_Set.Length!=0 ) - { -memcpy ( IEs, &Desc->TIM_Element_Set, Desc->TIM_Element_Set.Length+2 ); - ies_len+=Desc->TIM_Element_Set.Length+2 ; - IEs += (Desc->TIM_Element_Set.Length +2 ); - } - -if (Desc->ERP_Information_Set.Length!=0 ) - { -memcpy ( IEs, &Desc->ERP_Information_Set, Desc->ERP_Information_Set.Length+2 ); - ies_len+=Desc->ERP_Information_Set.Length+2 ; - IEs += (Desc->ERP_Information_Set.Length +2 ); - } - -if (Desc->ExtendedSupportedRateSet.Length!=0 ) - { -memcpy ( IEs, &Desc->ExtendedSupportedRateSet, Desc->ExtendedSupportedRateSet.Length+2 ); - ies_len+=Desc->ExtendedSupportedRateSet.Length+2 ; - IEs += (Desc->ExtendedSupportedRateSet.Length+2 ); - } - -//================================================================================ -//RSN_IE -//================================================================================ -while (LenLeft) - { -if (psBSS (wBssIdx)->RsnIe_Type[RsnNo] ==ELEMENT_ID_RSN_WPA ) - { -//u8 LenLeft; - rsn_ie = (struct RSN_Information_Element *)IEs; - rsn_ie->Element_ID =psBSS (wBssIdx)->RsnIe_Type[RsnNo]; - rsn_ie->Length =0 ; - -//20060926 add by anson's endian -//uValue = (u32)(OUI_WPA | (OUI_WPA_ADDITIONAL<<24)); - uValue =cpu_to_le32 ((u32)(OUI_WPA | (OUI_WPA_ADDITIONAL <<24 ))); -memcpy ( &rsn_ie->OuiWPAAdditional, &uValue,sizeof (u32) ); -//20060926 add by anson's endian -//Version_tmp = VERSION_WPA; - Version_tmp =cpu_to_le16 (VERSION_WPA ); -memcpy ( &rsn_ie->Version, &Version_tmp,sizeof (u16) ); - LenLeft =LenLeft -6 ; - rsn_ie->Length +=6 ; - -do - { -if (LenLeft !=0 ) - { -memcpy ( &rsn_ie->GroupKeySuite, &Desc->group_cipher,sizeof (u32) ); - LenLeft -=4 ; - rsn_ie->Length +=4 ; - } -else -break ; -if (LenLeft !=0 ) - { -memcpy ( &Pairwise_count, &Desc->pairwise_key_cipher_suite_count,sizeof (u16) ); -memcpy ( &rsn_ie->PairwiseKeySuiteCount, &Pairwise_count,sizeof (u16) ); -//20060926 add by anson's endian - *(u16 *)&rsn_ie->PairwiseKeySuiteCount = -cpu_to_le16 ( *(u16 *)&rsn_ie->PairwiseKeySuiteCount ); -memcpy ( &rsn_ie->PairwiseKeySuite, &Desc->pairwise_key_cipher_suites, Pairwise_count<<2 ); - LenLeft -= (2 + (Pairwise_count<<2 )); - rsn_ie->Length +=(2 + (Pairwise_count<<2 )); - } -else -break ; - -memcpy ( &Auth_count, &Desc->auth_key_mgt_suite_count,sizeof (u16) ); - -if (LenLeft !=0 ) - { - auth_sub_ie = (struct RSN_Auth_Sub_Information_Element *)((u8 *)&rsn_ie->PairwiseKeySuite + - (Desc->pairwise_key_cipher_suite_count<<2 )); - -memcpy ( &auth_sub_ie->AuthKeyMngtSuiteCount, &Auth_count,sizeof (u16) ); -//20060926 add by anson's endian - *(u16 *)&auth_sub_ie->AuthKeyMngtSuiteCount = -cpu_to_le16 (*(u16 *)&auth_sub_ie->AuthKeyMngtSuiteCount); -memcpy ( &auth_sub_ie->AuthKeyMngtSuite, &Desc->auth_key_mgt_suites, Auth_count<<2 ); - - LenLeft -= (2 + (Auth_count<<2 )); - rsn_ie->Length +=(2 + (Auth_count<<2 )); - } -else -break ; - -if (LenLeft !=0 )//RSN capability - { -//20060926 add by anson's endian -u16 TValue = *(u16 *)&Desc->rsn_capabilities; - TValue =cpu_to_le16 ( TValue ); - -memcpy ( ((u8 *)&auth_sub_ie->AuthKeyMngtSuite) + (Auth_count<<2 ), -//&(Desc->rsn_capabilities), sizeof(struct RSN_Capability_Element) ); //20060926 change anson's endian - &TValue,sizeof (struct RSN_Capability_Element ) ); - - LenLeft -=2 ; - rsn_ie->Length +=2 ; - } -if (LenLeft !=0 ) - { -#ifdef _PE_STATE_DUMP_ -WBDEBUG ((" !!!If this is not the last RsnIE that is Panic !!! WPA RSN IE is wrong.\n" )); -#endif -break ; - } - }while (FALSE); - - IEs += rsn_ie->Length+2 ; - ies_len += rsn_ie->Length+2 ; - } -#ifdef _WPA2_ - else//WPA2 RSN_IE - { -//u8 LenLeft; - WPA2_rsn_ie = (struct WPA2_RSN_Information_Element *)IEs; - WPA2_rsn_ie->Element_ID =psBSS (wBssIdx)->RsnIe_Type[RsnNo]; - WPA2_rsn_ie->Length =0 ; -//20060926 add by anson's endian -//Version_tmp = VERSION_WPA2; - Version_tmp =cpu_to_le16 (VERSION_WPA2 ); -memcpy ( &WPA2_rsn_ie->Version, &Version_tmp,sizeof (u16) ); - LenLeft -=2 ; - WPA2_rsn_ie->Length +=2 ; -do - { -if (LenLeft !=0 ) - { -memcpy ( &WPA2_rsn_ie->GroupKeySuite, &Desc->wpa2_group_cipher,sizeof (SUITE_SELECTOR ) ); - LenLeft -=4 ; - WPA2_rsn_ie->Length +=4 ; - } -else -break ; - -if (LenLeft !=0 ) - { -memcpy ( &Pairwise_count, &Desc->wpa2_pairwise_key_cipher_suite_count,sizeof (u16) ); -memcpy ( &WPA2_rsn_ie->PairwiseKeySuiteCount, &Pairwise_count,sizeof (u16) ); -//20060926 add by anson's endian - *(u16 *)&WPA2_rsn_ie->PairwiseKeySuiteCount = -cpu_to_le16 ( *(u16 *)&WPA2_rsn_ie->PairwiseKeySuiteCount ); -//wpa2_pairwise_key_cipher_suite_count*4 -memcpy ( &WPA2_rsn_ie->PairwiseKeySuite, &Desc->wpa2_pairwise_key_cipher_suites, Pairwise_count<<2 ); - - LenLeft -= (2 + (Pairwise_count<<2 )); - WPA2_rsn_ie->Length +=(2 + (Pairwise_count<<2 )); - } -else -break ; -if (LenLeft !=0 ) - { - WPA2_auth_sub_ie = (struct WPA2_RSN_Auth_Sub_Information_Element *)((u8 *)&WPA2_rsn_ie->PairwiseKeySuite + - (Desc->wpa2_pairwise_key_cipher_suite_count<<2 )); - -memcpy ( &Auth_count, &Desc->wpa2_auth_key_mgt_suite_count,sizeof (u16) ); -memcpy ( &WPA2_auth_sub_ie->AuthKeyMngtSuiteCount, &Auth_count,sizeof (u16) ); -//20060926 add by anson's endian - *(u16 *)&WPA2_auth_sub_ie->AuthKeyMngtSuiteCount = -cpu_to_le16 ( *(u16 *)&WPA2_auth_sub_ie->AuthKeyMngtSuiteCount ); -memcpy ( &WPA2_auth_sub_ie->AuthKeyMngtSuite, &Desc->wpa2_auth_key_mgt_suites, Auth_count<<2 ); - - LenLeft -= (2 + (Auth_count<<2 )); - WPA2_rsn_ie->Length +=(2 + (Auth_count<<2 )); - } -else -break ; -if (LenLeft !=0 )//RSN capability - { -//20060926 add by anson's endian -u16 TValue = *(u16 *)&Desc->wpa2_rsn_capabilities; - TValue =cpu_to_le16 ( TValue ); -memcpy ( ((u8 *)&WPA2_auth_sub_ie->AuthKeyMngtSuite + (Auth_count<<2 ) ), -//&(Desc->wpa2_rsn_capabilities), sizeof(struct RSN_Capability_Element) ); //20060926 modify by anson's endian - &TValue,sizeof (struct RSN_Capability_Element ) ); - LenLeft -=2 ; - WPA2_rsn_ie->Length +=2 ; - } -else -break ; -if (LenLeft !=0 ) - { -#ifdef _PE_STATE_DUMP_ -WBDEBUG ((" If this is not the last RsnIE that is Panic !!! Panic !!! WPA2 RSN IE is wrong.\n" )); -#endif -break ; - } - }while (FALSE); - - IEs += WPA2_rsn_ie->Length+2 ; - ies_len += WPA2_rsn_ie->Length+2 ; - } -#endif //end WPA2 - - RsnNo++; - } - - Desc->ies_len=(u32)(ies_len); - -#ifdef _PE_STATE_DUMP_ -WBDEBUG (("<<dump IE: idx =%d, IE len =%d >>\n" , wBssIdx, ies_len)); -DataDmp ( Desc->ies, Desc->ies_len,0 ); -#endif - -} -//============================================================================ -// wBSSUpdateScanData -- -// -// Description: -// The BSSDescriptor entry of the received beacon has exist, just update -// the necessary information.(Only Update Capability and ERP elements) -// -// Arguments: -// Adapter - The handle of an adapter bock. -// wBssIdx - BSSDescriptor entry index of received beacon -// psRcvData - The received beacon frame -// -// Return: -// 0 - FAIL -// 1 - SUCCESS -//============================================================================ -u16 wBSSUpdateScanData (PWB32_ADAPTER Adapter,u16 wBssIdx,psRXDATA psRcvData) -{ -BUG (); -} - -//for START IBSS only, copy SME parameter to local description -u16 wBSScreateIBSSdata (PWB32_ADAPTER Adapter,PWB_BSSDESCRIPTION psDesData) -{ -BUG (); -} - -//====================================================================================================== -//added by WS for adding rsn ie for IBSS for WPA_NONE. -void AddIBSSIe (PWB32_ADAPTER Adapter,PWB_BSSDESCRIPTION psDesData) -{ -BUG (); -} - -void DesiredRate2BSSdescriptor (PWB32_ADAPTER Adapter,PWB_BSSDESCRIPTION psDesData, -u8 *pBasicRateSet,u8 BasicRateCount, -u8 *pOperationRateSet,u8 OperationRateCount) -{ -u8 TmpRateSpace[64 ]; -u8 TotalRateLen; - -if (BasicRateCount <20 ) -memcpy ( TmpRateSpace, pBasicRateSet, BasicRateCount ); -if (OperationRateCount <20 ) -memcpy ( TmpRateSpace + BasicRateCount, pOperationRateSet, OperationRateCount ); - TotalRateLen = BasicRateCount + OperationRateCount; - psDesData->SupportedRateSet.Element_ID =ELEMENT_ID_SUPPORTED_RATES ; -//Fill the rates of temparary space into the SupportedRate Element. If -//it is full, fill to the ExtendedSupportedRate Element. -if (TotalRateLen <=8 ) - { -memcpy ( psDesData->SupportedRateSet.SupportedRates, TmpRateSpace, TotalRateLen ); - psDesData->SupportedRateSet.Length = TotalRateLen; - } -else - { -memcpy ( psDesData->SupportedRateSet.SupportedRates, TmpRateSpace,8 ); - psDesData->SupportedRateSet.Length =8 ; - TotalRateLen -=8 ; - psDesData->ExtendedSupportedRateSet.Element_ID =ELEMENT_ID_EXTENDED_SUPPORTED_RATES ; -memcpy ( psDesData->ExtendedSupportedRateSet.ExtendedSupportedRates, TmpRateSpace+8 , TotalRateLen ); - psDesData->ExtendedSupportedRateSet.Length = TotalRateLen; - } -} - -void DesiredRate2InfoElement (PWB32_ADAPTER Adapter,u8 *addr,u16 *iFildOffset, -u8 *pBasicRateSet,u8 BasicRateCount, -u8 *pOperationRateSet,u8 OperationRateCount) -{ -struct Supported_Rates_Element *ptr1; -struct Extended_Supported_Rates_Element *ptr2; -u16 FieldOffset; -u8 TmpRateSpace[64 ]; -u8 TotalRateLen; - -if ( BasicRateCount <20 ) -memcpy ( TmpRateSpace, pBasicRateSet, BasicRateCount ); - -if ( OperationRateCount <20 ) -memcpy ( TmpRateSpace + BasicRateCount, pOperationRateSet, OperationRateCount ); - - TotalRateLen = BasicRateCount + OperationRateCount; - - FieldOffset = *iFildOffset; - ptr1 = (struct Supported_Rates_Element *)(addr + FieldOffset); - ptr1->Element_ID =ELEMENT_ID_SUPPORTED_RATES ; -//Fill the rates of temparary space into the SupportedRate Element. If -//it is full, fill to the ExtendedSupportedRate Element. -if (TotalRateLen <=8 ) - { -memcpy ( ptr1->SupportedRates, TmpRateSpace, TotalRateLen ); - ptr1->Length = TotalRateLen; - FieldOffset += (ptr1->Length+2 ); - } -else - { -memcpy ( ptr1->SupportedRates, TmpRateSpace,8 ); - TotalRateLen -=8 ; - ptr1->Length =8 ; - FieldOffset += (ptr1->Length+2 ); - ptr2 = (struct Extended_Supported_Rates_Element *)(addr + FieldOffset); - ptr2->Element_ID =ELEMENT_ID_EXTENDED_SUPPORTED_RATES ; -memcpy ( ptr2->ExtendedSupportedRates, TmpRateSpace+8 , TotalRateLen ); - ptr2->Length = TotalRateLen; - FieldOffset += (ptr2->Length+2 ); - } - - *iFildOffset = FieldOffset; -} - -void BSSAddIBSSdata (PWB32_ADAPTER Adapter,PWB_BSSDESCRIPTION psDesData) -{ -//u16 wBssIdx; - -// copy the data of connected STA(available from sLocalPara->wConnectedSTAindex) -// to the new description(local) -//psLOCAL->wConnectedSTAindex -//psDesData->bBssType = +BUG ();/* foo */ }// NOTE: return(1) means 'EQ', return(0) means 'NEQ' unsigned char boCmpMacAddr (PUCHAR adr1,PUCHAR adr2 ) { -return OS_MEMORY_COMPARE ( adr1, adr2,MAC_ADDR_LENGTH ); -} - -unsigned char boCmpSSID (struct SSID_Element *psSSID1,struct SSID_Element *psSSID2) -{ -if (psSSID1->Length == psSSID2->Length) - { -if (OS_MEMORY_COMPARE ( psSSID1->SSID, psSSID2->SSID, psSSID1->Length ) ) -return (1 ); - } -return 0 ; -} - -//============================================================================ -// wRoamingQuery -- -// -// Description: -// For roaming module to find out the candidate AP with the same SSID. -// It just chooses the first found AP. It may choose the original connected AP. -// If the signal of original AP is lost, this function may choose the original -// AP to try to join. If it is the first time that try to re-join to the original -// AP, the content of original AP in BSSdescription will not be removed. If this -// re-join fails(JoinFail timeout), the content of original AP in BSSdescription -// will be removed. If this re-join success, the local device will not do -// authentication or association because the content in BSSdescription is still -// valid. - -// Arguments: -// Adapter - The handle of an adapter bock. -// -// Return: -// the BSSdescriptor index of the candidate -//============================================================================ -u16 wRoamingQuery (PWB32_ADAPTER Adapter) -{ -BUG (); -} - -//convert the supported and extended supported rate elements to basic and operational -// rates using bit map -void vRateToBitmap (PWB32_ADAPTER Adapter,u16 index) -{ -int i,j,k; -u8 TmpValue,tmp; - -psBSS (index)->dwBasicRateBitmap =0 ; -psBSS (index)->dwOperationalRateBitmap =0 ; - j = k =0 ; -for (i=0 ; i<psBSS (index)->SupportedRateSet.Length; i++) - { - TmpValue =psBSS (index)->SupportedRateSet.SupportedRates[i]; -if (TmpValue&0x80 ) - {//Basic Rates - tmp =bRateToBitmapIndex (Adapter, TmpValue&0x7f ); -psBSS (index)->dwBasicRateBitmap |= (1 <<tmp); -psBSS (index)->BasicRate[j++] = TmpValue; - } -else - { - tmp =bRateToBitmapIndex (Adapter, TmpValue); -psBSS (index)->dwOperationalRateBitmap |= (1 <<tmp); -psBSS (index)->OperationalRate[k++] = TmpValue; - } - } -for (i=0 ; i<psBSS (index)->ExtendedSupportedRateSet.Length; i++) - { -//Assume the rates in ExtendedSupportedRateSet are all not basic rates - TmpValue =psBSS (index)->ExtendedSupportedRateSet.ExtendedSupportedRates[i]; -if (TmpValue &0x80 ) - {//Basic Rates - tmp =bRateToBitmapIndex (Adapter, TmpValue&0x7f ); -psBSS (index)->dwBasicRateBitmap |= (1 <<tmp); -psBSS (index)->BasicRate[j++] = TmpValue; - } -else - { - tmp =bRateToBitmapIndex (Adapter, TmpValue); -psBSS (index)->dwOperationalRateBitmap |= (1 <<tmp); -psBSS (index)->OperationalRate[k++] = TmpValue; - } - } -psBSS (index)->BasicRate[j] =0 ; -psBSS (index)->OperationalRate[k] =0 ; -//Operational rates will include the basic rates to avoid the condition that -// supported rate element is lack of operational rates. -//psBSS(index)->dwOperationalRateBitmap |= psBSS(index)->dwBasicRateBitmap; - -} - -//return the index in the bitmap -u8 bRateToBitmapIndex (PWB32_ADAPTER Adapter,u8 bRate) -{ -u8 index;//bit number 0 ~ 31 - -if (bRate <=RATE_24M ) - index = bRate >>1 ; -else - index = (bRate+4 ) >>2 ; -if (index>31 ) -return 0 ; -else -return index; -} - -u8 bBitmapToRate (u8 i) -{ -//i : bit number 0 ~ 31 -if (i>31 ) -return 0 ; -else -return (Bitmap2RateValue[i]); -} - -unsigned char boIsERPsta (PWB32_ADAPTER Adapter,u16 i) -{ -u32 tmp; - -//If the STA doesn't include ERP data rates, it belongs to NonERP STA - tmp =psBSS (i)->dwBasicRateBitmap |psBSS (i)->dwOperationalRateBitmap; -//clear bit 1, 2, 5.5, 11 - tmp &=0xfffff7d9 ; -if (tmp>0 ) -return TRUE; -else -return FALSE; -} - -unsigned char boCheckConnect (PWB32_ADAPTER Adapter) -{ -BUG (); -} - -unsigned char boCheckSignal (PWB32_ADAPTER Adapter) -{ -s32 rssi, threshold; - - rssi =hal_get_rssi_bss ( &Adapter->sHwData, - psLOCAL->wConnectedSTAindex, -MAX_ACC_RSSI_COUNT ); - -#ifdef _PE_STATE_DUMP_ -WBDEBUG (("Check RSSI =%d!\n" , rssi)); -#endif - - threshold = (s32)(0 - psLOCAL->SignalLostTh); -//if (rssi < -70) -if (rssi < threshold) - { -#ifdef _PE_STATE_DUMP_ -WBDEBUG (("Signal lost!\n" )); -#endif -return FALSE; - } -return TRUE; -} - -//The BSS descriptor will be checked if it is up-to-date when performing background -//scan. -void BssScanUpToDate (PWB32_ADAPTER Adapter) -{ -BUG (); -} - -//The BSS descriptors at the channel that the connection is will be -// checked if they are up-to-date. -void BssUpToDate (PWB32_ADAPTER Adapter) -{ -BUG (); -} - -//sort rates, mode = 0 :descent -// 1 :acscent -void RateSort (u8 *RateArray,u8 num,u8 mode) -{ -u8 i, j, tmp; - -if (mode) - { -for (i=0 ; i<(num-1 ); ++i) - { -for (j=i+1 ; j<num; ++j) - { -if (RateArray[j] < RateArray[i]) - { -//swap - tmp = RateArray[i]; - RateArray[i] = RateArray[j]; - RateArray[j] = tmp; - } - } - } - } -} - -//acscent ,and DSSS rates first and then OFDM rates, -//such as, 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, ... -void RateReSortForSRate (PWB32_ADAPTER Adapter,u8 *RateArray,u8 num) -{ -u8 i; - -RateSort (RateArray, num,1 ); - -for (i=0 ; i<num; i++) - { -if (RateArray[i] ==22 ) -break ; - } -if (i < num)//we need adjust the order of rate list because 11Mbps rate exists - { -for (;i>0 ;i--) - { -if (RateArray[i-1 ] <=11 ) -break ; - RateArray[i] = RateArray[i-1 ]; - } - RateArray[i] =22 ; - psLOCAL->NumOfDsssRateInSRate = i+1 ; - } -else - { -for (i=0 ; i<num; i++) - { -if (RateArray[i] >=12 ) -break ; - } - psLOCAL->NumOfDsssRateInSRate = i; - } -#ifdef _PE_STATE_DUMP_ -WBDEBUG (("Dump Data Rates, no of DSSS rate=%d\n" ,psLOCAL->NumOfDsssRateInSRate)); -DataDmp (RateArray, num,0 ); -#endif -} - -void SetMaxTxRate (PWB32_ADAPTER Adapter) -{ -u8 RateIdx, OfdmRateIdx; - - RateIdx = psLOCAL->NumOfSRate -1 ; - -//get the max tx rate - psLOCAL->CurrentTxRate = psLOCAL->SRateSet[RateIdx]; - -//decide the fallback rate : next level with the same modulation type -#ifdef _USE_FALLBACK_RATE_ - OfdmRateIdx = psLOCAL->NumOfDsssRateInSRate; -if (RateIdx >= OfdmRateIdx) - { -//Current tx rate belongs to OFDM rates -if (RateIdx != OfdmRateIdx) - psLOCAL->CurrentTxFallbackRate = psLOCAL->SRateSet[RateIdx-1 ]; -else - psLOCAL->CurrentTxFallbackRate = psLOCAL->SRateSet[RateIdx]; - } -else - { -//Current tx rate belongs to DSSS rates -if (RateIdx >0 ) - psLOCAL->CurrentTxFallbackRate = psLOCAL->SRateSet[RateIdx-1 ]; -else - psLOCAL->CurrentTxFallbackRate = psLOCAL->SRateSet[RateIdx]; - } -#else - psLOCAL->CurrentTxFallbackRate = psLOCAL->CurrentTxRate; -#endif -#ifdef _PE_TX_DUMP_ -WBDEBUG (("Max Tx rate =%d, fallback rate =%d\n" , - psLOCAL->CurrentTxRate, - psLOCAL->CurrentTxFallbackRate)); -#endif -} - - - -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//added by ws for add IE to WPA packet 05/15/04 -void CreateWpaIE (PWB32_ADAPTER Adapter, -u16 * iFildOffset, -PUCHAR msg, -struct Management_Frame * msgHeader, -struct Association_Request_Frame_Body * msgBody, -u16 iMSindex) -{ -BUG (); -} - -#ifdef _WPA2_ -//========================================================================================== -//added by WS for add IE for WPA2 packet -void CreateRsnIE (PWB32_ADAPTER Adapter,u16 * iFildOffset,PUCHAR msg, -struct Management_Frame * msgHeader, -struct Association_Request_Frame_Body * msgBody,u16 iMSindex) -{ -BUG (); -} - -u16 SearchPmkid (PWB32_ADAPTER Adapter,struct Management_Frame * msgHeader,struct PMKID_Information_Element * AssoReq_PMKID ) -{ -BUG (); +return OS_MEMORY_COMPARE ( adr1, adr2,MAC_ADDR_LENGTH );/* foo */ } -#endif //end def _WPA2_
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html