OCStackResult RMAddInfo(const char *destination, void *message, bool isRequest,
bool *doPost)
{
- OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(message, TAG, "options");
CAHeaderOption_t **options = NULL;
*options = optionPtr;
}
- OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RMUpdateInfo(CAHeaderOption_t **options, uint8_t *numOptions,
CAEndpoint_t *endpoint)
{
- OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(options, TAG, "options");
RM_NULL_CHECK_WITH_RET(*options, TAG, "invalid option");
RM_NULL_CHECK_WITH_RET(numOptions, TAG, "numOptions");
{
memcpy(endpoint->routeData, (*options + routeIndex)->optionData + count,
GATEWAY_ID_LENGTH);
- OIC_LOG_V(DEBUG, TAG, "adding srcgid: %u in endpoint [%d]",
- *((uint32_t *)endpoint->routeData), sLen);
+
+ uint32_t rData1 = 0;
+ memcpy(&rData1, endpoint->routeData, sizeof(rData1));
+ OIC_LOG_V(DEBUG, TAG, "adding srcgid: %u in endpoint [%d]", rData1, sLen);
count += GATEWAY_ID_LENGTH;
{
memcpy(endpoint->routeData + GATEWAY_ID_LENGTH,
(*options + routeIndex)->optionData + count, ENDPOINT_ID_LENGTH);
- OIC_LOG_V(DEBUG, TAG, "adding srceid: %u in endpoint",
- *((uint16_t *)(endpoint->routeData + GATEWAY_ID_LENGTH)));
+
+ uint16_t rData2 = 0;
+ memcpy(&rData2, endpoint->routeData + GATEWAY_ID_LENGTH, sizeof(rData2));
+ OIC_LOG_V(DEBUG, TAG, "adding srceid: %u in endpoint", rData2);
}
}
}
OICFree(*options);
*options = NULL;
}
- OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
void RMGetRouteOptionIndex(const CAHeaderOption_t *options, uint8_t numOptions, int8_t *index)
{
- OIC_LOG(DEBUG, TAG, "IN");
- RM_NULL_CHECK_VOID(options, TAG, "options");
RM_NULL_CHECK_VOID(index, TAG, "index");
+
+ if (NULL == options)
+ {
+ OIC_LOG(INFO, TAG, "No existing options");
+ return;
+ }
+
for (uint32_t i = 0; i < numOptions; i++)
{
OIC_LOG_V(DEBUG, TAG, "Request- optionID: %u", options[i].optionID);
break;
}
}
- OIC_LOG(DEBUG, TAG, "OUT");
}
OCStackResult RMCreateRouteOption(const RMRouteOption_t *optValue, CAHeaderOption_t *options)
{
- OIC_LOG(DEBUG, RM_TAG, "IN");
RM_NULL_CHECK_WITH_RET(optValue, RM_TAG, "optValue");
RM_NULL_CHECK_WITH_RET(options, RM_TAG, "options");
OIC_LOG_V(DEBUG, RM_TAG, "createoption dlen %u slen [%u]", dLen, sLen);
unsigned int totalLength = 0;
- void *tempData = NULL;
+ uint8_t *tempData = NULL;
+
if (0 == dLen && 0 == sLen)
{
OIC_LOG(DEBUG, RM_TAG, "Source and destination is not present");
OIC_LOG_V(INFO, RM_TAG, "Option Length is %d", options->optionLength);
OICFree(tempData);
- OIC_LOG(DEBUG, RM_TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RMParseRouteOption(const CAHeaderOption_t *options, RMRouteOption_t *optValue)
{
- OIC_LOG(DEBUG, RM_TAG, "IN");
RM_NULL_CHECK_WITH_RET(options, RM_TAG, "options");
RM_NULL_CHECK_WITH_RET(optValue, RM_TAG, "optValue");
if (0 == options->optionLength)
OIC_LOG_V(INFO, RM_TAG, "Option Sender Addr is [%u][%u]", optValue->srcGw, optValue->srcEp);
OIC_LOG_V(INFO, RM_TAG, "Option Dest Addr is [%u][%u]", optValue->destGw, optValue->destEp);
OIC_LOG_V(INFO, RM_TAG, "Message Type is [%u]", optValue->msgType);
- OIC_LOG(DEBUG, RM_TAG, "OUT");
return OC_STACK_OK;
}