/** * * 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 openAuth_Timeout(auth_t *pAuth) { if (pAuth->retryCount >= pAuth->maxCount) { pAuth->authData.status = STATUS_PACKET_REJ_TIMEOUT; return auth_osSMEvent(&pAuth->currentState, OPEN_AUTH_SM_EVENT_MAX_RETRY, pAuth); } return auth_osSMEvent(&pAuth->currentState, OPEN_AUTH_SM_EVENT_TIMEOUT, pAuth); }
/** * * 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_start - Start event for the authentication SM * * \b Description: * * Start event for the authentication SM * * \b ARGS: * * I - hAuth - Authentication SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa auth_Stop, auth_Recv */ TI_STATUS auth_start(TI_HANDLE hAuth) { auth_t *pHandle = (auth_t*)hAuth; if (pHandle == NULL) { return TI_NOK; } if (pHandle->authType == AUTH_LEGACY_NONE) { TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "auth_start: pHandle->authType == AUTH_LEGACY_NONE\n"); return TI_NOK; } switch (pHandle->authType) { case AUTH_LEGACY_RESERVED1: case AUTH_LEGACY_OPEN_SYSTEM: return auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_START, pHandle); case AUTH_LEGACY_SHARED_KEY: return auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_START, pHandle); default: TRACE0(pHandle->hReport, REPORT_SEVERITY_ERROR, "auth_start: pHandle->authType unknown.\n"); 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)) { 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; }
/** * * auth_start - Start event for the authentication SM * * \b Description: * * Start event for the authentication SM * * \b ARGS: * * I - hAuth - Authentication SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * \sa auth_Stop, auth_Recv */ TI_STATUS auth_start(TI_HANDLE hAuth) { auth_t *pHandle = (auth_t*)hAuth; if (pHandle == NULL) { return TI_NOK; } if (pHandle->authType == AUTH_LEGACY_NONE) { return TI_NOK; } switch (pHandle->authType) { case AUTH_LEGACY_RESERVED1: case AUTH_LEGACY_OPEN_SYSTEM: return auth_osSMEvent(&pHandle->currentState, OPEN_AUTH_SM_EVENT_START, pHandle); case AUTH_LEGACY_SHARED_KEY: return auth_skSMEvent(&pHandle->currentState, SHARED_KEY_AUTH_SM_EVENT_START, pHandle); default: return TI_NOK; } }