Exemple #1
0
/** 
 * \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     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;
}
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);
}
Exemple #4
0
/** 
 * \fn     StaCap_GetHtCapabilitiesIe
 * \brief  Get the desired STA HT capabilities IE. get the physical HT capabilities from TWD 
 * and build HT capabilities IE. 
 * 
 * \note   
 * \param  hStaCap - The module object
 * \param  pRequest - pointer to request buffer\n 
 * \param  len - size of returned IE\n            
 * \return TI_OK on success or TI_NOK on failure 
 * \sa     
 */ 
TI_STATUS StaCap_GetHtCapabilitiesIe (TI_HANDLE hStaCap, TI_UINT8 *pRequest, TI_UINT32 *pLen)
{
    TStaCap                 *pStaCap = (TStaCap *)hStaCap;
    TTwdHtCapabilities      *pTwdHtCapabilities;
    TI_UINT8			    *pDataBuf = pRequest;
    TStaCapHtCapabilities   tHtCapabilities;
    TI_BOOL                 bWmeEnable;

    /* verify that WME flag enable */
    qosMngr_GetWmeEnableFlag (pStaCap->hQosMngr, &bWmeEnable); 
    if (bWmeEnable == TI_FALSE)
    {
   		*pLen = 0;
		return TI_OK;
    }

    TWD_GetTwdHtCapabilities (pStaCap->hTWD, &pTwdHtCapabilities);
    /* verify that 802.11n flag enable */
    if (pTwdHtCapabilities->b11nEnable == TI_FALSE)
    {
   		*pLen = 0;
		return TI_OK;
    }

    /* 
     * set TWD values to HT capabilities structure 
     *
     * Note: all numbers after "<<" represent the position of the values in the filed according  
     * to 11n SPEC.
     */
    tHtCapabilities.uHtCapabilitiesInfo = ((pTwdHtCapabilities->uChannelWidth   << 1) |
                                           (pTwdHtCapabilities->uRxSTBC         << 8) |
                                           (pTwdHtCapabilities->uMaxAMSDU       << 11)|
                                           (DSSS_CCK_MODE                       << 12));

    tHtCapabilities.uHtCapabilitiesInfo |= ((((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_LDPC_CODING)                       ? 1 : 0) << 0) |
                                            (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_GREENFIELD_FRAME_FORMAT)           ? 1 : 0) << 4) |
                                            (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_SHORT_GI_FOR_20MHZ_PACKETS)        ? 1 : 0) << 5) |
                                            (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_SHORT_GI_FOR_40MHZ_PACKETS)        ? 1 : 0) << 6) |
                                            (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_SUPPORT_FOR_STBC_IN_TRANSMISSION)  ? 1 : 0) << 7) |
                                            (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_DELAYED_BLOCK_ACK)                 ? 1 : 0) << 10) |
                                            (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_DSSS_CCK_IN_40_MHZ)                ? 1 : 0) << 12) |
                                            (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_LSIG_TXOP_PROTECTION)              ? 1 : 0) << 15));

    tHtCapabilities.uAMpduParam = ((pTwdHtCapabilities->uMaxAMPDU       << 0) |
                                   (pTwdHtCapabilities->uAMPDUSpacing   << 2));

    /* copy RX supported MCS rates */
    os_memoryCopy (pStaCap->hOs, tHtCapabilities.tSuppMcsSet.aRxMscBitmask, pTwdHtCapabilities->aRxMCS, RX_TX_MCS_BITMASK_SIZE);

    tHtCapabilities.tSuppMcsSet.uHighestSupportedDataRate = pTwdHtCapabilities->uRxMaxDataRate;

    /* check if supported MCS rates identical to TX and RX */
    if( 0 == os_memoryCompare(pStaCap->hOs, pTwdHtCapabilities->aRxMCS, pTwdHtCapabilities->aTxMCS, RX_TX_MCS_BITMASK_SIZE))
    {
        tHtCapabilities.tSuppMcsSet.uTxRxSetting = ((TX_MCS_SET_YES     <<  0) |    /* set supported TX MCS rate */
                                                    (TX_RX_NOT_EQUAL_NO <<  1));    /* set TX&RX MCS rate are equal */
    } 
    /* in case supported MCS rates TX different from the RX */
    else
    {
        TI_UINT32 i;

        /* check if there are TX MCS rates supported */
        for (i = 0; i <= (RX_TX_MCS_BITMASK_SIZE - 1); ++i) 
        {
            if (pTwdHtCapabilities->aTxMCS[i] != 0)
            {
                break;
            }
        }

        /* TX MCS supported */
        if(i <= (RX_TX_MCS_BITMASK_SIZE -1))
        {
            tHtCapabilities.tSuppMcsSet.uTxRxSetting = ((TX_MCS_SET_YES         <<  0) |    /* set supported TX MCS rates */    
                                                        (TX_RX_NOT_EQUAL_YES    <<  1));    /* set TX&RX MCS rates different */ 
        }
        /* TX MCS not supported */
        else
        {
            tHtCapabilities.tSuppMcsSet.uTxRxSetting = (TX_MCS_SET_NO          <<  0);      /* set no supported TX MCS rates */
        }
    }

    tHtCapabilities.uExteCapabilities = (((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_PCO) ? 1 : 0) << 0);

    if (tHtCapabilities.uExteCapabilities != 0)
    {
        tHtCapabilities.uExteCapabilities |= (pTwdHtCapabilities->uPCOTransTime <<  1);  
    }

    tHtCapabilities.uExteCapabilities |= ((pTwdHtCapabilities->uMCSFeedback << 8) |
                                          (HTC_SUPPORT_NO                   << 10));

    tHtCapabilities.uTxBfCapabilities = ((IMPLICIT_TXBF_REC_CAPABLE             << 0) |
                                         (TRANSMIT_STAGGERED_SOUNDING_CAPABLE   << 2));

    tHtCapabilities.uAselCapabilities = 0x0;


    /* build IE */
    *pDataBuf       = HT_CAPABILITIES_IE_ID;
    *(pDataBuf + 1) = DOT11_HT_CAPABILITIES_ELE_LEN;
    COPY_WLAN_WORD(pDataBuf + 2, &(tHtCapabilities.uHtCapabilitiesInfo));
    *(pDataBuf + 4) = tHtCapabilities.uAMpduParam;
    os_memoryCopy (pStaCap->hOs, pDataBuf + 5, tHtCapabilities.tSuppMcsSet.aRxMscBitmask, RX_TX_MCS_BITMASK_SIZE);
    COPY_WLAN_WORD(pDataBuf + 15, &(tHtCapabilities.tSuppMcsSet.uHighestSupportedDataRate));
    *(pDataBuf + 17) = tHtCapabilities.tSuppMcsSet.uTxRxSetting;
    /* clear the reserved bytes */
    os_memoryZero (pStaCap->hOs, (pDataBuf + 18), 3);
    COPY_WLAN_WORD(pDataBuf + 21, &(tHtCapabilities.uExteCapabilities));
    COPY_WLAN_LONG(pDataBuf + 23, &(tHtCapabilities.uTxBfCapabilities));
    *(pDataBuf + 27) = tHtCapabilities.uAselCapabilities;

    *pLen = DOT11_HT_CAPABILITIES_ELE_LEN + sizeof(dot11_eleHdr_t);

    return TI_OK;
}
/** 
 * \fn     sme_ScanResultCB
 * \brief  Callback function from scan concentrator for results and scan complete indications
 * 
 * Callback function from scan concentrator for results and scan complete indications
 * 
 * \param  hSme - handle to the SME object
 * \param  eStatus - the reason for calling the CB  
 * \param  pFrameInfo - frame information (if the CB is called due to received frame)
 * \param  uSPSStatus - SPS attened channels (if the CB is called to inidcate an SPS scan complete)
 * \return None
 */ 
