+ unsigned short curOptNumber = COAP_OPTION_KEY(*(coap_option *) opt->data);
+ if (prevOptNumber > curOptNumber)
+ {
+ OIC_LOG(ERROR, TAG, "option list is wrong");
+ return NULL;
+ }
+
+ size_t optValueLen = COAP_OPTION_LENGTH(*(coap_option *) opt->data);
+ size_t optLength = coap_get_opt_header_length(curOptNumber - prevOptNumber, optValueLen);
+ if (0 == optLength)
+ {
+ OIC_LOG(ERROR, TAG, "Reserved for the Payload marker for the option");
+ return NULL;
+ }
+ msgLength += optLength;
+ prevOptNumber = curOptNumber;
+ OIC_LOG_V(DEBUG, TAG, "curOptNumber[%d], prevOptNumber[%d], optValueLen[%zu], "
+ "optLength[%zu], msgLength[%d]",
+ curOptNumber, prevOptNumber, optValueLen, optLength, msgLength);