increase code quality 25/240825/3
authorYoungjae Shin <yj99.shin@samsung.com>
Wed, 12 Aug 2020 00:44:26 +0000 (09:44 +0900)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Tue, 3 Aug 2021 10:10:06 +0000 (15:40 +0530)
separate big function
add storage class specifier(static)
remove unused global varialbe

Change-Id: I9a61adc1c253a145654752ce869f85c7ad87380a

18 files changed:
src/network_interface.c
tools/manager-tool/wifi_mgr_extension.c
tools/manager-tool/wifi_mgr_extension_autoconnect.c
tools/manager-tool/wifi_mgr_extension_autoscan.c
tools/manager-tool/wifi_mgr_extension_bss.c
tools/manager-tool/wifi_mgr_extension_ipconflict.c
tools/manager-tool/wifi_mgr_extension_netlinkscan.c
tools/manager-tool/wifi_mgr_menu.c
tools/manager-tool/wifi_mgr_public.c
tools/manager-tool/wifi_mgr_public_config.c
tools/manager-tool/wifi_mgr_public_connect.c
tools/manager-tool/wifi_mgr_public_get.c
tools/manager-tool/wifi_mgr_public_ipconflict.c
tools/manager-tool/wifi_mgr_public_scan.c
tools/manager-tool/wifi_mgr_public_set.c
tools/manager-tool/wifi_mgr_public_tdls.c
tools/manager-tool/wifi_mgr_public_vsie.c
tools/manager-tool/wifi_mgr_tool.c

index 05662d7..4e46898 100644 (file)
@@ -197,79 +197,136 @@ static gboolean __net_check_address_type(int address_family, const char *address
        return FALSE;
 }
 
