- OC_LOG(DEBUG, TAG, "IN");
- RM_NULL_CHECK_WITH_RET(options, TAG, "options");
- RM_NULL_CHECK_WITH_RET(numOptions, TAG, "numOptions");
+ RM_NULL_CHECK_WITH_RET(message, TAG, "options");
+
+ CAHeaderOption_t **options = NULL;
+ uint8_t *numOptions = NULL;
+
+ if (isRequest)
+ {
+ CARequestInfo_t *requestMsg = message;
+ options = &(requestMsg->info.options);
+ RM_NULL_CHECK_WITH_RET(options, TAG, "options");
+ numOptions = &(requestMsg->info.numOptions);
+ RM_NULL_CHECK_WITH_RET(numOptions, TAG, "numOptions");
+ }
+ else
+ {
+ CAResponseInfo_t *respMsg = message;
+ if ('\0' == destination[0] && (CA_EMPTY == respMsg->result))
+ {
+ OIC_LOG(DEBUG, TAG, "Response is for an Endpoint, No need to add the routing Option");
+ return OC_STACK_OK;
+ }
+ options = &(respMsg->info.options);
+ RM_NULL_CHECK_WITH_RET(options, TAG, "options");
+ numOptions = &(respMsg->info.numOptions);
+ RM_NULL_CHECK_WITH_RET(numOptions, TAG, "numOptions");
+ }
+