/** * \fn mlme_authMsgBuild * \brief builds authentication request * * The function builds the authentication request according to the given params * * \param pMlme - pointer to mlme_t * \param authType - auth type (OPEN or SHARED) * \param seq - message sequence number * \param statusCode - 0 in case of success * \param extraIes - pointer extra IEs buffer * \param extraIesLen - extra IEs buffer length * \param authMsg - <output> pointer of the built auth message * \param authMsgLen - <output> length of the built auth message * * \return TI_OK if auth built successfully * TI_NOK otherwise * * \sa mlme_sendAuthRequest, mlme_sendSharedRequest */ TI_STATUS mlme_authMsgBuild(mlme_t *pMlme, legacyAuthType_e authType, TI_UINT16 seq, TI_UINT16 statusCode, TI_UINT8* pExtraIes, TI_UINT8 uExtraIesLen, TI_UINT8 *authMsg, TI_UINT16 *authMsgLen) { TI_UINT8 len; authMsg_t *pAuthMsg; pAuthMsg = (authMsg_t*)authMsg; /* insert algorithm */ pAuthMsg->authAlgo = ENDIAN_HANDLE_WORD((TI_UINT16)authType); /* insert sequense */ pAuthMsg->seqNum = ENDIAN_HANDLE_WORD(seq); /* insert status code */ pAuthMsg->status = ENDIAN_HANDLE_WORD(statusCode); len = sizeof(pAuthMsg->authAlgo) + sizeof(pAuthMsg->seqNum) + sizeof(pAuthMsg->status); if (pExtraIes != NULL) { os_memoryCopy(pMlme->hOs, &authMsg[len], pExtraIes, uExtraIesLen); len += uExtraIesLen; } *authMsgLen = len; return TI_OK; }
/** * \fn RxQueue_PassPacket() * \brief Responsible on decode packet parameters and pass it to upper layer. * * \note * \param hRxQueue - RxQueue handle. * \param aStatus - RxXfer status that indicate if the upper layer should free the packet or use it. * \param pFrame - paket address of the packet * \param pRxParams - address to structure of the Rx Descriptor received by FW. * \return TI_OK on success or TI_NOK on failure * \sa */ static TI_STATUS RxQueue_PassPacket (TI_HANDLE hRxQueue, TI_STATUS tStatus, const void *pBuffer) { TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; if (tStatus == TI_OK) { /* Get the mac header location in the packet Buffer */ dot11_header_t *pMacHdr = (dot11_header_t *)(TI_UINT8*)RX_BUF_DATA(pBuffer); /* Handle endian for the frame control fields */ pMacHdr->fc = ENDIAN_HANDLE_WORD(pMacHdr->fc); pMacHdr->duration = ENDIAN_HANDLE_WORD(pMacHdr->duration); pMacHdr->seqCtrl = ENDIAN_HANDLE_WORD(pMacHdr->seqCtrl); } else { RxIfDescriptor_t *pRxParams = (RxIfDescriptor_t*)pBuffer; pRxParams->status &= ~RX_DESC_STATUS_MASK; pRxParams->status |= RX_DESC_STATUS_DRIVER_RX_Q_FAIL; } /* Set the packet to upper layer */ /* if the packet status not success it will be discarded */ pRxQueue->tReceivePacketCB (pRxQueue->hReceivePacketCB_handle, pBuffer); return TI_OK; }
/**************************************************************************** * cmdBld_CmdIeSetKey() **************************************************************************** * DESCRIPTION: Construct the SetKey command fileds and send it to the mailbox * * INPUTS: * Action - add/remove key * MacAddr - relevant only for mapping keys * KeySize - key size * KeyType - default/mapping/TKIP * KeyId - relevant only for default keys * Key - key data * * OUTPUT: None * * RETURNS: TI_OK or TI_NOK ****************************************************************************/ TI_STATUS cmdBld_CmdIeSetKey (TI_HANDLE hCmdBld, TI_UINT32 action, TI_UINT8 *pMacAddr, TI_UINT32 uKeySize, TI_UINT32 uKeyType, TI_UINT32 uKeyId, TI_UINT8 *pKey, TI_UINT32 uSecuritySeqNumLow, TI_UINT32 uSecuritySeqNumHigh, void *fCb, TI_HANDLE hCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; SetKey_t AcxCmd_SetKey; SetKey_t *pCmd = &AcxCmd_SetKey; os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd)); MAC_COPY (pCmd->addr, pMacAddr); if (uKeySize > MAX_KEY_SIZE) { os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, MAX_KEY_SIZE); } else { os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, uKeySize); } pCmd->action = ENDIAN_HANDLE_WORD((TI_UINT16)action); pCmd->keySize = (TI_UINT8)uKeySize; pCmd->type = (TI_UINT8)uKeyType; pCmd->id = (TI_UINT8)uKeyId; pCmd->ssidProfile = 0; /* * Preserve TKIP/AES security sequence number after recovery. * Note that our STA Tx is currently using only one sequence-counter * for all ACs (unlike the Rx which is separated per AC). */ pCmd->AcSeqNum16[0] = ENDIAN_HANDLE_WORD((TI_UINT16)uSecuritySeqNumLow); pCmd->AcSeqNum16[1] = 0; pCmd->AcSeqNum16[2] = 0; pCmd->AcSeqNum16[3] = 0; pCmd->AcSeqNum32[0] = ENDIAN_HANDLE_LONG(uSecuritySeqNumHigh); pCmd->AcSeqNum32[1] = 0; pCmd->AcSeqNum32[2] = 0; pCmd->AcSeqNum32[3] = 0; TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Addr: %02x:%02x:%02x:%02x:%02x:%02x\n", pCmd->addr[0],pCmd->addr[1],pCmd->addr[2],pCmd->addr[3],pCmd->addr[4],pCmd->addr[5]); TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Action=%x,keySize=0x%x,type=%x, id=%x, ssidProfile=%x, AcSeqNum16[0]=%x, AcSeqNum32[0]=%x\n", pCmd->action,pCmd->keySize, pCmd->type,pCmd->id,pCmd->ssidProfile,pCmd->AcSeqNum16[0],pCmd->AcSeqNum32[0] ); return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_KEYS, (char *)pCmd, sizeof(*pCmd), fCb, hCb, NULL); }
/**************************************************************************** * cmdBld_CmdIeSetKey() **************************************************************************** * DESCRIPTION: Construct the SetKey command fileds and send it to the mailbox * * INPUTS: * Action - add/remove key * MacAddr - relevant only for mapping keys * KeySize - key size * KeyType - default/mapping/TKIP * KeyId - relevant only for default keys * Key - key data * * OUTPUT: None * * RETURNS: TI_OK or TI_NOK ****************************************************************************/ TI_STATUS cmdBld_CmdIeSetKey (TI_HANDLE hCmdBld, TI_UINT32 action, TI_UINT8 *pMacAddr, TI_UINT32 uKeySize, TI_UINT32 uKeyType, TI_UINT32 uKeyId, TI_UINT8 *pKey, TI_UINT32 uSecuritySeqNumLow, TI_UINT32 uSecuritySeqNumHigh, void *fCb, TI_HANDLE hCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; SetKey_t AcxCmd_SetKey; SetKey_t *pCmd = &AcxCmd_SetKey; os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd)); MAC_COPY (pCmd->addr, pMacAddr); if (uKeySize > MAX_KEY_SIZE) { os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, MAX_KEY_SIZE); } else { os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, uKeySize); } pCmd->action = ENDIAN_HANDLE_WORD((TI_UINT16)action); pCmd->keySize = (TI_UINT8)uKeySize; pCmd->type = (TI_UINT8)uKeyType; pCmd->id = (TI_UINT8)uKeyId; pCmd->ssidProfile = 0; /* * Preserve TKIP/AES security sequence number after recovery. * If not in reconfig set to 0 so the FW will ignore it and keep its own number. * Note that our STA Tx is currently using only one sequence-counter * for all ACs (unlike the Rx which is separated per AC). */ if (pCmdBld->bReconfigInProgress == TI_FALSE) { uSecuritySeqNumLow = uSecuritySeqNumHigh = 0; } pCmd->AcSeqNum16[0] = ENDIAN_HANDLE_WORD((TI_UINT16)uSecuritySeqNumLow); pCmd->AcSeqNum16[1] = 0; pCmd->AcSeqNum16[2] = 0; pCmd->AcSeqNum16[3] = 0; pCmd->AcSeqNum32[0] = ENDIAN_HANDLE_LONG(uSecuritySeqNumHigh); pCmd->AcSeqNum32[1] = 0; pCmd->AcSeqNum32[2] = 0; pCmd->AcSeqNum32[3] = 0; return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_KEYS, (char *)pCmd, sizeof(*pCmd), fCb, hCb, NULL); }
/**************************************************************************** * cmdBld_CmdIeSetKey() **************************************************************************** * DESCRIPTION: Construct the SetKey command fileds and send it to the mailbox * * INPUTS: * Action - add/remove key * MacAddr - relevant only for mapping keys * KeySize - key size * KeyType - default/mapping/TKIP * KeyId - relevant only for default keys * Key - key data * * OUTPUT: None * * RETURNS: TI_OK or TI_NOK ****************************************************************************/ TI_STATUS cmdBld_CmdIeSetKey (TI_HANDLE hCmdBld, TI_UINT32 action, TI_UINT8 hlid, TI_UINT8 lidkeytype, TI_UINT32 uKeySize, TI_UINT32 uKeyType, TI_UINT32 uKeyId, TI_UINT8 *pKey, TI_UINT32 uSecuritySeqNumLow, TI_UINT32 uSecuritySeqNumHigh, void *fCb, TI_HANDLE hCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; SetKey_t AcxCmd_SetKey; SetKey_t *pCmd = &AcxCmd_SetKey; os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd)); if (uKeySize > MAX_KEY_SIZE) { os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, MAX_KEY_SIZE); } else { os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, uKeySize); } pCmd->hlid = hlid; pCmd->lidKeyType = lidkeytype; pCmd->action = ENDIAN_HANDLE_WORD((TI_UINT16)action); pCmd->keySize = (TI_UINT8)uKeySize; pCmd->type = (TI_UINT8)uKeyType; pCmd->keyId = (TI_UINT8)uKeyId; /* * Preserve TKIP/AES security sequence number after recovery. * Note that our STA Tx is currently using only one sequence-counter * for all ACs (unlike the Rx which is separated per AC). */ pCmd->AcSeqNum16[0] = ENDIAN_HANDLE_WORD((TI_UINT16)uSecuritySeqNumLow); pCmd->AcSeqNum16[1] = 0; pCmd->AcSeqNum16[2] = 0; pCmd->AcSeqNum16[3] = 0; pCmd->AcSeqNum32[0] = ENDIAN_HANDLE_LONG(uSecuritySeqNumHigh); pCmd->AcSeqNum32[1] = 0; pCmd->AcSeqNum32[2] = 0; pCmd->AcSeqNum32[3] = 0; return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_KEYS, (char *)pCmd, sizeof(*pCmd), fCb, hCb, NULL); }
/**************************************************************************** * cmdBld_CmdIeNoiseHistogram () **************************************************************************** * DESCRIPTION: Send NOISE_HISTOGRAM Command * * INPUTS: None * * OUTPUT: None * * RETURNS: TI_OK or TI_NOK ****************************************************************************/ TI_STATUS cmdBld_CmdIeNoiseHistogram (TI_HANDLE hCmdBld, TNoiseHistogram *pNoiseHistParams, void *fCb, TI_HANDLE hCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; NoiseHistRequest_t AcxCmd_NoiseHistogram; NoiseHistRequest_t *pCmd = &AcxCmd_NoiseHistogram; os_memoryZero(pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd)); pCmd->mode = ENDIAN_HANDLE_WORD((TI_UINT16)pNoiseHistParams->cmd); pCmd->sampleIntervalUSec = ENDIAN_HANDLE_WORD(pNoiseHistParams->sampleInterval); os_memoryCopy (pCmdBld->hOs, (void *)&(pCmd->thresholds[0]), (void *)&(pNoiseHistParams->ranges[0]), MEASUREMENT_NOISE_HISTOGRAM_NUM_OF_RANGES); return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_NOISE_HIST, (TI_CHAR *)pCmd, sizeof(*pCmd), fCb, hCb, NULL); }
/** * * auth_stop - Stop event for the authentication SM * * \b Description: * * Stop event for the authentication SM * * \b ARGS: * * I - hAuth - Authentication SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa auth_Start, auth_Recv */ TI_STATUS auth_stop(TI_HANDLE hAuth, TI_BOOL sendDeAuth, mgmtStatus_e reason ) { auth_t *pHandle; pHandle = (auth_t*)hAuth; if (pHandle == NULL) return TI_NOK; if (pHandle->authType == AUTH_LEGACY_NONE) return TI_NOK; if( sendDeAuth == TI_TRUE ) { deAuth_t deAuth; deAuth.reason = ENDIAN_HANDLE_WORD(reason); mlmeBuilder_sendFrame(pHandle->hMlme, DE_AUTH, (TI_UINT8*)&deAuth, sizeof(deAuth_t), 0); } switch (pHandle->authType) { case AUTH_LEGACY_RESERVED1: case AUTH_LEGACY_OPEN_SYSTEM: return auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_STOP, pHandle); case AUTH_LEGACY_SHARED_KEY: return auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_STOP, pHandle); default: return TI_NOK; } }
/** * * openAuth_Recv - Recive a message from the AP * * \b Description: * * Parse a message form the AP and perform the appropriate event. * * \b ARGS: * * I - hAuth - Association SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa openAuth_Start, openAuth_Stop */ TI_STATUS openAuth_Recv(TI_HANDLE hAuth, mlmeFrameInfo_t *pFrame) { TI_STATUS status; auth_t *pHandle; TI_UINT16 authAlgo; pHandle = (auth_t*)hAuth; if (pHandle == NULL) { return TI_NOK; } /* check response status */ authAlgo = ENDIAN_HANDLE_WORD(pFrame->content.auth.authAlgo); if ((authAlgo != AUTH_LEGACY_OPEN_SYSTEM) && (authAlgo != AUTH_LEGACY_RESERVED1)) { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); return TI_NOK; } if ((pHandle->authType==AUTH_LEGACY_RESERVED1) && (authAlgo !=AUTH_LEGACY_RESERVED1)) { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); } pHandle->authData.status = pFrame->content.auth.status; if (pHandle->authData.status == STATUS_SUCCESSFUL) { status = auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_SUCCESS, pHandle); } else { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); status = auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_FAIL, pHandle); } return status; }
TI_STATUS cmdBld_CmdIeBssStart (TI_HANDLE hCmdBld, BssStartCmd_t *pBssStartParams, void* fCB, TI_HANDLE hCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; BssStartCmd_t tCmdBssStart; BssStartCmd_t *pCmd = &tCmdBssStart ; TI_UINT8 tmpSsid[33] = {0}; /* For debug only - Remove later!!*/ os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd)); pCmd->bssIndex = pBssStartParams->bssIndex; pCmd->beaconInterval = ENDIAN_HANDLE_WORD(pBssStartParams->beaconInterval); pCmd->dtimInterval = pBssStartParams->dtimInterval; pCmd->agingPeriod = ENDIAN_HANDLE_WORD(pBssStartParams->agingPeriod); pCmd->channelNumber = pBssStartParams->channelNumber; pCmd->band = pBssStartParams->band; pCmd->broadcastHLID = pBssStartParams->broadcastHLID; pCmd->globalHLID = pBssStartParams->globalHLID; pCmd->basicRateSet = ENDIAN_HANDLE_LONG(pBssStartParams->basicRateSet); pCmd->beaconExpiry = pBssStartParams->beaconExpiry; os_memoryCopy(pCmdBld->hOs, &pCmd->ssid, &pBssStartParams->ssid, sizeof(SSID_t)); os_memoryCopy(pCmdBld->hOs, pCmd->bssid, pBssStartParams->bssid, MAC_ADDR_LEN); os_memoryCopy(pCmdBld->hOs, &tmpSsid, &pBssStartParams->ssid.ssid, pBssStartParams->ssid.ssidLength); tmpSsid[pBssStartParams->ssid.ssidLength]= '\0'; WLAN_OS_REPORT(("\n%s: ------------------------------------------->\n", __FUNCTION__)); WLAN_OS_REPORT(("ssid=%s len=%d bssid=%02X:%02X:%02X:%02X:%02X:%02X Indx=%d\n", tmpSsid, pCmd->ssid.ssidLength, pCmd->bssid[0],pCmd->bssid[1],pCmd->bssid[2],pCmd->bssid[3],pCmd->bssid[4],pCmd->bssid[5], pCmd->bssIndex)); WLAN_OS_REPORT(("beacon=%d dtim=%d aging=%d chan=%d band=%d\n", pCmd->beaconInterval, pCmd->dtimInterval, pCmd->agingPeriod, pCmd->channelNumber, pCmd->band)); WLAN_OS_REPORT(("brdcstHLID=%d globalHLID=%d ssidType=%d basicRates=0x%04x beacon expiry=%d\n", pCmd->broadcastHLID, pCmd->globalHLID, pCmd->ssid.ssidType, (TI_UINT32)pCmd->basicRateSet, pCmd->beaconExpiry)); WLAN_OS_REPORT(("%s: <--------------------------------------------\n", __FUNCTION__)); return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_BSS_START, (void *)pCmd, sizeof(*pCmd), fCB, hCb, NULL); }
/**************************************************************************** * cmdBld_CmdIeStartBss() **************************************************************************** * DESCRIPTION: Construct the StartBss command fileds and send it to the mailbox * * INPUTS: None * * OUTPUT: None * * RETURNS: TI_OK or TI_NOK ****************************************************************************/ TI_STATUS cmdBld_CmdIeStartBss (TI_HANDLE hCmdBld, BSS_e BssType, void *fJoinCompleteCb, TI_HANDLE hCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; StartJoinRequest_t AcxCmd_StartBss; StartJoinRequest_t *pCmd = &AcxCmd_StartBss; TSsid *pSsid = &DB_BSS(hCmdBld).tSsid; TBssInfoParams *pBssInfoParams = &DB_BSS(hCmdBld); TI_UINT8 *BssId; TI_UINT8 *cmdBssId; EHwRateBitFiled HwBasicRatesBitmap; TI_UINT32 i; os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(StartJoinRequest_t)); /* * Set RxCfg and RxFilterCfg values */ pCmd->rxFilter.ConfigOptions = ENDIAN_HANDLE_LONG (DB_WLAN(hCmdBld).RxConfigOption); pCmd->rxFilter.FilterOptions = ENDIAN_HANDLE_LONG (DB_WLAN(hCmdBld).RxFilterOption); pCmd->beaconInterval = ENDIAN_HANDLE_WORD (DB_BSS(hCmdBld).BeaconInterval); pCmd->dtimInterval = DB_BSS(hCmdBld).DtimInterval; pCmd->channelNumber = DB_BSS(hCmdBld).RadioChannel; pCmd->bssType = BssType; /* Add radio band */ pCmd->bssType |= DB_WLAN(hCmdBld).RadioBand << 4; /* Bits 0-2: Tx-Session-Count. bit 7: indicates if to flush the Tx queues */ pCmd->ctrl = pBssInfoParams->Ctrl; /* * BasicRateSet * The wlan hardware uses pHwMboxCmd field to determine the rate at which to transmit * control frame responses (such as ACK or CTS frames) */ cmdBld_ConvertAppRatesBitmap (pBssInfoParams->BasicRateSet, 0, &HwBasicRatesBitmap); pCmd->basicRateSet = ENDIAN_HANDLE_LONG(HwBasicRatesBitmap); /* BSS ID - reversed order (see wlan hardware spec) */ BssId = DB_BSS(hCmdBld).BssId; cmdBssId = (TI_UINT8*)&pCmd->bssIdL; for (i = 0; i < MAC_ADDR_LEN; i++) cmdBssId[i] = BssId[MAC_ADDR_LEN - 1 - i]; /* SSID string */ pCmd->ssidLength = pSsid->len; os_memoryCopy (pCmdBld->hOs, (void *)pCmd->ssidStr, (void *)pSsid->str, pSsid->len); return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_START_JOIN, (TI_CHAR *)pCmd, sizeof(*pCmd), fJoinCompleteCb, hCb, NULL); }
/** * * auth_smMsgBuild - Build an authentication message and send it to the mlme builder * * \b Description: * * Build an authentication message and send it to the mlme builder. * * \b ARGS: * * I - pAssoc - Association SM context \n * I/O - pParam - Parameter \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa auth_Start, auth_Stop */ TI_STATUS auth_smMsgBuild(auth_t *pCtx, TI_UINT16 seq, TI_UINT16 statusCode, TI_UINT8* pChallange, TI_UINT8 challangeLen) { TI_STATUS status; TI_UINT8 len; TI_UINT8 authMsg[MAX_AUTH_MSG_LEN]; authMsg_t *pAuthMsg; dot11_CHALLENGE_t *pDot11Challenge; TI_UINT8 wepOpt; wepOpt = 0; pAuthMsg = (authMsg_t*)authMsg; /* insert algorithm */ pAuthMsg->authAlgo = (TI_UINT16)pCtx->authType; /* insert sequense */ pAuthMsg->seqNum = ENDIAN_HANDLE_WORD(seq); /* insert status code */ pAuthMsg->status = ENDIAN_HANDLE_WORD(statusCode); len = sizeof(pAuthMsg->authAlgo) + sizeof(pAuthMsg->seqNum) + sizeof(pAuthMsg->status); if (pChallange != NULL) { pDot11Challenge = (dot11_CHALLENGE_t*)&authMsg[len]; pDot11Challenge->hdr[0] = CHALLANGE_TEXT_IE_ID; pDot11Challenge->hdr[1] = challangeLen; os_memoryCopy(pCtx->hOs, (void *)pDot11Challenge->text, pChallange, challangeLen); len += challangeLen + 2; wepOpt = 1; } status = mlmeBuilder_sendFrame(pCtx->hMlme, AUTH, authMsg, len, wepOpt); return status; }
/**************************************************************************** * cmdBld_CmdIeConfigureTemplateFrame() **************************************************************************** * DESCRIPTION: Generic function which sets the Fw with a template frame according * to the given template type. * * INPUTS: templateType - CMD_BEACON, CMD_PROBE_REQ, CMD_PROBE_RESP etc. * * OUTPUT: None * * RETURNS: TI_OK or TI_NOK ****************************************************************************/ TI_STATUS cmdBld_CmdIeConfigureTemplateFrame (TI_HANDLE hCmdBld, TTemplateParams *pTemplate, TI_UINT16 uFrameSize, TemplateType_e eTemplateType, TI_UINT8 uIndex, void * fCb, TI_HANDLE hCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; PktTemplate_t AcxCmd_PktTemplate; PktTemplate_t *pCmd = &AcxCmd_PktTemplate; /* If the frame size is too big - we truncate the frame template */ if (uFrameSize > MAX_TEMPLATES_SIZE) { EReportSeverity eReportSeverity = (pTemplate == NULL) ? REPORT_SEVERITY_WARNING : REPORT_SEVERITY_ERROR; /* Report as error only if this is the actual template and not just a space holder */ TRACE3(pCmdBld->hReport, eReportSeverity, "cmdBld_CmdIeConfigureTemplateFrame: Frame size (=%d) of CmdType (=%d) is bigger than MAX_TEMPLATES_SIZE(=%d) !!!\n", uFrameSize, eTemplateType, MAX_TEMPLATES_SIZE); /* Truncate length to the template size limit */ uFrameSize = MAX_TEMPLATES_SIZE; } /* WLAN_OS_REPORT(("DloadTempl type =%d size=%d\n", eTemplateType, uFrameSize)); */ /* if pTemplate is NULL than it means that we just want to reserve place in Fw, and there is no need to copy */ if (pTemplate != NULL) { os_memoryCopy(pCmdBld->hOs, (void *)&pCmd->templateStart, (void *)(pTemplate->Buffer), uFrameSize); pCmd->templateTxAttribute.enabledRates = pTemplate->uRateMask; } pCmd->len = ENDIAN_HANDLE_WORD(uFrameSize); pCmd->index = uIndex; pCmd->templateType = eTemplateType; pCmd->templateTxAttribute.shortRetryLimit = 10; pCmd->templateTxAttribute.longRetryLimit = 10; #ifdef TI_DBG if (pCmdBld->uDbgTemplatesRateMask != 0) { pCmd->templateTxAttribute.enabledRates = pCmdBld->uDbgTemplatesRateMask; } #endif return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_TEMPLATE, (TI_CHAR *)pCmd, sizeof (PktTemplate_t), fCb, hCb, NULL); }
/** * \author Ronen Kalish\n * \date 29-Dec-2004\n * \brief Callback function used by the HAL ctrl to notify scan complete * * Function Scope \e Public.\n * \param hScanSRV - handle to the scan SRV object.\n * \param str - pointer to scan result buffer (holding SPS status for SPS scan only!).\n * \param strLen - scan result buffer length (should ALWAYS be 2, even for non SPS scans).\n */ void MacServices_scanSRV_scanCompleteCB( TI_HANDLE hScanSRV, char* str, UINT32 strLen ) { scanSRV_t *pScanSRV = (scanSRV_t*)hScanSRV; WLAN_REPORT_INFORMATION( pScanSRV->hReport, SCAN_SRV_MODULE_LOG, ("Scan complete notification from TNET.\n") ); /* nullify the consecutive no scan complete events counter - only if this is a scan complete that does not happen afetr a stop scan (due to a timer expiry) */ if ( FALSE == pScanSRV->bNoScanCompleteFlag ) { pScanSRV->currentNumberOfConsecutiveNoScanCompleteEvents = 0; } /* copy scan results according to scan type (only meaningful for SPS scan) */ if ( FALSE == pScanSRV->bSPSScan ) { /* normal scan - no result is available */ pScanSRV->bTSFError = FALSE; WLAN_REPORT_INFORMATION( pScanSRV->hReport, SCAN_SRV_MODULE_LOG, ("Normal scan completed.\n") ); } else { /* SPS scan - first byte indicates whether a TSF error (AP recovery) occured */ if ( 0 != str[ 0 ] ) { pScanSRV->bTSFError = TRUE; } else { pScanSRV->bTSFError = FALSE; } /* next two bytes indicates on which channels scan was attempted */ /* pScanSRV->SPSScanResult = ENDIAN_HANDLE_WORD( *((UINT16*)&(str[ 1 ])) ); */ /* Swap of aligned UINT16* */ COPY_UNALIGNED_WORD(&pScanSRV->SPSScanResult, &str[1]); pScanSRV->SPSScanResult = ENDIAN_HANDLE_WORD( pScanSRV->SPSScanResult ); WLAN_REPORT_INFORMATION( pScanSRV->hReport, SCAN_SRV_MODULE_LOG, ("SPS scan completed. TSF error: %s, SPS result: %x\n", (TRUE == pScanSRV->bTSFError ? "Yes": "No"), pScanSRV->SPSScanResult) ); } /* send a SCAN_COMPLETE event */ scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_SCAN_COMPLETE ); }
/**************************************************************************** * cmdBld_CmdIeConfigureTemplateFrame() **************************************************************************** * DESCRIPTION: Generic function which sets the Fw with a template frame according * to the given template type. * * INPUTS: templateType - CMD_BEACON, CMD_PROBE_REQ, CMD_PROBE_RESP etc. * * OUTPUT: None * * RETURNS: TI_OK or TI_NOK ****************************************************************************/ TI_STATUS cmdBld_CmdIeConfigureTemplateFrame (TI_HANDLE hCmdBld, TTemplateParams *pTemplate, TI_UINT16 uFrameSize, TemplateType_e eTemplateType, TI_UINT8 uIndex, void * fCb, TI_HANDLE hCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; PktTemplate_t AcxCmd_PktTemplate; PktTemplate_t *pCmd = &AcxCmd_PktTemplate; /* If the frame size is too big - we truncate the frame template */ if (uFrameSize > MAX_TEMPLATES_SIZE) { /* Report as error only if this is the actual template and not just a space holder */ /* Truncate length to the template size limit */ uFrameSize = MAX_TEMPLATES_SIZE; } /* if pTemplate is NULL than it means that we just want to reserve place in Fw, and there is no need to copy */ if (pTemplate != NULL) { os_memoryCopy(pCmdBld->hOs, (void *)&pCmd->templateStart, (void *)(pTemplate->Buffer), uFrameSize); pCmd->templateTxAttribute.enabledRates = pTemplate->uRateMask; } pCmd->len = ENDIAN_HANDLE_WORD(uFrameSize); pCmd->index = uIndex; pCmd->templateType = eTemplateType; pCmd->templateTxAttribute.shortRetryLimit = 2; pCmd->templateTxAttribute.longRetryLimit = 2; #ifdef TI_DBG if (pCmdBld->uDbgTemplatesRateMask != 0) { pCmd->templateTxAttribute.enabledRates = pCmdBld->uDbgTemplatesRateMask; } #endif return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_TEMPLATE, (TI_CHAR *)pCmd, sizeof (PktTemplate_t), fCb, hCb, NULL); }
/** * * openAuth_Recv - Recive a message from the AP * * \b Description: * * Parse a message form the AP and perform the appropriate event. * * \b ARGS: * * I - hAuth - Association SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa openAuth_Start, openAuth_Stop */ TI_STATUS openAuth_Recv(TI_HANDLE hAuth, mlmeFrameInfo_t *pFrame) { TI_STATUS status; auth_t *pHandle; TI_UINT16 authAlgo; pHandle = (auth_t*)hAuth; if (pHandle == NULL) { return TI_NOK; } /* check response status */ authAlgo = ENDIAN_HANDLE_WORD(pFrame->content.auth.authAlgo); if ((authAlgo != AUTH_LEGACY_OPEN_SYSTEM) && (authAlgo != AUTH_LEGACY_RESERVED1)) { TRACE0(pHandle->hReport, REPORT_SEVERITY_SM, "OPEN_AUTH_SM: DEBUG recieved authentication message with wrong algorithm \n"); rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); return TI_NOK; } if ((pHandle->authType==AUTH_LEGACY_RESERVED1) && (authAlgo !=AUTH_LEGACY_RESERVED1)) { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); } TRACE1(pHandle->hReport, REPORT_SEVERITY_SM, "OPEN_AUTH_SM: DEBUG Authentication status is %d \n", pFrame->content.auth.status); pHandle->authData.status = pFrame->content.auth.status; if (pHandle->authData.status == STATUS_SUCCESSFUL) { status = auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_SUCCESS, pHandle); } else { rsn_reportAuthFailure(pHandle->hRsn, RSN_AUTH_STATUS_INVALID_TYPE); status = auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_FAIL, pHandle); } return status; }
void txCtrlBlk_PrintTable (TI_HANDLE hTxCtrlBlk) { TTxCtrlBlkObj *pTxCtrlBlk = (TTxCtrlBlkObj *)hTxCtrlBlk; TI_UINT8 entry; WLAN_OS_REPORT((" Tx-Control-Block Information, UsedEntries=%d\n", pTxCtrlBlk->uNumUsedEntries)); WLAN_OS_REPORT(("==============================================\n")); for (entry = 0; entry < CTRL_BLK_ENTRIES_NUM; entry++) { WLAN_OS_REPORT(("Entry %d: DescID=%d, Next=0x%x, Len=%d, StartTime=%d, TID=%d, ExtraBlks=%d, TotalBlks=%d, Flags=0x%x\n", entry, pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.descID, pTxCtrlBlk->aTxCtrlBlkTbl[entry].pNextFreeEntry, ENDIAN_HANDLE_WORD(pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.length), ENDIAN_HANDLE_LONG(pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.startTime), pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.tid, pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.extraMemBlks, pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.totalMemBlks, pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxPktParams.uFlags)); } }
/**************************************************************************** * cmdBld_CmdIeApDiscovery() **************************************************************************** * DESCRIPTION: send Command for AP Discovery * to the mailbox * * INPUTS: None * * OUTPUT: None * * RETURNS: TI_OK or TI_NOK ****************************************************************************/ TI_STATUS cmdBld_CmdIeApDiscovery (TI_HANDLE hCmdBld, TApDiscoveryParams *pApDiscoveryParams, void *fCb, TI_HANDLE hCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; ApDiscoveryParameters_t Cmd_ApDiscovery; ApDiscoveryParameters_t *pCmd = &Cmd_ApDiscovery; os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd)); pCmd->txPowerAttenuation = pApDiscoveryParams->txPowerDbm; pCmd->numOfProbRqst = pApDiscoveryParams->numOfProbRqst; pCmd->scanDuration = ENDIAN_HANDLE_LONG(pApDiscoveryParams->scanDuration); pCmd->scanOptions = ENDIAN_HANDLE_WORD(pApDiscoveryParams->scanOptions); pCmd->txdRateSet = ENDIAN_HANDLE_LONG(pApDiscoveryParams->txdRateSet); pCmd->rxFilter.ConfigOptions = ENDIAN_HANDLE_LONG(pApDiscoveryParams->ConfigOptions); pCmd->rxFilter.FilterOptions = ENDIAN_HANDLE_LONG(pApDiscoveryParams->FilterOptions); return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_AP_DISCOVERY, (void *)pCmd, sizeof(*pCmd), fCb, hCb, NULL); }
/** * * sharedKeyAuth_Recv - Recive a message from the AP * * \b Description: * * Parse a message form the AP and perform the appropriate event. * * \b ARGS: * * I - hAuth - Association SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa sharedKeyAuth_Start, sharedKeyAuth_Stop */ TI_STATUS sharedKeyAuth_Recv(TI_HANDLE hAuth, mlmeFrameInfo_t *pFrame) { TI_STATUS status = TI_NOK; auth_t *pHandle; TI_UINT16 authAlgo; TI_UINT16 rspSeq; pHandle = (auth_t*)hAuth; if (pHandle == NULL) { return TI_NOK; } /* check response status */ authAlgo = ENDIAN_HANDLE_WORD(pFrame->content.auth.authAlgo); if (authAlgo != AUTH_LEGACY_SHARED_KEY) { return TI_NOK; } /* check response status */ rspSeq = pFrame->content.auth.seqNum; pHandle->authData.status = pFrame->content.auth.status; pHandle->authData.pChalange = (char *)(pFrame->content.auth.pChallenge->text); pHandle->authData.challangeLen = pFrame->content.auth.pChallenge->hdr[1]; if (pHandle->authData.status == STATUS_SUCCESSFUL) { switch (rspSeq) { case 2: if (pFrame->content.auth.pChallenge->hdr[0] != CHALLANGE_TEXT_IE_ID) { status = TI_NOK; break; } status = auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_SUCCESS_1, hAuth); break; case 4: status = auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_SUCCESS_2, hAuth); break; default: status = TI_NOK; break; } } else { switch (rspSeq) { case 2: status = auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_FAIL_1, hAuth); break; case 4: status = auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_FAIL_2, hAuth); break; default: status = TI_NOK; break; } } return status; }
/** * * sharedKeyAuth_Recv - Recive a message from the AP * * \b Description: * * Parse a message form the AP and perform the appropriate event. * * \b ARGS: * * I - hAuth - Association SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa sharedKeyAuth_Start, sharedKeyAuth_Stop */ TI_STATUS sharedKeyAuth_Recv(TI_HANDLE hAuth, mlmeFrameInfo_t *pFrame) { TI_STATUS status = TI_NOK; auth_t *pHandle; TI_UINT16 authAlgo; TI_UINT16 rspSeq; pHandle = (auth_t*)hAuth; if (pHandle == NULL) { return TI_NOK; } /* check response status */ authAlgo = ENDIAN_HANDLE_WORD(pFrame->content.auth.authAlgo); if (authAlgo != AUTH_LEGACY_SHARED_KEY) { TRACE0(pHandle->hReport, REPORT_SEVERITY_SM, "SHARED_KEY_AUTH_SM: DEBUG recieved authentication message with wrong algorithm \n"); return TI_NOK; } /* check response status */ rspSeq = pFrame->content.auth.seqNum; pHandle->authData.status = pFrame->content.auth.status; pHandle->authData.pChalange = (char *)(pFrame->content.auth.pChallenge->text); pHandle->authData.challangeLen = pFrame->content.auth.pChallenge->hdr[1]; if (pHandle->authData.status == STATUS_SUCCESSFUL) { switch (rspSeq) { case 2: TRACE0(pHandle->hReport, REPORT_SEVERITY_SM, "SHARED_KEY_AUTH_SM: DEBUG Success authenticating to AP stage 1\n"); if (pFrame->content.auth.pChallenge->hdr[0] != CHALLANGE_TEXT_IE_ID) { TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "SHARED_KEY_AUTH_SM: Wrong element ID for challange \n"); status = TI_NOK; break; } status = auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_SUCCESS_1, hAuth); break; case 4: TRACE0(pHandle->hReport, REPORT_SEVERITY_SM, "SHARED_KEY_AUTH_SM: DEBUG Success authenticating to AP stage 2\n"); status = auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_SUCCESS_2, hAuth); break; default: TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "SHARED_KEY_AUTH_SM: Wrong sequence number \n"); status = TI_NOK; break; } } else { switch (rspSeq) { case 2: status = auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_FAIL_1, hAuth); break; case 4: status = auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_FAIL_2, hAuth); break; default: status = TI_NOK; break; } } return status; }
/** * \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, ¶m); 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,¶m); spectrumManagementEnabled = param.content.spectrumManagementEnabled; /* Checking the selected AP capablities */ param.paramType = SITE_MGR_SITE_CAPABILITY_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr,¶m); 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, ¶m); 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, ¶m); 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, ¶m); /* 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; }
/************************************************************************ * insertMeasurementIEToQueue * ************************************************************************ DESCRIPTION: The function inserts measurement request of one received measurement request information element. INPUT: hRequestHandler - A Handler to the Request Handler Object. frameToken - Frame token of the received frame in which This current measurement request IE is included. measurementObjMode - XCC or SPECTRUM_MNGMNT dataLen - pointer to the data length that is left. pData - pointer to the data. OUTPUT: singelRequestLen - The Length of the request that was inserted to the queue. RETURN: TI_OK on success, TI_NOK otherwise ************************************************************************/ static TI_STATUS insertMeasurementIEToQueue(TI_HANDLE hRequestHandler, TI_UINT16 frameToken, EMeasurementMode measurementObjMode, TI_UINT8 *pData, TI_UINT8 *singelRequestLen) { requestHandler_t *pRequestHandler = (requestHandler_t *)hRequestHandler; TI_UINT16 HeaderLen; TI_UINT8 measurementMode; TI_UINT8 parallelBit; TI_UINT8 enableBit; TI_UINT16 durationTime; TI_UINT16 measurementToken; MeasurementRequest_t *pCurrRequest = &(pRequestHandler->reqArr[pRequestHandler->numOfWaitingRequests]); if (pRequestHandler->parserRequestIEHdr(pData, &HeaderLen, &measurementToken) != TI_OK) { return TI_NOK; } pCurrRequest->frameToken = frameToken; pCurrRequest->measurementToken = measurementToken; pData += HeaderLen; /*** Getting the Measurement Mode ***/ measurementMode = *pData++; /* getting parallel bit */ parallelBit = measurementMode & 0x1; /* getting Enable bit */ enableBit = (measurementMode & 0x2)>>1; /* checking enable bit, the current implementation does not support enable bit which set to one, so there is no need to check request/report bits */ if(enableBit == 1) return TI_OK; pCurrRequest->isParallel = parallelBit; /* Getting the Measurement Mode */ pCurrRequest->Type = (EMeasurementType)(*pData++); /* Inserting the request that is included in the current measurement request IE. */ pCurrRequest->channelNumber = *pData++; pCurrRequest->ScanMode = (EMeasurementScanMode)(*pData++); /* IN dot11h - Spare = 0 */ os_memoryCopy(pRequestHandler->hOs, &durationTime, pData, 2); durationTime = ENDIAN_HANDLE_WORD(durationTime); pCurrRequest->DurationTime = durationTime; *singelRequestLen = HeaderLen + 6; pRequestHandler->numOfWaitingRequests ++; return TI_OK; }