-static int __net_extract_common_info(const char *key, GVariant *variant, net_profile_info_s* ProfInfo)
-{
-       __NETWORK_FUNC_ENTER__;
+static inline int _net_extract_cinfo_state(const gchar *value)
+{
+       if (g_strcmp0(value, "idle") == 0)
+               return NET_STATE_TYPE_IDLE;
+       else if (g_strcmp0(value, "failure") == 0)
+               return NET_STATE_TYPE_FAILURE;
+       else if (g_strcmp0(value, "association") == 0)
+               return NET_STATE_TYPE_ASSOCIATION;
+       else if (g_strcmp0(value, "configuration") == 0)
+               return NET_STATE_TYPE_CONFIGURATION;
+       else if (g_strcmp0(value, "ready") == 0)
+               return NET_STATE_TYPE_READY;
+       else if (g_strcmp0(value, "disconnect") == 0)
+               return NET_STATE_TYPE_DISCONNECT;
+       else if (g_strcmp0(value, "online") == 0)
+               return NET_STATE_TYPE_ONLINE;
+       else
+               return NET_STATE_TYPE_UNKNOWN;
+}
+
+static inline int _net_extract_cinfo_error(const gchar *value)
+{
+       if (g_strcmp0(value, "invalid-key") == 0)
+               return NET_STATE_ERROR_INVALID_KEY;
+       else if (g_strcmp0(value, "connect-failed") == 0)
+               return NET_STATE_ERROR_CONNECT_FAILED;
+       else if (g_strcmp0(value, "auth-failed") == 0)
+               return NET_STATE_ERROR_AUTH_FAILED;
+       else if (g_strcmp0(value, "login-failed") == 0)
+               return NET_STATE_ERROR_LOGIN_FAILED;
+       else if (g_strcmp0(value, "dhcp-failed") == 0)
+               return NET_STATE_ERROR_DHCP_FAILED;
+       else if (g_strcmp0(value, "out-of-range") == 0)
+               return NET_STATE_ERROR_OUT_OF_RANGE;
+       else if (g_strcmp0(value, "pin-missing") == 0)
+               return NET_STATE_ERROR_PIN_MISSING;
+       else
+               return NET_STATE_ERROR_NONE;
+}
 
-       net_err_e Error = NET_ERR_NONE;
-       const gchar *subKey = NULL;
+static inline void _net_extract_cinfo_ethernet(GVariant *variant, net_dev_info_s *net_info)
+{
+       GVariant *var = NULL;
+       GVariantIter *iter = NULL;
        const gchar *value = NULL;
-       net_dev_info_s* net_info = NULL;
+       const gchar *subKey = NULL;
+
+       g_variant_get(variant, "a{sv}", &iter);
+       while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
+               if (g_strcmp0(subKey, "Interface") == 0) {
+                       value = g_variant_get_string(var, NULL);
+
+                       if (value != NULL)
+                               g_strlcpy(net_info->DevName, value, NET_MAX_DEVICE_NAME_LEN);
+               } else if (g_strcmp0(subKey, "Address") == 0) {
+                       value = g_variant_get_string(var, NULL);
+
+                       if (value != NULL)
+                               g_strlcpy(net_info->MacAddr, value, WIFI_MAC_ADDR_LEN + 1);
+               }
+       }
+       g_variant_iter_free(iter);
+}
+
+static inline void _net_extract_cinfo_ipv4(GVariant *variant, net_dev_info_s *net_info)
+{
        GVariant *var = NULL;
        GVariantIter *iter = NULL;
+       const gchar *value = NULL;
+       const gchar *subKey = NULL;
 
-       net_info = &(ProfInfo->net_info);
+       g_variant_get(variant, "a{sv}", &iter);
+       while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
+               if (g_strcmp0(subKey, "Method") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-       if (g_strcmp0(key, "State") == 0) {
-               value = g_variant_get_string(variant, NULL);
+                       if (g_strcmp0(value, "dhcp") == 0)
+                               net_info->IpConfigType = NET_IP_CONFIG_TYPE_DYNAMIC;
+                       else if (g_strcmp0(value, "manual") == 0)
+                               net_info->IpConfigType = NET_IP_CONFIG_TYPE_STATIC;
+                       else if (g_strcmp0(value, "fixed") == 0)
+                               net_info->IpConfigType = NET_IP_CONFIG_TYPE_FIXED;
+                       else if (g_strcmp0(value, "off") == 0)
+                               net_info->IpConfigType = NET_IP_CONFIG_TYPE_OFF;
+
+                       if (net_info->IpConfigType != NET_IP_CONFIG_TYPE_DYNAMIC) {
+                               net_info->BServerAddr = FALSE;
+                               net_info->ServerAddr.Type = NET_ADDR_IPV4;
+                               net_info->ServerAddr.Data.Ipv4.s_addr = 0;
+                       }
 
-               if (g_strcmp0(value, "idle") == 0)
-                       ProfInfo->ProfileState = NET_STATE_TYPE_IDLE;
-               else if (g_strcmp0(value, "failure") == 0)
-                       ProfInfo->ProfileState = NET_STATE_TYPE_FAILURE;
-               else if (g_strcmp0(value, "association") == 0)
-                       ProfInfo->ProfileState = NET_STATE_TYPE_ASSOCIATION;
-               else if (g_strcmp0(value, "configuration") == 0)
-                       ProfInfo->ProfileState = NET_STATE_TYPE_CONFIGURATION;
-               else if (g_strcmp0(value, "ready") == 0)
-                       ProfInfo->ProfileState = NET_STATE_TYPE_READY;
-               else if (g_strcmp0(value, "disconnect") == 0)
-                       ProfInfo->ProfileState = NET_STATE_TYPE_DISCONNECT;
-               else if (g_strcmp0(value, "online") == 0)
-                       ProfInfo->ProfileState = NET_STATE_TYPE_ONLINE;
-               else
-                       ProfInfo->ProfileState = NET_STATE_TYPE_UNKNOWN;
-       } else if (g_strcmp0(key, "Error") == 0) {
-               value = g_variant_get_string(variant, NULL);
+               } else if (g_strcmp0(subKey, "Address") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-               if (g_strcmp0(value, "invalid-key") == 0)
-                       ProfInfo->ProfileErrorState = NET_STATE_ERROR_INVALID_KEY;
-               else if (g_strcmp0(value, "connect-failed") == 0)
-                       ProfInfo->ProfileErrorState = NET_STATE_ERROR_CONNECT_FAILED;
-               else if (g_strcmp0(value, "auth-failed") == 0)
-                       ProfInfo->ProfileErrorState = NET_STATE_ERROR_AUTH_FAILED;
-               else if (g_strcmp0(value, "login-failed") == 0)
-                       ProfInfo->ProfileErrorState = NET_STATE_ERROR_LOGIN_FAILED;
-               else if (g_strcmp0(value, "dhcp-failed") == 0)
-                       ProfInfo->ProfileErrorState = NET_STATE_ERROR_DHCP_FAILED;
-               else if (g_strcmp0(value, "out-of-range") == 0)
-                       ProfInfo->ProfileErrorState = NET_STATE_ERROR_OUT_OF_RANGE;
-               else if (g_strcmp0(value, "pin-missing") == 0)
-                       ProfInfo->ProfileErrorState = NET_STATE_ERROR_PIN_MISSING;
-       } else if (g_strcmp0(key, "Favorite") == 0) {
-               gboolean val = g_variant_get_boolean(variant);
+                       __net_extract_ip(value, &net_info->IpAddr);
+               } else if (g_strcmp0(subKey, "Netmask") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-               if (val)
-                       ProfInfo->Favourite = (char)TRUE;
-               else
-                       ProfInfo->Favourite = (char)FALSE;
-       } else if (g_strcmp0(key, "Ethernet") == 0) {
-               g_variant_get(variant, "a{sv}", &iter);
-               while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
-                       if (g_strcmp0(subKey, "Interface") == 0) {
-                               value = g_variant_get_string(var, NULL);
+                       __net_extract_ip(value, &net_info->SubnetMask);
+                       net_info->PrefixLen = __net_get_prefix_len(value);
+                       net_info->BNetmask = TRUE;
+               } else if (g_strcmp0(subKey, "Gateway") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-                               if (value != NULL)
-                                       g_strlcpy(net_info->DevName, value, NET_MAX_DEVICE_NAME_LEN);
-                       } else if (g_strcmp0(subKey, "Address") == 0) {
-                               value = g_variant_get_string(var, NULL);
+                       __net_extract_ip(value, &net_info->GatewayAddr);
+                       net_info->BDefGateway = TRUE;
+               } else if (g_strcmp0(subKey, "DHCPServerIP") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-                               if (value != NULL)
-                                       g_strlcpy(net_info->MacAddr, value, WIFI_MAC_ADDR_LEN + 1);
-                       }
+                       __net_extract_ip(value, &net_info->ServerAddr);
+                       net_info->BServerAddr = TRUE;
+               } else if (g_strcmp0(subKey, "DHCPLeaseDuration") == 0) {
+                       net_info->DHCPLeaseDuration = g_variant_get_int32(var);
                }
-               g_variant_iter_free(iter);
-       } else if (g_strcmp0(key, "IPv4") == 0) {
+       }
+       g_variant_iter_free(iter);
+}
+
+static inline void _net_extract_cinfo_ipv4_configuration(GVariant *variant, net_dev_info_s *net_info)
+{
+       GVariant *var = NULL;
+       GVariantIter *iter = NULL;
+       const gchar *value = NULL;
+       const gchar *subKey = NULL;
+
+       if (net_info->IpConfigType != NET_IP_CONFIG_TYPE_DYNAMIC &&
+               net_info->IpConfigType != NET_IP_CONFIG_TYPE_STATIC &&
+               net_info->IpConfigType != NET_IP_CONFIG_TYPE_FIXED &&
+               net_info->IpConfigType != NET_IP_CONFIG_TYPE_OFF) {
+
                g_variant_get(variant, "a{sv}", &iter);
                while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
                        if (g_strcmp0(subKey, "Method") == 0) {
@@ -284,323 +341,243 @@ static int __net_extract_common_info(const char *key, GVariant *variant, net_pro
                                else if (g_strcmp0(value, "off") == 0)
                                        net_info->IpConfigType = NET_IP_CONFIG_TYPE_OFF;
 
-                               if (net_info->IpConfigType != NET_IP_CONFIG_TYPE_DYNAMIC) {
-                                       net_info->BServerAddr = FALSE;
-                                       net_info->ServerAddr.Type = NET_ADDR_IPV4;
-                                       net_info->ServerAddr.Data.Ipv4.s_addr = 0;
-                               }
-
-                       } else if (g_strcmp0(subKey, "Address") == 0) {
+                       } else if (g_strcmp0(subKey, "Address") == 0 &&
+                               net_info->IpAddr.Data.Ipv4.s_addr == 0) {
                                value = g_variant_get_string(var, NULL);
 
                                __net_extract_ip(value, &net_info->IpAddr);
-                       } else if (g_strcmp0(subKey, "Netmask") == 0) {
+                       } else if (g_strcmp0(subKey, "Netmask") == 0 &&
+                               net_info->SubnetMask.Data.Ipv4.s_addr == 0) {
                                value = g_variant_get_string(var, NULL);
 
                                __net_extract_ip(value, &net_info->SubnetMask);
                                net_info->PrefixLen = __net_get_prefix_len(value);
                                net_info->BNetmask = TRUE;
-                       } else if (g_strcmp0(subKey, "Gateway") == 0) {
+                       } else if (g_strcmp0(subKey, "Gateway") == 0 &&
+                               net_info->GatewayAddr.Data.Ipv4.s_addr == 0) {
                                value = g_variant_get_string(var, NULL);
 
                                __net_extract_ip(value, &net_info->GatewayAddr);
                                net_info->BDefGateway = TRUE;
-                       } else if (g_strcmp0(subKey, "DHCPServerIP") == 0) {
-                               value = g_variant_get_string(var, NULL);
-
-                               __net_extract_ip(value, &net_info->ServerAddr);
-                               net_info->BServerAddr = TRUE;
-                       } else if (g_strcmp0(subKey, "DHCPLeaseDuration") == 0) {
-                               net_info->DHCPLeaseDuration = g_variant_get_int32(var);
                        }
                }
                g_variant_iter_free(iter);
-       } else if (g_strcmp0(key, "IPv4.Configuration") == 0) {
-               if (net_info->IpConfigType != NET_IP_CONFIG_TYPE_DYNAMIC &&
-                   net_info->IpConfigType != NET_IP_CONFIG_TYPE_STATIC &&
-                   net_info->IpConfigType != NET_IP_CONFIG_TYPE_FIXED &&
-                   net_info->IpConfigType != NET_IP_CONFIG_TYPE_OFF) {
-
-                       g_variant_get(variant, "a{sv}", &iter);
-                       while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
-                               if (g_strcmp0(subKey, "Method") == 0) {
-                                       value = g_variant_get_string(var, NULL);
-
-                                       if (g_strcmp0(value, "dhcp") == 0)
-                                               net_info->IpConfigType = NET_IP_CONFIG_TYPE_DYNAMIC;
-                                       else if (g_strcmp0(value, "manual") == 0)
-                                               net_info->IpConfigType = NET_IP_CONFIG_TYPE_STATIC;
-                                       else if (g_strcmp0(value, "fixed") == 0)
-                                               net_info->IpConfigType = NET_IP_CONFIG_TYPE_FIXED;
-                                       else if (g_strcmp0(value, "off") == 0)
-                                               net_info->IpConfigType = NET_IP_CONFIG_TYPE_OFF;
-
-                               } else if (g_strcmp0(subKey, "Address") == 0 &&
-                                                       net_info->IpAddr.Data.Ipv4.s_addr == 0) {
-                                       value = g_variant_get_string(var, NULL);
-
-                                       __net_extract_ip(value, &net_info->IpAddr);
-                               } else if (g_strcmp0(subKey, "Netmask") == 0 &&
-                                                       net_info->SubnetMask.Data.Ipv4.s_addr == 0) {
-                                       value = g_variant_get_string(var, NULL);
-
-                                       __net_extract_ip(value, &net_info->SubnetMask);
-                                       net_info->PrefixLen = __net_get_prefix_len(value);
-                                       net_info->BNetmask = TRUE;
-                               } else if (g_strcmp0(subKey, "Gateway") == 0 &&
-                                                       net_info->GatewayAddr.Data.Ipv4.s_addr == 0) {
-                                       value = g_variant_get_string(var, NULL);
-
-                                       __net_extract_ip(value, &net_info->GatewayAddr);
-                                       net_info->BDefGateway = TRUE;
-                               }
-                       }
-                       g_variant_iter_free(iter);
-               }
-       } else if (g_strcmp0(key, "IPv6") == 0) {
-               g_variant_get(variant, "a{sv}", &iter);
-               while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
-                       if (g_strcmp0(subKey, "Method") == 0) {
-                               value = g_variant_get_string(var, NULL);
+       }
+}
 
