Change byte order of port number for register and resolve reply function 99/98299/3 accepted/tizen/common/20161125.095636 accepted/tizen/ivi/20161128.000834 accepted/tizen/mobile/20161128.000712 accepted/tizen/tv/20161128.000804 accepted/tizen/wearable/20161128.000818 submit/tizen/20161125.052705
authorYu Jiung <jiung.yu@samsung.com>
Thu, 17 Nov 2016 03:35:25 +0000 (12:35 +0900)
committerYu Jiung <jiung.yu@samsung.com>
Thu, 17 Nov 2016 03:49:53 +0000 (12:49 +0900)
Description : Register and resolve reply  function use the port number as
"Network Byte Order". For more information about this topic, please find
https://developer.apple.com/reference/dnssd/1804733-dnsserviceregister
https://developer.apple.com/reference/dnssd/dnsserviceresolvereply

Change-Id: Icb0f0746d10adfb3815e794f7921cf7125606c48
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
packaging/capi-network-nsd.spec
src/dns-sd/dns-sd.c

index e77e525..3ab1691 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-network-nsd
 Summary:    A Network Service Discovery libraries in Native API
-Version:    0.0.7
+Version:    0.0.8
 Release:    1
 Group:      System/Network
 License:    Apache-2.0
index 0cb027f..126ce8a 100644 (file)
@@ -816,7 +816,8 @@ int dnssd_register_local_service(dnssd_service_h local_service,
        ret = DNSServiceRegister(sd_ref, local_handle->flags,
                        reg->if_index, reg->service_name,
                        local_handle->service_type, local_handle->domain,
-                       NULL, reg->port, 1, "", __dnssd_register_reply_cb,
+                       NULL, htons((unsigned short int)reg->port),
+                       1, "", __dnssd_register_reply_cb,
                        NULL);
        if (ret < 0) {
                DNSSD_LOGE("Failed to register for dns service, error[%s]",     //LCOV_EXCL_LINE
@@ -1028,7 +1029,7 @@ static int __dnssd_getaddrinfo(dnssd_handle_s *dnssd_handle, unsigned int flags,
                found->txt_len = txt_len;
        }
        found->host = g_strdup(host_name);
-       found->port = port;
+       found->port = (int)ntohs(port);
 
        DNSSD_LOGD("Create found handle [%u]", local_handle->service_handler);