[JIRA-IOT 722] Removed deprecated socket functions and updated inet_ntop() instead...
authorvimala.v <vimala.v@samsung.com>
Mon, 12 Oct 2015 07:05:17 +0000 (12:35 +0530)
committerJon A. Cruz <jonc@osg.samsung.com>
Wed, 18 Nov 2015 19:08:43 +0000 (19:08 +0000)
Change-Id: I1efa2129728386728bcee0f3d0859c7343b4fd8f
Signed-off-by: vimala.v <vimala.v@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3795
Reviewed-by: Abhishek Sharma <ce.abhishek@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Abhishek Pandey <abhi.siso@samsung.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
resource/csdk/connectivity/src/ip_adapter/caipserver.c

index e5db10660d4ada38fc8bd1343fb294f3e08d458c..2938c8982d4e6f67442f2900ef3e740e442114d6 100644 (file)
@@ -511,7 +511,7 @@ CAResult_t CAIPStartServer(const ca_thread_pool_t threadPool)
 
     if (!IPv4MulticastAddress.s_addr)
     {
-        (void)inet_aton(IPv4_MULTICAST, &IPv4MulticastAddress);
+        (void)inet_pton(AF_INET, IPv4_MULTICAST, &IPv4MulticastAddress);
         (void)inet_pton(AF_INET6, IPv6_MULTICAST_INT, &IPv6MulticastAddressInt);
         (void)inet_pton(AF_INET6, IPv6_MULTICAST_LNK, &IPv6MulticastAddressLnk);
         (void)inet_pton(AF_INET6, IPv6_MULTICAST_RLM, &IPv6MulticastAddressRlm);
@@ -1076,9 +1076,7 @@ CAResult_t CAGetIPInterfaceInformation(CAEndpoint_t **info, uint32_t *size)
             eps[j].flags = CA_IPV4;
             eps[j].port = caglobals.ip.u4.port;
 
-            unsigned char *addr=  (unsigned char *) &(ifitem->ipv4addr);
-            snprintf(eps[j].addr, MAX_ADDR_STR_SIZE_CA, "%d.%d.%d.%d",
-                     addr[0], addr[1], addr[2], addr[3]);
+            inet_ntop(AF_INET, &(ifitem->ipv4addr), eps[j].addr, MAX_ADDR_STR_SIZE_CA);
         }
 
 #ifdef __WITH_DTLS__
@@ -1096,10 +1094,7 @@ CAResult_t CAGetIPInterfaceInformation(CAEndpoint_t **info, uint32_t *size)
         {
             eps[j].flags = CA_IPV4 | CA_SECURE;
             eps[j].port = caglobals.ip.u4s.port;
-
-            unsigned char *addr=  (unsigned char *) &(ifitem->ipv4addr);
-            snprintf(eps[j].addr, MAX_ADDR_STR_SIZE_CA, "%d.%d.%d.%d",
-                     addr[0], addr[1], addr[2], addr[3]);
+            inet_ntop(AF_INET, &(ifitem->ipv4addr), eps[j].addr, MAX_ADDR_STR_SIZE_CA);
         }
 #endif
         j++;