-                               if (g_strcmp0(value, "manual") == 0)
-                                       net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_STATIC;
-                               else if (g_strcmp0(value, "off") == 0)
-                                       net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_OFF;
-                               else if (g_strcmp0(value, "auto") == 0)
-                                       net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_AUTO_IP;
+static inline void _net_extract_cinfo_ipv6(GVariant *variant, net_dev_info_s *net_info)
+{
+       GVariant *var = NULL;
+       GVariantIter *iter = NULL;
+       const gchar *value = NULL;
+       const gchar *subKey = NULL;
 
-                       } else if (g_strcmp0(subKey, "Address") == 0) {
-                               value = g_variant_get_string(var, NULL);
+       g_variant_get(variant, "a{sv}", &iter);
+       while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
+               if (g_strcmp0(subKey, "Method") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-                               inet_pton(AF_INET6, value, &net_info->IpAddr6.Data.Ipv6);
-                       } else if (g_strcmp0(subKey, "PrefixLength") == 0) {
-                               net_info->PrefixLen6 = g_variant_get_byte(var);
-                       } else if (g_strcmp0(subKey, "Gateway") == 0) {
-                               value = g_variant_get_string(var, NULL);
+                       if (g_strcmp0(value, "manual") == 0)
+                               net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_STATIC;
+                       else if (g_strcmp0(value, "off") == 0)
+                               net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_OFF;
+                       else if (g_strcmp0(value, "auto") == 0)
+                               net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_AUTO_IP;
 
-                               inet_pton(AF_INET6, value, &net_info->GatewayAddr6.Data.Ipv6);
-                               net_info->BDefGateway6 = TRUE;
-                       } else if (g_strcmp0(subKey, "Privacy") == 0) {
-                               value = g_variant_get_string(var, NULL);
+               } else if (g_strcmp0(subKey, "Address") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-                               if (value != NULL)
-                                       g_strlcpy(net_info->Privacy6, value, NET_IPV6_MAX_PRIVACY_LEN);
-                       }
+                       inet_pton(AF_INET6, value, &net_info->IpAddr6.Data.Ipv6);
+               } else if (g_strcmp0(subKey, "PrefixLength") == 0) {
+                       net_info->PrefixLen6 = g_variant_get_byte(var);
+               } else if (g_strcmp0(subKey, "Gateway") == 0) {
+                       value = g_variant_get_string(var, NULL);
+
+                       inet_pton(AF_INET6, value, &net_info->GatewayAddr6.Data.Ipv6);
+                       net_info->BDefGateway6 = TRUE;
+               } else if (g_strcmp0(subKey, "Privacy") == 0) {
+                       value = g_variant_get_string(var, NULL);
+
+                       if (value != NULL)
+                               g_strlcpy(net_info->Privacy6, value, NET_IPV6_MAX_PRIVACY_LEN);
                }
-               g_variant_iter_free(iter);
-       } else if (g_strcmp0(key, "IPv6.Configuration") == 0) {
-               g_variant_get(variant, "a{sv}", &iter);
-               while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
-                       if (g_strcmp0(subKey, "Method") == 0) {
-                               value = g_variant_get_string(var, NULL);
+       }
+       g_variant_iter_free(iter);
+}
 
