/** * \fn mlme_sendAssocRequest * \brief sends association request * * The function builds and sends the association request according to the * mlme parames * * \param pMlme - pointer to mlme_t * \return TI_OK if auth send successfully * TI_NOK otherwise * * \sa mlme_assocRequestMsgBuild */ TI_STATUS mlme_sendAssocRequest(mlme_t *pMlme) { TI_STATUS status = TI_OK; static TI_UINT8 assocMsg[MAX_ASSOC_MSG_LENGTH]; TI_UINT32 msgLen; dot11MgmtSubType_e assocType=ASSOC_REQUEST; if ( pMlme->assocInfo.retryCount >= pMlme->assocInfo.maxCount) { TRACE0(pMlme->hReport, REPORT_SEVERITY_ERROR, "mlme_sendAssocRequest: retry count - failed to send assoc request\n"); pMlme->mlmeData.mgmtStatus = STATUS_UNSPECIFIED; pMlme->mlmeData.uStatusCode = TI_NOK; mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_FAIL, pMlme); return TI_NOK; } pMlme->assocInfo.retryCount++; if (pMlme->reAssoc) { assocType = RE_ASSOC_REQUEST; } status = mlme_assocRequestMsgBuild(pMlme, assocMsg, &msgLen); if (status == TI_OK) { TRACE_INFO_HEX(pMlme->hReport,(TI_UINT8 *)assocMsg, msgLen); /* Save the association request message */ mlme_saveAssocReqMessage(pMlme, assocMsg, msgLen); status = mlmeBuilder_sendFrame(pMlme, assocType, assocMsg, msgLen, 0); } return status; }
/** * \fn mlme_sendAuthRequest * \brief sends authentication request * * The function builds and sends the authentication request according to the * mlme parames * * \param pMlme - pointer to mlme_t * \return TI_OK if auth send successfully * TI_NOK otherwise * * \sa mlme_authMsgBuild */ TI_STATUS mlme_sendAuthRequest(mlme_t *pMlme) { TI_STATUS status = TI_OK; TI_UINT8 authMsg[MAX_AUTH_MSG_LEN] = {0}; TI_UINT16 authMsgLen = 0; legacyAuthType_e authType = pMlme->authInfo.authType; TI_UINT16 seq = 1, statusCode = 0; TI_UINT8* pExtraIes = NULL; TI_UINT8 uExtraIesLen = pMlme->extraIesLen; TRACE2(pMlme->hReport, REPORT_SEVERITY_INFORMATION, "mlme_sendAuthRequest: retryCount = %d, maxCount = %d\n", pMlme->authInfo.retryCount, pMlme->authInfo.maxCount); if (pMlme->authInfo.retryCount >= pMlme->authInfo.maxCount) { return TI_NOK; } pMlme->authInfo.retryCount++; /* TODO - YD - 802.11r add the extra Ies in case of BSS FT authentication and RSN in the build auth and assoc*/ if (pMlme->extraIesLen > 0) { pExtraIes = pMlme->extraIes; } mlme_authMsgBuild(pMlme, authType, seq, statusCode, pExtraIes, uExtraIesLen, (TI_UINT8*)authMsg, &authMsgLen); status = mlmeBuilder_sendFrame(pMlme, AUTH, authMsg, authMsgLen, 0); if (status != TI_OK) { TRACE0(pMlme->hReport, REPORT_SEVERITY_ERROR, "mlme_sendAuthRequest: failed to send auth request\n"); } return status; }
/** * * 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; } }
/** * * 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; }
void sendMgmtPacket(TI_HANDLE hOs) { static TI_UINT8 aMsg[2000]; TI_UINT32 i; dot11MgmtSubType_e eMsgType = DE_AUTH; for (i = 0; i < packetLength; i++) { aMsg[i] = i; } mlmeBuilder_sendFrame(tmp_hMlme, eMsgType, aMsg, packetLength, 0); numOfPackets++; if ((infinitLoopFl == 0) && (numOfPackets > packetsNum)) { os_timerStop(hOs, dTimer); os_printf("\n *********** Last Packet was sent **********"); os_timerDestroy(hOs, dTimer); } else { os_timerStart(hOs, dTimer, 1000); } }
/** * \fn mlme_sendSharedRequest * \brief sends authentication request * * The function builds and sends the second authentication request in shared key authentication * according to the * mlme parames * * \param pMlme - pointer to mlme_t * \return TI_OK if auth send successfully * TI_NOK otherwise * * \sa mlme_authMsgBuild */ TI_STATUS mlme_sendSharedRequest(mlme_t *pMlme) { TI_UINT8 authMsg[MAX_AUTH_MSG_LEN]; TI_UINT16 authMsgLen = 0; legacyAuthType_e authType = AUTH_LEGACY_SHARED_KEY; TI_UINT16 seq = 3, statusCode = 0; TI_UINT8* pChallenge = pMlme->authInfo.authData.pChalange; TI_UINT8 challengeLen = pMlme->authInfo.authData.challangeLen; dot11_CHALLENGE_t dot11Challenge; TRACE2(pMlme->hReport, REPORT_SEVERITY_INFORMATION, "mlme_sendAuthRequest: retryCount = %d, maxCount = %d\n", pMlme->authInfo.retryCount, pMlme->authInfo.maxCount); if (pMlme->authInfo.retryCount >= pMlme->authInfo.maxCount) { return TI_NOK; } pMlme->authInfo.retryCount++; /*If the shared key auth was received stop the timout timer */ tmr_StopTimer(pMlme->hMlmeTimer); if (pChallenge != NULL) { /* pDot11Challenge = (dot11_CHALLENGE_t*)&authMsg[len]; */ dot11Challenge.hdr[0] = CHALLANGE_TEXT_IE_ID; dot11Challenge.hdr[1] = challengeLen; os_memoryCopy(pMlme->hOs, (void *)dot11Challenge.text, pChallenge, challengeLen); } mlme_authMsgBuild(pMlme, authType, seq, statusCode, (TI_UINT8*)&dot11Challenge, challengeLen + 2, (TI_UINT8*)authMsg, &authMsgLen); report_PrintDump((TI_UINT8*)authMsg, authMsgLen); return mlmeBuilder_sendFrame(pMlme, AUTH, authMsg, authMsgLen, 1); }