Esempio n. 1
0
/**
* mlme_Start - Start event for the MLME SM
*
* \b Description:
* Start event for the MLME SM
*
* \b ARGS:
*  I   - hMlme - MLME SM context  \n
*  II  - connectionType - roaming or initial? with FT (802.11r) or not?
* \b RETURNS:
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa mlme_Stop, mlme_Recv
*/
TI_STATUS mlme_start(TI_HANDLE hMlme, TI_UINT8 connectionType)
{
	EConnType econnectionType = (EConnType)connectionType;
	mlme_t		*pMlme = (mlme_t*)hMlme;
    paramInfo_t *pParam;

	if (pMlme == NULL)
    {
        return TI_NOK;
    }

    pParam = (paramInfo_t *)os_memoryAlloc(pMlme->hOs, sizeof(paramInfo_t));

    if (pParam == NULL)
    {
        return TI_NOK;
    }

	pMlme->assocInfo.disAssoc = TI_FALSE;

	pParam->paramType = RSN_EXT_AUTHENTICATION_MODE;
	rsn_getParam(pMlme->hRsn, pParam);

	switch (econnectionType)
	{
	case CONN_TYPE_FIRST_CONN:
	case CONN_TYPE_ROAM:
		if (AUTH_LEGACY_SHARED_KEY == pParam->content.rsnExtAuthneticationMode)
		{
			pMlme->authInfo.authType = AUTH_LEGACY_SHARED_KEY;
		}
		else
		{
			pMlme->authInfo.authType = AUTH_LEGACY_OPEN_SYSTEM;
		}
		break;
	default:
		pMlme->authInfo.authType = AUTH_LEGACY_OPEN_SYSTEM;
		break;
	}
	mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_START, pMlme);
	return TI_OK;
}
Esempio n. 2
0
/**
* mlme_Start - Start event for the MLME SM
*
* \b Description:
* Start event for the MLME SM
*
* \b ARGS:
*  I   - hMlme - MLME SM context  \n
*  II  - connectionType - roaming or initial? with FT (802.11r) or not?
* \b RETURNS:
*  TI_OK if successful, TI_NOK otherwise.
*
* \sa mlme_Stop, mlme_Recv
*/
TI_STATUS mlme_start(TI_HANDLE hMlme, TI_UINT8 connectionType)
{
	EConnType econnectionType = (EConnType)connectionType;
	mlme_t		*pMlme = (mlme_t*)hMlme;
    paramInfo_t param;

	if (pMlme == NULL)
    {
        return TI_NOK;
    }

	pMlme->assocInfo.disAssoc = TI_FALSE;

	param.paramType = RSN_EXT_AUTHENTICATION_MODE;
	rsn_getParam(pMlme->hRsn, &param);
	pMlme->legacyAuthType = AUTH_LEGACY_NONE;
    switch (econnectionType)
	{
	case CONN_TYPE_FIRST_CONN:
	case CONN_TYPE_ROAM:
        if (RSN_AUTH_SHARED_KEY == param.content.rsnExtAuthneticationMode)
        {
            pMlme->authInfo.authType = AUTH_LEGACY_SHARED_KEY;
        }
        else if (RSN_AUTH_AUTO_SWITCH == param.content.rsnExtAuthneticationMode)
        {
            pMlme->authInfo.authType = AUTH_LEGACY_SHARED_KEY;  /* the default of AutoSwitch mode is SHARED mode */
			pMlme->legacyAuthType = RSN_AUTH_AUTO_SWITCH;   /* legacyAuthType indecate that the auth mode is AutoSwitch */
			pMlme->bSharedFailed = TI_FALSE;
        }
        else
		{
			pMlme->authInfo.authType = AUTH_LEGACY_OPEN_SYSTEM;
		}
		break;
	default:
		pMlme->authInfo.authType = AUTH_LEGACY_OPEN_SYSTEM;
		break;
	}
	mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_START, pMlme);
	return TI_OK;
}
Esempio n. 3
0
/** 
 * \fn     mlme_assocCapBuild 
 * \brief  builds capabilties of assoc request 
 * 
 * builds capabilties of assoc request  according to the mlme params 
 * 
 * \param  pCtx - pointer to mlme_t
 * \param  cap - <output> pointer to the built capablities

 * \return TI_OK if auth send successfully
 *         TI_NOK otherwise
 * 
 * \sa     mlme_assocRequestMsgBuild 
 */ 
