X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Frouting%2Fsrc%2Froutingutility.c;h=de7781a966e3f448458700c68110f0fe6c878c84;hb=3c093548382bb2542c87a67e6e5fa32552c29cb3;hp=cabd07c1e45ac618e7486281b1158bd778303c5a;hpb=9c42f3fe634ac3ee088e9a7592a35f319549f745;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/routing/src/routingutility.c b/resource/csdk/routing/src/routingutility.c index cabd07c..de7781a 100644 --- a/resource/csdk/routing/src/routingutility.c +++ b/resource/csdk/routing/src/routingutility.c @@ -80,7 +80,6 @@ void RMSetStackMode(OCMode mode) 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; @@ -214,14 +213,12 @@ OCStackResult RMAddInfo(const char *destination, void *message, bool isRequest, *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"); @@ -256,8 +253,10 @@ OCStackResult RMUpdateInfo(CAHeaderOption_t **options, uint8_t *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; @@ -265,8 +264,10 @@ OCStackResult RMUpdateInfo(CAHeaderOption_t **options, uint8_t *numOptions, { 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); } } } @@ -284,15 +285,19 @@ OCStackResult RMUpdateInfo(CAHeaderOption_t **options, uint8_t *numOptions, 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); @@ -303,12 +308,10 @@ void RMGetRouteOptionIndex(const CAHeaderOption_t *options, uint8_t numOptions, 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"); @@ -320,7 +323,8 @@ OCStackResult RMCreateRouteOption(const RMRouteOption_t *optValue, CAHeaderOptio 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"); @@ -419,13 +423,11 @@ OCStackResult RMCreateRouteOption(const RMRouteOption_t *optValue, CAHeaderOptio 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) @@ -497,6 +499,5 @@ OCStackResult RMParseRouteOption(const CAHeaderOption_t *options, RMRouteOption_ 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; }