/**
* Logging tag for module name.
*/
-#define TAG "RTM"
+#define TAG "OIC_RM_TM"
/**
* Tag for printing the Routing table.
*/
-#define RM_TAG "RAP"
+#define RM_TAG "OIC_RM_RAP"
/**
OCStackResult RTMInitialize(u_linklist_t **gatewayTable, u_linklist_t **endpointTable)
{
- OC_LOG(DEBUG, TAG, "RTMInitialize IN");
+ OIC_LOG(DEBUG, TAG, "RTMInitialize IN");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_WITH_RET(endpointTable, TAG, "endpointTable");
if (NULL == *gatewayTable)
*gatewayTable = u_linklist_create();
if (NULL == *gatewayTable)
{
- OC_LOG(ERROR, TAG, "Creating Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Creating Routing Table failed");
RTMTerminate(gatewayTable, endpointTable);
return OC_STACK_ERROR;
}
*endpointTable = u_linklist_create();
if (NULL == *endpointTable)
{
- OC_LOG(ERROR, TAG, "Creating Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Creating Routing Table failed");
RTMTerminate(gatewayTable, endpointTable);
return OC_STACK_ERROR;
}
}
- OC_LOG(DEBUG, TAG, "RTMInitialize OUT");
+ OIC_LOG(DEBUG, TAG, "RTMInitialize OUT");
return OC_STACK_OK;
}
*/
OCStackResult RTMFreeGatewayRouteTable(u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "RTMFreeGatewayRouteTable IN");
+ OIC_LOG(DEBUG, TAG, "RTMFreeGatewayRouteTable IN");
if (NULL == gatewayTable || NULL == *gatewayTable)
{
return OC_STACK_OK;
OCStackResult ret = u_linklist_remove(*gatewayTable, &iterTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
return OC_STACK_ERROR;
}
}
u_linklist_free(gatewayTable);
- OC_LOG(DEBUG, TAG, "RTMFreeGatewayRouteTable OUT");
+ OIC_LOG(DEBUG, TAG, "RTMFreeGatewayRouteTable OUT");
return OC_STACK_OK;
}
*/
OCStackResult RTMFreeEndpointRouteTable(u_linklist_t **endpointTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
if (NULL == endpointTable || NULL == *endpointTable)
{
return OC_STACK_OK;
OCStackResult ret = u_linklist_remove(*endpointTable, &iterTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
return OC_STACK_ERROR;
}
}
u_linklist_free(endpointTable);
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RTMFreeGatewayIdList(u_linklist_t **gatewayIdTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
if (NULL == gatewayIdTable || NULL == *gatewayIdTable)
{
return OC_STACK_OK;
OCStackResult ret = u_linklist_remove(*gatewayIdTable, &iterTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
return OC_STACK_ERROR;
}
}
OCStackResult res = u_linklist_remove(*gatewayIdTable, &iterTable);
if (OC_STACK_OK != res)
{
- OC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
return OC_STACK_ERROR;
}
}
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
*/
OCStackResult RTMTerminate(u_linklist_t **gatewayTable, u_linklist_t **endpointTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
OCStackResult ret = RTMFreeGatewayRouteTable(gatewayTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Deleting Gateway Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Deleting Gateway Routing Table failed");
}
if (NULL != *gatewayTable)
{
ret = RTMFreeEndpointRouteTable(endpointTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Deleting Endpoint Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Deleting Endpoint Routing Table failed");
}
if (NULL != *endpointTable)
{
*endpointTable = NULL;
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RTMAddGatewayEntry(uint32_t gatewayId, uint32_t nextHop, uint32_t routeCost,
const RTMDestIntfInfo_t *destInterfaces, u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
if (NULL == *gatewayTable)
{
*gatewayTable = u_linklist_create();
if (NULL == *gatewayTable)
{
- OC_LOG(ERROR, TAG, "u_linklist_create failed");
+ OIC_LOG(ERROR, TAG, "u_linklist_create failed");
return OC_STACK_NO_MEMORY;
}
}
if (1 == routeCost && 0 != nextHop)
{
- OC_LOG(ERROR, TAG, "Adding Gateway Failed as Next Hop should be 0 for route cost 1");
+ OIC_LOG(ERROR, TAG, "Adding Gateway Failed as Next Hop should be 0 for route cost 1");
return OC_STACK_ERROR;
}
if (0 == routeCost)
{
- OC_LOG(ERROR, TAG, "Adding Gateway Failed as Route cost shouldnot be less than 1");
+ OIC_LOG(ERROR, TAG, "Adding Gateway Failed as Route cost shouldnot be less than 1");
return OC_STACK_ERROR;
}
if (1 < routeCost && NULL == gatewayNodeMap)
{
- OC_LOG(ERROR, TAG, "Adding Gateway Failed as Next Hop is invalid");
+ OIC_LOG(ERROR, TAG, "Adding Gateway Failed as Next Hop is invalid");
return OC_STACK_ERROR;
}
{
if (NULL == destInterfaces)
{
- OC_LOG(ERROR, TAG, "Not Adding Gateway destInterfaces is NULL");
+ OIC_LOG(ERROR, TAG, "Not Adding Gateway destInterfaces is NULL");
return OC_STACK_ERROR;
}
OCStackResult update = RTMUpdateDestinationIntfAdr(gatewayId, *destInterfaces, true,
gatewayTable);
if (OC_STACK_OK != update)
{
- OC_LOG(ERROR, TAG, "RTMUpdateDestinationIntfAdr failed");
+ OIC_LOG(ERROR, TAG, "RTMUpdateDestinationIntfAdr failed");
}
return update;
}
if (entry->routeCost == routeCost && NULL != entry->nextHop &&
(nextHop == entry->nextHop->gatewayId))
{
- OC_LOG(ERROR, TAG, "Not Adding Gateway As it is Duplicate request");
+ OIC_LOG(ERROR, TAG, "Not Adding Gateway As it is Duplicate request");
return OC_STACK_DUPLICATE_REQUEST;
}
{
entry->routeCost = 1;
// Entry can't be updated if Next hop is not same as existing Destinations of Table.
- OC_LOG(DEBUG, TAG, "Updating the gateway");
+ OIC_LOG(DEBUG, TAG, "Updating the gateway");
entry->nextHop = NULL;
entry->destination->destIntfAddr = u_arraylist_create();
if (NULL == entry->destination->destIntfAddr)
{
- OC_LOG(ERROR, TAG, "Failed to create array list");
+ OIC_LOG(ERROR, TAG, "Failed to create array list");
return OC_STACK_ERROR;
}
(RTMDestIntfInfo_t *) OICCalloc(1, sizeof(RTMDestIntfInfo_t));
if (NULL == destAdr)
{
- OC_LOG(ERROR, TAG, "Failed to Calloc destAdr");
+ OIC_LOG(ERROR, TAG, "Failed to Calloc destAdr");
return OC_STACK_ERROR;
}
u_arraylist_add(entry->destination->destIntfAddr, (void *)destAdr);
if (!result)
{
- OC_LOG(ERROR, TAG, "Adding node to head failed");
+ OIC_LOG(ERROR, TAG, "Adding node to head failed");
OICFree(destAdr);
return OC_STACK_ERROR;
}
}
else
{
- OC_LOG(ERROR, TAG, "Adding Gateway Failed as Next hop is invalid");
+ OIC_LOG(ERROR, TAG, "Adding Gateway Failed as Next hop is invalid");
return OC_STACK_ERROR;
}
}
else if (NULL != entry && entry->routeCost < routeCost)
{
- OC_LOG(ERROR, TAG, "Adding Gateway Failed as Route cost is more than old");
+ OIC_LOG(ERROR, TAG, "Adding Gateway Failed as Route cost is more than old");
return OC_STACK_ERROR;
}
OCStackResult res = u_linklist_remove(*gatewayTable, &destNode);
if (OC_STACK_OK != res)
{
- OC_LOG(ERROR, TAG, "Removing node failed");
+ OIC_LOG(ERROR, TAG, "Removing node failed");
}
else
{
res = u_linklist_add_head(*gatewayTable, (void *)entry);
if (OC_STACK_OK != res)
{
- OC_LOG(ERROR, TAG, "Adding node to head failed");
+ OIC_LOG(ERROR, TAG, "Adding node to head failed");
}
}
}
RTMGatewayEntry_t *hopEntry = (RTMGatewayEntry_t *)OICCalloc(1, sizeof(RTMGatewayEntry_t));
if (NULL == hopEntry)
{
- OC_LOG(ERROR, TAG, "Calloc failed for hop entry");
+ OIC_LOG(ERROR, TAG, "Calloc failed for hop entry");
return OC_STACK_ERROR;
}
hopEntry->destination = (RTMGatewayId_t*)OICCalloc(1, sizeof(RTMGatewayId_t));
if (NULL == hopEntry->destination)
{
- OC_LOG(ERROR, TAG, "Calloc failed for hop entry destination");
+ OIC_LOG(ERROR, TAG, "Calloc failed for hop entry destination");
OICFree(hopEntry);
return OC_STACK_ERROR;
}
(RTMDestIntfInfo_t *) OICCalloc(1, sizeof(RTMDestIntfInfo_t));
if (NULL == destAdr)
{
- OC_LOG(ERROR, TAG, "Calloc failed for destAdr");
+ OIC_LOG(ERROR, TAG, "Calloc failed for destAdr");
u_arraylist_free(&(hopEntry->destination->destIntfAddr));
OICFree(hopEntry->destination);
OICFree(hopEntry);
}
else
{
- OC_LOG(ERROR, TAG, "Adding Gateway Failed as Next Hop is invalid");
+ OIC_LOG(ERROR, TAG, "Adding Gateway Failed as Next Hop is invalid");
while (u_arraylist_length(hopEntry->destination->destIntfAddr) > 0)
{
RTMDestIntfInfo_t *data =
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Adding Gateway Entry to Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Adding Gateway Entry to Routing Table failed");
while (u_arraylist_length(hopEntry->destination->destIntfAddr) > 0)
{
RTMDestIntfInfo_t *data = u_arraylist_remove(hopEntry->destination->destIntfAddr, 0);
return OC_STACK_ERROR;
}
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RTMAddEndpointEntry(uint16_t *endpointId, const CAEndpoint_t *destAddr,
u_linklist_t **endpointTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(endpointId, TAG, "endpointId");
RM_NULL_CHECK_WITH_RET(destAddr, TAG, "destAddr");
RM_NULL_CHECK_WITH_RET(endpointTable, TAG, "endpointTable");
*endpointTable = u_linklist_create();
if (NULL == *endpointTable)
{
- OC_LOG(ERROR, TAG, "u_linklist_create failed");
+ OIC_LOG(ERROR, TAG, "u_linklist_create failed");
return OC_STACK_NO_MEMORY;
}
}
&& destAddr->port == entry->destIntfAddr.port)
{
*endpointId = entry->endpointId;
- OC_LOG(ERROR, TAG, "Adding failed as Enpoint Entry Already present in Table");
+ OIC_LOG(ERROR, TAG, "Adding failed as Enpoint Entry Already present in Table");
return OC_STACK_DUPLICATE_REQUEST;
}
u_linklist_get_next(&iterTable);
if (NULL == hopEntry)
{
- OC_LOG(ERROR, TAG, "Malloc failed for hop entry");
+ OIC_LOG(ERROR, TAG, "Malloc failed for hop entry");
return OC_STACK_ERROR;
}
OCStackResult ret = u_linklist_add(*endpointTable, (void *)hopEntry);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Adding Enpoint Entry to Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Adding Enpoint Entry to Routing Table failed");
OICFree(hopEntry);
return OC_STACK_ERROR;
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RTMAddObserver(uint32_t obsID, CAEndpoint_t devAddr, u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_WITH_RET(*gatewayTable, TAG, "*gatewayTable");
&& devAddr.port == destCheck->destIntfAddr.port)
{
destCheck->observerId = obsID;
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_ERROR;
}
bool RTMIsObserverPresent(CAEndpoint_t devAddr, OCObservationId *obsID,
const u_linklist_t *gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
if (NULL == obsID)
{
- OC_LOG(ERROR, TAG, "obsID is null");
+ OIC_LOG(ERROR, TAG, "obsID is null");
return false;
}
if (NULL == gatewayTable)
{
- OC_LOG(ERROR, TAG, "gatewayTable is null");
+ OIC_LOG(ERROR, TAG, "gatewayTable is null");
return false;
}
RTMGatewayEntry_t *entry = u_linklist_get_data(iterTable);
if (NULL == entry || NULL == entry->destination)
{
- OC_LOG(ERROR, TAG, "entry is NULL");
+ OIC_LOG(ERROR, TAG, "entry is NULL");
return false;
}
for (uint32_t i = 0; i < u_arraylist_length(entry->destination->destIntfAddr); i++)
&& devAddr.port == destCheck->destIntfAddr.port && 0 != destCheck->observerId)
{
*obsID = destCheck->observerId;
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return true;
}
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return false;
}
OCStackResult RTMRemoveGatewayEntry(uint32_t gatewayId, u_linklist_t **removedGatewayNodes,
u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_WITH_RET(*gatewayTable, TAG, "*gatewayTable");
*removedGatewayNodes = u_linklist_create();
if (NULL == *removedGatewayNodes)
{
- OC_LOG(ERROR, TAG, "u_linklist_create failed");
+ OIC_LOG(ERROR, TAG, "u_linklist_create failed");
return OC_STACK_NO_MEMORY;
}
}
if (gatewayId == entry->destination->gatewayId || (NULL != entry->nextHop &&
(gatewayId == entry->nextHop->gatewayId)))
{
- OC_LOG_V(DEBUG, TAG, "Removing the gateway entry: %u", entry->destination->gatewayId);
+ OIC_LOG_V(DEBUG, TAG, "Removing the gateway entry: %u", entry->destination->gatewayId);
ret = u_linklist_remove(*gatewayTable, &iterTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
return OC_STACK_ERROR;
}
else
u_linklist_get_next(&iterTable);
}
}
- OC_LOG(DEBUG, TAG, "RTMRemoveGatewayEntry OUT");
+ OIC_LOG(DEBUG, TAG, "RTMRemoveGatewayEntry OUT");
return OC_STACK_OK;
}
const RTMDestIntfInfo_t *destInfAdr,
RTMGatewayEntry_t **existEntry, u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_WITH_RET(*gatewayTable, TAG, "*gatewayTable");
RM_NULL_CHECK_WITH_RET(destInfAdr, TAG, "destInfAdr");
// Remove node with given gatewayid and nextHop if not found update exist entry.
if (NULL != entry->destination && (gatewayId == entry->destination->gatewayId))
{
- OC_LOG_V(INFO, TAG, "Remove the gateway ID: %u", entry->destination->gatewayId);
+ OIC_LOG_V(INFO, TAG, "Remove the gateway ID: %u", entry->destination->gatewayId);
if (NULL != entry->nextHop && nextHop == entry->nextHop->gatewayId)
{
ret = u_linklist_remove(*gatewayTable, &iterTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
return OC_STACK_ERROR;
}
OICFree(entry);
}
*existEntry = entry;
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_ERROR;
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_ERROR;
}
OCStackResult RTMRemoveEndpointEntry(uint16_t endpointId, u_linklist_t **endpointTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(endpointTable, TAG, "endpointTable");
RM_NULL_CHECK_WITH_RET(*endpointTable, TAG, "*endpointTable");
OCStackResult ret = u_linklist_remove(*endpointTable, &iterTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
+ OIC_LOG(ERROR, TAG, "Deleting Entry from Routing Table failed");
return OC_STACK_ERROR;
}
OICFree(entry);
u_linklist_get_next(&iterTable);
}
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RTMRemoveGateways(u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
if (NULL == gatewayTable || NULL == *gatewayTable)
{
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult ret = RTMFreeGatewayRouteTable(gatewayTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Removing Gateways failed");
+ OIC_LOG(ERROR, TAG, "Removing Gateways failed");
return ret;
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RTMRemoveEndpoints(u_linklist_t **endpointTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
if (NULL == endpointTable || NULL == *endpointTable)
{
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult ret = RTMFreeEndpointRouteTable(endpointTable);
if (OC_STACK_OK != ret)
{
- OC_LOG(ERROR, TAG, "Freeing Endpoints failed");
+ OIC_LOG(ERROR, TAG, "Freeing Endpoints failed");
return OC_STACK_ERROR;
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
void RTMFreeGateway(RTMGatewayId_t *gateway, u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_VOID(gateway, TAG, "gateway");
RM_NULL_CHECK_VOID(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_VOID(*gatewayTable, TAG, "*gatewayTable");
}
u_arraylist_free(&(gateway->destIntfAddr));
OICFree(gateway);
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
}
void RTMGetNeighbours(u_linklist_t **neighbourNodes, const u_linklist_t *gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_VOID(neighbourNodes, TAG, "neighbourNodes");
RM_NULL_CHECK_VOID(gatewayTable, TAG, "gatewayTable");
*neighbourNodes = u_linklist_create();
if (NULL == *neighbourNodes)
{
- OC_LOG(ERROR, TAG, "u_linklist_create failed");
+ OIC_LOG(ERROR, TAG, "u_linklist_create failed");
return;
}
u_linklist_iterator_t *iterTable = NULL;
}
else if (NULL != entry && 1 < entry->routeCost)
{
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return;
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
}
RTMGatewayId_t *RTMGetNextHop(uint32_t gatewayId, const u_linklist_t *gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
if (0 == gatewayId)
{
- OC_LOG(ERROR, TAG, "gatewayId is invalid");
+ OIC_LOG(ERROR, TAG, "gatewayId is invalid");
return NULL;
}
if (NULL == gatewayTable)
{
- OC_LOG(ERROR, TAG, "gatewayTable is null");
+ OIC_LOG(ERROR, TAG, "gatewayTable is null");
return NULL;
}
{
if (1 == entry->routeCost)
{
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return entry->destination;
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return entry->nextHop;
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return NULL;
}
CAEndpoint_t *RTMGetEndpointEntry(uint16_t endpointId, const u_linklist_t *endpointTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
if (NULL == endpointTable)
{
- OC_LOG(ERROR, TAG, "endpointTable is null");
+ OIC_LOG(ERROR, TAG, "endpointTable is null");
return NULL;
}
RTMEndpointEntry_t *entry = u_linklist_get_data(iterTable);
if (NULL != entry && (endpointId == entry->endpointId))
{
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return &(entry->destIntfAddr);
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return NULL;
}
void RTMGetObserverList(OCObservationId **obsList, uint8_t *obsListLen,
const u_linklist_t *gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_VOID(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_VOID(obsList, TAG, "obsList");
*obsList = (OCObservationId *) OICCalloc(MAX_OBSERVER_LIST_LENGTH, sizeof(OCObservationId));
if (!(*obsList))
{
- OC_LOG(ERROR, TAG, "out of memory");
+ OIC_LOG(ERROR, TAG, "out of memory");
return;
}
RTMDestIntfInfo_t *destCheck = u_arraylist_get(entry->destination->destIntfAddr, 0);
if (NULL == destCheck)
{
- OC_LOG(ERROR, TAG, "destCheck is null");
+ OIC_LOG(ERROR, TAG, "destCheck is null");
return;
}
if (0 != destCheck->observerId)
{
- OC_LOG_V(DEBUG, TAG, "Observer ID is %d", destCheck->observerId);
+ OIC_LOG_V(DEBUG, TAG, "Observer ID is %d", destCheck->observerId);
*(*obsList + len) = destCheck->observerId;
len++;
}
}
*obsListLen = len;
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
}
OCStackResult RTMUpdateDestinationIntfAdr(uint32_t gatewayId, RTMDestIntfInfo_t destInterfaces,
bool addAdr, u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_WITH_RET(*gatewayTable, TAG, "*gatewayTable");
u_arraylist_get(entry->destination->destIntfAddr, i);
if (NULL == destCheck)
{
- OC_LOG(ERROR, TAG, "Destination adr get failed");
+ OIC_LOG(ERROR, TAG, "Destination adr get failed");
continue;
}
{
destCheck->timeElapsed = RTMGetCurrentTime();
destCheck->isValid = true;
- OC_LOG(ERROR, TAG, "destInterfaces already present");
+ OIC_LOG(ERROR, TAG, "destInterfaces already present");
return OC_STACK_ERROR;
}
}
(RTMDestIntfInfo_t *) OICCalloc(1, sizeof(RTMDestIntfInfo_t));
if (NULL == destAdr)
{
- OC_LOG(ERROR, TAG, "Calloc destAdr failed");
+ OIC_LOG(ERROR, TAG, "Calloc destAdr failed");
return OC_STACK_ERROR;
}
*destAdr = destInterfaces;
u_arraylist_add(entry->destination->destIntfAddr, (void *)destAdr);
if (!result)
{
- OC_LOG(ERROR, TAG, "Updating Destinterface address failed");
+ OIC_LOG(ERROR, TAG, "Updating Destinterface address failed");
OICFree(destAdr);
return OC_STACK_ERROR;
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_DUPLICATE_REQUEST;
}
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RTMUpdateMcastSeqNumber(uint32_t gatewayId, uint16_t seqNum,
u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_WITH_RET(*gatewayTable, TAG, "*gatewayTable");
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RTMUpdateDestAddrValidity(u_linklist_t **invalidTable, u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(invalidTable, TAG, "invalidTable");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_WITH_RET(*gatewayTable, TAG, "*gatewayTable");
*invalidTable = u_linklist_create();
if (NULL == *invalidTable)
{
- OC_LOG(ERROR, TAG, "u_linklist_create failed");
+ OIC_LOG(ERROR, TAG, "u_linklist_create failed");
return OC_STACK_NO_MEMORY;
}
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
OCStackResult RTMRemoveInvalidGateways(u_linklist_t **invalidTable, u_linklist_t **gatewayTable)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(invalidTable, TAG, "invalidTable");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_WITH_RET(*gatewayTable, TAG, "*gatewayTable");
*invalidTable = u_linklist_create();
if (NULL == *invalidTable)
{
- OC_LOG(ERROR, TAG, "u_linklist_create failed");
+ OIC_LOG(ERROR, TAG, "u_linklist_create failed");
return OC_STACK_NO_MEMORY;
}
RTMRemoveGatewayEntry(entry->destination->gatewayId, invalidTable, gatewayTable);
if (OC_STACK_OK != res)
{
- OC_LOG(ERROR, TAG, "Removing Entries failed");
+ OIC_LOG(ERROR, TAG, "Removing Entries failed");
return OC_STACK_ERROR;
}
u_linklist_get_next(&iterTable);
u_linklist_get_next(&iterTable);
}
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
const RTMDestIntfInfo_t *destAdr, u_linklist_t **gatewayTable,
bool forceUpdate)
{
- OC_LOG(DEBUG, TAG, "IN");
+ OIC_LOG(DEBUG, TAG, "IN");
RM_NULL_CHECK_WITH_RET(gatewayTable, TAG, "gatewayTable");
RM_NULL_CHECK_WITH_RET(*gatewayTable, TAG, "*gatewayTable");
RM_NULL_CHECK_WITH_RET(destAdr, TAG, "destAdr");
else
{
entry->seqNum = seqNum;
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
}
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, TAG, "OUT");
+ OIC_LOG(DEBUG, TAG, "OUT");
return OC_STACK_OK;
}
void RTMPrintTable(const u_linklist_t *gatewayTable, const u_linklist_t *endpointTable)
{
RM_NULL_CHECK_VOID(gatewayTable, TAG, "gatewayTable");
- OC_LOG(DEBUG, RM_TAG, "=================Gateway List table============================\n");
+ OIC_LOG(DEBUG, RM_TAG, "=================Gateway List table============================\n");
u_linklist_iterator_t *iterTable = NULL;
u_linklist_init_iterator(gatewayTable, &iterTable);
while (NULL != iterTable)
(RTMGatewayEntry_t *) u_linklist_get_data(iterTable);
if (NULL == hop)
{
- OC_LOG(ERROR, RM_TAG, "Printing Table Failed");
+ OIC_LOG(ERROR, RM_TAG, "Printing Table Failed");
return;
}
if (NULL == hop->nextHop || 0 == hop->nextHop->gatewayId)
{
- OC_LOG_V(DEBUG, RM_TAG, "\nDestination : %u\nNextHop : (null)\nHopCount : %d",
+ OIC_LOG_V(DEBUG, RM_TAG, "\nDestination : %u\nNextHop : (null)\nHopCount : %d",
hop->destination->gatewayId, hop->routeCost);
- OC_LOG_V(DEBUG, RM_TAG, "\nSequence Number :%u", hop->seqNum);
+ OIC_LOG_V(DEBUG, RM_TAG, "\nSequence Number :%u", hop->seqNum);
}
else
{
- OC_LOG_V(DEBUG, RM_TAG, "\nDestination : %u\nNextHop : %u\nHopCount : %d",
+ OIC_LOG_V(DEBUG, RM_TAG, "\nDestination : %u\nNextHop : %u\nHopCount : %d",
hop->destination->gatewayId, hop->nextHop->gatewayId, hop->routeCost);
- OC_LOG_V(DEBUG, RM_TAG, "\nSequence Number :%u", hop->seqNum);
+ OIC_LOG_V(DEBUG, RM_TAG, "\nSequence Number :%u", hop->seqNum);
}
if (1 == hop->routeCost && NULL != hop->destination &&
hop->destination->destIntfAddr != NULL)
RTMDestIntfInfo_t *dest = u_arraylist_get(hop->destination->destIntfAddr, i);
if (NULL != dest)
{
- OC_LOG_V(DEBUG, RM_TAG, "\nDestination interface addresses: %s Port : %d Obs ID: %d",
+ OIC_LOG_V(DEBUG, RM_TAG, "\nDestination interface addresses: %s Port : %d Obs ID: %d",
dest->destIntfAddr.addr, dest->destIntfAddr.port, dest->observerId);
- OC_LOG_V(DEBUG, RM_TAG, "Validity: %d", dest->isValid);
+ OIC_LOG_V(DEBUG, RM_TAG, "Validity: %d", dest->isValid);
}
}
}
- OC_LOG(DEBUG, RM_TAG, "********************************************\n");
+ OIC_LOG(DEBUG, RM_TAG, "********************************************\n");
u_linklist_get_next(&iterTable);
}
- OC_LOG(DEBUG, RM_TAG, "=================Endpoint List table============================\n");
+ OIC_LOG(DEBUG, RM_TAG, "=================Endpoint List table============================\n");
u_linklist_iterator_t *iterEndpointTable = NULL;
u_linklist_init_iterator(endpointTable, &iterEndpointTable);
(RTMEndpointEntry_t *) u_linklist_get_data(iterEndpointTable);
if (NULL == hop)
{
- OC_LOG(ERROR, RM_TAG, "Printing Table Failed");
+ OIC_LOG(ERROR, RM_TAG, "Printing Table Failed");
return;
}
- OC_LOG_V(DEBUG, RM_TAG, "EndpointId : %u\naddr : %s Port : %d",
+ OIC_LOG_V(DEBUG, RM_TAG, "EndpointId : %u\naddr : %s Port : %d",
hop->endpointId, hop->destIntfAddr.addr, hop->destIntfAddr.port);
- OC_LOG(DEBUG, RM_TAG, "********************************************\n");
+ OIC_LOG(DEBUG, RM_TAG, "********************************************\n");
u_linklist_get_next(&iterEndpointTable);
}
}