TI_STATUS mlme_assocCapBuild(mlme_t *pCtx, TI_UINT16 *cap)
{
    paramInfo_t         param;
    TI_STATUS           status;
    EDot11Mode          mode;
    TI_UINT32           rateSuppMask, rateBasicMask;
    TI_UINT8            ratesBuf[DOT11_MAX_SUPPORTED_RATES];
    TI_UINT32           len = 0, ofdmIndex = 0;
    TI_BOOL             b11nEnable, bWmeEnable;

    *cap = 0;

    /* Bss type */
    param.paramType = CTRL_DATA_CURRENT_BSS_TYPE_PARAM;
    status =  ctrlData_getParam(pCtx->hCtrlData, &param);
    if (status == TI_OK)
    {
        if (param.content.ctrlDataCurrentBssType == BSS_INFRASTRUCTURE)
        {
            *cap |= DOT11_CAPS_ESS;
        } else {
            *cap |= DOT11_CAPS_IBSS;
        }
    } else {
        return TI_NOK;
    }

    /* Privacy */
    param.paramType = RSN_ENCRYPTION_STATUS_PARAM;
    status =  rsn_getParam(pCtx->hRsn, &param);
    if (status == TI_OK)
    {
        if (param.content.rsnEncryptionStatus != TWD_CIPHER_NONE)
        {
            *cap |= DOT11_CAPS_PRIVACY;
        }
    } else {
        return TI_NOK;
    }

    /* Preamble */
    param.paramType = SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM;
    status =  siteMgr_getParam(pCtx->hSiteMgr, &param);
    if (status == TI_OK)
    {
        if (param.content.siteMgrCurrentPreambleType == PREAMBLE_SHORT)
            *cap |= DOT11_CAPS_SHORT_PREAMBLE;
    } else {
        return TI_NOK;
    }

    /* Pbcc */
    param.paramType = SITE_MGR_CURRENT_RATE_PAIR_PARAM;
    status =  siteMgr_getParam(pCtx->hSiteMgr, &param);
    if (status == TI_OK)
    {
        if(param.content.siteMgrCurrentRateMask.supportedRateMask & DRV_RATE_MASK_22_PBCC)
            *cap |= DOT11_CAPS_PBCC;
    } else {
        return TI_NOK;
    }

    /* Checking if the station supports Spectrum Management (802.11h) */
    param.paramType = REGULATORY_DOMAIN_MANAGEMENT_CAPABILITY_ENABLED_PARAM;
    status =  regulatoryDomain_getParam(pCtx->hRegulatoryDomain, &param);
    if (status == TI_OK )
    {
        if( param.content.spectrumManagementEnabled)
            *cap |= DOT11_SPECTRUM_MANAGEMENT;
    }
    else
    {
        return TI_NOK;
    }

    /* slot time */
    param.paramType = SITE_MGR_OPERATIONAL_MODE_PARAM;
    status = siteMgr_getParam(pCtx->hSiteMgr, &param);
    if(status == TI_OK)
    {
        mode = param.content.siteMgrDot11OperationalMode;
    }
    else
        return TI_NOK;

    if(mode == DOT11_G_MODE)
    {
        /* new requirement: the short slot time should be set only
           if the AP's modulation is OFDM (highest rate) */

        /* get Rates */
        param.paramType = SITE_MGR_CURRENT_RATE_PAIR_PARAM;
        status =  siteMgr_getParam(pCtx->hSiteMgr, &param);
        if (status == TI_OK)
        {
            rateBasicMask = param.content.siteMgrCurrentRateMask.basicRateMask;
            rateSuppMask  = param.content.siteMgrCurrentRateMask.supportedRateMask;
        } else {
            return TI_NOK;
        }

        /* convert the bit map to the rates array */
        rate_DrvBitmapToNetStr (rateSuppMask, rateBasicMask, ratesBuf, &len, &ofdmIndex);

        if(ofdmIndex < len)
            *cap |= DOT11_CAPS_SHORT_SLOT_TIME;

/*
        param.paramType = SITE_MGR_CURRENT_MODULATION_TYPE_PARAM;
        status = siteMgr_getParam(pCtx->hSiteMgr, &param);
        if(param.content.siteMgrCurrentModulationType == DRV_MODULATION_OFDM)
            *cap |= DOT11_CAPS_SHORT_SLOT_TIME;
*/
    }

    /* Primary Site support HT ? */
    param.paramType = SITE_MGR_PRIMARY_SITE_HT_SUPPORT;
    siteMgr_getParam(pCtx->hSiteMgr, &param);

    if (param.content.bPrimarySiteHtSupport == TI_TRUE)
    {
        /* Immediate Block Ack subfield - (is WME on?) AND (is HT Enable?) */
        /* verify 11n_Enable and Chip type */
        StaCap_IsHtEnable (pCtx->hStaCap, &b11nEnable);
        /* verify that WME flag enable */
        qosMngr_GetWmeEnableFlag (pCtx->hQosMngr, &bWmeEnable);

        if ((b11nEnable != TI_FALSE) && (bWmeEnable != TI_FALSE))
        {
            *cap |= DOT11_CAPS_IMMEDIATE_BA;
        }
    }

    return TI_OK;
}
Esempio n. 4
0
/** 
 * \fn     mlme_assocRequestMsgBuild 
 * \brief  buils association request
 * 
 * The function builds the association request according to the given parames
 * 
 * \param  pCtx - pointer to mlme_t
 * \param  reqBuf - <output> pointer to built assoc request buffer
 * \param  reqLen - <output> length of built assoc request buffer
 * 
 * \return TI_OK if auth send successfully
 *         TI_NOK otherwise
 * 
 * \sa     mlme_sendAssocRequest 
 */ 
