From c903b25af5ff3d2bdf3d49ebb090285834798870 Mon Sep 17 00:00:00 2001 From: Priya Kohli Date: Wed, 26 Jul 2017 09:26:28 +0530 Subject: [PATCH] Adding IPv4 and IPv6 addresses in Network Info. Change-Id: I496fa92ea4181bec8ed496555de16bfbe6257afc Signed-off-by: Priya Kohli --- sources/libraries/Common/common_ip_info.c | 39 +++++++++++++++++++++++ sources/libraries/Common/include/common_ip_info.h | 2 ++ 2 files changed, 41 insertions(+) diff --git a/sources/libraries/Common/common_ip_info.c b/sources/libraries/Common/common_ip_info.c index f4db815..a2c595b 100755 --- a/sources/libraries/Common/common_ip_info.c +++ b/sources/libraries/Common/common_ip_info.c @@ -25,6 +25,8 @@ #include "i18nmanager.h" #define DEFAULT_PROXY_ADDR "0.0.0.0:80" +#define IPV4_LABEL "IPv4" +#define IPV6_LABEL "IPv6" #define MAX_PORT_NUMBER 65535 #define MAX_LABEL_LENGTH 512 @@ -872,6 +874,7 @@ static void __ip_info_toggle_item_sel_cb(void* data, if (ip_type == WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC) { char *ip_addr = NULL; + char *ipv6_addr = NULL; /* Hide input keypad if popped out */ ecore_imf_input_panel_hide(); @@ -879,6 +882,7 @@ static void __ip_info_toggle_item_sel_cb(void* data, _delete_static_ip_table(ip_info_list_data); wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &ip_addr); + wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV6, &ipv6_addr); /* Dynamic IP Address */ ip_info_list_data->ip_addr_item = _add_description( @@ -887,13 +891,36 @@ static void __ip_info_toggle_item_sel_cb(void* data, ip_addr, ip_info_list_data->ip_toggle_item); + ip_info_list_data->ipv4_addr_item = _add_description( + ip_info_list_data->genlist, + IPV4_LABEL, + ip_addr, + ip_info_list_data->ip_addr_item); + + if (g_strcmp0(ipv6_addr, "::")) + ip_info_list_data->ipv6_addr_item = _add_description( + ip_info_list_data->genlist, + IPV6_LABEL, + ipv6_addr, + ip_info_list_data->ipv4_addr_item); + g_free(ip_addr); ip_addr = NULL; + g_free(ipv6_addr); + ipv6_addr = NULL; + ip_info_list_data->ip_type = WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC; } else if (ip_type == WIFI_MANAGER_IP_CONFIG_TYPE_STATIC) { elm_object_item_del(ip_info_list_data->ip_addr_item); ip_info_list_data->ip_addr_item = NULL; + + elm_object_item_del(ip_info_list_data->ipv4_addr_item); + ip_info_list_data->ipv4_addr_item = NULL; + + elm_object_item_del(ip_info_list_data->ipv6_addr_item); + ip_info_list_data->ipv6_addr_item = NULL; + ip_data->is_first_create = FALSE; /* Create the entry layouts */ @@ -1067,6 +1094,7 @@ full_ip_info_t *ip_info_append_items(wifi_manager_ap_h ap, const char *pkg_name, common_utils_entry_info_t *edit_box_details; wifi_manager_proxy_type_e proxy_type; char *ip_addr = NULL; + char *ipv6_addr = NULL; char *temp = NULL; char *str2 = NULL; full_ip_info_t *ip_data = NULL; @@ -1148,14 +1176,25 @@ full_ip_info_t *ip_info_append_items(wifi_manager_ap_h ap, const char *pkg_name, _create_static_ip_table(ip_data); } else if (WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC == type) { wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &ip_addr); + wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV6, &ipv6_addr); prev_ip_info->ip_addr = g_strdup(ip_addr); ip_info_list_data->ip_addr_item = _add_description(genlist, "IDS_WIFI_BODY_IP_ADDRESS", ip_addr, NULL); + ip_info_list_data->ipv4_addr_item = _add_description(genlist, + IPV4_LABEL, ip_addr, NULL); + + if(g_strcmp0(ipv6_addr, "::")) + ip_info_list_data->ipv6_addr_item = _add_description(genlist, + IPV6_LABEL, ipv6_addr, NULL); + g_free(ip_addr); ip_addr = NULL; + + g_free(ipv6_addr); + ipv6_addr = NULL; } if (_is_emulator()) { diff --git a/sources/libraries/Common/include/common_ip_info.h b/sources/libraries/Common/include/common_ip_info.h index 20f91fd..06a5a01 100755 --- a/sources/libraries/Common/include/common_ip_info.h +++ b/sources/libraries/Common/include/common_ip_info.h @@ -40,6 +40,8 @@ typedef struct ip_info_list { Evas_Object *genlist; Elm_Object_Item *ip_toggle_item; Elm_Object_Item *ip_addr_item; + Elm_Object_Item *ipv4_addr_item; + Elm_Object_Item *ipv6_addr_item; Elm_Object_Item *mac_addr_item; Elm_Object_Item *subnet_mask_item; Elm_Object_Item *gateway_addr_item; -- 2.7.4