-                               if (g_strcmp0(value, "manual") == 0)
-                                       net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_STATIC;
-                               else if (g_strcmp0(value, "off") == 0)
-                                       net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_OFF;
-                               else if (g_strcmp0(value, "auto") == 0)
-                                       net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_AUTO_IP;
+static inline void _net_extract_cinfo_ipv6_configuration(GVariant *variant, net_dev_info_s *net_info)
+{
+       GVariant *var = NULL;
+       GVariantIter *iter = NULL;
+       const gchar *value = NULL;
+       const gchar *subKey = NULL;
 
-                       } else if (g_strcmp0(subKey, "Address") == 0) {
-                               value = g_variant_get_string(var, NULL);
+       g_variant_get(variant, "a{sv}", &iter);
+       while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
+               if (g_strcmp0(subKey, "Method") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-                               inet_pton(AF_INET6, value, &net_info->IpAddr6.Data.Ipv6);
-                       } else if (g_strcmp0(subKey, "PrefixLength") == 0) {
-                               net_info->PrefixLen6 = g_variant_get_byte(var);
-                       } else if (g_strcmp0(subKey, "Gateway") == 0) {
-                               value = g_variant_get_string(var, NULL);
+                       if (g_strcmp0(value, "manual") == 0)
+                               net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_STATIC;
+                       else if (g_strcmp0(value, "off") == 0)
+                               net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_OFF;
+                       else if (g_strcmp0(value, "auto") == 0)
+                               net_info->IpConfigType6 = NET_IP_CONFIG_TYPE_AUTO_IP;
 
-                               inet_pton(AF_INET6, value, &net_info->GatewayAddr6.Data.Ipv6);
-                               net_info->BDefGateway6 = TRUE;
-                       } else if (g_strcmp0(subKey, "Privacy") == 0) {
-                               value = g_variant_get_string(var, NULL);
+               } else if (g_strcmp0(subKey, "Address") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-                               if (value != NULL)
-                                       g_strlcpy(net_info->Privacy6, value, NET_IPV6_MAX_PRIVACY_LEN);
-                       }
-               }
-               g_variant_iter_free(iter);
-       } else if (g_strcmp0(key, "Nameservers") == 0) {
-               int dnsCount = 0;
-               int dnsCount6 = 0;
-               gchar *dns_value = NULL;
-               gchar *dns_type = NULL;
-
-               g_variant_get(variant, "as", &iter);
-
-               while (g_variant_iter_loop(iter, "s", &dns_value)) {
-                       if (__net_check_address_type(AF_INET6, dns_value)) {
-                               if (dnsCount6 < NET_DNS_ADDR_MAX) {
-                                       net_info->DnsAddr6[dnsCount6].Type =
-                                               NET_ADDR_IPV6;
-                                       inet_pton(AF_INET6, dns_value,
-                                                       &net_info->DnsAddr6[dnsCount6]\
-                                                       .Data.Ipv6);
-                                       dnsCount6++;
-                               }
-                       } else if (__net_check_address_type(AF_INET, dns_value)) {
-                               if (dnsCount < NET_DNS_ADDR_MAX) {
-                                       net_info->DnsAddr[dnsCount].Type =
-                                               NET_ADDR_IPV4;
-                                       __net_extract_ip(dns_value,
-                                                       &net_info->DnsAddr[dnsCount]);
-                                       dnsCount++;
-                               }
-                       } else { /* DNS Type */
-                               dns_type = g_strdup(dns_value);
-                               if (g_strcmp0(dns_type, "ipv4.manual") == 0)
-                                       net_info->DnsConfigType =
-                                               NET_DNS_CONFIG_TYPE_STATIC;
-                               else if (g_strcmp0(dns_type, "ipv4.dhcp") == 0)
-                                       net_info->DnsConfigType =
-                                               NET_DNS_CONFIG_TYPE_DYNAMIC;
-                               if (g_strcmp0(dns_type, "ipv6.manual") == 0)
-                                       net_info->DnsConfigType6 =
-                                               NET_DNS_CONFIG_TYPE_STATIC;
-                               else if (g_strcmp0(dns_type, "ipv6.dhcp") == 0)
-                                       net_info->DnsConfigType6 =
-                                               NET_DNS_CONFIG_TYPE_DYNAMIC;
-                               g_free(dns_type);
-                       }
-               }
-               g_variant_iter_free(iter);
+                       inet_pton(AF_INET6, value, &net_info->IpAddr6.Data.Ipv6);
+               } else if (g_strcmp0(subKey, "PrefixLength") == 0) {
+                       net_info->PrefixLen6 = g_variant_get_byte(var);
+               } else if (g_strcmp0(subKey, "Gateway") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-               net_info->DnsCount = dnsCount;
-               net_info->DnsCount6 = dnsCount6;
-       } else if (g_strcmp0(key, "Nameservers.Configuration") == 0 && net_info->DnsCount == 0) {
-               int dnsCount = 0;
-               int dnsCount6 = 0;
-               gchar *dns_value = NULL;
-               gchar *dns_type = NULL;
-
-               g_variant_get(variant, "as", &iter);
-
-               while (g_variant_iter_loop(iter, "s", &dns_value)) {
-                       if (__net_check_address_type(AF_INET6, dns_value)) {
-                               if (dnsCount6 < NET_DNS_ADDR_MAX) {
-                                       net_info->DnsAddr6[dnsCount6].Type =
-                                               NET_ADDR_IPV6;
-                                       inet_pton(AF_INET6, dns_value,
-                                                       &net_info->DnsAddr6[dnsCount6]\
-                                                       .Data.Ipv6);
-                                       dnsCount6++;
-                               }
-                       } else if (__net_check_address_type(AF_INET, dns_value)) {
-                               if (dnsCount < NET_DNS_ADDR_MAX) {
-                                       net_info->DnsAddr[dnsCount].Type =
-                                               NET_ADDR_IPV4;
-                                       __net_extract_ip(dns_value,
-                                                       &net_info->DnsAddr[dnsCount]);
-                                       dnsCount++;
-                               }
-                       } else { /* DNS Type */
-                               dns_type = g_strdup(dns_value);
-                               if (g_strcmp0(dns_type, "ipv4.manual") == 0)
-                                       net_info->DnsConfigType =
-                                               NET_DNS_CONFIG_TYPE_STATIC;
-                               else if (g_strcmp0(dns_type, "ipv4.dhcp") == 0)
-                                       net_info->DnsConfigType =
-                                               NET_DNS_CONFIG_TYPE_DYNAMIC;
-                               if (g_strcmp0(dns_type, "ipv6.manual") == 0)
-                                       net_info->DnsConfigType6 =
-                                               NET_DNS_CONFIG_TYPE_STATIC;
-                               else if (g_strcmp0(dns_type, "ipv6.dhcp") == 0)
-                                       net_info->DnsConfigType6 =
-                                               NET_DNS_CONFIG_TYPE_DYNAMIC;
-                               g_free(dns_type);
-                       }
-               }
-               g_variant_iter_free(iter);
+                       inet_pton(AF_INET6, value, &net_info->GatewayAddr6.Data.Ipv6);
+                       net_info->BDefGateway6 = TRUE;
+               } else if (g_strcmp0(subKey, "Privacy") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-               net_info->DnsCount = dnsCount;
-               net_info->DnsCount6 = dnsCount6;
-       } else if (g_strcmp0(key, "Domains") == 0) {
-       } else if (g_strcmp0(key, "Domains.Configuration") == 0) {
-       } else if (g_strcmp0(key, "Proxy") == 0) {
-               const gchar *url = NULL;
-               gchar *servers = NULL;
+                       if (value != NULL)
+                               g_strlcpy(net_info->Privacy6, value, NET_IPV6_MAX_PRIVACY_LEN);
+               }
+       }
+       g_variant_iter_free(iter);
+}
 
