Exemplo n.º 1
0
CWBool CWAssembleWTPVendorPayloadUCI(CWProtocolMessage *msgPtr) {
	int* iPtr;
	unsigned short  msgType;
	CWProtocolVendorSpecificValues* valuesPtr;
	CWVendorUciValues* uciPtr;

	CWLog("Assembling Protocol Configuration Update Request [VENDOR CASE]...");

	if(msgPtr == NULL) return CWErrorRaise(CW_ERROR_WRONG_ARG, NULL);

	if((iPtr = ((int*)CWThreadGetSpecific(&gIndexSpecific))) == NULL) {
	  return CW_FALSE;
	}

	valuesPtr =gWTPs[*iPtr].vendorValues;
	switch (valuesPtr->vendorPayloadType){
			case CW_MSG_ELEMENT_VENDOR_SPEC_PAYLOAD_UCI:
				msgType = CW_MSG_ELEMENT_VENDOR_SPEC_PAYLOAD_UCI;
				uciPtr = (CWVendorUciValues *) valuesPtr->payload;
				if (uciPtr->commandArgs != NULL) {
					/* create message */
					CW_CREATE_PROTOCOL_MESSAGE(*msgPtr, sizeof(short)+sizeof(char)+sizeof(int)+(strlen(uciPtr->commandArgs)*sizeof(char)), return CWErrorRaise(CW_ERROR_OUT_OF_MEMORY, NULL););
					CWProtocolStore16(msgPtr, (unsigned short) msgType);
					CWProtocolStore8(msgPtr, (unsigned char) uciPtr->command);
					CWProtocolStore32(msgPtr, (unsigned int) strlen(uciPtr->commandArgs));
					CWProtocolStoreStr(msgPtr, uciPtr->commandArgs);
				} else {
Exemplo n.º 2
0
/*Update 2009:
    Assemble protocol Configuration update request.
    Mainly added to  manage vendor specific packets*/
CWBool CWProtocolAssembleConfigurationUpdateRequest(CWProtocolMessage ** msgElems, int *msgElemCountPtr,
						    int MsgElementType)
{
	int *iPtr;
	int k = -1;

	if (msgElems == NULL || msgElemCountPtr == NULL)
		return CWErrorRaise(CW_ERROR_WRONG_ARG, NULL);

	if ((iPtr = ((int *)CWThreadGetSpecific(&gIndexSpecific))) == NULL) {
		return CW_FALSE;
	}

	*msgElemCountPtr = 1;

	CWLog("Assembling Protocol Configuration Update Request...");

	CW_CREATE_PROTOCOL_MSG_ARRAY_ERR(*msgElems, *msgElemCountPtr, return CWErrorRaise(CW_ERROR_OUT_OF_MEMORY, NULL);
	    );