TI_STATUS mlme_assocRequestMsgBuild(mlme_t *pCtx, TI_UINT8* reqBuf, TI_UINT32* reqLen)
{
    TI_STATUS       status;
    TI_UINT8        *pRequest;
    TI_UINT32       len;
    paramInfo_t     param;
    TTwdParamInfo   tTwdParam;
    TI_UINT16       capabilities;
	TI_BOOL spectrumManagementEnabled;
	ECipherSuite    eCipherSuite = TWD_CIPHER_NONE; /* To be used for checking whether

                                                       AP supports HT rates and TKIP */
    pRequest = reqBuf;
    *reqLen = 0;


    /* insert capabilities */
    status = mlme_assocCapBuild(pCtx, &capabilities);
    if (status == TI_OK)
    {
         *(TI_UINT16*)pRequest = ENDIAN_HANDLE_WORD(capabilities);
    }
    else
	{
		TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build assoc Capa\n");
        return TI_NOK;
	}

    pRequest += sizeof(TI_UINT16);
    *reqLen += sizeof(TI_UINT16);

    /* insert listen interval */
    tTwdParam.paramType = TWD_LISTEN_INTERVAL_PARAM_ID;
    status =  TWD_GetParam (pCtx->hTWD, &tTwdParam);
    if (status == TI_OK)
    {
        *(TI_UINT16*)pRequest = ENDIAN_HANDLE_WORD((TI_UINT16)tTwdParam.content.halCtrlListenInterval);
    } else {
		TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to get listen interval\n");
        return TI_NOK;
    }

    pRequest += sizeof(TI_UINT16);
    *reqLen += sizeof(TI_UINT16);

	if (pCtx->reAssoc)
    {   /* Insert currentAPAddress element only in reassoc request*/
        param.paramType = SITE_MGR_PREV_SITE_BSSID_PARAM;
        status = siteMgr_getParam(pCtx->hSiteMgr, &param);
        if (status == TI_OK)
        {
            MAC_COPY (pRequest, param.content.siteMgrDesiredBSSID);
            TRACE6(pCtx->hReport, REPORT_SEVERITY_INFORMATION, "ASSOC_SM: ASSOC_REQ - prev AP = %x-%x-%x-%x-%x-%x\n", param.content.siteMgrDesiredBSSID[0], param.content.siteMgrDesiredBSSID[1], param.content.siteMgrDesiredBSSID[2], param.content.siteMgrDesiredBSSID[3], param.content.siteMgrDesiredBSSID[4], param.content.siteMgrDesiredBSSID[5]);


            pRequest += MAC_ADDR_LEN;
            *reqLen += MAC_ADDR_LEN;
        }
        else
        {
            TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: ASSOC_REQ - No prev AP \n");
            return status;

        }
    }

    /* insert SSID element */
    status = mlme_assocSSIDBuild(pCtx, pRequest, &len);
    if (status != TI_OK)
    {
		TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build SSID IE\n");
        return TI_NOK;
    }

    pRequest += len;
    *reqLen += len;

    /* insert Rates element */
    status = mlme_assocRatesBuild(pCtx, pRequest, &len);
    if (status != TI_OK)
    {
		TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build rates IE\n");
        return TI_NOK;
    }
    pRequest += len;
    *reqLen += len;

	/* Checking if the station supports Spectrum Management (802.11h) */
    param.paramType = REGULATORY_DOMAIN_MANAGEMENT_CAPABILITY_ENABLED_PARAM;
    status = regulatoryDomain_getParam(pCtx->hRegulatoryDomain,&param);
	spectrumManagementEnabled = param.content.spectrumManagementEnabled;

	/* Checking the selected AP capablities */
    param.paramType = SITE_MGR_SITE_CAPABILITY_PARAM;
    status =  siteMgr_getParam(pCtx->hSiteMgr,&param);
    if (status == TI_OK &&
    		spectrumManagementEnabled &&
    		param.content.siteMgrSiteCapability & (DOT11_SPECTRUM_MANAGEMENT != 0))
    {
         /* insert Power capability element */
         status = mlme_assocPowerCapabilityBuild(pCtx, pRequest, &len);
         if (status != TI_OK)
         {
			 TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build Power IE\n");
             return TI_NOK;
         }
         pRequest += len;
         *reqLen += len;
    }


#ifdef XCC_MODULE_INCLUDED
    status = rsn_getXCCExtendedInfoElement(pCtx->hRsn, pRequest, (TI_UINT8*)&len);
    if (status != TI_OK)
    {
        return TI_NOK;
    }
    pRequest += len;
    *reqLen += len;

    if (pCtx->reAssoc)
    {   /* insert CCKM information element only in reassoc */
        status = XCCMngr_getCckmInfoElement(pCtx->hXCCMngr, pRequest, (TI_UINT8*)&len);

        if (status != TI_OK)
        {
            return TI_NOK;
        }
        pRequest += len;
        *reqLen += len;
    }
    status = XCCMngr_getXCCVersionInfoElement(pCtx->hXCCMngr, pRequest, (TI_UINT8*)&len);
    if (status != TI_OK)
    {
        return TI_NOK;
    }
    pRequest += len;
    *reqLen += len;

    /* Insert Radio Mngt Capability IE */
    status = measurementMgr_radioMngtCapabilityBuild(pCtx->hMeasurementMgr, pRequest, (TI_UINT8*)&len);
    if (status != TI_OK)
    {
        return TI_NOK;
    }
    pRequest += len;
    *reqLen += len;
#endif

     /* Get Simple-Config state */
    param.paramType = SITE_MGR_SIMPLE_CONFIG_MODE;
    status = siteMgr_getParam(pCtx->hSiteMgr, &param);

   if (param.content.siteMgrWSCMode.WSCMode == TIWLN_SIMPLE_CONFIG_OFF)
   {
   /* insert RSN information elements */
    status = rsn_getInfoElement(pCtx->hRsn, pRequest, &len);

	if (status != TI_OK)
	{
		TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build RSN IE\n");
		return TI_NOK;
	}
	pRequest += len;
	*reqLen += len;
  }

  /* Privacy - Used later on HT */

    param.paramType = RSN_ENCRYPTION_STATUS_PARAM;

    status          = rsn_getParam(pCtx->hRsn, &param);



    if(status == TI_OK)

    {

        eCipherSuite = param.content.rsnEncryptionStatus;

    }



	/* insert QoS capability information element */
    status = qosMngr_getQosCapabiltyInfeElement(pCtx->hQosMngr,pRequest,&len);
    if (status != TI_OK)
    {
		TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build QoS capa IE\n");
        return TI_NOK;
    }
    pRequest += len;
    *reqLen += len;


    /* Primary Site support HT ? */
    param.paramType = SITE_MGR_PRIMARY_SITE_HT_SUPPORT;
    siteMgr_getParam(pCtx->hSiteMgr, &param);


    /* Disallow TKIP with HT Rates: If this is the case - discard HT rates from Association Request */
    if((TI_TRUE == param.content.bPrimarySiteHtSupport) && (eCipherSuite != TWD_CIPHER_TKIP))
    {

        status = StaCap_GetHtCapabilitiesIe (pCtx->hStaCap, pRequest, &len);
    	if (status != TI_OK)
    	{
    		return TI_NOK;
    	}
    	pRequest += len;
    	*reqLen += len;
    }

	status = qosMngr_assocReqBuild(pCtx->hQosMngr,pRequest,&len);
	if (status != TI_OK)
	{
		TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build QoS IE\n");
		return TI_NOK;
	}
	pRequest += len;
	*reqLen += len;

	status = apConn_getVendorSpecificIE(pCtx->hApConn, pRequest, &len);
	if (status != TI_OK)
	{
		TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build vendor IE\n");
		return TI_NOK;
	}
	pRequest += len;
	*reqLen += len;

    if (*reqLen>=MAX_ASSOC_MSG_LENGTH)
    {
		TRACE1(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build, reqLen = %u\n", *reqLen);
        return TI_NOK;
    }



    return TI_OK;
}
Esempio n. 5
0
/*************************************************************************
 *																		 *
 *************************************************************************
DESCRIPTION:                  
                                                      
INPUT:       

OUTPUT:      

RETURN:     
                                                   
************************************************************************/
void rsnDebugFunction(TI_HANDLE hRsn, TI_UINT32 funcType, void *pParam)
{
	paramInfo_t 	param, *pRsnParam;
	TI_UINT32			value;
    rsnAuthEncrCapability_t rsnAuthEncrCap;

	switch (funcType)
	{
	case DBG_RSN_PRINT_HELP:
		printRsnDbgFunctions();
		break;

	case DBG_RSN_SET_DESIRED_AUTH:
		WLAN_OS_REPORT(("RSN DBG - Set desired Authentication suite \n"));
		value = *(TI_UINT32*)pParam;

		param.paramType = RSN_EXT_AUTHENTICATION_MODE;
		param.content.rsnDesiredAuthType = (EAuthSuite)value;

		rsn_setParam(hRsn, &param);
		break;

	case DBG_RSN_SET_DESIRED_CIPHER:
		WLAN_OS_REPORT(("RSN DBG - Set desired cipher suite \n"));
		value = *(TI_UINT32*)pParam;

		param.paramType = RSN_ENCRYPTION_STATUS_PARAM;
		param.content.rsnEncryptionStatus = (ECipherSuite)value;

		rsn_setParam(hRsn, &param);
		break;
	

	case DBG_RSN_GEN_MIC_FAILURE_REPORT:
		value = *(TI_UINT32*)pParam;
		/* generate unicast mic failure report to the OS and to the RSN module */
		rsn_reportMicFailure(hRsn, (TI_UINT8*)&value,1);
		break;

	case DBG_RSN_GET_PARAM_802_11_CAPABILITY:
			
		param.paramType = RSN_AUTH_ENCR_CAPABILITY;
        param.content.pRsnAuthEncrCapability = &rsnAuthEncrCap;
	
        /* Get 802_11 capability info */
		rsn_getParam(hRsn, &param);
		break;
		
	case DBG_RSN_GET_PMKID_CACHE:
		
		pRsnParam = (paramInfo_t *)&infoBuf;
		pRsnParam->paramType = RSN_PMKID_LIST;
		pRsnParam->paramLength = 480;

		/* Get PMKID list */
		rsn_getParam(hRsn, pRsnParam);
		break;

	case DBG_RSN_RESET_PMKID_CACHE:
		
		rsn_resetPMKIDList(hRsn);

		break;
#ifdef XCC_MODULE_INCLUDED
    case DBG_RSN_PRINT_ROGUE_AP_TABLE:
        printRogueApTable(((XCCMngr_t*)((rsn_t*)hRsn)->hXCCMngr)->hRogueAp);
        break;
#endif

    case DBG_RSN_SET_PORT_STATUS:
        WLAN_OS_REPORT(("Setting PORT STATUS to open\n"));
        rsn_setPortStatus(hRsn,TI_TRUE);
        break;

    case DBG_RSN_PRINT_PORT_STATUS:
        {
            TI_BOOL portStatus = TI_FALSE;
            portStatus = rsn_getPortStatus(((rsn_t*)hRsn));
            WLAN_OS_REPORT(("\n\nPORT is %s !!\n",(portStatus)?"OPEN":"CLOSE"));
        }
       
        break;
	default:
		WLAN_OS_REPORT(("Invalid function type in RSN Function Command: %d\n", funcType));
		break;
	}

}