TI_STATUS roamingMngr_connect(TI_HANDLE hRoamingMngr, TargetAp_t* pTargetAp) { roamingMngr_t *pRoamingMngr = (roamingMngr_t*)hRoamingMngr; bssList_t *bssList; int i=0; TRACE2(pRoamingMngr->hReport, REPORT_SEVERITY_INFORMATION, "roamingMngr_connect()," "transitionMethod = %d," "requestType = %d," " \n", pTargetAp->transitionMethod,pTargetAp->connRequest.requestType) ; TRACE6(pRoamingMngr->hReport, REPORT_SEVERITY_ERROR, "roamingMngr_connect()," " AP to roam BSSID: " "%02x-%02x-%02x-%02x-%02x-%02x " "\n", pTargetAp->newAP.BSSID[0],pTargetAp->newAP.BSSID[1],pTargetAp->newAP.BSSID[2],pTargetAp->newAP.BSSID[3],pTargetAp->newAP.BSSID[4],pTargetAp->newAP.BSSID[5]); /* Search for target AP in the scan manager results table, to get its beacon/ProbResponse buffer */ bssList = scanMngr_getBSSList(((roamingMngr_t*)hRoamingMngr)->hScanMngr); for (i=0; i< bssList->numOfEntries ; i++) { if (MAC_EQUAL(bssList->BSSList[i].BSSID, pTargetAp->newAP.BSSID)) { pTargetAp->newAP.pBuffer = bssList->BSSList[i].pBuffer; pTargetAp->newAP.bufferLength = bssList->BSSList[i].bufferLength; os_memoryCopy(pRoamingMngr->hOs, &(pRoamingMngr->targetAP), (void*)pTargetAp, sizeof(TargetAp_t)); return roamingMngr_smEvent(ROAMING_MANUAL_EVENT_CONNECT, hRoamingMngr); } } TRACE6(pRoamingMngr->hReport, REPORT_SEVERITY_ERROR, "roamingMngr_connect()," "AP was not found in scan table!! BSSID: " "%02x-%02x-%02x-%02x-%02x-%02x " "\n", pTargetAp->newAP.BSSID[0],pTargetAp->newAP.BSSID[1],pTargetAp->newAP.BSSID[2],pTargetAp->newAP.BSSID[3],pTargetAp->newAP.BSSID[4],pTargetAp->newAP.BSSID[5]); return TI_NOK; }
TI_STATUS keyParserExternal_remove(struct _keyParser_t *pKeyParser, TI_UINT8 *pKeyData, TI_UINT32 keyDataLen) { TI_STATUS status; OS_802_11_KEY *pKeyDesc; paramInfo_t macParam; encodedKeyMaterial_t encodedKeyMaterial; TI_UINT8 broadcastMacAddr[MAC_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; TI_UINT8 keyBuffer[MAC_ADDR_LEN+KEY_RSC_LEN+MAX_EXT_KEY_DATA_LENGTH]; if (pKeyData == NULL) { return TI_NOK; } pKeyDesc = (OS_802_11_KEY*)pKeyData; if (pKeyDesc->KeyIndex & EXT_KEY_TRANSMIT_MASK) { /* Bit 31 should always be zero */ return TI_NOK; } if (pKeyDesc->KeyIndex & EXT_KEY_REMAIN_BITS_MASK) { /* Bits 8-29 should always be zero */ return TI_NOK; } encodedKeyMaterial.keyId = pKeyDesc->KeyIndex; encodedKeyMaterial.keyLen = 0; encodedKeyMaterial.pData = (char *) keyBuffer; if (pKeyDesc->KeyIndex & EXT_KEY_PAIRWISE_GROUP_MASK) { /* delete all pairwise keys or for the current BSSID */ if (!MAC_EQUAL(pKeyDesc->BSSID, broadcastMacAddr)) { MAC_COPY (keyBuffer, pKeyDesc->BSSID); } else { macParam.paramType = CTRL_DATA_CURRENT_BSSID_PARAM; status = ctrlData_getParam(pKeyParser->hCtrlData, &macParam); if (status != TI_OK) { return TI_NOK; } MAC_COPY (keyBuffer, macParam.content.ctrlDataCurrentBSSID); } status = pKeyParser->pUcastKey->pKeyDerive->remove(pKeyParser->pUcastKey->pKeyDerive, &encodedKeyMaterial); } else { /* delete all group keys or for the current BSSID */ MAC_COPY (keyBuffer, broadcastMacAddr); status = pKeyParser->pBcastKey->pKeyDerive->remove(pKeyParser->pUcastKey->pKeyDerive, &encodedKeyMaterial); } return status; }
/************************************************************************ * findSiteEntry * ************************************************************************ DESCRIPTION: Perform the following things: - Compute the site's hash entry based on the site BSSID and hash function - Look fotr the site entry in the linked list pointed by the hash entry - If the site is found in the site table, returns a pointer to the site entry - If the site is not found, return NULL. INPUT: pSiteMgr - Handle to site mgr mac - The site BSSID OUTPUT: RETURN: Pointer to the site entry if site found, NULL otherwise ************************************************************************/ siteEntry_t *findSiteEntry(siteMgr_t *pSiteMgr, TMacAddr *mac) { siteTablesParams_t *pCurrentSiteTable = pSiteMgr->pSitesMgmtParams->pCurrentSiteTable; siteEntry_t *pSiteEntry; TI_UINT8 tableIndex=2, i; /* It looks like it never happens. Anyway decided to check */ if ( pCurrentSiteTable->maxNumOfSites > MAX_SITES_BG_BAND ) { TRACE2( pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "findSiteEntry. pCurrentSiteTable->maxNumOfSites=%d exceeds the limit %d\n", pCurrentSiteTable->maxNumOfSites, MAX_SITES_BG_BAND); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return NULL; } do { tableIndex--; for (i = 0; i < pCurrentSiteTable->maxNumOfSites; i++) { pSiteEntry = &(pCurrentSiteTable->siteTable[i]); if (MAC_EQUAL (pSiteEntry->bssid, *mac)) { TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "FIND success, bssid: %X-%X-%X-%X-%X-%X\n\n", (*mac)[0], (*mac)[1], (*mac)[2], (*mac)[3], (*mac)[4], (*mac)[5]); return pSiteEntry; } } if ((pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_DUAL_MODE) && (tableIndex==1)) { /* change site table */ if (pCurrentSiteTable == &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables) { pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables; } else { pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables; } } } while (tableIndex>0); TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "FIND failure, bssid: %X-%X-%X-%X-%X-%X\n\n", (*mac)[0], (*mac)[1], (*mac)[2], (*mac)[3], (*mac)[4], (*mac)[5]); return NULL; }
/** * \fn sme_SelectBssidMatch * \brief Check if a site BSSID matches the desired BSSID for selection * * Check if a site BSSID matches the desired BSSID for selection * * \param pSiteBssid - the site BSSID * \param pDesiredBssid - the desired BSSID * \return TI_TRUE if BSSIDs match, TI_FALSE if they don't * \sa sme_Select */ TI_BOOL sme_SelectBssidMatch (TMacAddr *pSiteBssid, TMacAddr *pDesiredBssid) { /* check if the desired BSSID is broadcast (no need to match) */ if (TI_TRUE == MAC_BROADCAST (*pDesiredBssid)) { return TI_TRUE; } /* if the desired BSSID is not any BSSID, check if the site BSSID equals the desired BSSID */ if (TI_TRUE == MAC_EQUAL (*pDesiredBssid, *pSiteBssid)) { return TI_TRUE; } /* no match */ return TI_FALSE; }
/** * \fn scanResultTable_GetByBssid * \brief retreives an entry according to its SSID and BSSID * * retreives an entry according to its BSSID * * \param hScanResultTable - handle to the scan result table object * \param pSsid - SSID to search for * \param pBssid - BSSID to search for * \return A pointer to the entry with macthing BSSID, NULL if no such entry was found. */ TSiteEntry *scanResultTable_GetBySsidBssidPair (TI_HANDLE hScanResultTable, TSsid *pSsid, TMacAddr *pBssid) { TScanResultTable *pScanResultTable = (TScanResultTable*)hScanResultTable; TI_UINT32 uIndex; /* check all entries in the table */ for (uIndex = 0; uIndex < pScanResultTable->uCurrentSiteNumber; uIndex++) { /* if the BSSID and SSID match */ if (MAC_EQUAL (*pBssid, pScanResultTable->pTable[ uIndex ].bssid) && ((pSsid->len == pScanResultTable->pTable[ uIndex ].ssid.len) && (0 == os_memoryCompare (pScanResultTable->hOS, &(pSsid->str[ 0 ]), &(pScanResultTable->pTable[ uIndex ].ssid.str[ 0 ]), pSsid->len)))) { return &(pScanResultTable->pTable[ uIndex ]); } } /* site wasn't found: return NULL */ return NULL; }
/************************************************************************ * findAndInsertSiteEntry * ************************************************************************ DESCRIPTION: Perform the following things: - Compute the site's hash entry based on the site BSSID and hash function - Look for the site entry in the linked list pointed by the hash entry - If the site is found in the site table, returns a pointer to the site entry - If the site is not found in the site table, tries to add the site - If succeeds, returns a pointer to the site entry - Otherwise, returns NULL INPUT: pSiteMgr - Handle to site mgr mac - The site BSSID band - The site band OUTPUT: RETURN: Pointer to the site entry if site found/inserted, NULL otherwise ************************************************************************/ siteEntry_t *findAndInsertSiteEntry(siteMgr_t *pSiteMgr, TMacAddr *mac, ERadioBand band) { TI_UINT8 i, emptySiteIndex=0, nextSite2Remove=0; siteEntry_t *pSiteEntry, *pPrimarySite=pSiteMgr->pSitesMgmtParams->pPrimarySite; sitesMgmtParams_t *pSitesMgmtParams = pSiteMgr->pSitesMgmtParams; siteTablesParams_t *pCurrentSiteTable; TI_BOOL firstEmptySiteFound = TI_FALSE; TI_UINT32 oldestTS; /* choose site table according to AP's band */ if ( RADIO_BAND_2_4_GHZ == band ) { pCurrentSiteTable = &(pSitesMgmtParams->dot11BG_sitesTables); } else if (RADIO_BAND_5_0_GHZ == band) { pCurrentSiteTable = (siteTablesParams_t*) &(pSitesMgmtParams->dot11A_sitesTables); } else { TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Bad band: %d\n\n", band); pCurrentSiteTable = &(pSitesMgmtParams->dot11BG_sitesTables); } /* Set the first TS to a site which is not the Primary site */ if (pPrimarySite != &(pCurrentSiteTable->siteTable[0])) { oldestTS = pCurrentSiteTable->siteTable[0].localTimeStamp; } else { oldestTS = pCurrentSiteTable->siteTable[1].localTimeStamp; } /* It looks like it never happens. Anyway decided to check */ if ( pCurrentSiteTable->maxNumOfSites > MAX_SITES_BG_BAND ) { TRACE2( pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "findAndInsertSiteEntry. pCurrentSiteTable->maxNumOfSites=%d exceeds the limit %d\n", pCurrentSiteTable->maxNumOfSites, MAX_SITES_BG_BAND); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return NULL; } /* Loop all the sites till the desired MAC is found */ for (i = 0; i < pCurrentSiteTable->maxNumOfSites; i++) { pSiteEntry = &(pCurrentSiteTable->siteTable[i]); if (MAC_EQUAL (pSiteEntry->bssid, *mac)) { TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "FIND success, bssid: %X-%X-%X-%X-%X-%X\n\n", (*mac)[0], (*mac)[1], (*mac)[2], (*mac)[3], (*mac)[4], (*mac)[5]); return pSiteEntry; } else if (pSiteEntry->siteType == SITE_NULL) { /* Save the first empty site, in case the desired MAC is not found */ if (!firstEmptySiteFound) { emptySiteIndex = i; firstEmptySiteFound=TI_TRUE; } } else if (oldestTS == pSiteEntry->localTimeStamp) { /* Save the oldest site's index, according to TS */ nextSite2Remove = i; } } TRACE4(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "INSERT failure, no free entry!, oldestTS=%d, nextSite2Remove=%d, " "[0].localTimeStamp=%d, [1]localTimeStamp%d \n", oldestTS, nextSite2Remove, pCurrentSiteTable->siteTable[0].localTimeStamp, pCurrentSiteTable->siteTable[1].localTimeStamp); if ((!firstEmptySiteFound) || (pCurrentSiteTable->numOfSites>=pCurrentSiteTable->maxNumOfSites)) { /* No NULL entry has been found. Remove the oldest site */ pSiteEntry = &(pCurrentSiteTable->siteTable[nextSite2Remove]); TRACE9(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "INSERT failure, no free entry!, numOfSites=%d, removing site index=%d,\n bssid: %X-%X-%X-%X-%X-%X, ts=%d \n", pCurrentSiteTable->numOfSites, nextSite2Remove, pSiteEntry->bssid[0], pSiteEntry->bssid[1], pSiteEntry->bssid[2], pSiteEntry->bssid[3], pSiteEntry->bssid[4], pSiteEntry->bssid[5], pSiteEntry->localTimeStamp); removeSiteEntry(pSiteMgr, pCurrentSiteTable, pSiteEntry); emptySiteIndex = nextSite2Remove; } pCurrentSiteTable->numOfSites++; pSiteEntry = &(pCurrentSiteTable->siteTable[emptySiteIndex]); /* fill the entry with the station mac */ MAC_COPY (pSiteEntry->bssid, *mac); /* Some parameters have to be initialized immediately after entry allocation */ if(pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE) pSiteEntry->currentSlotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime; TRACE8(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "INSERT success, bssid: %X-%X-%X-%X-%X-%X, band=%d, index=%d\n\n", (*mac)[0], (*mac)[1], (*mac)[2], (*mac)[3], (*mac)[4], (*mac)[5], band, emptySiteIndex); return pSiteEntry; }
TI_STATUS keyParserExternal_recv(struct _keyParser_t *pKeyParser, TI_UINT8 *pKeyData, TI_UINT32 keyDataLen) { TI_STATUS status; OS_802_11_KEY *pKeyDesc; encodedKeyMaterial_t encodedKeyMaterial; paramInfo_t macParam; TI_BOOL macEqual2Associated=TI_FALSE; TI_BOOL macIsBroadcast=TI_FALSE; TI_BOOL wepKey = TI_FALSE; TI_UINT8 broadcastMacAddr[MAC_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; TI_UINT8 nullMacAddr[MAC_ADDR_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; TI_UINT8 keyBuffer[MAC_ADDR_LEN+KEY_RSC_LEN+MAX_EXT_KEY_DATA_LENGTH]; if (pKeyData == NULL) { TRACE0(pKeyParser->hReport, REPORT_SEVERITY_ERROR, "EXT_KEY_PARSER: ERROR: NULL KEY Data\n"); return TI_NOK; } pKeyDesc = (OS_802_11_KEY*)pKeyData; /* copy the key data, mac address and RSC */ MAC_COPY (keyBuffer, pKeyDesc->BSSID); /* configure keyRSC value (if needed) */ if (pKeyDesc->KeyIndex & EXT_KEY_RSC_KEY_MASK) { /* set key recieve sequence counter */ os_memoryCopy(pKeyParser->hOs, &keyBuffer[MAC_ADDR_LEN], (TI_UINT8*)&(pKeyDesc->KeyRSC), KEY_RSC_LEN); } else { os_memoryZero(pKeyParser->hOs, &keyBuffer[MAC_ADDR_LEN], KEY_RSC_LEN); } /* check type and validity of keys */ /* check MAC Address validity */ macParam.paramType = CTRL_DATA_CURRENT_BSSID_PARAM; status = ctrlData_getParam(pKeyParser->hCtrlData, &macParam); if (status != TI_OK) { TRACE0(pKeyParser->hReport, REPORT_SEVERITY_ERROR, "EXT_KEY_PARSER: ERROR: Cannot get MAC address !!!\n"); return TI_NOK; } /* check key length */ if((pKeyDesc->KeyLength != WEP_KEY_LEN_40) && (pKeyDesc->KeyLength != WEP_KEY_LEN_104) && (pKeyDesc->KeyLength != WEP_KEY_LEN_232) && (pKeyDesc->KeyLength != CKIP_KEY_LEN) && (pKeyDesc->KeyLength != TKIP_KEY_LEN) && (pKeyDesc->KeyLength != AES_KEY_LEN) ) { TRACE1(pKeyParser->hReport, REPORT_SEVERITY_ERROR, "EXT_KEY_PARSER: ERROR: Incorrect key length - %d \n", pKeyDesc->KeyLength); return TI_NOK; } if (MAC_EQUAL(macParam.content.ctrlDataCurrentBSSID, pKeyDesc->BSSID)) { macEqual2Associated = TI_TRUE; } if (MAC_EQUAL (pKeyDesc->BSSID, broadcastMacAddr)) { macIsBroadcast = TI_TRUE; } if ((pKeyDesc->KeyLength == WEP_KEY_LEN_40) || (pKeyDesc->KeyLength == WEP_KEY_LEN_104) || (pKeyDesc->KeyLength == WEP_KEY_LEN_232)) { /* In Add WEP the MAC address is nulled, since it's irrelevant */ macEqual2Associated = TI_TRUE; wepKey = TI_TRUE; } if (pKeyDesc->KeyIndex & EXT_KEY_SUPP_AUTHENTICATOR_MASK) { /* The key is being set by an Authenticator - not allowed in IBSS mode */ if (pKeyParser->pParent->pParent->pParent->pAdmCtrl->networkMode == RSN_IBSS) { /* in IBSS only Broadcast MAC is allowed */ TRACE0(pKeyParser->hReport, REPORT_SEVERITY_ERROR, "EXT_KEY_PARSER: ERROR: Authenticator set key in IBSS mode !!!\n"); return TI_NOK; } } if (pKeyDesc->KeyIndex & EXT_KEY_REMAIN_BITS_MASK) { /* the reamining bits in the key index are not 0 (when they should be) */ TRACE0(pKeyParser->hReport, REPORT_SEVERITY_ERROR, "EXT_KEY_PARSER: ERROR: Key index bits 8-27 should be 0 !!!\n"); return TI_NOK; } encodedKeyMaterial.pData = (char *) keyBuffer; /* Check key length according to the cipher suite - TKIP, etc...??? */ if (wepKey) { if (!((pKeyDesc->KeyLength == WEP_KEY_LEN_40) || (pKeyDesc->KeyLength == WEP_KEY_LEN_104) || (pKeyDesc->KeyLength == WEP_KEY_LEN_232))) { /*Invalid key length*/ TRACE1(pKeyParser->hReport, REPORT_SEVERITY_ERROR, "WEP_KEY_PARSER: ERROR: Invalid Key length: %d !!!\n", pKeyDesc->KeyLength); return TI_NOK; } os_memoryCopy(pKeyParser->hOs, &keyBuffer[0], pKeyDesc->KeyMaterial, pKeyDesc->KeyLength); if (MAC_EQUAL (nullMacAddr, pKeyDesc->BSSID)) { macIsBroadcast = TI_TRUE; } encodedKeyMaterial.keyLen = pKeyDesc->KeyLength; } else /* this is TKIP or CKIP */ { if ((pKeyDesc->KeyLength == CKIP_KEY_LEN) && (pKeyParser->pPaeConfig->unicastSuite == TWD_CIPHER_CKIP)) { os_memoryCopy(pKeyParser->hOs, &keyBuffer[0], pKeyDesc->KeyMaterial, pKeyDesc->KeyLength); encodedKeyMaterial.keyLen = pKeyDesc->KeyLength; } else { os_memoryCopy(pKeyParser->hOs, &keyBuffer[MAC_ADDR_LEN+KEY_RSC_LEN], pKeyDesc->KeyMaterial, pKeyDesc->KeyLength); encodedKeyMaterial.keyLen = MAC_ADDR_LEN+KEY_RSC_LEN+pKeyDesc->KeyLength; } } encodedKeyMaterial.keyId = pKeyDesc->KeyIndex; TRACE2(pKeyParser->hReport, REPORT_SEVERITY_INFORMATION, "EXT_KEY_PARSER: Key received keyId=%x, keyLen=%d \n", pKeyDesc->KeyIndex, pKeyDesc->KeyLength ); if (pKeyDesc->KeyIndex & EXT_KEY_PAIRWISE_GROUP_MASK) { /* Pairwise key */ /* check that the lower 8 bits of the key index are 0 */ if (!wepKey && (pKeyDesc->KeyIndex & 0xff)) { TRACE0(pKeyParser->hReport, REPORT_SEVERITY_WARNING, "EXT_KEY_PARSER: ERROR: Pairwise key must have index 0 !!!\n"); return TI_NOK; } if (macIsBroadcast) { TRACE0(pKeyParser->hReport, REPORT_SEVERITY_ERROR, "EXT_KEY_PARSER: ERROR: Broadcast MAC address for unicast !!!\n"); return TI_NOK; } if (pKeyDesc->KeyIndex & EXT_KEY_TRANSMIT_MASK) { /* tx only pairwase key */ /* set unicast keys */ if (pKeyParser->pUcastKey->recvSuccess!=NULL) { status = pKeyParser->pUcastKey->recvSuccess(pKeyParser->pUcastKey, &encodedKeyMaterial); } } else { /* recieve only pairwase keys are not allowed */ TRACE0(pKeyParser->hReport, REPORT_SEVERITY_ERROR, "EXT_KEY_PARSER: ERROR: recieve only pairwase keys are not allowed !!!\n"); return TI_NOK; } } else { /* set broadcast keys */ if (!macIsBroadcast) { /* not broadcast MAC */ if (pKeyParser->pParent->pParent->pParent->pAdmCtrl->networkMode == RSN_IBSS) { /* in IBSS only Broadcast MAC is allowed */ TRACE0(pKeyParser->hReport, REPORT_SEVERITY_ERROR, "EXT_KEY_PARSER: ERROR: not broadcast MAC in IBSS mode !!!\n"); return TI_NOK; } else if (!macEqual2Associated) { /* ESS mode and MAC is different than the associated one */ /* save the key for later */ status = TI_OK; /* pKeyParser->pBcastKey->saveKey(pKeyParser->pBcastKey, &encodedKey);*/ } else { /* MAC is equal to the associated one - configure immediately */ if (!wepKey) { MAC_COPY (keyBuffer, broadcastMacAddr); } if (pKeyParser->pBcastKey->recvSuccess!=NULL) { status = pKeyParser->pBcastKey->recvSuccess(pKeyParser->pBcastKey, &encodedKeyMaterial); } } } else { /* MAC is broadcast - configure immediately */ if (!wepKey) { MAC_COPY (keyBuffer, broadcastMacAddr); } /* set broadcast key */ if (pKeyParser->pBcastKey->recvSuccess!=NULL) { status = pKeyParser->pBcastKey->recvSuccess(pKeyParser->pBcastKey, &encodedKeyMaterial); } if (pKeyDesc->KeyIndex & EXT_KEY_TRANSMIT_MASK) { /* Group key used to transmit */ /* set as unicast key as well */ if (pKeyParser->pUcastKey->recvSuccess!=NULL) { status = pKeyParser->pUcastKey->recvSuccess(pKeyParser->pUcastKey, &encodedKeyMaterial); } } } } return status; }
/** * \fn sme_SetParam * \brief Set parameters values * * Set parameters values * * \note Note is indicated here * \param hSme - handle to the SME object * \param pParam - pointer to the param to set * \return PARAM_NOT_SUPPORTED for an unrecognized parameter, TI_OK if successfull. * \sa sme_GetParam */ TI_STATUS sme_SetParam (TI_HANDLE hSme, paramInfo_t *pParam) { TSme *pSme = (TSme*)hSme; TRACE1(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_SetParam: param type is 0x%x\n", pParam->paramType); switch (pParam->paramType) { case SME_RADIO_ON_PARAM: /* if new value is different than current one */ if (pSme->bRadioOn != pParam->content.smeRadioOn) { /* set new radio on value and send an event to the state-machine accordingly */ pSme->bRadioOn = pParam->content.smeRadioOn; if (TI_TRUE == pSme->bRadioOn) { if(TI_TRUE == pSme->bRunning) { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_START, hSme); } } else { genSM_Event (pSme->hSmeSm, SME_SM_EVENT_STOP, hSme); } } break; case SME_DESIRED_SSID_PARAM: /* if new value is different than current one */ if ((pSme->tSsid.len != pParam->content.smeDesiredSSID.len) || (0 != os_memoryCompare (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pParam->content.smeDesiredSSID.str[ 0 ]), pSme->tSsid.len))) { /* set new desired SSID */ os_memoryCopy (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pParam->content.smeDesiredSSID.str[ 0 ]), pParam->content.smeDesiredSSID.len); pSme->tSsid.len = pParam->content.smeDesiredSSID.len; pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } break; case SME_DESIRED_SSID_ACT_PARAM: pSme->bRadioOn = TI_TRUE; /* if new value is different than current one */ if ((pSme->tSsid.len != pParam->content.smeDesiredSSID.len) || (0 != os_memoryCompare (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pParam->content.smeDesiredSSID.str[ 0 ]), pSme->tSsid.len))) { /* set new desired SSID */ os_memoryCopy (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pParam->content.smeDesiredSSID.str[ 0 ]), pParam->content.smeDesiredSSID.len); pSme->tSsid.len = pParam->content.smeDesiredSSID.len; } /* also set SSID type and connect required flag */ if (OS_802_11_SSID_JUNK (pSme->tSsid.str, pSme->tSsid.len)) { pSme->eSsidType = SSID_TYPE_INVALID; pSme->bConnectRequired = TI_FALSE; } else if (0 == pSme->tSsid.len) { pSme->eSsidType = SSID_TYPE_ANY; pSme->bConnectRequired = TI_TRUE; } else { pSme->eSsidType = SSID_TYPE_SPECIFIC; pSme->bConnectRequired = TI_TRUE; } pSme->uScanCount = 0; /* if junk SSID */ if(TI_FALSE == pSme->bConnectRequired) { pSme->bConstantScan = TI_FALSE; } /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); break; case SME_DESIRED_BSSID_PARAM: /* if new value is different than current one */ if (TI_FALSE == MAC_EQUAL (pSme->tBssid, pParam->content.smeDesiredBSSID)) { /* set new BSSID */ MAC_COPY (pSme->tBssid, pParam->content.smeDesiredBSSID); pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } break; case SME_CONNECTION_MODE_PARAM: /* if new value is different than current one */ if (pSme->eConnectMode != pParam->content.smeConnectionMode) { /* set new connection mode */ pSme->eConnectMode = pParam->content.smeConnectionMode; pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } break; case SME_DESIRED_BSS_TYPE_PARAM: /* if new value is different than current one */ if (pSme->eBssType != pParam->content.smeDesiredBSSType) { /* set new BSS type */ pSme->eBssType = pParam->content.smeDesiredBSSType; pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } break; case SME_WSC_PB_MODE_PARAM: if (pParam->content.siteMgrWSCMode.WSCMode != TIWLN_SIMPLE_CONFIG_OFF) { pSme->bConstantScan = TI_TRUE; pSme->uScanCount = 0; /* now send a disconnect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_DISCONNECT, hSme); } else { pSme->bConstantScan = TI_FALSE; } break; default: TRACE1(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_SetParam: unrecognized param type %d\n", pParam->paramType); return PARAM_NOT_SUPPORTED; /* break;*/ } return TI_OK; }