CAResponseInfo_t responseInfo = { 0 };
- if (msgType != CA_MSG_RESET)
+ if (CA_MSG_RESET == msgType ||
+ (CA_MSG_ACKNOWLEDGE == msgType && CA_EMPTY == responseValue))
+ {
+ printf("RESET or ACK/EMPTY. there will be not payload/option\n");
+ responseInfo.result = CA_EMPTY;
+ }
+ else
{
responseData.token = g_clientToken;
responseData.tokenLength = g_clientTokenLength;
responseData.payloadSize = length;
}
}
- //msgType is RESET
- else
- {
- responseInfo.result = CA_EMPTY;
- }
responseInfo.info = responseData;
.payloadSize = 0,
.resourceUri = resourceUri };
- if(CA_MSG_RESET != messageType)
+ if (CA_MSG_RESET == messageType ||
+ (CA_MSG_ACKNOWLEDGE == messageType && CA_EMPTY == responseCode))
+ {
+ printf("RESET or ACK/EMPTY. there will be not payload/option\n");
+
+ }
+ else
{
responseData.token = (info != NULL) ? info->token : NULL;
responseData.tokenLength = (info != NULL) ? info->tokenLength : 0;
// and ACKNOWLEDGE can use empty message when code is empty.
if (CA_MSG_RESET == info->type || (CA_EMPTY == code && CA_MSG_ACKNOWLEDGE == info->type))
{
+ if ((CA_EMPTY == code) && (info->payloadSize > 0 || info->payload
+ || info->token || info->tokenLength > 0))
+ {
+ OIC_LOG(ERROR, TAG, "Empty message has unnecessary data after messageID");
+ return NULL;
+ }
+
OIC_LOG(DEBUG, TAG, "code is empty");
if (!(pdu = CAGeneratePDUImpl((code_t) code, info, endpoint, NULL, transport)))
{