1981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* 2981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * smeSelect.c 3981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 4981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * All rights reserved. 6981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 7981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Redistribution and use in source and binary forms, with or without 8981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * modification, are permitted provided that the following conditions 9981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * are met: 10981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 11981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * * Redistributions of source code must retain the above copyright 12981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * notice, this list of conditions and the following disclaimer. 13981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * * Redistributions in binary form must reproduce the above copyright 14981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * notice, this list of conditions and the following disclaimer in 15981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * the documentation and/or other materials provided with the 16981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * distribution. 17981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * * Neither the name Texas Instruments nor the names of its 18981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * contributors may be used to endorse or promote products derived 19981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * from this software without specific prior written permission. 20981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 21981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 33981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 34981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** \file smeSelect.c 35981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief SME select function implementation 36981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 37981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \see smeSm.h, smeSm.c, sme.c, sme.h, smePrivate.h 38981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 39981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 40981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 41981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define __FILE_ID__ FILE_ID_42 42981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "smePrivate.h" 43981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "scanResultTable.h" 44981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "rsnApi.h" 45981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "siteMgrApi.h" 46981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "EvHandler.h" 47981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "GenSM.h" 48981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "smeSm.h" 49653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt#include "tidef.h" 50981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 51981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_BOOL sme_SelectSsidMatch (TI_HANDLE hSme, TSsid *pSiteSsid, TSsid *pDesiredSsid, 52981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ESsidType eDesiredSsidType); 53981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_BOOL sme_SelectBssidMatch (TMacAddr *pSiteBssid, TMacAddr *pDesiredBssid); 54981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_BOOL sme_SelectBssTypeMatch (ScanBssType_e eSiteBssType, ScanBssType_e eDesiredBssType); 55981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_BOOL sme_SelectWscMatch (TI_HANDLE hSme, TSiteEntry *pCurrentSite, 56981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_BOOL *pbWscPbAbort, TI_BOOL *pbWscPbApFound); 57981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_BOOL sme_SelectRsnMatch (TI_HANDLE hSme, TSiteEntry *pCurrentSite); 58981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 59981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 60981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn sme_Select 61981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Select a connection candidate from the scan result table 62981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 63981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Select a connection candidate from the scan result table. 64981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 65981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Connection candidate must match SSID, BSSID, BSS type, RSN and WSC settings, has the best 66981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * RSSI level from all matching sites, and connection was not attempted to it in this SME cycle 67981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * (since last scan was completed) 68981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 69981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hSme - handle to the SME object 70981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return A pointer to the selected site, NULL if no site macthes the selection criteria 71981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 72981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTSiteEntry *sme_Select (TI_HANDLE hSme) 73981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 74981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TSme *pSme = (TSme*)hSme; 75981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TSiteEntry *pCurrentSite, *pSelectedSite = NULL; 76981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_INT8 iSelectedSiteRssi = -127; /* minimum RSSI */ 77981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_BOOL bWscPbAbort, pWscPbApFound = TI_FALSE; 78653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt int apFoundCtr =0; 79981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 80981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select called\n"); 81981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 82981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* on SG avalanche, select is not needed, send connect event automatically */ 83981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_TRUE == pSme->bReselect) 84981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 85023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt paramInfo_t *pParam; 86023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt 87981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: reselect flag is on, reselecting the current site\n"); 88981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 89023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); 90023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt if (!pParam) 91023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt return NULL; 92023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt 93981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pSme->bReselect = TI_FALSE; 94981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 95981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Get Primary Site */ 96023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt pParam->paramType = SITE_MGR_GET_PRIMARY_SITE; 97023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt siteMgr_getParam(pSme->hSiteMgr, pParam); 98023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt pCurrentSite = pParam->content.pPrimarySite; 99023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); 100023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt return pCurrentSite; 101981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 102981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 103981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get the first site from the scan result table */ 104981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite = scanResultTable_GetFirst (pSme->hScanResultTable); 105981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 106981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* check all sites */ 107981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while (NULL != pCurrentSite) 108981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 109981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: considering BSSID: %02x:%02x:%02x:%02x:%02x:%02x for selection\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 110981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 111981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if this site was previously selected in the current SME connection attempt, and conn mode is auto */ 1121e288e68a3d13d00a3014c0c0e0ddf308b1caabdVishal Mahaveer if (TI_TRUE == pCurrentSite->bConsideredForSelect) 113981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 114981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x was selected previously\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 115981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get the next site and continue the loop */ 116981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 117981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt continue; 118981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 119981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 120981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* check if site matches */ 121981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* first check SSID match */ 122981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_FALSE == sme_SelectSsidMatch (hSme, &(pCurrentSite->ssid), &(pSme->tSsid), pSme->eSsidType)) 123981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* site doesn't match */ 124981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 125981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match SSID\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 126981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 127981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get the next site and continue the loop */ 128981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 129981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt continue; 130981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 131981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 132981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* Now check BSSID match */ 133981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_FALSE == sme_SelectBssidMatch (&(pCurrentSite->bssid), &(pSme->tBssid))) 134981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* site doesn't match */ 135981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 136981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match SSID\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 137981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 138981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get the next site and continue the loop */ 139981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 140981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt continue; 141981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 142981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 143981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* and BSS type match */ 144981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_FALSE == sme_SelectBssTypeMatch (pCurrentSite->bssType, pSme->eBssType)) 145981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* site doesn't match */ 146981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 147981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match BSS type\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 148981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 149981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get the next site and continue the loop */ 150981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 151981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt continue; 152981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 153981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 154653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if (pCurrentSite->WSCSiteMode == TIWLN_SIMPLE_CONFIG_PBC_METHOD) 155653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt { 156653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt apFoundCtr++; 157653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt } 158653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if (apFoundCtr > 1) 159653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt { 160653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt pWscPbApFound = TI_TRUE; 161653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt } 162653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 163981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* and simple config match */ 164981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_FALSE == sme_SelectWscMatch (hSme, pCurrentSite, &bWscPbAbort, &pWscPbApFound)) 165981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* site doesn't match */ 166981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 167981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* also check if abort was indicated */ 168981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_TRUE == bWscPbAbort) 169981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 170981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* send event to user mode to indicate this */ 171981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt EvHandlerSendEvent (pSme->hEvHandler, IPC_EVENT_WPS_SESSION_OVERLAP, NULL, 0); 172981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* select failed - will rescan in time */ 173981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return NULL; 174981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 175981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match WSC\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 176981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 177981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get the next site and continue the loop */ 178981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 179981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt continue; 180981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 181981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 182981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* and security match */ 183981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_FALSE == sme_SelectRsnMatch (hSme, pCurrentSite)) 184981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* site doesn't match */ 185981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 186981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match RSN\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 187981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 188981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get the next site and continue the loop */ 189981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 190981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt continue; 191981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 192981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 193981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* and rate match */ 194981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_FALSE == siteMgr_SelectRateMatch (pSme->hSiteMgr, pCurrentSite)) 195981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* site doesn't match */ 196981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 197981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match rates\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 198981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ 199981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* get the next site and continue the loop */ 200981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 201981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt continue; 202981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 203981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 204981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if this site RSSI is higher than current maximum, select it */ 205981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (pCurrentSite->rssi > iSelectedSiteRssi) 206981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 207981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x match and has highest RSSI so far!\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); 208981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pSelectedSite = pCurrentSite; 209981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt iSelectedSiteRssi = pCurrentSite->rssi; 210981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 211981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 212981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* and continue to the next site */ 213981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); 214981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 215981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 216981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if a matching site was found */ 217981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (NULL != pSelectedSite) 218981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 219981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* mark that a connection to this site was (actually is) attempted */ 220981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pSelectedSite->bConsideredForSelect = TI_TRUE; 221981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 222981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* hope this is the correct place for siteMgr_changeBandParams */ 223981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt siteMgr_changeBandParams (pSme->hSiteMgr, pSelectedSite->eBand); 224981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 225981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* 226981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Coordinate between SME module site table and Site module site Table 227981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * copy candidate AP to Site module site Table. 228981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 229981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt siteMgr_CopyToPrimarySite(pSme->hSiteMgr, pSelectedSite); 230981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 231981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 232981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* return the selected site (or NULL, if no site was selected) */ 233981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return pSelectedSite; 234981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 235981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 236981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 237981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn sme_SelectSsidMatch 238981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Check if a site SSID matches the desired SSID for selection 239981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 240981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Check if a site SSID matches the desired SSID for selection 241981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 242981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hSme - handle to the SME object 243981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param pSiteSsid - the site SSID 244981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param pDesiredSsid - the desired SSID 245981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param edesiredSsidType - the desired SSID type 246981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_TRUE if SSIDs match, TI_FALSE if they don't 247981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa sme_Select 248981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 249981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_BOOL sme_SelectSsidMatch (TI_HANDLE hSme, TSsid *pSiteSsid, TSsid *pDesiredSsid, 250981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ESsidType eDesiredSsidType) 251981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 252981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TSme *pSme = (TSme*)hSme; 253981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 254981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if the desired SSID type is any, return TRUE (site matches) */ 255981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (SSID_TYPE_ANY == eDesiredSsidType) 256981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 257981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_TRUE; 258981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 259981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 260981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* otherwise, check if the SSIDs match */ 261981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ((pSiteSsid->len == pDesiredSsid->len) && /* lngth match */ 262981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt (0 == os_memoryCompare (pSme->hOS, &(pSiteSsid->str[ 0 ]), &(pDesiredSsid->str[ 0 ]), pSiteSsid->len))) /* content match */ 263981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 264981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_TRUE; 265981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 266981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 267981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 268981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_FALSE; 269981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 270981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 271981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 272981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 273981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn sme_SelectBssidMatch 274981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Check if a site BSSID matches the desired BSSID for selection 275981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 276981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Check if a site BSSID matches the desired BSSID for selection 277981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 278981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param pSiteBssid - the site BSSID 279981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param pDesiredBssid - the desired BSSID 280981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_TRUE if BSSIDs match, TI_FALSE if they don't 281981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa sme_Select 282981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 283981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_BOOL sme_SelectBssidMatch (TMacAddr *pSiteBssid, TMacAddr *pDesiredBssid) 284981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 285981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* check if the desired BSSID is broadcast (no need to match) */ 286981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_TRUE == MAC_BROADCAST (*pDesiredBssid)) 287981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 288981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_TRUE; 289981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 290981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 291981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if the desired BSSID is not any BSSID, check if the site BSSID equals the desired BSSID */ 292981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (TI_TRUE == MAC_EQUAL (*pDesiredBssid, *pSiteBssid)) 293981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 294981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_TRUE; 295981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 296981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 297981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* no match */ 298981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_FALSE; 299981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 300981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 301981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 302981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn sme_SelectBssTypeMatch 303981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Checks if the desired BSS type match the BSS type of a site 304981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 305981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Checks if the desired BSS type match the BSS type of a site 306981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 307981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param eSiteBssType - the site BSS type 308981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param edesiredBssType - the desired BSS type 309981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_TRUE if the BSS types matches, TI_FALSE if they don't 310981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa sme_Select 311981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 312981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_BOOL sme_SelectBssTypeMatch (ScanBssType_e eSiteBssType, ScanBssType_e eDesiredBssType) 313981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 314981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if the desired type is any, there is a match */ 315981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (BSS_ANY == eDesiredBssType) 316981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 317981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_TRUE; 318981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 319981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 320981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if the BSS types equal, there is a match */ 321981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (eDesiredBssType == eSiteBssType) 322981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 323981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_TRUE; 324981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 325981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 326981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* no match */ 327981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_FALSE; 328981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 329981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 330981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 331981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn sme_SelectWscMatch 332981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief checks if the configred WSC mode equals the WSC mode of a site 333981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 334981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * checks if the configred WSC mode equals the WSC mode of a site 335981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 336981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hSme - handle to the SME object 337981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param pCurrentSite - site to check 338981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_TRUE if site macthes current WSC mode, TI_FALSE if it doesn't match 339981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa sme_Select 340981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 341981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_BOOL sme_SelectWscMatch (TI_HANDLE hSme, TSiteEntry *pCurrentSite, 342981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_BOOL *pbWscPbAbort, TI_BOOL *pbWscPbApFound) 343981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 344981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TSme *pSme = (TSme*)hSme; 345023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt TIWLN_SIMPLE_CONFIG_MODE wscMode; 346981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 347023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt siteMgr_getParamWSC(pSme->hSiteMgr, &wscMode); /* SITE_MGR_SIMPLE_CONFIG_MODE - get the WSC mode from site mgr */ 348981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if simple config is off, site match */ 349023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt if (TIWLN_SIMPLE_CONFIG_OFF == wscMode) 350981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 351981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_TRUE; 352981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 353981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 354981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if WSC is supported, and more than one AP with PB configuration is found - indicate to abort */ 355981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if ((TI_TRUE == *pbWscPbApFound) && (TIWLN_SIMPLE_CONFIG_PBC_METHOD == pCurrentSite->WSCSiteMode)) 356981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 357023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt TRACE1(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_SelectWscMatch: WSC mode is %d, and more than one AP with WSC PB found - aborting\n", wscMode); 358981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *pbWscPbAbort = TI_TRUE; 359981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_FALSE; 360981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 361981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 362981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 363981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* indicate NOT to abort the select process */ 364981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *pbWscPbAbort = TI_FALSE; 365981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 366981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 367981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* if configured simple config mode equals site simple config mode, site match */ 368023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt if (pCurrentSite->WSCSiteMode == wscMode) 369981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 370981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_TRUE; 371981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 372981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 373981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* site doesn't match */ 374981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_FALSE; 375981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 376981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 377981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** 378981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn sme_SelectRsnMatch 379981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief Checks if the configured scurity settings match those of a site 380981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 381981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Checks if the configured scurity settings match those of a site 382981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * 383981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param hSme - handle to the SME object 384981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param pCurrentSite - the site to check 385981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_TRUE if site matches RSN settings, TI FALSE if it doesn't 386981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa sme_Select 387981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */ 388981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_BOOL sme_SelectRsnMatch (TI_HANDLE hSme, TSiteEntry *pCurrentSite) 389981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{ 390981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TSme *pSme = (TSme*)hSme; 391981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRsnData tRsnData; 392981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt dot11_RSN_t *pRsnIe; 393981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT8 uRsnIECount=0; 394981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT8 uCurRsnData[255]; 395981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT8 uLength = 0; 396981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TI_UINT32 uMetric; 397653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt TRsnSiteParams tRsnSiteParams; 398653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt 399653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt tRsnSiteParams.bssType = pCurrentSite->bssType; 400653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt MAC_COPY(tRsnSiteParams.bssid, pCurrentSite->bssid); 401653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt tRsnSiteParams.pHTCapabilities = &pCurrentSite->tHtCapabilities; 402653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt tRsnSiteParams.pHTInfo = &pCurrentSite->tHtInformation; 403981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 404981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* copy all RSN IE's */ 405981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRsnIe = pCurrentSite->pRsnIe; 406981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt while ((uLength < pCurrentSite->rsnIeLen) && (uRsnIECount < MAX_RSN_IE)) 407981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 408981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uCurRsnData[ 0 + uLength ] = pRsnIe->hdr[ 0 ]; 409981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uCurRsnData[ 1 + uLength ] = pRsnIe->hdr[ 1 ]; 410981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt os_memoryCopy (pSme->hOS, &uCurRsnData[ 2 + uLength ], pRsnIe->rsnIeData, pRsnIe->hdr[ 1 ]); 411981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uLength += pRsnIe->hdr[ 1 ] + 2; 412981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt pRsnIe += 1; 413981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt uRsnIECount++; 414981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 415981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* sanity check - make sure RSN IE's size is not too big */ 416981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt if (uLength < pCurrentSite->rsnIeLen) 417981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 418981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt TRACE2(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_SelectRsnMatch, RSN IE is too long: rsnIeLen=%d, MAX_RSN_IE=%d\n", pCurrentSite->rsnIeLen, MAX_RSN_IE); 419981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 420981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 421981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* call the RSN to evaluate the site */ 422981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt tRsnData.pIe = (pCurrentSite->rsnIeLen == 0) ? NULL : uCurRsnData; 423981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt tRsnData.ieLen = pCurrentSite->rsnIeLen; 424981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt tRsnData.privacy = pCurrentSite->privacy; 425653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt if (rsn_evalSite (pSme->hRsn, &tRsnData, &tRsnSiteParams , &uMetric) != TI_OK) 426981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 427981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* no match */ 428981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_FALSE; 429981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 430981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt else 431981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt { 432981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt /* match! */ 433981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt return TI_TRUE; 434981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt } 435981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt} 436981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt 437