-               g_variant_get(variant, "a{sv}", &iter);
-               while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
-                       if (g_strcmp0(subKey, "Method") == 0) {
-                               value = g_variant_get_string(var, NULL);
+static void _net_extract_cinfo_nameservers(GVariant *variant, net_dev_info_s *net_info)
+{
+       int dnsCount = 0;
+       int dnsCount6 = 0;
+       gchar *dns_value = NULL;
+       gchar *dns_type = NULL;
+       GVariantIter *iter = NULL;
 
-                               if (g_strcmp0(value, "direct") == 0)
-                                       net_info->ProxyMethod = NET_PROXY_TYPE_DIRECT;
-                               else if (g_strcmp0(value, "auto") == 0)
-                                       net_info->ProxyMethod = NET_PROXY_TYPE_AUTO;
-                               else if (g_strcmp0(value, "manual") == 0)
-                                       net_info->ProxyMethod = NET_PROXY_TYPE_MANUAL;
-                               else
-                                       net_info->ProxyMethod = NET_PROXY_TYPE_UNKNOWN;
-                       } else if (g_strcmp0(subKey, "URL") == 0) {
-                               url = g_variant_get_string(var, NULL);
-                       } else if (g_strcmp0(subKey, "Servers") == 0) {
-                               GVariantIter *iter_sub = NULL;
-
-                               g_variant_get(var, "as", &iter_sub);
-                               if (!g_variant_iter_loop(iter_sub, "s", &servers))
-                                       WIFI_LOG(WIFI_ERROR, "There was no value");
-                               g_variant_iter_free(iter_sub);
+       g_variant_get(variant, "as", &iter);
+       while (g_variant_iter_loop(iter, "s", &dns_value)) {
+               if (__net_check_address_type(AF_INET6, dns_value)) {
+                       if (dnsCount6 < NET_DNS_ADDR_MAX) {
+                               net_info->DnsAddr6[dnsCount6].Type = NET_ADDR_IPV6;
+                               inet_pton(AF_INET6, dns_value,
+                                       &net_info->DnsAddr6[dnsCount6].Data.Ipv6);
+                               dnsCount6++;
                        }
+               } else if (__net_check_address_type(AF_INET, dns_value)) {
+                       if (dnsCount < NET_DNS_ADDR_MAX) {
+                               net_info->DnsAddr[dnsCount].Type = NET_ADDR_IPV4;
+                               __net_extract_ip(dns_value, &net_info->DnsAddr[dnsCount]);
+                               dnsCount++;
+                       }
+               } else { /* DNS Type */
+                       dns_type = g_strdup(dns_value);
+                       if (g_strcmp0(dns_type, "ipv4.manual") == 0)
+                               net_info->DnsConfigType = NET_DNS_CONFIG_TYPE_STATIC;
+                       else if (g_strcmp0(dns_type, "ipv4.dhcp") == 0)
+                               net_info->DnsConfigType = NET_DNS_CONFIG_TYPE_DYNAMIC;
+                       if (g_strcmp0(dns_type, "ipv6.manual") == 0)
+                               net_info->DnsConfigType6 = NET_DNS_CONFIG_TYPE_STATIC;
+                       else if (g_strcmp0(dns_type, "ipv6.dhcp") == 0)
+                               net_info->DnsConfigType6 = NET_DNS_CONFIG_TYPE_DYNAMIC;
+                       g_free(dns_type);
                }
-               g_variant_iter_free(iter);
+       }
+       g_variant_iter_free(iter);
 
-               if (net_info->ProxyMethod == NET_PROXY_TYPE_AUTO && url != NULL)
-                       g_strlcpy(net_info->ProxyAddr, url, NET_PROXY_LEN_MAX);
-               else if (net_info->ProxyMethod == NET_PROXY_TYPE_MANUAL && servers != NULL)
-                       g_strlcpy(net_info->ProxyAddr, servers, NET_PROXY_LEN_MAX);
+       net_info->DnsCount = dnsCount;
+       net_info->DnsCount6 = dnsCount6;
+}
 
-               if (servers)
-                       g_free(servers);
-       } else if (g_strcmp0(key, "Proxy.Configuration") == 0 &&
-                       net_info->ProxyMethod != NET_PROXY_TYPE_AUTO &&
-                       net_info->ProxyMethod != NET_PROXY_TYPE_MANUAL) {
+static void _net_extract_cinfo_proxy(GVariant *variant, net_dev_info_s *net_info)
+{
+       GVariant *var = NULL;
+       GVariantIter *iter = NULL;
+       const gchar *value = NULL;
+       const gchar *subKey = NULL;
+       const gchar *url = NULL;
+       gchar *servers = NULL;
 
-               const gchar *url = NULL;
-               gchar *servers = NULL;
+       g_variant_get(variant, "a{sv}", &iter);
+       while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
+               if (g_strcmp0(subKey, "Method") == 0) {
+                       value = g_variant_get_string(var, NULL);
 
-               g_variant_get(variant, "a{sv}", &iter);
-               while (g_variant_iter_loop(iter, "{sv}", &subKey, &var)) {
-                       if (g_strcmp0(subKey, "Method") == 0) {
-                               value = g_variant_get_string(var, NULL);
+                       if (g_strcmp0(value, "direct") == 0)
+                               net_info->ProxyMethod = NET_PROXY_TYPE_DIRECT;
+                       else if (g_strcmp0(value, "auto") == 0)
+                               net_info->ProxyMethod = NET_PROXY_TYPE_AUTO;
+                       else if (g_strcmp0(value, "manual") == 0)
+                               net_info->ProxyMethod = NET_PROXY_TYPE_MANUAL;
+                       else
+                               net_info->ProxyMethod = NET_PROXY_TYPE_UNKNOWN;
+               } else if (g_strcmp0(subKey, "URL") == 0) {
+                       url = g_variant_get_string(var, NULL);
+               } else if (g_strcmp0(subKey, "Servers") == 0) {
+                       GVariantIter *iter_sub = NULL;
 
-                               if (g_strcmp0(value, "direct") == 0)
-                                       net_info->ProxyMethod = NET_PROXY_TYPE_DIRECT;
-                               else if (g_strcmp0(value, "auto") == 0)
-                                       net_info->ProxyMethod = NET_PROXY_TYPE_AUTO;
-                               else if (g_strcmp0(value, "manual") == 0)
-                                       net_info->ProxyMethod = NET_PROXY_TYPE_MANUAL;
-                               else
-                                       net_info->ProxyMethod = NET_PROXY_TYPE_UNKNOWN;
-                       } else if (g_strcmp0(subKey, "URL") == 0) {
-                               url = g_variant_get_string(var, NULL);
-                       } else if (g_strcmp0(subKey, "Servers") == 0) {
-                               GVariantIter *iter_sub = NULL;
+                       g_variant_get(var, "as", &iter_sub);
+                       if (!g_variant_iter_loop(iter_sub, "s", &servers))
+                               WIFI_LOG(WIFI_ERROR, "There was no value");
+                       g_variant_iter_free(iter_sub);
+               }
+       }
+       g_variant_iter_free(iter);
 
-                               g_variant_get(var, "as", &iter_sub);
-                               if (!g_variant_iter_loop(iter_sub, "s", &servers))
-                                       WIFI_LOG(WIFI_ERROR, "There was no value");
+       if (net_info->ProxyMethod == NET_PROXY_TYPE_AUTO && url != NULL)
+               g_strlcpy(net_info->ProxyAddr, url, NET_PROXY_LEN_MAX);
+       else if (net_info->ProxyMethod == NET_PROXY_TYPE_MANUAL && servers != NULL)
+               g_strlcpy(net_info->ProxyAddr, servers, NET_PROXY_LEN_MAX);
 
-                               g_variant_iter_free(iter_sub);
-                       }
-               }
-               g_variant_iter_free(iter);
+       if (servers)
+               g_free(servers);
+}
 
-               if (net_info->ProxyMethod == NET_PROXY_TYPE_AUTO && url != NULL)
-                       g_strlcpy(net_info->ProxyAddr, url, NET_PROXY_LEN_MAX);
-               else if (net_info->ProxyMethod == NET_PROXY_TYPE_MANUAL && servers != NULL)
-                       g_strlcpy(net_info->ProxyAddr, servers, NET_PROXY_LEN_MAX);
+static int __net_extract_common_info(const char *key, GVariant *variant, net_profile_info_s* ProfInfo)
+{
+       __NETWORK_FUNC_ENTER__;
 
-               if (servers)
-                       g_free(servers);
+       const gchar *value = NULL;
+       net_dev_info_s* net_info = NULL;
+
+       net_info = &(ProfInfo->net_info);
+
+       if (g_strcmp0(key, "State") == 0) {
+               value = g_variant_get_string(variant, NULL);
+               ProfInfo->ProfileState = _net_extract_cinfo_state(value);
+       } else if (g_strcmp0(key, "Error") == 0) {
+               value = g_variant_get_string(variant, NULL);
+               ProfInfo->ProfileErrorState = _net_extract_cinfo_error(value);
+       } else if (g_strcmp0(key, "Favorite") == 0) {
+               gboolean val = g_variant_get_boolean(variant);
+               ProfInfo->Favourite = (val) ? (char)TRUE : (char)FALSE;
+       } else if (g_strcmp0(key, "Ethernet") == 0) {
+               _net_extract_cinfo_ethernet(variant, net_info);
+       } else if (g_strcmp0(key, "IPv4") == 0) {
+               _net_extract_cinfo_ipv4(variant, net_info);
+       } else if (g_strcmp0(key, "IPv4.Configuration") == 0) {
+               _net_extract_cinfo_ipv4_configuration(variant, net_info);
+       } else if (g_strcmp0(key, "IPv6") == 0) {
+               _net_extract_cinfo_ipv6(variant, net_info);
+       } else if (g_strcmp0(key, "IPv6.Configuration") == 0) {
+               _net_extract_cinfo_ipv6_configuration(variant, net_info);
+       } else if (g_strcmp0(key, "Nameservers") == 0) {
+               _net_extract_cinfo_nameservers(variant, net_info);
+       } else if (g_strcmp0(key, "Nameservers.Configuration") == 0
+                       && net_info->DnsCount == 0) {
+               _net_extract_cinfo_nameservers(variant, net_info);
+       } else if (g_strcmp0(key, "Domains") == 0) {
+       } else if (g_strcmp0(key, "Domains.Configuration") == 0) {
+       } else if (g_strcmp0(key, "Proxy") == 0) {
+               _net_extract_cinfo_proxy(variant, net_info);
+       } else if (g_strcmp0(key, "Proxy.Configuration") == 0
+                       && net_info->ProxyMethod != NET_PROXY_TYPE_AUTO
+                       && net_info->ProxyMethod != NET_PROXY_TYPE_MANUAL) {
+               _net_extract_cinfo_proxy(variant, net_info);
        } else if (g_strcmp0(key, "Provider") == 0) {
                /* Do noting */
        }
 
        __NETWORK_FUNC_EXIT__;
-       return Error;
+       return NET_ERR_NONE;
 }
 
 static wlan_eap_type_e __convert_eap_type_from_string(const char *eap_type)
