- 论坛徽章:
- 0
|
- 2013年7月18日 17:56:25 晴
- CWBool CWParseConfigureRequestMessage(char *msg,
- int len,
- int *seqNumPtr,
- CWProtocolConfigureRequestValues *valuesPtr,
- char *tmp_RadioInformationABGN,
- char *tmp_SuppRates,
- char *[color=Red]tmp_MultiDomCapa[/color]) {
-
- if([color=Red]tmp_MultiDomCapa[/color])
- lprint("tmp_MultiDomCapa is no null!\n");
- else
- lprint("tmp_MultiDomCapa is null!\n");
-
- CWControlHeaderValues controlVal;
- int i,j;
- int offsetTillMessages;
-
- CWProtocolMessage completeMsg;
-
- if(msg == NULL || seqNumPtr == NULL || valuesPtr == NULL)
- return CWErrorRaise(CW_ERROR_WRONG_ARG, NULL);
-
- CWDebugLog("Parsing Configure Request...");
-
- completeMsg.msg = msg;
- completeMsg.offset = 0;
-
- if(!(CWParseControlHeader(&completeMsg, &controlVal)))
- /* will be handled by the caller */
- return CW_FALSE;
-
- /* different type */
- if(controlVal.messageTypeValue != CW_MSG_TYPE_VALUE_CONFIGURE_REQUEST)
- return CWErrorRaise(CW_ERROR_INVALID_FORMAT, "Message is not Configure Request (maybe it is Image Data Request)");
-
- *seqNumPtr = controlVal.seqNum;
- /* skip timestamp */
- controlVal.msgElemsLen -= CW_CONTROL_HEADER_OFFSET_FOR_MSG_ELEMS;
-
- offsetTillMessages = completeMsg.offset;
-
- /* valuesPtr->WTPRadioInfo.radiosCount=0; */
- valuesPtr->ACinWTP.count=0;
- valuesPtr->radioAdminInfoCount=0;
- /* parse message elements */
- while((completeMsg.offset-offsetTillMessages) < controlVal.msgElemsLen) {
-
- unsigned short int elemType = 0;/* = CWProtocolRetrieve32(&completeMsg); */
- unsigned short int elemLen = 0; /* = CWProtocolRetrieve16(&completeMsg); */
-
- CWParseFormatMsgElem(&completeMsg,&elemType,&elemLen);
-
- /*CWDebugLog("Parsing Message Element: %u, elemLen: %u", elemType, elemLen);*/
-
- switch(elemType) {
- case CW_MSG_ELEMENT_AC_NAME_CW_TYPE:
- if(!(CWParseACName(&completeMsg, elemLen, &(valuesPtr->ACName))))
- /* will be handled by the caller */
- return CW_FALSE;
- break;
- case CW_MSG_ELEMENT_AC_NAME_INDEX_CW_TYPE:
- /* just count how many radios we have,
- * so we can allocate the array
- */
- valuesPtr->ACinWTP.count++;
- completeMsg.offset += elemLen;
- break;
- case CW_MSG_ELEMENT_RADIO_ADMIN_STATE_CW_TYPE:
- /* just count how many radios we have,
- * so we can allocate the array
- */
- (valuesPtr->radioAdminInfoCount)++;
- completeMsg.offset += elemLen;
- break;
- case CW_MSG_ELEMENT_STATISTICS_TIMER_CW_TYPE:
- if(!(CWParseWTPStatisticsTimer(&completeMsg, elemLen, &(valuesPtr->StatisticsTimer))))
- /* will be handled by the caller */
- return CW_FALSE;
- break;
- case CW_MSG_ELEMENT_WTP_REBOOT_STATISTICS_CW_TYPE:
- CW_CREATE_OBJECT_ERR(valuesPtr->WTPRebootStatistics,
- WTPRebootStatisticsInfo,
- return CWErrorRaise(CW_ERROR_OUT_OF_MEMORY, NULL););
- if(!(CWParseWTPRebootStatistics(&completeMsg,
- elemLen,
- valuesPtr->WTPRebootStatistics)))
- /* will be handled by the caller */
- return CW_FALSE;
- break;
-
- case CW_MSG_ELEMENT_IEEE80211_WTP_RADIO_INFORMATION_CW_TYPE:
- if(!(CWParseWTPRadioInformation(&completeMsg, elemLen,(unsigned char *) &tmp_RadioInformationABGN)))return CW_FALSE;
- break;
-
- case CW_MSG_ELEMENT_IEEE80211_MULTI_DOMAIN_CAPABILITY_CW_TYPE:
- if([color=Red]tmp_MultiDomCapa[/color])
- lprint("tmp_MultiDomCapa is no null!\n");
- else
- lprint("tmp_MultiDomCapa is null!\n");
- if(!(CWParseWTPMultiDomainCapability(&completeMsg, elemLen, (char *)&tmp_MultiDomCapa)))return CW_FALSE;
- break;
-
- case CW_MSG_ELEMENT_IEEE80211_SUPPORTED_RATES_CW_TYPE:
- if(!(CWParseWTPSupportedRates(&completeMsg, elemLen, (unsigned char *)&tmp_SuppRates)))return CW_FALSE;
- break;
-
- default:
- return CWErrorRaise(CW_ERROR_INVALID_FORMAT, "Unrecognized Message Element");
- }
- }
复制代码 |
|