Fixed to get IPv6 address in address changed callback 85/121785/1 accepted/tizen/common/20170329.172456 accepted/tizen/ivi/20170329.222306 accepted/tizen/mobile/20170329.222205 accepted/tizen/tv/20170329.222229 accepted/tizen/unified/20170329.222322 accepted/tizen/wearable/20170329.222244 submit/tizen/20170329.085840
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 29 Mar 2017 04:20:52 +0000 (13:20 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 29 Mar 2017 04:21:05 +0000 (13:21 +0900)
Change-Id: Ib6c9d6e1f9778d176b1006f5e4bc4e95ff474a34
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
packaging/capi-network-connection.spec
src/connection.c

index 001bb57..73a55fa 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          capi-network-connection
 Summary:       Network Connection library in TIZEN C API
-Version:       1.0.99
+Version:       1.0.100
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 0cf5532..348a3a2 100755 (executable)
@@ -205,6 +205,7 @@ static void *__connection_get_ip_changed_userdata(
 static gboolean __connection_cb_ip_changed_cb_idle(gpointer user_data)
 {
        char *ip_addr;
+       char *ip6_addr;
        void *data;
        connection_address_changed_cb callback;
        connection_handle_s *local_handle = (connection_handle_s *)user_data;
@@ -217,13 +218,19 @@ static gboolean __connection_cb_ip_changed_cb_idle(gpointer user_data)
                CONNECTION_LOG(CONNECTION_ERROR, //LCOV_EXCL_LINE
                        "vconf_get_str(VCONFKEY_NETWORK_IP) is Failed");
 
+       ip6_addr = vconf_get_str(VCONFKEY_NETWORK_IP6);
+       if (ip6_addr == NULL)
+               CONNECTION_LOG(CONNECTION_ERROR, //LCOV_EXCL_LINE
+                       "vconf_get_str(VCONFKEY_NETWORK_IP6) is Failed");
+
        callback = __connection_get_ip_changed_callback(local_handle);
        data = __connection_get_ip_changed_userdata(local_handle);
-       /* TODO: IPv6 should be supported */
+
        if (callback)
-               callback(ip_addr, NULL, data);
+               callback(ip_addr, ip6_addr, data);
 
        free(ip_addr);
+       free(ip6_addr);
 
        return FALSE;
 }
@@ -254,9 +261,12 @@ static int __connection_set_ip_changed_callback(connection_h connection,
        local_handle = (connection_handle_s *)connection;
 
        if (callback) {
-               if (refcount == 0)
+               if (refcount == 0) {
                        vconf_notify_key_changed(VCONFKEY_NETWORK_IP,
                                        __connection_cb_ip_change_cb, NULL);
+                       vconf_notify_key_changed(VCONFKEY_NETWORK_IP6,
+                                       __connection_cb_ip_change_cb, NULL);
+               }
 
                refcount++;
                CONNECTION_LOG(CONNECTION_INFO, "Successfully registered(%d)", refcount);
@@ -272,6 +282,14 @@ static int __connection_set_ip_changed_callback(connection_h connection,
                                        CONNECTION_LOG(CONNECTION_INFO,
                                                        "Successfully de-registered(%d)", refcount);
                                }
+                               if (vconf_ignore_key_changed(VCONFKEY_NETWORK_IP6,
+                                               __connection_cb_ip_change_cb) < 0) {
+                                       CONNECTION_LOG(CONNECTION_ERROR, //LCOV_EXCL_LINE
+                                                       "Error to de-register vconf callback(%d)", refcount);
+                               } else {
+                                       CONNECTION_LOG(CONNECTION_INFO,
+                                                       "Successfully de-registered(%d)", refcount);
+                               }
                        }
                }
        }