@@ -824,7 +801,155 @@ done:
        return Error;
 }
 
-static int __net_extract_wifi_info(GVariantIter *array, net_profile_info_s* ProfInfo)
+static inline int _net_extract_winfo_mode(const gchar *value)
+{
+       if (g_strcmp0(value, "managed") == 0)
+               return NET_WLAN_CONNMODE_INFRA;
+       else if (g_strcmp0(value, "adhoc") == 0)
+               return NET_WLAN_CONNMODE_ADHOC;
+       else
+               return NET_WLAN_CONNMODE_AUTO;
+}
+
+static inline void _net_extract_winfo_security(GVariant *var, net_profile_info_s *ProfInfo)
+{
+       const gchar *value;
+       GVariantIter *iter_sub = NULL;
+
+       g_variant_get(var, "as", &iter_sub);
+       while (g_variant_iter_loop(iter_sub, "s", &value)) {
+               if (g_strcmp0(value, "none") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_NONE)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_NONE;
+               else if (g_strcmp0(value, "wep") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WEP)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WEP;
+               else if (g_strcmp0(value, "psk") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WPA_PSK)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WPA_PSK;
+               else if (g_strcmp0(value, "ft_psk") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WPA_FT_PSK)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WPA_FT_PSK;
+               else if (g_strcmp0(value, "ieee8021x") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_IEEE8021X)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_IEEE8021X;
+               else if (g_strcmp0(value, "wpa") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WPA_PSK)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WPA_PSK;
+               else if (g_strcmp0(value, "rsn") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WPA_PSK)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WPA2_PSK;
+               else if (g_strcmp0(value, "sae") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_SAE)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_SAE;
+               else if (g_strcmp0(value, "owe") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_SAE)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_OWE;
+               else if (g_strcmp0(value, "dpp") == 0
+                               && ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_SAE)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_DPP;
+               else if (g_strcmp0(value, "wps") == 0)
+                       ProfInfo->security_info.wps_support = TRUE;
+               else if (ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_NONE)
+                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_NONE;
+       }
+       g_variant_iter_free(iter_sub);
+}
+
+static inline void _net_extract_winfo_encryptionmode(const gchar *value, net_profile_info_s *ProfInfo)
+{
+       if (g_strcmp0(value, "none") == 0)
+               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_NONE;
+       else if (g_strcmp0(value, "wep") == 0)
+               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_WEP;
+       else if (g_strcmp0(value, "tkip") == 0)
+               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_TKIP;
+       else if (g_strcmp0(value, "aes") == 0)
+               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_AES;
+       else if (g_strcmp0(value, "mixed") == 0)
+               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_TKIP_AES_MIXED;
+}
+
+static inline void _net_extract_winfo_passphrase(GVariant *var, net_profile_info_s *ProfInfo)
+{
+       wlan_security_info_s *security_info = &(ProfInfo->security_info);
+       const gchar *value = g_variant_get_string(var, NULL);
+
+       if (security_info->sec_mode == WLAN_SEC_MODE_WEP && value != NULL) {
+               g_strlcpy(security_info->authentication.wep.wepKey,
+                       value, NET_WLAN_MAX_WEP_KEY_LEN + 1);
+       } else if ((security_info->sec_mode == WLAN_SEC_MODE_WPA_PSK
+                       || security_info->sec_mode == WLAN_SEC_MODE_WPA2_PSK)
+                       && value != NULL) {
+               g_strlcpy(security_info->authentication.psk.pskKey,
+                       value, NET_WLAN_MAX_PSK_PASSPHRASE_LEN + 1);
+       }
+}
+
+static inline void _net_extract_winfo_ssid(GVariant *var, net_profile_info_s *ProfInfo)
+{
+       gsize ssid_len;
+       const gchar *ssid;
+
+       ssid = g_variant_get_fixed_array(var, &ssid_len, sizeof(guchar));
+       memcpy(ProfInfo->raw_ssid, ssid, ssid_len);
+       ProfInfo->raw_ssid_len = ssid_len;
+}
+
+static inline void _net_extract_winfo_vsie(GVariant *var, net_profile_info_s *ProfInfo)
+{
+       gsize size;
+       unsigned char *vsie = NULL;
+       const unsigned char *vsie_bytes;
+
+       vsie_bytes = g_variant_get_fixed_array(var, &size, sizeof(guchar));
+
+       if (vsie_bytes) {
+               vsie = (unsigned char *)g_try_malloc0(size);
+               if (vsie) {
+                       memcpy(vsie, vsie_bytes, size);
+                       ProfInfo->vsie_list = g_slist_append(ProfInfo->vsie_list, vsie);
+               } else
+                       WIFI_LOG(WIFI_ERROR, "Failed to allocate memory.");
+       }
+}
+
+static inline void _net_extract_winfo_bssid_list(GVariant *var, net_profile_info_s *ProfInfo)
+{
+       GVariantIter *iter_sub = NULL;
+       net_profile_bssid_list_s *bssid_list = NULL;
+       gchar *bssid_key = NULL;
+       GVariant *bssid_var = NULL;
+       g_variant_get(var, "a{sv}", &iter_sub);
+
+       while (g_variant_iter_loop(iter_sub, "{sv}", &bssid_key, &bssid_var)) {
+               if (g_strcmp0(bssid_key, "BSSID") == 0) {
+                       bssid_list = g_try_malloc0(sizeof(net_profile_bssid_list_s));
+
+                       if (bssid_list) {
+                               const gchar *value = g_variant_get_string(bssid_var, NULL);
+
+                               if (value != NULL)
+                                       g_strlcpy(bssid_list->bssid, value, 18);
+                               else
+                                       WIFI_LOG(WIFI_ERROR, "Value is empty");
+                       } else {
+                               WIFI_LOG(WIFI_ERROR, "Failed to allocate memory.");
+                               g_variant_unref(bssid_var);
+                               g_free(bssid_key);
+                               break;
+                       }
+               } else if (bssid_list && g_strcmp0(bssid_key, "Strength") == 0) {
+                       bssid_list->strength = (int)g_variant_get_uint16(bssid_var);
+               } else if (bssid_list && g_strcmp0(bssid_key, "Frequency") == 0) {
+                       bssid_list->frequency = (int)g_variant_get_uint16(bssid_var);
+                       ProfInfo->bssid_list = g_slist_append(ProfInfo->bssid_list, bssid_list);
+               }
+       }
+       g_variant_iter_free(iter_sub);
+}
+
+static int __net_extract_wifi_info(GVariantIter *array, net_profile_info_s *ProfInfo)
 {
        net_err_e Error = NET_ERR_NONE;
        GVariant *var = NULL;
@@ -837,248 +962,84 @@ static int __net_extract_wifi_info(GVariantIter *array, net_profile_info_s* Prof
 
                if (g_strcmp0(key, "Mode") == 0) {
                        value = g_variant_get_string(var, NULL);
-
-                       if (g_strcmp0(value, "managed") == 0)
-                               ProfInfo->wlan_mode = NET_WLAN_CONNMODE_INFRA;
-                       else if (g_strcmp0(value, "adhoc") == 0)
-                               ProfInfo->wlan_mode = NET_WLAN_CONNMODE_ADHOC;
-                       else
-                               ProfInfo->wlan_mode = NET_WLAN_CONNMODE_AUTO;
-
+                       ProfInfo->wlan_mode = _net_extract_winfo_mode(value);
                } else if (g_strcmp0(key, "Security") == 0) {
-                       GVariantIter *iter_sub = NULL;
-
-                       g_variant_get(var, "as", &iter_sub);
-                       while (g_variant_iter_loop(iter_sub, "s", &value)) {
-                               if (g_strcmp0(value, "none") == 0 &&
-                                       ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_NONE)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_NONE;
-                               else if (g_strcmp0(value, "wep") == 0 &&
-                                                ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WEP)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WEP;
-                               else if (g_strcmp0(value, "psk") == 0 &&
-                                                ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WPA_PSK)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WPA_PSK;
-                               else if (g_strcmp0(value, "ft_psk") == 0 &&
-                                       ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WPA_FT_PSK)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WPA_FT_PSK;
-                               else if (g_strcmp0(value, "ieee8021x") == 0 &&
-                                                ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_IEEE8021X)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_IEEE8021X;
-                               else if (g_strcmp0(value, "wpa") == 0 &&
-                                                ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WPA_PSK)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WPA_PSK;
-                               else if (g_strcmp0(value, "rsn") == 0 &&
-                                                ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_WPA_PSK)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_WPA2_PSK;
-                               else if (g_strcmp0(value, "sae") == 0 &&
-                                                ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_SAE)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_SAE;
-                               else if (g_strcmp0(value, "owe") == 0 &&
-                                                ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_SAE)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_OWE;
-                               else if (g_strcmp0(value, "dpp") == 0 &&
-                                                ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_SAE)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_DPP;
-                               else if (g_strcmp0(value, "wps") == 0)
-                                       ProfInfo->security_info.wps_support = TRUE;
-                               else if (ProfInfo->security_info.sec_mode < WLAN_SEC_MODE_NONE)
-                                       ProfInfo->security_info.sec_mode = WLAN_SEC_MODE_NONE;
-                       }
-                       g_variant_iter_free(iter_sub);
+                       _net_extract_winfo_security(var, ProfInfo);
                } else if (g_strcmp0(key, "EncryptionMode") == 0) {
                        value = g_variant_get_string(var, NULL);
-
-                       if (g_strcmp0(value, "none") == 0)
-                               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_NONE;
-                       else if (g_strcmp0(value, "wep") == 0)
-                               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_WEP;
-                       else if (g_strcmp0(value, "tkip") == 0)
-                               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_TKIP;
-                       else if (g_strcmp0(value, "aes") == 0)
-                               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_AES;
-                       else if (g_strcmp0(value, "mixed") == 0)
-                               ProfInfo->security_info.enc_mode = WLAN_ENC_MODE_TKIP_AES_MIXED;
-
+                       _net_extract_winfo_encryptionmode(value, ProfInfo);
                } else if (g_strcmp0(key, "Passpoint") == 0) {
-                       gboolean passpoint;
-
-                       passpoint = g_variant_get_boolean(var);
-                       if (passpoint)
-                               ProfInfo->passpoint = TRUE;
-                       else
-                               ProfInfo->passpoint = FALSE;
-
+                       gboolean passpoint = g_variant_get_boolean(var);
+                       ProfInfo->passpoint = (passpoint) ? TRUE : FALSE;
                } else if (g_strcmp0(key, "Strength") == 0) {
                        ProfInfo->Strength = g_variant_get_byte(var);
                } else if (g_strcmp0(key, "Name") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->essid, value, NET_WLAN_ESSID_LEN + 1);
                } else if (g_strcmp0(key, "Passphrase") == 0) {
-                       wlan_security_info_s *security_info = &(ProfInfo->security_info);
-                       value = g_variant_get_string(var, NULL);
-
-                       if (security_info->sec_mode == WLAN_SEC_MODE_WEP && value != NULL)
-                               g_strlcpy(security_info->authentication.wep.wepKey,
-                                               value, NET_WLAN_MAX_WEP_KEY_LEN+1);
-                       else if ((security_info->sec_mode == WLAN_SEC_MODE_WPA_PSK ||
-                                               security_info->sec_mode == WLAN_SEC_MODE_WPA2_PSK) &&
-                                               value != NULL)
-                               g_strlcpy(security_info->authentication.psk.pskKey,
-                                               value, NET_WLAN_MAX_PSK_PASSPHRASE_LEN+1);
+                       _net_extract_winfo_passphrase(var, ProfInfo);
                } else if (g_strcmp0(key, "PassphraseRequired") == 0) {
-                       gboolean val;
-
-                       val = g_variant_get_boolean(var);
-
-                       if (val)
-                               ProfInfo->PassphraseRequired = TRUE;
-                       else
-                               ProfInfo->PassphraseRequired = FALSE;
+                       gboolean val = g_variant_get_boolean(var);
+                       ProfInfo->PassphraseRequired = (val) ? TRUE : FALSE;
                } else if (g_strcmp0(key, "SSID") == 0) {
-                       const gchar *ssid = NULL;
-                       gsize ssid_len;
-                       ssid = g_variant_get_fixed_array(var, &ssid_len, sizeof(guchar));
-                       memcpy(ProfInfo->raw_ssid, ssid, ssid_len);
-                       ProfInfo->raw_ssid_len = ssid_len;
+                       _net_extract_winfo_ssid(var, ProfInfo);
                } else if (g_strcmp0(key, "BSSID") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->bssid, value, WIFI_MAC_ADDR_LEN + 1);
-
                } else if (g_strcmp0(key, "MaxSpeed") == 0) {
                        ProfInfo->max_rate = g_variant_get_int32(var);
-
                } else if (g_strcmp0(key, "Frequency") == 0) {
                        ProfInfo->frequency = (unsigned int)g_variant_get_uint16(var);
                } else if (g_strcmp0(key, "Protocol") == 0) {
-                       value = g_variant_get_string(var, NULL);
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->operation_mode, value, NET_MAX_PROTOCOL_LEN+1);
                } else if (g_strcmp0(key, "ConnMode") == 0) {
                        ProfInfo->connection_mode = (unsigned int)g_variant_get_uint16(var);
-
                } else if (g_strcmp0(key, "Vsie") == 0) {
-                       const unsigned char *vsie_bytes = NULL;
-                       unsigned char *vsie = NULL;
-                       gsize size;
-
-                       vsie_bytes = g_variant_get_fixed_array(var, &size, sizeof(guchar));
-
-                       if (vsie_bytes) {
-                               vsie = (unsigned char *)g_try_malloc0(size);
-                               if (vsie) {
-                                       memcpy(vsie, vsie_bytes, size);
-                                       ProfInfo->vsie_list = g_slist_append(ProfInfo->vsie_list, vsie);
-                               } else
-                                       WIFI_LOG(WIFI_ERROR, "Failed to allocate memory.");
-                       }
+                       _net_extract_winfo_vsie(var, ProfInfo);
                } else if (g_strcmp0(key, "DisconnectReason") == 0) {
                        ProfInfo->disconnect_reason = g_variant_get_int32(var);
-
                } else if (g_strcmp0(key, "AssocStatusCode") == 0) {
                        ProfInfo->assoc_status_code = g_variant_get_int32(var);
-
                } else if (g_strcmp0(key, "EAP") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                ProfInfo->security_info.authentication.eap.eap_type =
-                                               __convert_eap_type_from_string(value);
-
+                                       __convert_eap_type_from_string(value);
                } else if (g_strcmp0(key, "Phase2") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                ProfInfo->security_info.authentication.eap.eap_auth =
-                                               __convert_eap_auth_from_string(value);
-
+                                       __convert_eap_auth_from_string(value);
                } else if (g_strcmp0(key, "Identity") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->security_info.authentication.eap.username,
-                                               value, NET_WLAN_USERNAME_LEN+1);
-
+                                       value, NET_WLAN_USERNAME_LEN+1);
                } else if (g_strcmp0(key, "Password") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->security_info.authentication.eap.password,
                                                value, NET_WLAN_PASSWORD_LEN+1);
