Added vconf key for ipv6 address. 30/84230/2 tizen_tv_devel
authorSumit Aggarwal <aggarwal.s@samsung.com>
Wed, 17 Aug 2016 11:24:30 +0000 (16:54 +0530)
committerSumit Aggarwal <aggarwal.s@samsung.com>
Thu, 25 Aug 2016 01:12:20 +0000 (06:42 +0530)
Corrected API __connection_cb_proxy_changed_cb_idle for ipv6
address change callback.
Corrected API connection_get_ip_address for ipv6 address.

Change-Id: Ic36a294abcc338d2d7d8de388919d06c46c9d532
Signed-off-by: Sumit Aggarwal <aggarwal.s@samsung.com>
src/connection.c

index 3901e2e826bd65037a9d8ca15ed0ea647a63d1b1..12cdede8a769a5647975ed51dca8ac97ff6d7608 100755 (executable)
@@ -21,6 +21,8 @@
 
 #include "net_connection_private.h"
 
+#define VCONFKEY_NETWORK_IP6            "memory/dnet/ip6"
+
 static __thread GSList *conn_handle_list = NULL;
 
 //LCOV_EXCL_START
@@ -202,6 +204,7 @@ static void *__connection_get_ip_changed_userdata(
 static gboolean __connection_cb_ip_changed_cb_idle(gpointer user_data)
 {
        char *ip_addr;
+       char *ip_addr6;
        void *data;
        connection_address_changed_cb callback;
        connection_handle_s *local_handle = (connection_handle_s *)user_data;
@@ -214,13 +217,18 @@ 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");
 
+       ip_addr6 = vconf_get_str(VCONFKEY_NETWORK_IP6);
+       if (ip_addr6 == 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, ip_addr6, data);
 
        g_free(ip_addr);
+       g_free(ip_addr6);
 
        return FALSE;
 }
@@ -254,6 +262,8 @@ static int __connection_set_ip_changed_callback(connection_h connection,
                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);
@@ -493,9 +503,11 @@ EXPORT_API int connection_get_ip_address(connection_h connection,
 
        switch (address_family) {
        case CONNECTION_ADDRESS_FAMILY_IPV4:
-       case CONNECTION_ADDRESS_FAMILY_IPV6:
                *ip_address = vconf_get_str(VCONFKEY_NETWORK_IP);
                break;
+       case CONNECTION_ADDRESS_FAMILY_IPV6:
+               *ip_address = vconf_get_str(VCONFKEY_NETWORK_IP6);
+               break;
        default:
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
                return CONNECTION_ERROR_INVALID_PARAMETER;