void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus,
                       TScanFrameInfo* pFrameInfo, TI_UINT16 uSPSStatus)
{
    TSme                *pSme = (TSme*)hSme;
    paramInfo_t	        param;


    switch (eStatus)
    {
    /* a frame was received - update the scan result table */
    case SCAN_CRS_RECEIVED_FRAME:

        TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received frame from BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]);

        /* 
         * in auto mode in order to find country IE only !!!
         * filter frames according to desired SSID, in case we are also trying to find 
         * country IE in passive scan, to avoid a table overflow (in manual mode, the SME table must be equal to the app
         * table, the app is responsible to decide which SSIDs to use for scan)
         */
        if (CONNECT_MODE_AUTO == pSme->eConnectMode)
        {
            if (SSID_TYPE_SPECIFIC == pSme->eSsidType)
            {
#ifndef XCC_MODULE_INCLUDED
                if ((pSme->tSsid.len == pFrameInfo->parsedIEs->content.iePacket.pSsid->hdr[ 1 ]) &&
                    (0 == os_memoryCompare (pSme->hOS, &(pSme->tSsid.str[ 0 ]),
                                            &(pFrameInfo->parsedIEs->content.iePacket.pSsid->serviceSetId[ 0 ]),
                                            pSme->tSsid.len)))
#endif
                {

                    if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo))
                    {
                        TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update specific enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]);
                    }
                }
            }
            else
            {

                if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo))
                {
                    TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]);
                }
            }
        }
        else
        /* manual mode */
        {
            if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo))
            {
                TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update application scan enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]);
            }
        }
        break;

    /* scan was completed successfully */
    case SCAN_CRS_SCAN_COMPLETE_OK:
    /* an error occured, try selecting a site anyway */
    case SCAN_CRS_SCAN_ABORTED_FW_RESET:
    case SCAN_CRS_SCAN_ABORTED_HIGHER_PRIORITY:
    case SCAN_CRS_SCAN_FAILED:
    case SCAN_CRS_TSF_ERROR:
        TRACE1(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received scan complete indication with status %d\n", eStatus);

        /* stablizie the scan result table - delete its contenst if no results were recived during last scan */
        scanResultTable_SetStableState (pSme->hScanResultTable);

        if (CONNECT_MODE_AUTO == pSme->eConnectMode)
        {
 
           /* try to select a site */
           pSme->pCandidate = sme_Select (hSme);

           /* if no matching site was found */
           if (NULL == pSme->pCandidate)
           {
               /* for IBSS or any, if no entries where found, add the self site */
               if (pSme->eBssType == BSS_INFRASTRUCTURE)
               {
                   TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: No candidate available, sending connect failure\n");

                   genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);
                   break;
               }

               {
                   TI_UINT8     uDesiredChannel;

                   param.paramType = SITE_MGR_DESIRED_CHANNEL_PARAM;
                   siteMgr_getParam(pSme->hSiteMgr, &param);
                   uDesiredChannel = param.content.siteMgrDesiredChannel;

                   if (uDesiredChannel >= SITE_MGR_CHANNEL_A_MIN)
                   {
                       param.content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ;
                   } 
                   else 
                   {
                       param.content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ;
                   }

                   /*
                   update the regulatory domain with the selected band
                   */
                   /* Check if the selected channel is valid according to regDomain */
                   param.paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES;
                   param.content.channelCapabilityReq.scanOption = ACTIVE_SCANNING;
                   param.content.channelCapabilityReq.channelNum = uDesiredChannel;

                   regulatoryDomain_getParam (pSme->hRegDomain,&param);
                   if (!param.content.channelCapabilityRet.channelValidity)
                   {
                       TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "IBSS SELECT FAILURE  - No channel !!!\n\n");

                       genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);

                       break;
                   }

                   pSme->pCandidate = (TSiteEntry *)addSelfSite(pSme->hSiteMgr);

                   if (pSme->pCandidate == NULL)
                   {
                       TRACE0(pSme->hReport, REPORT_SEVERITY_ERROR , "IBSS SELECT FAILURE  - could not open self site !!!\n\n");

                       genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);

                       break;
                   }

#ifdef REPORT_LOG    
                   TRACE6(pSme->hReport, REPORT_SEVERITY_CONSOLE,"%%%%%%%%%%%%%%	SELF SELECT SUCCESS, bssid: %X-%X-%X-%X-%X-%X	%%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5]);
                   WLAN_OS_REPORT (("%%%%%%%%%%%%%%	SELF SELECT SUCCESS, bssid: %02x.%02x.%02x.%02x.%02x.%02x %%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5]));
#endif
                }
           }

           /* a connection candidate is available, send a connect event */
           genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme);
        }
        break;        

    /*
     * scan was stopped according to SME request (should happen when moving to disconnecting from scanning), send a 
     * connect failure event to move out of disconnecting
     */
    case SCAN_CRS_SCAN_STOPPED:
        TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received scan stopped indication\n");
        genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme);
        break;

    default:
        TRACE1(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: received unrecognized status %d\n", eStatus);
        break;
    }
}
/** 
 * \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;
}