-
                } else if (g_strcmp0(key, "CACertFile") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->security_info.authentication.eap.ca_cert_filename,
                                                value, NET_WLAN_CA_CERT_FILENAME_LEN+1);
-
                } else if (g_strcmp0(key, "ClientCertFile") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->security_info.authentication.eap.client_cert_filename,
                                                value, NET_WLAN_CLIENT_CERT_FILENAME_LEN+1);
-
                } else if (g_strcmp0(key, "PrivateKeyFile") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->security_info.authentication.eap.private_key_filename,
                                                value, NET_WLAN_PRIVATE_KEY_FILENAME_LEN+1);
-
                } else if (g_strcmp0(key, "PrivateKeyPassphrase") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->security_info.authentication.eap.private_key_passwd,
                                                value, NET_WLAN_PRIVATE_KEY_PASSWD_LEN+1);
-
                } else if (g_strcmp0(key, "Keymgmt") == 0) {
                        ProfInfo->security_info.keymgmt = (unsigned int)g_variant_get_uint32(var);
                } else if (g_strcmp0(key, "Country") == 0) {
-                       value = g_variant_get_string(var, NULL);
-
-                       if (value != NULL)
+                       if ((value = g_variant_get_string(var, NULL)))
                                g_strlcpy(ProfInfo->country_code, value, NET_WLAN_COUNTRY_CODE_LEN);
                } else if (g_strcmp0(key, "BSSID.List") == 0) {
-                       GVariantIter *iter_sub = NULL;
-                       net_profile_bssid_list_s *bssid_list = NULL;
-                       gchar *bssid_key = NULL;
-                       GVariant *bssid_var = NULL;
-                       g_variant_get(var, "a{sv}", &iter_sub);
-
-                       while (g_variant_iter_loop(iter_sub, "{sv}", &bssid_key,
-                                                                          &bssid_var)) {
-                               if (g_strcmp0(bssid_key, "BSSID") == 0) {
-                                       bssid_list = (net_profile_bssid_list_s *)g_try_malloc0(sizeof(net_profile_bssid_list_s));
-
-                                       if (bssid_list) {
-                                               value = g_variant_get_string(bssid_var, NULL);
-
-                                               if (value != NULL)
-                                                       g_strlcpy(bssid_list->bssid, value, 18);
-                                               else
-                                                       WIFI_LOG(WIFI_ERROR, "Value is empty");
-                                       } else {
-                                               WIFI_LOG(WIFI_ERROR, "Failed to allocate memory.");
-                                               g_variant_unref(bssid_var);
-                                               g_free(bssid_key);
-                                               break;
-                                       }
-                               } else if (bssid_list && g_strcmp0(bssid_key, "Strength") == 0) {
-                                       bssid_list->strength = (int)g_variant_get_uint16(bssid_var);
-                               } else if (bssid_list && g_strcmp0(bssid_key, "Frequency") == 0) {
-                                       bssid_list->frequency = (int)g_variant_get_uint16(bssid_var);
-                                       ProfInfo->bssid_list = g_slist_append(ProfInfo->bssid_list,
-                                                                                                                 bssid_list);
-                               }
-                       }
-                       g_variant_iter_free(iter_sub);
+                       _net_extract_winfo_bssid_list(var, ProfInfo);
                } else if (g_strcmp0(key, "Hidden") == 0) {
                        ProfInfo->ap_hidden_status = g_variant_get_boolean(var);
                } else
