// 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))
+ if (CA_EMPTY != code)
+ {
+ OIC_LOG(ERROR, TAG, "reset is not empty message");
+ return NULL;
+ }
+
+ if (info->payloadSize > 0 || info->payload || info->token || info->tokenLength > 0)
{
OIC_LOG(ERROR, TAG, "Empty message has unnecessary data after messageID");
return NULL;
// ACK, RST --> remove the CON data
CAMessageType_t type = CAGetMessageTypeFromPduBinaryData(pdu, size);
uint16_t messageId = CAGetMessageIdFromPduBinaryData(pdu, size);
+ CAResponseResult_t code = CAGetCodeFromPduBinaryData(pdu, size);
- OIC_LOG_V(DEBUG, TAG, "received pdu, msgtype=%d, msgid=%d", type, messageId);
+ OIC_LOG_V(DEBUG, TAG, "received pdu, msgtype=%d, msgid=%d, code=%d",
+ type, messageId, code);
- if ((CA_MSG_ACKNOWLEDGE != type) && (CA_MSG_RESET != type))
+ if (((CA_MSG_ACKNOWLEDGE != type) && (CA_MSG_RESET != type))
+ || (CA_MSG_RESET == type && CA_EMPTY != code))
{
return CA_STATUS_OK;
}