/************************************************************************ * siteMgr_resetSiteTable * ************************************************************************ DESCRIPTION: reset the following things: - Mgmt parameters structure - Site table - Hash table - Primary site pointer - Number of sites INPUT: hSiteMgr - Handle to site mgr OUTPUT: RETURN: TI_OK ************************************************************************/ TI_STATUS siteMgr_resetSiteTable(TI_HANDLE hSiteMgr, siteTablesParams_t *pSiteTableParams) { int i; siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr; /* It looks like it never happens. Anyway decided to check */ if ( pSiteTableParams->maxNumOfSites > MAX_SITES_BG_BAND ) { TRACE2( pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "siteMgr_resetSiteTable. pScanMngr->currentBSSBand=%d exceeds the limit %d\n", pSiteTableParams->maxNumOfSites, MAX_SITES_BG_BAND); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return TI_NOK; } os_memoryZero(pSiteMgr->hOs, &pSiteTableParams->siteTable[0], sizeof(siteEntry_t)*pSiteTableParams->maxNumOfSites); for (i = 0; i < pSiteTableParams->maxNumOfSites; i++) { pSiteTableParams->siteTable[i].index = i; pSiteTableParams->siteTable[i].siteType = SITE_NULL; pSiteTableParams->siteTable[i].beaconRecv = TI_FALSE; pSiteTableParams->siteTable[i].dtimPeriod = 1; } pSiteTableParams->numOfSites = 0; pSiteMgr->pSitesMgmtParams->pPrimarySite = NULL; return TI_OK; }
/** * \fn sme_SelectSsidMatch * \brief Check if a site SSID matches the desired SSID for selection * * Check if a site SSID matches the desired SSID for selection * * \param hSme - handle to the SME object * \param pSiteSsid - the site SSID * \param pDesiredSsid - the desired SSID * \param edesiredSsidType - the desired SSID type * \return TI_TRUE if SSIDs match, TI_FALSE if they don't * \sa sme_Select */ TI_BOOL sme_SelectSsidMatch (TI_HANDLE hSme, TSsid *pSiteSsid, TSsid *pDesiredSsid, ESsidType eDesiredSsidType) { TSme *pSme = (TSme*)hSme; /*If SSID length is 0 (hidden SSID)- Discard*/ if (pSiteSsid->len == 0) { return TI_FALSE; } /* if the desired SSID type is any, return TRUE (site matches) */ if (SSID_TYPE_ANY == eDesiredSsidType) { return TI_TRUE; } /* It looks like it never happens. Anyway decided to check */ if (( pSiteSsid->len > MAX_SSID_LEN ) || ( pDesiredSsid->len > MAX_SSID_LEN )) { handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return TI_FALSE; } /* otherwise, check if the SSIDs match */ if ((pSiteSsid->len == pDesiredSsid->len) && /* lngth match */ (0 == os_memoryCompare (pSme->hOS, &(pSiteSsid->str[ 0 ]), &(pDesiredSsid->str[ 0 ]), pSiteSsid->len))) /* content match */ { return TI_TRUE; } else { return TI_FALSE; } }
/** * \fn sme_SelectRsnMatch * \brief Checks if the configured scurity settings match those of a site * * Checks if the configured scurity settings match those of a site * * \param hSme - handle to the SME object * \param pCurrentSite - the site to check * \return TI_TRUE if site matches RSN settings, TI FALSE if it doesn't * \sa sme_Select */ TI_BOOL sme_SelectRsnMatch (TI_HANDLE hSme, TSiteEntry *pCurrentSite) { TSme *pSme = (TSme*)hSme; TRsnData tRsnData; dot11_RSN_t *pRsnIe; TI_UINT8 uRsnIECount=0; TI_UINT8 uCurRsnData[255]; TI_UINT32 uLength = 0; TI_UINT32 uMetric; TRsnSiteParams tRsnSiteParams; tRsnSiteParams.bssType = pCurrentSite->bssType; MAC_COPY(tRsnSiteParams.bssid, pCurrentSite->bssid); tRsnSiteParams.pHTCapabilities = &pCurrentSite->tHtCapabilities; tRsnSiteParams.pHTInfo = &pCurrentSite->tHtInformation; /* copy all RSN IE's */ pRsnIe = pCurrentSite->pRsnIe; while ((uLength < pCurrentSite->rsnIeLen) && (uRsnIECount < MAX_RSN_IE)) { if (uLength + 2 + pRsnIe->hdr[ 1 ] > sizeof (uCurRsnData)) { TRACE4( pSme->hReport, REPORT_SEVERITY_ERROR, "sme_SelectRsnMatch. uRsnIECount=%d, uLength=%d; required copy of %d bytes exceeds the buffer limit %d\n", uRsnIECount, uLength, pRsnIe->hdr[ 1 ] +2, sizeof (uCurRsnData)); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return TI_FALSE; } uCurRsnData[ 0 + uLength ] = pRsnIe->hdr[ 0 ]; uCurRsnData[ 1 + uLength ] = pRsnIe->hdr[ 1 ]; os_memoryCopy (pSme->hOS, &uCurRsnData[ 2 + uLength ], pRsnIe->rsnIeData, pRsnIe->hdr[ 1 ]); uLength += pRsnIe->hdr[ 1 ] + 2; pRsnIe += 1; uRsnIECount++; } /* sanity check - make sure RSN IE's size is not too big */ if (uLength < pCurrentSite->rsnIeLen) { 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); } /* call the RSN to evaluate the site */ tRsnData.pIe = (pCurrentSite->rsnIeLen == 0) ? NULL : uCurRsnData; tRsnData.ieLen = pCurrentSite->rsnIeLen; tRsnData.privacy = pCurrentSite->privacy; if (rsn_evalSite (pSme->hRsn, &tRsnData, &tRsnSiteParams , &uMetric) != TI_OK) { /* no match */ return TI_FALSE; } else { /* match! */ return TI_TRUE; } }
/************************************************************************ * 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_SetDefaults * \brief Set default values to the SME (and the SM and scan result table) * * Set default values to the SME (and the SM and scan result table) * * \param hSme - handle to the SME object * \param pInitParams - values read from registry / ini file * \return None * \sa sme_Create, sme_Init */ void sme_SetDefaults (TI_HANDLE hSme, TSmeModifiedInitParams *pModifiedInitParams, TSmeInitParams *pInitParams) { TSme *pSme = (TSme*)hSme; /* copy init params */ os_memoryCopy (pSme->hOS, &(pSme->tInitParams), pInitParams, sizeof (TSmeInitParams)); /* initialize SME varaibles */ pSme->bRadioOn = pModifiedInitParams->bRadioOn; pSme->eConnectMode = pModifiedInitParams->eConnectMode; pSme->eBssType = pModifiedInitParams->eDesiredBssType; MAC_COPY (pSme->tBssid, pModifiedInitParams->tDesiredBssid); pSme->tSsid.len = pModifiedInitParams->tDesiredSsid.len; /* It looks like it never happens. Anyway decided to check */ if ( pSme->tSsid.len > MAX_SSID_LEN ) { TRACE2( pSme->hReport, REPORT_SEVERITY_ERROR, "sme_SetDefaults. pSme->tSsid.len=%d exceeds the limit %d\n", pSme->tSsid.len, MAX_SSID_LEN); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return; } os_memoryCopy (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pModifiedInitParams->tDesiredSsid.str[ 0 ]), pModifiedInitParams->tDesiredSsid.len); 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->eLastConnectMode = CONNECT_MODE_AUTO; pSme->bAuthSent = TI_FALSE; pSme->bReselect = TI_FALSE; pSme->uScanCount = 0; pSme->bRunning = TI_FALSE; /* Initialize the SME state-machine */ genSM_SetDefaults (pSme->hSmeSm, SME_SM_NUMBER_OF_STATES, SME_SM_NUMBER_OF_EVENTS, (TGenSM_matrix)tSmMatrix, SME_SM_STATE_IDLE, "SME SM", uStateDescription, uEventDescription, __FILE_ID__); /* register scan conecntrator CB */ scanCncn_RegisterScanResultCB (pSme->hScanCncn, SCAN_SCC_DRIVER, sme_ScanResultCB, hSme); }
/************************************************************************ * buildProbeRspTemplate * ************************************************************************ DESCRIPTION: This function build a probe response template to set to the HAL when joining an IBSS network. performs the following: - Build a template & set the template len, the template type is set in the site mgr - The template is built based on the chosen site attributes NOTE: This function is used to build beacon template too. The site manager set the template type (after thos function returns) to beacon or probe response accordingly. INPUT: pSiteMgr - Handle to site manager pTemplate - Pointer to the template structure OUTPUT: RETURN: TI_OK ************************************************************************/ TI_STATUS buildProbeRspTemplate(siteMgr_t * pSiteMgr, TSetTemplate * pTemplate) { paramInfo_t param; TI_UINT8 *pBuf; probeRspTemplate_t *pBuffer = (probeRspTemplate_t *) pTemplate->ptr; siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite; TI_INT32 i, j; TI_UINT32 size; dot11_RATES_t *pDot11Rates; dot11_ERP_t *pdot11Erp; TI_UINT32 len = 0, ofdmIndex = 0; TI_BOOL extRates = TI_FALSE; TI_BOOL useProtection, NonErpPresent, barkerPreambleType; TCountry *pCountry = NULL; TI_UINT8 ratesBuf[DOT11_MAX_SUPPORTED_RATES]; TI_UINT32 supportedRateMask, basicRateMask; TI_UINT16 headerFC = DOT11_FC_PROBE_RESP; os_memoryZero(pSiteMgr->hOs, pBuffer, sizeof(probeRspTemplate_t)); /* * Build WLAN Header: * ================== */ /* Set destination address */ for (i = 0; i < MAC_ADDR_LEN; i++) pBuffer->hdr.DA[i] = 0xFF; /* Set BSSID address */ MAC_COPY(pBuffer->hdr.BSSID, pPrimarySite->bssid); /* Build Source address */ param.paramType = CTRL_DATA_MAC_ADDRESS; ctrlData_getParam(pSiteMgr->hCtrlData, ¶m); MAC_COPY(pBuffer->hdr.SA, param.content.ctrlDataDeviceMacAddress); COPY_WLAN_WORD(&pBuffer->hdr.fc, &headerFC); size = sizeof(dot11_mgmtHeader_t); pBuf = (TI_UINT8 *) pBuffer->timeStamp; /* * Fixed Fields */ /* we skip the timestamp field */ size += TIME_STAMP_LEN; pBuf += TIME_STAMP_LEN; /* Beacon interval */ COPY_WLAN_WORD(pBuf, &pPrimarySite->beaconInterval); size += FIX_FIELD_LEN; pBuf += FIX_FIELD_LEN; /* capabilities */ COPY_WLAN_WORD(pBuf, &pPrimarySite->capabilities); size += FIX_FIELD_LEN; pBuf += FIX_FIELD_LEN; /* * Build Informataion Elements: * ============================ */ /* SSID IE */ /* It looks like it never happens. Anyway decided to check */ if (pPrimarySite->ssid.len > MAX_SSID_LEN) { TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "buildProbeRspTemplate. pPrimarySite->ssid.len=%d exceeds the limit %d\n", pPrimarySite->ssid.len, MAX_SSID_LEN); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return TI_NOK; } ((dot11_SSID_t *) (pBuf))->hdr[0] = DOT11_SSID_ELE_ID; ((dot11_SSID_t *) (pBuf))->hdr[1] = pPrimarySite->ssid.len; os_memoryCopy(pSiteMgr->hOs, pBuf + sizeof(dot11_eleHdr_t), (void *)pPrimarySite->ssid.str, pPrimarySite->ssid.len); size += sizeof(dot11_eleHdr_t) + pPrimarySite->ssid.len; pBuf += sizeof(dot11_eleHdr_t) + pPrimarySite->ssid.len; /* Rates IE */ pDot11Rates = (dot11_RATES_t *) pBuf; if (pPrimarySite->channel == SPECIAL_BG_CHANNEL) { supportedRateMask = rate_GetDrvBitmapForDefaultSupporteSet(); basicRateMask = rate_GetDrvBitmapForDefaultBasicSet(); } else { supportedRateMask = pSiteMgr->pDesiredParams->siteMgrMatchedSuppRateMask; basicRateMask = pSiteMgr->pDesiredParams->siteMgrMatchedBasicRateMask; } rate_DrvBitmapToNetStr(supportedRateMask, basicRateMask, ratesBuf, &len, &ofdmIndex); if (pSiteMgr->siteMgrOperationalMode != DOT11_G_MODE || pSiteMgr->pDesiredParams->siteMgrUseDraftNum == DRAFT_5_AND_EARLIER || ofdmIndex == len) { pDot11Rates->hdr[0] = DOT11_SUPPORTED_RATES_ELE_ID; pDot11Rates->hdr[1] = len; os_memoryCopy(pSiteMgr->hOs, (void *)pDot11Rates->rates, ratesBuf, pDot11Rates->hdr[1]); size += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); pBuf += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); } else { pDot11Rates->hdr[0] = DOT11_SUPPORTED_RATES_ELE_ID; pDot11Rates->hdr[1] = ofdmIndex; os_memoryCopy(pSiteMgr->hOs, (void *)pDot11Rates->rates, ratesBuf, pDot11Rates->hdr[1]); size += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); pBuf += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); extRates = TI_TRUE; } /* DS IE */ ((dot11_DS_PARAMS_t *) (pBuf))->hdr[0] = DOT11_DS_PARAMS_ELE_ID; ((dot11_DS_PARAMS_t *) (pBuf))->hdr[1] = DOT11_DS_PARAMS_ELE_LEN; ((dot11_DS_PARAMS_t *) (pBuf))->currChannel = pPrimarySite->channel; size += sizeof(dot11_eleHdr_t) + DOT11_DS_PARAMS_ELE_LEN; pBuf += sizeof(dot11_eleHdr_t) + DOT11_DS_PARAMS_ELE_LEN; /* IBSS IE */ ((dot11_IBSS_PARAMS_t *) (pBuf))->hdr[0] = DOT11_IBSS_PARAMS_ELE_ID; ((dot11_IBSS_PARAMS_t *) (pBuf))->hdr[1] = DOT11_IBSS_PARAMS_ELE_LEN; COPY_WLAN_WORD(&((dot11_IBSS_PARAMS_t *) (pBuf))->atimWindow, &pPrimarySite->atimWindow); size += sizeof(dot11_eleHdr_t) + DOT11_IBSS_PARAMS_ELE_LEN; pBuf += sizeof(dot11_eleHdr_t) + DOT11_IBSS_PARAMS_ELE_LEN; /* Country IE */ param.paramType = REGULATORY_DOMAIN_ENABLED_PARAM; regulatoryDomain_getParam(pSiteMgr->hRegulatoryDomain, ¶m); if (param.content.regulatoryDomainEnabled == TI_TRUE) { /* get country IE */ param.paramType = REGULATORY_DOMAIN_COUNTRY_PARAM; regulatoryDomain_getParam(pSiteMgr->hRegulatoryDomain, ¶m); pCountry = param.content.pCountry; /* Check if a country IE was found */ if (pCountry != NULL) { *pBuf = DOT11_COUNTRY_ELE_ID; pBuf++; size++; *pBuf = (TI_UINT8) (pCountry->len); pBuf++; size++; /* Note: The country structure is not byte-aligned so it is copied as follows to ensure that there are no gaps in the output structure (pBuf). */ os_memoryCopy(pSiteMgr->hOs, pBuf, &pCountry->countryIE.CountryString, DOT11_COUNTRY_STRING_LEN); pBuf += DOT11_COUNTRY_STRING_LEN; size += DOT11_COUNTRY_STRING_LEN; /* Loop on all tripletChannels. Each item has three fields ('i' counts rows and 'j' counts bytes). */ for (i = 0, j = 0; j < (pCountry->len - DOT11_COUNTRY_STRING_LEN); i++, j += 3) { *(pBuf + j) = pCountry->countryIE.tripletChannels[i]. firstChannelNumber; *(pBuf + j + 1) = pCountry->countryIE.tripletChannels[i]. maxTxPowerLevel; *(pBuf + j + 2) = pCountry->countryIE.tripletChannels[i]. numberOfChannels; } pBuf += (pCountry->len - DOT11_COUNTRY_STRING_LEN); size += (pCountry->len - DOT11_COUNTRY_STRING_LEN); } } /*ERP IE */ siteMgr_IsERP_Needed(pSiteMgr, &useProtection, &NonErpPresent, &barkerPreambleType); if (useProtection || NonErpPresent || barkerPreambleType) { pdot11Erp = (dot11_ERP_t *) pBuf; pdot11Erp->hdr[0] = DOT11_ERP_IE_ID; pdot11Erp->hdr[1] = 1; pdot11Erp->ctrl = 0; if (NonErpPresent) pdot11Erp->ctrl |= ERP_IE_NON_ERP_PRESENT_MASK; if (useProtection) pdot11Erp->ctrl |= ERP_IE_USE_PROTECTION_MASK; if (barkerPreambleType) pdot11Erp->ctrl |= ERP_IE_BARKER_PREAMBLE_MODE_MASK; size += pdot11Erp->hdr[1] + sizeof(dot11_eleHdr_t); pBuf += pdot11Erp->hdr[1] + sizeof(dot11_eleHdr_t); } /* Extended supported rates IE */ if (extRates) { pDot11Rates = (dot11_RATES_t *) pBuf; pDot11Rates->hdr[0] = DOT11_EXT_SUPPORTED_RATES_ELE_ID; pDot11Rates->hdr[1] = len - ofdmIndex; os_memoryCopy(pSiteMgr->hOs, (void *)pDot11Rates->rates, &ratesBuf[ofdmIndex], pDot11Rates->hdr[1]); size += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); pBuf += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); } /* no need to insert RSN information elements */ pTemplate->len = size; TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Probe response template len = %d\n", size); return TI_OK; }
/************************************************************************ * buildProbeReqTemplate * ************************************************************************ DESCRIPTION: This function build a probe request template to set to the HAL in the scan process. performs the following: - Build a template & set the template len, the template type is set in the site mgr INPUT: pSiteMgr - Handle to site manager pTemplate - Pointer to the template structure pSsid - Desired SSID OUTPUT: RETURN: TI_OK ************************************************************************/ TI_STATUS buildProbeReqTemplate(siteMgr_t * pSiteMgr, TSetTemplate * pTemplate, TSsid * pSsid, ERadioBand radioBand) { paramInfo_t param; char *pBuf; int i; probeReqTemplate_t *pBuffer = (probeReqTemplate_t *) pTemplate->ptr; TI_UINT32 size; dot11_RATES_t *pDot11Rates; TI_UINT32 len = 0, ofdmIndex = 0; TI_UINT32 suppRatesLen, extSuppRatesLen; TI_UINT8 ratesBuf[DOT11_MAX_SUPPORTED_RATES]; TI_UINT8 WSCOuiIe[DOT11_OUI_LEN] = { 0x00, 0x50, 0xf2, 0x04 }; TI_UINT32 supportedRateMask, basicRateMask; TI_UINT16 fc = DOT11_FC_PROBE_REQ; os_memoryZero(pSiteMgr->hOs, pBuffer, sizeof(probeReqTemplate_t)); /* * Header First */ /* Set destination address */ for (i = 0; i < MAC_ADDR_LEN; i++) pBuffer->hdr.DA[i] = 0xFF; /* Set BSSID address */ for (i = 0; i < MAC_ADDR_LEN; i++) pBuffer->hdr.BSSID[i] = 0xFF; /* Build Source address */ param.paramType = CTRL_DATA_MAC_ADDRESS; ctrlData_getParam(pSiteMgr->hCtrlData, ¶m); MAC_COPY(pBuffer->hdr.SA, param.content.ctrlDataDeviceMacAddress); COPY_WLAN_WORD(&pBuffer->hdr.fc, &fc); /* copy with endianess handling. */ size = sizeof(dot11_mgmtHeader_t); pBuf = (char *)&(pBuffer->infoElements); /* * Informataion elements */ /* SSID */ /* It looks like it never happens. Anyway decided to check */ if (pSsid->len > MAX_SSID_LEN) { TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "buildProbeReqTemplate. pSsid->len=%d exceeds the limit %d\n", pSsid->len, MAX_SSID_LEN); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return TI_NOK; } ((dot11_SSID_t *) (pBuf))->hdr[0] = DOT11_SSID_ELE_ID; ((dot11_SSID_t *) (pBuf))->hdr[1] = pSsid->len; os_memoryCopy(pSiteMgr->hOs, pBuf + sizeof(dot11_eleHdr_t), (void *)pSsid->str, pSsid->len); size += sizeof(dot11_eleHdr_t) + pSsid->len; pBuf += sizeof(dot11_eleHdr_t) + pSsid->len; /* Rates */ pDot11Rates = (dot11_RATES_t *) pBuf; /* * Supported rates in probe request will always use the default rates for BG or A bands, * regardless of the STA desired rates. */ if (radioBand == RADIO_BAND_2_4_GHZ) { /* Basic rates: 1,2,5.5,11 */ basicRateMask = rate_BasicToDrvBitmap((EBasicRateSet) (pSiteMgr->pDesiredParams-> siteMgrRegstryBasicRate [DOT11_G_MODE]), TI_FALSE); /* Extended: 6,9,12,18,24,36,48,54 */ supportedRateMask = rate_SupportedToDrvBitmap((ESupportedRateSet) (pSiteMgr->pDesiredParams-> siteMgrRegstrySuppRate [DOT11_G_MODE]), TI_FALSE); } else if (radioBand == RADIO_BAND_5_0_GHZ) { /* Basic rates: 6,12,24 */ basicRateMask = rate_BasicToDrvBitmap((EBasicRateSet) (pSiteMgr->pDesiredParams-> siteMgrRegstryBasicRate [DOT11_A_MODE]), TI_TRUE); /* Extended: 9,18,24,36,48,54 */ supportedRateMask = rate_SupportedToDrvBitmap((ESupportedRateSet) (pSiteMgr->pDesiredParams-> siteMgrRegstrySuppRate [DOT11_A_MODE]), TI_TRUE); } else { TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "buildProbeReqTemplate, radioBand =%d ???\n", radioBand); /* Use default and pray for the best */ /* Basic rates: 1,2,5.5,11 */ basicRateMask = rate_BasicToDrvBitmap(BASIC_RATE_SET_1_2_5_5_11, TI_FALSE); /* Extended: 6,9,12,18,24,36,48,54 */ supportedRateMask = rate_SupportedToDrvBitmap(SUPPORTED_RATE_SET_UP_TO_54, TI_FALSE); } rate_DrvBitmapToNetStr(supportedRateMask, basicRateMask, ratesBuf, &len, &ofdmIndex); TRACE5(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "buildProbeReqTemplate, supportedRateMask=0x%x, basicRateMask=0x%x, len=%d, ofdmIndex=%d, radioBand =%d\n", supportedRateMask, basicRateMask, len, ofdmIndex, radioBand); /* It looks like it never happens. Anyway decided to check */ if (len > DOT11_MAX_SUPPORTED_RATES) { TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "buildProbeReqTemplate. len=%d exceeds the limit %d\n", len, DOT11_MAX_SUPPORTED_RATES); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return TI_NOK; } if (radioBand == RADIO_BAND_5_0_GHZ || pSiteMgr->pDesiredParams->siteMgrUseDraftNum == DRAFT_5_AND_EARLIER || ofdmIndex == len) { pDot11Rates->hdr[0] = DOT11_SUPPORTED_RATES_ELE_ID; pDot11Rates->hdr[1] = len; os_memoryCopy(pSiteMgr->hOs, (void *)pDot11Rates->rates, ratesBuf, pDot11Rates->hdr[1]); size += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); pBuf += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); } else { pDot11Rates->hdr[0] = DOT11_SUPPORTED_RATES_ELE_ID; pDot11Rates->hdr[1] = ofdmIndex; os_memoryCopy(pSiteMgr->hOs, (void *)pDot11Rates->rates, ratesBuf, pDot11Rates->hdr[1]); suppRatesLen = pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); pDot11Rates = (dot11_RATES_t *) (pBuf + suppRatesLen); pDot11Rates->hdr[0] = DOT11_EXT_SUPPORTED_RATES_ELE_ID; pDot11Rates->hdr[1] = len - ofdmIndex; os_memoryCopy(pSiteMgr->hOs, (void *)pDot11Rates->rates, &ratesBuf[ofdmIndex], pDot11Rates->hdr[1]); extSuppRatesLen = pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); size += suppRatesLen + extSuppRatesLen; pBuf += suppRatesLen + extSuppRatesLen; } /* add HT capabilities IE */ StaCap_GetHtCapabilitiesIe(pSiteMgr->hStaCap, (TI_UINT8 *) pBuf, &len); size += len; pBuf += len; /* WiFi Simple Config */ if (pSiteMgr->includeWSCinProbeReq && (pSiteMgr->siteMgrWSCCurrMode != TIWLN_SIMPLE_CONFIG_OFF)) { ((dot11_WSC_t *) pBuf)->hdr[0] = DOT11_WSC_PARAM_ELE_ID; ((dot11_WSC_t *) pBuf)->hdr[1] = pSiteMgr->uWscIeSize + DOT11_OUI_LEN; pBuf += sizeof(dot11_eleHdr_t); os_memoryCopy(pSiteMgr->hOs, pBuf, &WSCOuiIe, DOT11_OUI_LEN); os_memoryCopy(pSiteMgr->hOs, pBuf + DOT11_OUI_LEN, &pSiteMgr->siteMgrWSCProbeReqParams, pSiteMgr->uWscIeSize); size += sizeof(dot11_eleHdr_t) + pSiteMgr->uWscIeSize + DOT11_OUI_LEN; pBuf += sizeof(dot11_eleHdr_t) + pSiteMgr->uWscIeSize + DOT11_OUI_LEN; } pTemplate->len = size; return TI_OK; }
/* Function implementation */ void siteMgrDebugFunction (TI_HANDLE hSiteMgr, TStadHandlesList *pStadHandles, TI_UINT32 funcType, void *pParam) { siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr; paramInfo_t param; TSsid newDesiredSsid; TI_UINT8 value; TI_UINT8 i; OS_802_11_BSSID primarySiteDesc; TRates ratesSet; newDesiredSsid.len = 5; os_memoryCopy(pSiteMgr->hOs, (void *)newDesiredSsid.str, "yaeli", 5); switch (funcType) { case SITE_MGR_DEBUG_HELP_MENU: printSiteMgrHelpMenu(); break; case PRIMARY_SITE_DBG: printPrimarySite(pSiteMgr); break; case SITE_TABLE_DBG: printSiteTable(pSiteMgr, NULL); break; case DESIRED_PARAMS_DBG: printDesiredParams(pSiteMgr, pStadHandles->hCmdDispatch); break; case GET_PRIMARY_SITE_DESC_DBG: param.paramType = SITE_MGR_GET_SELECTED_BSSID_INFO; param.content.pSiteMgrPrimarySiteDesc = &primarySiteDesc; cmdDispatch_GetParam(pStadHandles->hCmdDispatch, ¶m); printPrimarySiteDesc(pSiteMgr, &primarySiteDesc); break; case SET_RSN_DESIRED_CIPHER_SUITE_DBG: param.paramType = RSN_ENCRYPTION_STATUS_PARAM; value = *((TI_UINT32 *)pParam); param.content.rsnEncryptionStatus = (ECipherSuite)value; cmdDispatch_SetParam(pStadHandles->hCmdDispatch, ¶m); WLAN_OS_REPORT(("\nSetting RSN_DESIRED_CIPHER_SUITE_PARAM : %d\n", value)); break; case GET_RSN_DESIRED_CIPHER_SUITE_DBG: param.paramType = RSN_ENCRYPTION_STATUS_PARAM; cmdDispatch_GetParam(pStadHandles->hCmdDispatch, ¶m); WLAN_OS_REPORT(("\nGetting RSN_DESIRED_CIPHER_SUITE_PARAM: %d\n", param.content.rsnEncryptionStatus)); break; case SET_RSN_DESIRED_AUTH_TYPE_DBG: param.paramType = RSN_EXT_AUTHENTICATION_MODE; value = *((TI_UINT32 *)pParam); param.content.rsnDesiredAuthType = (EAuthSuite)value; cmdDispatch_SetParam(pStadHandles->hCmdDispatch, ¶m); if (value == RSN_AUTH_OPEN) WLAN_OS_REPORT(("\nSetting RSN_DESIRED_AUTH_TYPE_PARAM: RSN_AUTH_OPEN\n")); else if (value == RSN_AUTH_SHARED_KEY) WLAN_OS_REPORT(("\nSetting RSN_DESIRED_AUTH_TYPE_PARAM: RSN_AUTH_SHARED_KEY\n")); else if (value == RSN_AUTH_AUTO_SWITCH) WLAN_OS_REPORT(("\nSetting RSN_DESIRED_AUTH_TYPE_PARAM: RSN_AUTH_AUTO_SWITCH\n")); else WLAN_OS_REPORT(("\nSetting RSN_DESIRED_AUTH_TYPE_PARAM: Invalid: %d\n", value)); break; case GET_RSN_DESIRED_AUTH_TYPE_DBG: param.paramType = RSN_EXT_AUTHENTICATION_MODE; cmdDispatch_GetParam(pStadHandles->hCmdDispatch, ¶m); if (param.content.rsnDesiredAuthType == RSN_AUTH_OPEN) WLAN_OS_REPORT(("\nGetting RSN_DESIRED_AUTH_TYPE_PARAM: RSN_AUTH_OPEN\n")); else if (param.content.rsnDesiredAuthType == RSN_AUTH_SHARED_KEY) WLAN_OS_REPORT(("\nGetting RSN_DESIRED_AUTH_TYPE_PARAM: RSN_AUTH_SHARED_KEY\n")); else if (param.content.rsnDesiredAuthType == RSN_AUTH_AUTO_SWITCH) WLAN_OS_REPORT(("\nGetting RSN_DESIRED_AUTH_TYPE_PARAM: RSN_AUTH_AUTO_SWITCH\n")); else WLAN_OS_REPORT(("\nGetting RSN_DESIRED_AUTH_TYPE_PARAM: Invalid: %d\n", param.content.rsnDesiredAuthType)); break; case GET_CONNECTION_STATUS_DBG: param.paramType = SME_CONNECTION_STATUS_PARAM; cmdDispatch_GetParam(pStadHandles->hCmdDispatch, ¶m); if (param.content.smeSmConnectionStatus == eDot11Idle) WLAN_OS_REPORT(("\nGetting SITE_MGR_CONNECTION_STATUS_PARAM: STATUS_IDLE\n")); else if (param.content.smeSmConnectionStatus == eDot11Scaning) WLAN_OS_REPORT(("\nGetting SITE_MGR_CONNECTION_STATUS_PARAM: STATUS_SCANNING\n")); else if (param.content.smeSmConnectionStatus == eDot11Connecting) WLAN_OS_REPORT(("\nGetting SITE_MGR_CONNECTION_STATUS_PARAM: STATUS_CONNECTING\n")); else if (param.content.smeSmConnectionStatus == eDot11Associated) WLAN_OS_REPORT(("\nGetting SITE_MGR_CONNECTION_STATUS_PARAM: STATUS_ASSOCIATED\n")); else if (param.content.smeSmConnectionStatus == eDot11Disassociated) WLAN_OS_REPORT(("\nGetting SITE_MGR_CONNECTION_STATUS_PARAM: STATUS_DIS_ASSOCIATED\n")); else if (param.content.smeSmConnectionStatus == eDot11RadioDisabled) WLAN_OS_REPORT(("\nGetting SITE_MGR_CONNECTION_STATUS_PARAM: STATUS_RADIO_DISABLED\n")); else WLAN_OS_REPORT(("\nGetting SITE_MGR_CONNECTION_STATUS_PARAM: STATUS_ERROR\n")); break; case SET_SUPPORTED_RATE_SET_DBG: param.paramType = SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM; value = *((TI_UINT32 *)pParam); setRateSet(value, &ratesSet); os_memoryCopy(pSiteMgr->hOs, &(param.content.siteMgrDesiredSupportedRateSet), &(ratesSet), sizeof(TRates)); WLAN_OS_REPORT(("\nSetting SET_SUPPORTED_RATE_SET_DBG\n")); cmdDispatch_SetParam(pStadHandles->hCmdDispatch, ¶m); break; case GET_SUPPORTED_RATE_SET_DBG: param.paramType = SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM; cmdDispatch_GetParam(pStadHandles->hCmdDispatch, ¶m); WLAN_OS_REPORT(("\nGetting SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM\n")); if(param.content.siteMgrDesiredSupportedRateSet.len == 0) WLAN_OS_REPORT(("\nNo rates defined\n")); else { /* It looks like it never happens. Anyway decided to check */ if ( param.content.siteMgrDesiredSupportedRateSet.len > DOT11_MAX_SUPPORTED_RATES ) { WLAN_OS_REPORT(("siteMgrDebugFunction. param.content.siteMgrDesiredSupportedRateSet.len=%d exceeds the limit %d\n", param.content.siteMgrDesiredSupportedRateSet.len, DOT11_MAX_SUPPORTED_RATES)); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); param.content.siteMgrDesiredSupportedRateSet.len = DOT11_MAX_SUPPORTED_RATES; } for (i = 0; i < param.content.siteMgrDesiredSupportedRateSet.len; i++) WLAN_OS_REPORT(("\nRate %d is 0x%X\n", i +1, param.content.siteMgrDesiredSupportedRateSet.ratesString[i])); } break; case SET_MLME_LEGACY_AUTH_TYPE_DBG: param.paramType = MLME_LEGACY_TYPE_PARAM; value = *((TI_UINT32 *)pParam); param.content.mlmeLegacyAuthType = (legacyAuthType_e)value; cmdDispatch_SetParam(pStadHandles->hCmdDispatch, ¶m); if (value == AUTH_LEGACY_OPEN_SYSTEM) WLAN_OS_REPORT(("\nSetting MLME_LEGACY_TYPE_PARAM: AUTH_LEGACY_OPEN_SYSTEM\n")); else if (value == AUTH_LEGACY_SHARED_KEY) WLAN_OS_REPORT(("\nSetting MLME_LEGACY_TYPE_PARAM: AUTH_LEGACY_SHARED_KEY\n")); else if (value == AUTH_LEGACY_AUTO_SWITCH) WLAN_OS_REPORT(("\nSetting MLME_LEGACY_TYPE_PARAM: AUTH_LEGACY_AUTO_SWITCH\n")); else WLAN_OS_REPORT(("\nSetting MLME_LEGACY_TYPE_PARAM: Invalid: %d\n", value)); break; case GET_MLME_LEGACY_AUTH_TYPE_DBG: param.paramType = MLME_LEGACY_TYPE_PARAM; cmdDispatch_GetParam(pStadHandles->hCmdDispatch, ¶m); if (param.content.mlmeLegacyAuthType == AUTH_LEGACY_OPEN_SYSTEM) WLAN_OS_REPORT(("\nGetting MLME_LEGACY_TYPE_PARAM: AUTH_LEGACY_OPEN_SYSTEM\n")); else if (param.content.rsnDesiredAuthType == AUTH_LEGACY_SHARED_KEY) WLAN_OS_REPORT(("\nGetting MLME_LEGACY_TYPE_PARAM: AUTH_LEGACY_SHARED_KEY\n")); else if (param.content.rsnDesiredAuthType == AUTH_LEGACY_AUTO_SWITCH) WLAN_OS_REPORT(("\nGetting MLME_LEGACY_TYPE_PARAM: AUTH_AUTO_SWITCH\n")); else WLAN_OS_REPORT(("\nGetting MLME_LEGACY_TYPE_PARAM: Invalid: %d\n", param.content.rsnDesiredAuthType)); break; case RADIO_STAND_BY_CHANGE_STATE: WLAN_OS_REPORT(("\nChange GPIO-13 State...\n")); break; case PRINT_FAILURE_EVENTS: { WLAN_OS_REPORT(("\n PRINT HEALTH MONITOR LOG\n")); healthMonitor_printFailureEvents (pStadHandles->hHealthMonitor); apConn_printStatistics(pStadHandles->hAPConnection); #ifdef REPORT_LOG conn_ibssPrintStatistics(pStadHandles->hConn); #endif if (((conn_t*)pStadHandles->hConn)->currentConnType==CONNECTION_INFRA) { switch (((conn_t*)pStadHandles->hConn)->state) { case 0: WLAN_OS_REPORT((" CONN state is IDLE\n")); break; case 1: WLAN_OS_REPORT((" CONN state is SCR_WAIT\n")); break; case 2: WLAN_OS_REPORT((" CONN state is WAIT_JOIN_CMPLT\n")); break; case 3: WLAN_OS_REPORT((" CONN state is MLME_WAIT\n")); break; case 4: WLAN_OS_REPORT((" CONN state is RSN_WAIT\n")); break; case 5: WLAN_OS_REPORT((" CONN state is CONFIG_HW\n")); break; case 6: WLAN_OS_REPORT((" CONN state is CONNECTED\n")); break; case 7: WLAN_OS_REPORT((" CONN state is DISASSOCC\n")); break; default: break; } } } break; case FORCE_HW_RESET_RECOVERY: WLAN_OS_REPORT(("\n Currently not supported!\n")); break; case FORCE_SOFT_RECOVERY: WLAN_OS_REPORT(("\n FORCE Full Recovery (Soft)\n")); break; case PERFORM_HEALTH_TEST: WLAN_OS_REPORT(("\n PERFORM_HEALTH_TEST \n")); healthMonitor_PerformTest(pStadHandles->hHealthMonitor, TI_FALSE); break; case PRINT_SITE_TABLE_PER_SSID: printSiteTable(pSiteMgr, (char*)pParam); break; case SET_DESIRED_CHANNEL: param.paramType = SITE_MGR_DESIRED_CHANNEL_PARAM; param.content.siteMgrDesiredChannel = *(TI_UINT8*)pParam; siteMgr_setParam(pStadHandles->hSiteMgr, ¶m); break; default: WLAN_OS_REPORT(("Invalid function type in Debug Site Manager Function Command: %d\n\n", funcType)); break; } }
void printSiteTable(siteMgr_t *pSiteMgr, char *desiredSsid) { TI_UINT8 i, numOfSites = 0; siteEntry_t *pSiteEntry; char ssid[MAX_SSID_LEN + 1]; siteTablesParams_t *pCurrentSiteTable = pSiteMgr->pSitesMgmtParams->pCurrentSiteTable; TI_UINT8 tableIndex=2; WLAN_OS_REPORT(("\n\n************************ SITE TABLE ****************************\n\n\n")); /* It looks like it never happens. Anyway decided to check */ if ( pCurrentSiteTable->maxNumOfSites > MAX_SITES_BG_BAND ) { WLAN_OS_REPORT(("printSiteTable. pCurrentSiteTable->maxNumOfSites=%d exceeds the limit %d\n", pCurrentSiteTable->maxNumOfSites, MAX_SITES_BG_BAND)); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); pCurrentSiteTable->maxNumOfSites = MAX_SITES_BG_BAND; } do { tableIndex--; for (i = 0; i < pCurrentSiteTable->maxNumOfSites; i++) { pSiteEntry = &(pCurrentSiteTable->siteTable[i]); if (pSiteEntry->siteType == SITE_NULL) continue; /* It looks like it never happens. Anyway decided to check */ if ( pCurrentSiteTable->siteTable[i].ssid.len > MAX_SSID_LEN ) { WLAN_OS_REPORT(("printSiteTable. pCurrentSiteTable->siteTable[%d].ssid.len=%d exceeds the limit %d\n", i, pCurrentSiteTable->siteTable[i].ssid.len, MAX_SSID_LEN)); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); pCurrentSiteTable->siteTable[i].ssid.len = MAX_SSID_LEN; } os_memoryCopy(pSiteMgr->hOs ,ssid, (void *)pCurrentSiteTable->siteTable[i].ssid.str, pCurrentSiteTable->siteTable[i].ssid.len); ssid[pCurrentSiteTable->siteTable[i].ssid.len] = '\0'; if (desiredSsid != NULL) { int desiredSsidLength = 0; char * tmp = desiredSsid; while (tmp != '\0') { desiredSsidLength++; tmp++; } if (os_memoryCompare(pSiteMgr->hOs, (TI_UINT8 *)ssid, (TI_UINT8 *)desiredSsid, desiredSsidLength)) continue; } WLAN_OS_REPORT(("SSID %s\n\n", ssid)); if (pSiteEntry->siteType == SITE_PRIMARY) WLAN_OS_REPORT( (" ENTRY PRIMARY %d \n", numOfSites)); else WLAN_OS_REPORT( (" ENTRY %d\n", i)); WLAN_OS_REPORT(("BSSID %2X-%2X-%2X-%2X-%2X-%2X \n", pCurrentSiteTable->siteTable[i].bssid[0], pCurrentSiteTable->siteTable[i].bssid[1], pCurrentSiteTable->siteTable[i].bssid[2], pCurrentSiteTable->siteTable[i].bssid[3], pCurrentSiteTable->siteTable[i].bssid[4], pCurrentSiteTable->siteTable[i].bssid[5])); if (pCurrentSiteTable->siteTable[i].bssType == BSS_INFRASTRUCTURE) WLAN_OS_REPORT(("BSS Type INFRASTRUCTURE\n\n")); else if (pCurrentSiteTable->siteTable[i].bssType == BSS_INDEPENDENT) WLAN_OS_REPORT(("BSS Type IBSS\n\n")); else if (pCurrentSiteTable->siteTable[i].bssType == BSS_ANY) WLAN_OS_REPORT(("BSS Type ANY\n\n")); else WLAN_OS_REPORT(("BSS Type INVALID\n\n")); WLAN_OS_REPORT(("Channel %d\n", pCurrentSiteTable->siteTable[i].channel)); WLAN_OS_REPORT(("\n")); switch (pCurrentSiteTable->siteTable[i].maxBasicRate) { case DRV_RATE_1M: WLAN_OS_REPORT(("Max Basic Rate RATE_1M_BIT\n")); break; case DRV_RATE_2M: WLAN_OS_REPORT(("Max Basic Rate RATE_2M_BIT\n")); break; case DRV_RATE_5_5M: WLAN_OS_REPORT(("Max Basic Rate RATE_5_5M_BIT\n")); break; case DRV_RATE_11M: WLAN_OS_REPORT(("Max Basic Rate RATE_11M_BIT\n")); break; case DRV_RATE_6M: WLAN_OS_REPORT(("Max Basic Rate RATE_6M_BIT\n")); break; case DRV_RATE_9M: WLAN_OS_REPORT(("Max Basic Rate RATE_9M_BIT\n")); break; case DRV_RATE_12M: WLAN_OS_REPORT(("Max Basic Rate RATE_12M_BIT\n")); break; case DRV_RATE_18M: WLAN_OS_REPORT(("Max Basic Rate RATE_18M_BIT\n")); break; case DRV_RATE_24M: WLAN_OS_REPORT(("Max Basic Rate RATE_24M_BIT\n")); break; case DRV_RATE_36M: WLAN_OS_REPORT(("Max Basic Rate RATE_36M_BIT\n")); break; case DRV_RATE_48M: WLAN_OS_REPORT(("Max Basic Rate RATE_48M_BIT\n")); break; case DRV_RATE_54M: WLAN_OS_REPORT(("Max Basic Rate RATE_54M_BIT\n")); break; default: WLAN_OS_REPORT(("Max Basic Rate INVALID, 0x%X\n", pCurrentSiteTable->siteTable[i].maxBasicRate)); break; } switch (pCurrentSiteTable->siteTable[i].maxActiveRate) { case DRV_RATE_1M: WLAN_OS_REPORT(("Max Active Rate RATE_1M_BIT\n")); break; case DRV_RATE_2M: WLAN_OS_REPORT(("Max Active Rate RATE_2M_BIT\n")); break; case DRV_RATE_5_5M: WLAN_OS_REPORT(("Max Active Rate RATE_5_5M_BIT\n")); break; case DRV_RATE_11M: WLAN_OS_REPORT(("Max Active Rate RATE_11M_BIT\n")); break; case DRV_RATE_22M: WLAN_OS_REPORT(("Max Active Rate RATE_22M_BIT\n")); break; case DRV_RATE_6M: WLAN_OS_REPORT(("Max Active Rate RATE_6M_BIT\n")); break; case DRV_RATE_9M: WLAN_OS_REPORT(("Max Active Rate RATE_9M_BIT\n")); break; case DRV_RATE_12M: WLAN_OS_REPORT(("Max Active Rate RATE_12M_BIT\n")); break; case DRV_RATE_18M: WLAN_OS_REPORT(("Max Active Rate RATE_18M_BIT\n")); break; case DRV_RATE_24M: WLAN_OS_REPORT(("Max Active Rate RATE_24M_BIT\n")); break; case DRV_RATE_36M: WLAN_OS_REPORT(("Max Active Rate RATE_36M_BIT\n")); break; case DRV_RATE_48M: WLAN_OS_REPORT(("Max Active Rate RATE_48M_BIT\n")); break; case DRV_RATE_54M: WLAN_OS_REPORT(("Max Active Rate RATE_54M_BIT\n")); break; default: WLAN_OS_REPORT(("Max Active Rate INVALID, 0x%X\n", pCurrentSiteTable->siteTable[i].maxActiveRate)); break; } WLAN_OS_REPORT(("\n")); if (pCurrentSiteTable->siteTable[i].probeModulation == DRV_MODULATION_QPSK) WLAN_OS_REPORT(("Probe Modulation QPSK\n")); else if (pCurrentSiteTable->siteTable[i].probeModulation == DRV_MODULATION_CCK) WLAN_OS_REPORT(("Probe Modulation CCK\n")); else if (pCurrentSiteTable->siteTable[i].probeModulation == DRV_MODULATION_PBCC) WLAN_OS_REPORT(("Probe Modulation PBCC\n")); else WLAN_OS_REPORT(("Probe Modulation INVALID, %d\n", pCurrentSiteTable->siteTable[i].probeModulation)); if (pCurrentSiteTable->siteTable[i].beaconModulation == DRV_MODULATION_QPSK) WLAN_OS_REPORT(("Beacon Modulation QPSK\n")); else if (pCurrentSiteTable->siteTable[i].beaconModulation == DRV_MODULATION_CCK) WLAN_OS_REPORT(("Beacon Modulation CCK\n")); else if (pCurrentSiteTable->siteTable[i].beaconModulation == DRV_MODULATION_PBCC) WLAN_OS_REPORT(("Beacon Modulation PBCC\n")); else WLAN_OS_REPORT(("Beacon Modulation INVALID, %d\n", pCurrentSiteTable->siteTable[i].beaconModulation)); WLAN_OS_REPORT(("\n")); if (pCurrentSiteTable->siteTable[i].privacy == TI_TRUE) WLAN_OS_REPORT(("Privacy On\n")); else WLAN_OS_REPORT(("Privacy Off\n")); if (pCurrentSiteTable->siteTable[i].currentPreambleType == PREAMBLE_SHORT) WLAN_OS_REPORT(("Preamble Type Short\n")); else if (pCurrentSiteTable->siteTable[i].currentPreambleType == PREAMBLE_LONG) WLAN_OS_REPORT(("Preamble Type Long\n")); else WLAN_OS_REPORT(("Preamble INVALID, %d\n", pCurrentSiteTable->siteTable[i].currentPreambleType)); WLAN_OS_REPORT(("\n")); WLAN_OS_REPORT(("Beacon interval %d\n", pCurrentSiteTable->siteTable[i].beaconInterval)); WLAN_OS_REPORT(("Local Time Stamp %d\n", pCurrentSiteTable->siteTable[i].localTimeStamp)); WLAN_OS_REPORT(("rssi %d\n", pCurrentSiteTable->siteTable[i].rssi)); WLAN_OS_REPORT(("\n")); WLAN_OS_REPORT(("Fail status %d\n", pCurrentSiteTable->siteTable[i].failStatus)); WLAN_OS_REPORT(("ATIM Window %d\n", pCurrentSiteTable->siteTable[i].atimWindow)); WLAN_OS_REPORT(("\n---------------------------------------------------------------\n\n", NULL)); numOfSites++; } WLAN_OS_REPORT(("\n Number Of Sites: %d\n", numOfSites)); WLAN_OS_REPORT(("\n---------------------------------------------------------------\n", NULL)); if ((pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_DUAL_MODE) && (tableIndex==1)) { /* change site table */ if (pCurrentSiteTable == &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables) { WLAN_OS_REPORT(("\n dot11A_sitesTables \n")); pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables; } else { WLAN_OS_REPORT(("\n dot11BG_sitesTables \n")); pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables; } } } while (tableIndex>0); }
static void printPrimarySite(siteMgr_t *pSiteMgr) { siteEntry_t *pSiteEntry; TI_UINT8 len; char ssid[MAX_SSID_LEN + 1]; pSiteEntry = pSiteMgr->pSitesMgmtParams->pPrimarySite; if (pSiteEntry == NULL) { WLAN_OS_REPORT(("\n\n************************ PRIMARY SITE IS NULL ****************************\n\n\n")); return; } WLAN_OS_REPORT(("\n\n************************ PRIMARY SITE ****************************\n\n\n")); WLAN_OS_REPORT(("BSSID %2X-%2X-%2X-%2X-%2X-%2X ", pSiteEntry->bssid[0], pSiteEntry->bssid[1], pSiteEntry->bssid[2], pSiteEntry->bssid[3], pSiteEntry->bssid[4], pSiteEntry->bssid[5])); len = pSiteEntry->ssid.len; /* It looks like it never happens. Anyway decided to check */ if ( pSiteEntry->ssid.len > MAX_SSID_LEN ) { WLAN_OS_REPORT(("printPrimarySite. pSiteEntry->ssid.len=%d exceeds the limit %d\n", pSiteEntry->ssid.len, MAX_SSID_LEN)); handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); len = MAX_SSID_LEN; } os_memoryCopy(pSiteMgr->hOs, ssid, (void *)pSiteEntry->ssid.str, len); ssid[len] = '\0'; WLAN_OS_REPORT(("SSID %s\n\n", ssid)); if (pSiteEntry->bssType == BSS_INFRASTRUCTURE) WLAN_OS_REPORT(("BSS Type INFRASTRUCTURE\n\n")); else if (pSiteEntry->bssType == BSS_INDEPENDENT) WLAN_OS_REPORT(("BSS Type IBSS\n\n")); else if (pSiteEntry->bssType == BSS_ANY) WLAN_OS_REPORT(("BSS Type ANY\n\n")); else WLAN_OS_REPORT(("BSS Type INVALID\n\n")); WLAN_OS_REPORT(("Channel %d\n", pSiteEntry->channel)); WLAN_OS_REPORT(("\n")); switch (pSiteEntry->maxBasicRate) { case DRV_RATE_1M: WLAN_OS_REPORT(("Max Basic Rate RATE_1M_BIT\n")); break; case DRV_RATE_2M: WLAN_OS_REPORT(("Max Basic Rate RATE_2M_BIT\n")); break; case DRV_RATE_5_5M: WLAN_OS_REPORT(("Max Basic Rate RATE_5_5M_BIT\n")); break; case DRV_RATE_11M: WLAN_OS_REPORT(("Max Basic Rate RATE_11M_BIT\n")); break; case DRV_RATE_6M: WLAN_OS_REPORT(("Max Basic Rate RATE_6M_BIT\n")); break; case DRV_RATE_9M: WLAN_OS_REPORT(("Max Basic Rate RATE_9M_BIT\n")); break; case DRV_RATE_12M: WLAN_OS_REPORT(("Max Basic Rate RATE_12M_BIT\n")); break; case DRV_RATE_18M: WLAN_OS_REPORT(("Max Basic Rate RATE_18M_BIT\n")); break; case DRV_RATE_24M: WLAN_OS_REPORT(("Max Basic Rate RATE_24M_BIT\n")); break; case DRV_RATE_36M: WLAN_OS_REPORT(("Max Basic Rate RATE_36M_BIT\n")); break; case DRV_RATE_48M: WLAN_OS_REPORT(("Max Basic Rate RATE_48M_BIT\n")); break; case DRV_RATE_54M: WLAN_OS_REPORT(("Max Basic Rate RATE_54M_BIT\n")); break; default: WLAN_OS_REPORT(("Max Basic Rate INVALID, 0x%X\n", pSiteEntry->maxBasicRate)); break; } switch (pSiteEntry->maxActiveRate) { case DRV_RATE_1M: WLAN_OS_REPORT(("Max Active Rate RATE_1M_BIT\n")); break; case DRV_RATE_2M: WLAN_OS_REPORT(("Max Active Rate RATE_2M_BIT\n")); break; case DRV_RATE_5_5M: WLAN_OS_REPORT(("Max Active Rate RATE_5_5M_BIT\n")); break; case DRV_RATE_11M: WLAN_OS_REPORT(("Max Active Rate RATE_11M_BIT\n")); break; case DRV_RATE_22M: WLAN_OS_REPORT(("Max Active Rate RATE_22M_BIT\n")); break; case DRV_RATE_6M: WLAN_OS_REPORT(("Max Active Rate RATE_6M_BIT\n")); break; case DRV_RATE_9M: WLAN_OS_REPORT(("Max Active Rate RATE_9M_BIT\n")); break; case DRV_RATE_12M: WLAN_OS_REPORT(("Max Active Rate RATE_12M_BIT\n")); break; case DRV_RATE_18M: WLAN_OS_REPORT(("Max Active Rate RATE_18M_BIT\n")); break; case DRV_RATE_24M: WLAN_OS_REPORT(("Max Active Rate RATE_24M_BIT\n")); break; case DRV_RATE_36M: WLAN_OS_REPORT(("Max Active Rate RATE_36M_BIT\n")); break; case DRV_RATE_48M: WLAN_OS_REPORT(("Max Active Rate RATE_48M_BIT\n")); break; case DRV_RATE_54M: WLAN_OS_REPORT(("Max Active Rate RATE_54M_BIT\n")); break; default: WLAN_OS_REPORT(("Max Active Rate INVALID, 0x%X\n", pSiteEntry->maxActiveRate)); break; } WLAN_OS_REPORT(("\n")); if (pSiteEntry->probeModulation == DRV_MODULATION_QPSK) WLAN_OS_REPORT(("Probe Modulation QPSK\n")); else if (pSiteEntry->probeModulation == DRV_MODULATION_CCK) WLAN_OS_REPORT(("Probe Modulation CCK\n")); else if (pSiteEntry->probeModulation == DRV_MODULATION_PBCC) WLAN_OS_REPORT(("Probe Modulation PBCC\n")); else if (pSiteEntry->probeModulation == DRV_MODULATION_OFDM) WLAN_OS_REPORT(("Probe Modulation OFDM\n")); else WLAN_OS_REPORT(("Probe Modulation INVALID, %d\n", pSiteEntry->probeModulation)); if (pSiteEntry->beaconModulation == DRV_MODULATION_QPSK) WLAN_OS_REPORT(("Beacon Modulation QPSK\n")); else if (pSiteEntry->beaconModulation == DRV_MODULATION_CCK) WLAN_OS_REPORT(("Beacon Modulation CCK\n")); else if (pSiteEntry->beaconModulation == DRV_MODULATION_PBCC) WLAN_OS_REPORT(("Beacon Modulation PBCC\n")); else if (pSiteEntry->beaconModulation == DRV_MODULATION_OFDM) WLAN_OS_REPORT(("Beacon Modulation OFDM\n")); else WLAN_OS_REPORT(("Beacon Modulation INVALID, %d\n", pSiteEntry->beaconModulation)); WLAN_OS_REPORT(("\n")); if (pSiteEntry->privacy == TI_TRUE) WLAN_OS_REPORT(("Privacy On\n\n")); else WLAN_OS_REPORT(("Privacy Off\n\n")); if (pSiteEntry->currentPreambleType == PREAMBLE_SHORT) WLAN_OS_REPORT(("Cap Preamble Type Short\n")); else if (pSiteEntry->currentPreambleType == PREAMBLE_LONG) WLAN_OS_REPORT(("Cap Preamble Type Long\n")); else WLAN_OS_REPORT(("Preamble INVALID, %d\n", pSiteEntry->currentPreambleType)); if(pSiteEntry->barkerPreambleType == PREAMBLE_UNSPECIFIED) WLAN_OS_REPORT(("Barker preamble Type Unspecified\n")); else if(pSiteEntry->barkerPreambleType == PREAMBLE_SHORT) WLAN_OS_REPORT(("Barker_Preamble Type Short\n")); else WLAN_OS_REPORT(("Barker_Preamble Type Long\n")); if(pSiteEntry->currentSlotTime == PHY_SLOT_TIME_SHORT) WLAN_OS_REPORT(("Slot time type Short\n")); else WLAN_OS_REPORT(("Slot time type Long\n")); WLAN_OS_REPORT(("\n")); WLAN_OS_REPORT(("Beacon interval %d\n", pSiteEntry->beaconInterval)); WLAN_OS_REPORT(("Local Time Stamp %d\n", pSiteEntry->localTimeStamp)); WLAN_OS_REPORT(("rssi %d\n", pSiteEntry->rssi)); WLAN_OS_REPORT(("\n")); WLAN_OS_REPORT(("Fail status %d\n", pSiteEntry->failStatus)); WLAN_OS_REPORT(("\n---------------------------------------------------------------\n\n", 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; }
/** * \fn scanResultTable_GetBssidList * \brief Retrieves the site table content * * Retrieves the site table content * * \param hScanResultTable - handle to the scan result table object * \param pBssidList - pointer to a buffer large enough to hols the BSSID list * \param plength - length of the supplied buffer, will be overwritten with the actual list length * \param bAllVarIes - whether to include all variable size IEs * \return None * \sa scanResultTable_CalculateBssidListSize */ TI_STATUS scanResultTable_GetBssidList (TI_HANDLE hScanResultTable, OS_802_11_BSSID_LIST_EX *pBssidList, TI_UINT32 *pLength, TI_BOOL bAllVarIes) { TScanResultTable *pScanResultTable = (TScanResultTable*)hScanResultTable; TI_UINT32 uLength, uSiteIndex, rsnIndex, rsnIeLength, len, firstOFDMloc = 0; TSiteEntry *pSiteEntry; OS_802_11_BSSID_EX *pBssid; OS_802_11_FIXED_IEs *pFixedIes; OS_802_11_VARIABLE_IEs *pVarIes; TI_UINT8 *pData; /* verify the supplied length is enough */ uLength = scanResultTable_CalculateBssidListSize (hScanResultTable, bAllVarIes); if (uLength > *pLength) { *pLength = uLength; return TI_NOK; } /* Nullify number of items in the BSSID list */ pBssidList->NumberOfItems = 0; /* set length to list header size (only list count) */ uLength = sizeof(OS_802_11_BSSID_LIST_EX) - sizeof(OS_802_11_BSSID_EX); /* set data pointer to first item in list */ pData = (TI_UINT8*)&(pBssidList->Bssid[0]); for (uSiteIndex = 0; uSiteIndex < pScanResultTable->uCurrentSiteNumber; uSiteIndex++) { /* set BSSID entry pointer to current location in buffer */ pBssid = (OS_802_11_BSSID_EX*)pData; /* set pointer to site entry */ pSiteEntry = &(pScanResultTable->pTable[ uSiteIndex ]); /* start copy stuff: */ /* MacAddress */ MAC_COPY (pBssid->MacAddress, pSiteEntry->bssid); /* Capabilities */ pBssid->Capabilities = pSiteEntry->capabilities; /* SSID */ os_memoryZero (pScanResultTable->hOS, &(pBssid->Ssid.Ssid), MAX_SSID_LEN); if (pSiteEntry->ssid.len > MAX_SSID_LEN) { pSiteEntry->ssid.len = MAX_SSID_LEN; } os_memoryCopy (pScanResultTable->hOS, (void *)pBssid->Ssid.Ssid, (void *)pSiteEntry->ssid.str, pSiteEntry->ssid.len); pBssid->Ssid.SsidLength = pSiteEntry->ssid.len; /* privacy */ pBssid->Privacy = pSiteEntry->privacy; /* RSSI */ pBssid->Rssi = pSiteEntry->rssi; pBssid->Configuration.Length = sizeof(OS_802_11_CONFIGURATION); pBssid->Configuration.BeaconPeriod = pSiteEntry->beaconInterval; pBssid->Configuration.ATIMWindow = pSiteEntry->atimWindow; pBssid->Configuration.Union.channel = Chan2Freq(pSiteEntry->channel); if (pSiteEntry->bssType == BSS_INDEPENDENT) pBssid->InfrastructureMode = os802_11IBSS; else pBssid->InfrastructureMode = os802_11Infrastructure; /* Supported Rates */ os_memoryZero (pScanResultTable->hOS, (void *)pBssid->SupportedRates, sizeof(OS_802_11_RATES_EX)); rate_DrvBitmapToNetStr (pSiteEntry->rateMask.supportedRateMask, pSiteEntry->rateMask.basicRateMask, (TI_UINT8*)pBssid->SupportedRates, &len, &firstOFDMloc); /* set network type acording to band and rates */ if (RADIO_BAND_2_4_GHZ == pSiteEntry->eBand) { if (firstOFDMloc == len) { pBssid->NetworkTypeInUse = os802_11DS; } else { pBssid->NetworkTypeInUse = os802_11OFDM24; } } else { pBssid->NetworkTypeInUse = os802_11OFDM5; } /* start copy IE's: first nullify length */ pBssid->IELength = 0; /* copy fixed IEs from site entry */ pFixedIes = (OS_802_11_FIXED_IEs*)&(pBssid->IEs[ pBssid->IELength ]); os_memoryCopy (pScanResultTable->hOS, (void*)pFixedIes->TimeStamp, &(pSiteEntry->tsfTimeStamp[ 0 ]), TIME_STAMP_LEN); pFixedIes->BeaconInterval = pSiteEntry->beaconInterval; pFixedIes->Capabilities = pSiteEntry->capabilities; pBssid->IELength += sizeof(OS_802_11_FIXED_IEs); /* set pointer for variable length IE's */ pVarIes = (OS_802_11_VARIABLE_IEs*)&(pBssid->IEs[ pBssid->IELength ]); if (!bAllVarIes) { /* copy only some variable IEs */ /* copy SSID */ pVarIes->ElementID = SSID_IE_ID; pVarIes->Length = pSiteEntry->ssid.len; os_memoryCopy (pScanResultTable->hOS, (void *)pVarIes->data, (void *)pSiteEntry->ssid.str, pSiteEntry->ssid.len); pBssid->IELength += (pVarIes->Length + 2); /* copy RATES */ pVarIes = (OS_802_11_VARIABLE_IEs*)&(pBssid->IEs[ pBssid->IELength ]); pVarIes->ElementID = SUPPORTED_RATES_IE_ID; rate_DrvBitmapToNetStr (pSiteEntry->rateMask.supportedRateMask, pSiteEntry->rateMask.basicRateMask, (TI_UINT8 *)pVarIes->data, &len, &firstOFDMloc); pVarIes->Length = len; pBssid->IELength += (pVarIes->Length + 2); /* copy DS */ pVarIes = (OS_802_11_VARIABLE_IEs*)&(pBssid->IEs[ pBssid->IELength ]); pVarIes->ElementID = DS_PARAMETER_SET_IE_ID; pVarIes->Length = DOT11_DS_PARAMS_ELE_LEN; os_memoryCopy (pScanResultTable->hOS, (void *)pVarIes->data, &(pSiteEntry->channel), DOT11_DS_PARAMS_ELE_LEN); pBssid->IELength += (pVarIes->Length + 2); /* copy RSN information elements */ if (0 < pSiteEntry->rsnIeLen) { rsnIeLength = 0; for (rsnIndex=0; rsnIndex < MAX_RSN_IE && pSiteEntry->pRsnIe[ rsnIndex ].hdr[1] > 0; rsnIndex++) { pVarIes = (OS_802_11_VARIABLE_IEs*)&(pBssid->IEs[ pBssid->IELength + rsnIeLength ]); pVarIes->ElementID = pSiteEntry->pRsnIe[ rsnIndex ].hdr[0]; pVarIes->Length = pSiteEntry->pRsnIe[ rsnIndex ].hdr[1]; os_memoryCopy (pScanResultTable->hOS, (void *)pVarIes->data, (void *)pSiteEntry->pRsnIe[ rsnIndex ].rsnIeData, pSiteEntry->pRsnIe[ rsnIndex ].hdr[1]); rsnIeLength += pSiteEntry->pRsnIe[ rsnIndex ].hdr[1] + 2; } pBssid->IELength += pSiteEntry->rsnIeLen; } /* QOS_WME/XCC */ if (TI_TRUE == pSiteEntry->WMESupported) { /* oui */ TI_UINT8 ouiWME[3] = {0x50, 0xf2, 0x01}; dot11_WME_PARAM_t *pWMEParams; /* fill in the general element parameters */ pVarIes = (OS_802_11_VARIABLE_IEs*)&(pBssid->IEs[ pBssid->IELength ]); pVarIes->ElementID = DOT11_WME_ELE_ID; pVarIes->Length = DOT11_WME_PARAM_ELE_LEN; /* fill in the specific element parameters */ pWMEParams = (dot11_WME_PARAM_t*)pVarIes; os_memoryCopy (pScanResultTable->hOS, (void *)pWMEParams->OUI, ouiWME, 3); pWMEParams->OUIType = dot11_WME_OUI_TYPE; pWMEParams->OUISubType = dot11_WME_OUI_SUB_TYPE_PARAMS_IE; pWMEParams->version = dot11_WME_VERSION; pWMEParams->ACInfoField = dot11_WME_ACINFO_MASK & pSiteEntry->lastWMEParameterCnt; /* fill in the data */ os_memoryCopy (pScanResultTable->hOS, &(pWMEParams->WME_ACParameteres), &(pSiteEntry->WMEParameters), sizeof(dot11_ACParameters_t)); /* update the general length */ pBssid->IELength += (pVarIes->Length + 2); } /* Copy the unknown IEs */ if ( 0 < pSiteEntry->unknownIeLen ) { os_memoryCopy (pScanResultTable->hOS, (void *)(&pBssid->IEs[ pBssid->IELength ]), (void *)pSiteEntry->pUnknownIe, pSiteEntry->unknownIeLen ); pBssid->IELength += pSiteEntry->unknownIeLen; } } else { /* Copy all variable IEs */ if (pSiteEntry->probeRecv) { /* It looks like it never happens. Anyway decided to check */ if ( pSiteEntry->probeRespLength > MAX_BEACON_BODY_LENGTH ) /* it may have sense to check the Len here for 0 or MIN_BEACON_BODY_LENGTH also */ { handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return TI_NOK; } os_memoryCopy (pScanResultTable->hOS, pVarIes, pSiteEntry->probeRespBuffer, pSiteEntry->probeRespLength); pBssid->IELength += pSiteEntry->probeRespLength; } else { /* It looks like it never happens. Anyway decided to check */ if ( pSiteEntry->beaconLength > MAX_BEACON_BODY_LENGTH ) /* it may have sense to check the Len here for 0 or MIN_BEACON_BODY_LENGTH also */ { handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); return TI_NOK; } os_memoryCopy (pScanResultTable->hOS, pVarIes, pSiteEntry->beaconBuffer, pSiteEntry->beaconLength); pBssid->IELength += pSiteEntry->beaconLength; } } /* -1 to remove the IEs[1] placeholder in OS_802_11_BSSID_EX which is taken into account in pBssid->IELength */ pBssid->Length = sizeof(OS_802_11_BSSID_EX) + pBssid->IELength - 1; /* make sure length is 4 bytes aligned */ if (pBssid->Length % 4) { pBssid->Length += (4 - (pBssid->Length % 4)); } pData += pBssid->Length; uLength += pBssid->Length; } pBssidList->NumberOfItems = pScanResultTable->uCurrentSiteNumber; *pLength = uLength; return TI_OK; }
/** * \fn scanResultTable_UpdateEntry * \brief Update or insert a site data. * * Update a site's data in the table if it already exists, or create an antry if the site doesn't exist. * If the table is in stable state, will move it to updating state and clear its contents. * * \param hScanResultTable - handle to the scan result table object * \param pBssid - a pointer to the site BSSID * \param pframe - a pointer to the received frame data * \return TI_OK if entry was inseretd or updated successfuly, TI_NOK if table is full * \sa scanResultTable_SetStableState */ TI_STATUS scanResultTable_UpdateEntry (TI_HANDLE hScanResultTable, TMacAddr *pBssid, TScanFrameInfo* pFrame) { TScanResultTable *pScanResultTable = (TScanResultTable*)hScanResultTable; TSiteEntry *pSite; TSsid tTempSsid; /* check if the table is in stable state */ if (TI_TRUE == pScanResultTable->bStable) { /* move the table to updating state */ pScanResultTable->bStable = TI_FALSE; /* and clear its contents */ pScanResultTable->uCurrentSiteNumber = 0; } if (NULL == pFrame->parsedIEs->content.iePacket.pSsid) { return TI_NOK; } /* Verify that the SSID IE is available (if not return NOK) */ if (NULL == pFrame->parsedIEs->content.iePacket.pSsid) { return TI_NOK; } /* use temporary SSID structure */ tTempSsid.len = pFrame->parsedIEs->content.iePacket.pSsid->hdr[1]; /* The change is made to "close" the issue 414 in KlockWork. This is tricky for incorrect data case. At least it looks better than running out of buffer in os_memoryCopy below */ if (MAX_SSID_LEN < tTempSsid.len) { handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION); tTempSsid.len = MAX_SSID_LEN; } os_memoryCopy(pScanResultTable->hOS, (void *)&(tTempSsid.str[ 0 ]), (void *)&(pFrame->parsedIEs->content.iePacket.pSsid->serviceSetId[ 0 ]), tTempSsid.len); if (MAX_SSID_LEN > tTempSsid.len) tTempSsid.str[ tTempSsid.len ] ='\0'; /* check if the SSID:BSSID pair already exists in the table */ pSite = scanResultTable_GetBySsidBssidPair (hScanResultTable, &tTempSsid ,pBssid); if (NULL != pSite) { if (TI_NOK != scanResultTable_CheckRxSignalValidity(pScanResultTable, pSite, pFrame->rssi, pFrame->channel)) { /* BSSID exists: update its data */ scanResultTable_UpdateSiteData (hScanResultTable, pSite, pFrame); } } else { /* BSSID doesn't exist: allocate a new entry for it */ pSite = scanResultTbale_AllocateNewEntry (hScanResultTable); if (NULL == pSite) { return TI_NOK; } /* and update its data */ scanResultTable_UpdateSiteData (hScanResultTable, pSite, pFrame); } return TI_OK; }