index 1d02df0..9511f1d 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_extension.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 extern struct menu_data menu_extension_autoscan[];
 extern struct menu_data menu_extension_autoconnect[];
index 04d8609..6a351e1 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_extension_autoconnect.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 extern wifi_manager_device_state_e g_device_state;
 
 static char g_ssid[MENU_DATA_SIZE] = "dnet2";
index f330c06..50a2187 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_extension_autoscan.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 extern wifi_manager_device_state_e g_device_state;
 
 static char g_autoscan_state[MENU_DATA_SIZE] = "0";
index 546300e..34aeb89 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_extension_bss.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 static char g_bssid[MENU_DATA_SIZE] = "";
 
index d5218c9..0d6c14f 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_extension_ipconflict.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 static char g_period[MENU_DATA_SIZE] = "0";
 
index 64bd3f3..1233904 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_extension_netlinkscan.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 static char g_ssid[MENU_DATA_SIZE] = "dnet2";
 static char g_vsie[MENU_DATA_SIZE] = "x";
index a501509..2a0b3f6 100644 (file)
@@ -44,8 +44,8 @@ struct menu_manager {
 };
 
 
-char key_buffer[MENU_DATA_SIZE];
-int flag_pid_display = 1;
+static char key_buffer[MENU_DATA_SIZE];
+static int flag_pid_display = 1;
 
 
 static void _show_prompt(void)
index a392b20..93654b9 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_public.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 extern wifi_manager_device_state_e g_device_state;
 
 static char g_ssid[MENU_DATA_SIZE] = "dnet2";
index 0741797..6cb3b49 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_public_config.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 static char g_name[MENU_DATA_SIZE] = "dnet2";
 static char g_passphrase[MENU_DATA_SIZE] = "passphrase";
index c949389..a2d63bd 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_public_connect.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 extern wifi_manager_device_state_e g_device_state;
 
 static char g_ssid[MENU_DATA_SIZE] = "dnet2";
index 4937806..06f2280 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_public_get.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 static char g_ssid[MENU_DATA_SIZE] = "dnet2";
 
index 25a5598..4c0a84d 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_public_ipconflict.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 static char g_detection[MENU_DATA_SIZE] = "0";
 
index 0ff91c2..96e1b9a 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_public_scan.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 static wifi_manager_specific_scan_h g_specific_scan = NULL;
 static int g_specific_scan_cnt = 0;
index 4a893e4..e6cd494 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_public_set.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 extern wifi_manager_device_state_e g_device_state;
 
 static char g_ssid[MENU_DATA_SIZE] = "dnet2";
index 7136d7a..eec396d 100644 (file)
@@ -30,7 +30,6 @@
 #define MACADDRLEN 17
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 static char g_mac_address[MENU_DATA_SIZE] = "00:12:36:96:61:01";
 static char g_frequency[MENU_DATA_SIZE] = "1";
index fb65c1f..df48b0a 100644 (file)
@@ -28,7 +28,6 @@
 #include "wifi_mgr_public_vsie.h"
 
 extern wifi_manager_h g_wifi_h;
-extern wifi_manager_h g_wifi2_h;
 
 static char g_frame_id[MENU_DATA_SIZE] = "0";
 static char g_vsie[MENU_DATA_SIZE] = "vsie data";
index 1e51da9..f77d02e 100644 (file)
@@ -29,8 +29,8 @@
 #include "wifi_mgr_extension.h"
 
 wifi_manager_h g_wifi_h = NULL;
-wifi_manager_h g_wifi2_h = NULL;
 wifi_manager_device_state_e g_device_state = WIFI_MANAGER_DEVICE_STATE_DEACTIVATED;
+static wifi_manager_h g_wifi2_h = NULL;
 static int cs_tid = 0;
 
 static char g_ifname[MENU_DATA_SIZE] = "wlan1";