CWBool ACEnterJoin(int WTPIndex, CWProtocolMessage *msgPtr) { int seqNum; CWProtocolJoinRequestValues joinRequest; CWList msgElemList = NULL; CWLog("\n"); CWLog("######### Join State #########"); if(msgPtr == NULL) return CWErrorRaise(CW_ERROR_WRONG_ARG, NULL); if(!(CWParseJoinRequestMessage(msgPtr->msg, msgPtr->offset, &seqNum, &joinRequest))) { /* note: we can kill our thread in case of out-of-memory * error to free some space. * we can see this just calling CWErrorGetLastErrorCode() */ return CW_FALSE; } // cancel waitJoin timer if(!CWTimerCancel(&(gWTPs[WTPIndex].currentTimer))) { return CW_FALSE; } CWBool ACIpv4List = CW_FALSE; CWBool ACIpv6List = CW_FALSE; CWBool resultCode = CW_TRUE; int resultCodeValue = CW_PROTOCOL_SUCCESS; /* CWBool sessionID = CW_FALSE; */ if(!(CWSaveJoinRequestMessage(&joinRequest, &(gWTPs[WTPIndex].WTPProtocolManager)))) { resultCodeValue = CW_PROTOCOL_FAILURE_RES_DEPLETION; } CWMsgElemData *auxData; if(ACIpv4List) { CW_CREATE_OBJECT_ERR(auxData, CWMsgElemData, return CWErrorRaise(CW_ERROR_OUT_OF_MEMORY, NULL);); auxData->type = CW_MSG_ELEMENT_AC_IPV4_LIST_CW_TYPE; auxData->value = 0; CWAddElementToList(&msgElemList,auxData); }
CWBool ACEnterJoin(int WTPIndex, CWProtocolMessage *msgPtr) { int seqNum; CWProtocolJoinRequestValues joinRequest; memset(&joinRequest,0,sizeof(CWProtocolJoinRequestValues)); CWList msgElemList = NULL; int ret = 0; wid_syslog_debug_debug(WID_WTPINFO,"######### WTP %d Enter Join State #########",WTPIndex); if(msgPtr == NULL) { wid_syslog_err("wtp %d join msgPtr is NULL\n", WTPIndex); return CWErrorRaise(CW_ERROR_WRONG_ARG, NULL); } if(!(CWParseJoinRequestMessage(msgPtr->msg, msgPtr->offset, &seqNum, &joinRequest, WTPIndex))) { wid_syslog_err("parse wtp %d jion request failed\n", WTPIndex); return CW_FALSE; } if(!CWTimerCancel(&(gWTPs[WTPIndex].currentTimer),1)) { return CW_FALSE; } if((find_in_wtp_list(WTPIndex) == CW_TRUE)) { wid_syslog_debug_debug(WID_DEFAULT, "find wtp %d update info in updatelist\n", WTPIndex); if(!CWTimerCancel(&(gWTPs[WTPIndex].updateTimer),1)) { wid_syslog_info("CWTimerCancel error\n"); return CW_FALSE; } } CWBool ACIpv4List = CW_FALSE; CWBool ACIpv6List = CW_FALSE; CWBool resultCode = CW_TRUE; int resultCodeValue = CW_PROTOCOL_SUCCESS; //CWBool sessionID = CW_FALSE; /* unsigned char *mac; mac = (unsigned char*)malloc(6); memset(mac,0,6); if(!(CWCheckWTPBoardData(WTPIndex, &(joinRequest.WTPBoardData), mac))){ gWTPs[WTPIndex].currentState = CW_QUIT; AC_WTP[WTPIndex]->WTPStat = 0; memset(AC_WTP[WTPIndex]->WTPIP, 0, 128); free(mac); mac = NULL; return CW_TRUE; } memcpy(AC_WTP[WTPIndex]->WTPMAC, mac, 6); free(mac); mac = NULL;*/ if(!(CWSaveJoinRequestMessage(&joinRequest,&(gWTPs[WTPIndex].WTPProtocolManager),WTPIndex))) { resultCodeValue = CW_PROTOCOL_FAILURE_RES_DEPLETION; } CWMsgElemData *auxData; if(ACIpv4List) { CW_CREATE_OBJECT_ERR_WID(auxData, CWMsgElemData, return CWErrorRaise(CW_ERROR_OUT_OF_MEMORY, NULL);); auxData->type = CW_MSG_ELEMENT_AC_IPV4_LIST_CW_TYPE; auxData->value = 0; CWAddElementToList(&msgElemList,auxData); }