+ retAddr->adapter = adapter;
+ retAddr->flags = flags;
+
+ address = end + 1;
+ int tmp = 0;
+ if (flags & OC_IP_USE_V6)
+ {
+ address++;
+ }
+ uint16_t port = address[tmp++] - '0';
+
+ while(true)
+ {
+ if (address[tmp] == '\0' || address[tmp] > '9' || address[tmp] < '0')
+ {
+ break;
+ }
+ if (tmp >= 5 || (port >= 6553 && (address[tmp] -'0') >= 6))
+ {
+ NS_LOG_V(ERROR, "Invalid Input Address - Port. %d", tmp+1);
+ NSOICFree(retAddr);
+ return NULL;
+ }
+ port *= 10;
+ port += address[tmp++] - '0';
+ }
+
+ retAddr->port = port;
+
+ NS_LOG(DEBUG, "Change Address for TCP request");
+ NS_LOG_V(INFO_PRIVATE, "Origin : %s", inputaddress);
+ NS_LOG_V(INFO_PRIVATE, "Changed Addr : %s", retAddr->addr);
+ NS_LOG_V(INFO_PRIVATE, "Changed Port : %d", retAddr->port);
+
+ return retAddr;
+}
+
+bool NSOCResultToSuccess(OCStackResult ret)
+{
+ switch (ret)
+ {
+ case OC_STACK_OK:
+ case OC_STACK_RESOURCE_CREATED:
+ case OC_STACK_RESOURCE_DELETED:
+ case OC_STACK_PRESENCE_STOPPED:
+ case OC_STACK_CONTINUE:
+ case OC_STACK_RESOURCE_CHANGED:
+ return true;
+ default:
+ NS_LOG_V(DEBUG, "OCStackResult : %d", (int)ret);
+ return false;
+ }