From: hyunuktak Date: Mon, 24 Jun 2019 01:38:12 +0000 (+0900) Subject: Add to get passphrase internally from config X-Git-Tag: accepted/tizen/unified/20190703.110719~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F66%2F208366%2F2;p=platform%2Fcore%2Fapi%2Fwifi-manager.git Add to get passphrase internally from config Change-Id: I46766950cdd8a6d45dd06d8055e978042073699e Signed-off-by: hyunuktak --- diff --git a/include/network_dbus.h b/include/network_dbus.h index 2aac720..f966e9a 100755 --- a/include/network_dbus.h +++ b/include/network_dbus.h @@ -133,13 +133,13 @@ int _net_dbus_config_set_field(const gchar *config_id, const gchar *key, const g int _net_dbus_config_get_passphrase(const gchar *config_id, gchar **passphrase); int _net_dbus_config_save_configurations(const gchar *config_id, const gchar *name, const gchar *ssid, const gchar *passphrase, const gchar *proxy_address, - net_ip_info_config_s *ip_info, gboolean is_hidden); + net_ip_info_config_s *ip_info, gboolean is_hidden, gboolean is_created); int _net_dbus_config_save_eap_configurations(const gchar *config_id, const gchar *name, const gchar *ssid, const gchar *passphrase, - const gchar *proxy_address, net_eap_config_s *eap_config, gboolean is_hidden); + const gchar *proxy_address, net_eap_config_s *eap_config, gboolean is_hidden, gboolean is_created); int _net_dbus_config_remove_configurations(const gchar *config_id); int _net_dbus_config_load_configurations(const gchar *config_id, gchar **name, - net_wifi_security_type_e *security_type, gchar **proxy_address, + gchar **passphrase, net_wifi_security_type_e *security_type, gchar **proxy_address, gboolean *is_hidden, net_ip_info_config_s **ip_info, void *last_error); int _net_dbus_config_load_eap_configurations(const gchar *config_id, gchar **name, net_wifi_security_type_e *security_type, gchar **proxy_address, diff --git a/include/network_interface.h b/include/network_interface.h index d758b8a..e800102 100755 --- a/include/network_interface.h +++ b/include/network_interface.h @@ -347,13 +347,13 @@ int net_config_get_passphrase(const gchar *config_id, gchar **passphrase); int net_config_save_configurations(const gchar *config_id, const gchar *name, const gchar *ssid, const gchar *passphrase, const gchar *proxy_address, net_ip_info_config_s *ip_info, - gboolean is_hidden); + gboolean is_hidden, gboolean is_created); int net_config_save_eap_configurations(const gchar *config_id, const gchar *name, const gchar *ssid, const gchar *passphrase, - const gchar *proxy_address, void *eap_config, gboolean is_hidden); + const gchar *proxy_address, void *eap_config, gboolean is_hidden, gboolean is_created); int net_config_remove_configurations(const gchar *config_id); int net_config_load_configurations(const gchar *config_id, gchar **name, - void *security_type, gchar **proxy_address, gboolean *is_hidden, + gchar **passphrase, void *security_type, gchar **proxy_address, gboolean *is_hidden, net_ip_info_config_s **ip_info, void *last_error); int net_config_load_eap_configurations(const gchar *config_id, gchar **name, void *security_type, gchar **proxy_address, diff --git a/include/wifi_internal.h b/include/wifi_internal.h index 03d5486..1a62db6 100755 --- a/include/wifi_internal.h +++ b/include/wifi_internal.h @@ -46,6 +46,7 @@ extern "C" { #define WIFI_CONFIG_SECURITY_TYPE "Security" #define WIFI_CONFIG_PROXYADDRESS "ProxyAddress" #define WIFI_CONFIG_HIDDEN "Hidden" +#define WIFI_CONFIG_CREATED "Created" #define WIFI_CONFIG_IPV4_METHOD "IPv4.method" #define WIFI_CONFIG_IPV6_METHOD "IPv6.method" #define WIFI_CONFIG_IPV4_ADDRESS "IPv4.local_address" @@ -181,6 +182,7 @@ typedef struct { gchar *name; gchar *passphrase; wifi_manager_security_type_e security_type; + gboolean is_created; gboolean is_saved; gboolean is_hidden; @@ -346,7 +348,7 @@ int _wifi_config_get_config_id_list(GSList **list); int _wifi_save_configuration(const gchar *name, const gchar *passphrase, wifi_manager_security_type_e security_type, const gchar *proxy_address, - wifi_config_ip_info_s *ip_info, gboolean is_hidden); + wifi_config_ip_info_s *ip_info, gboolean is_hidden, gboolean is_created); int _wifi_load_configurations(void); int _wifi_foreach_configuration(wifi_manager_config_list_cb callback, void *user_data); int _wifi_remove_configuration(const gchar *config_id); @@ -354,7 +356,7 @@ int _wifi_configuration_set_field(const gchar *config_id, const gchar *key, cons int _wifi_configuration_get_passphrase(const gchar *config_id, gchar **passphrase); int _wifi_save_eap_configurations(const gchar *name, const gchar *passphrase, wifi_manager_security_type_e security_type, const gchar *proxy_address, - wifi_eap_config_s *eap_config, gboolean is_hidden); + wifi_eap_config_s *eap_config, gboolean is_hidden, gboolean is_created); gchar *_wifi_eap_type_to_string(wifi_manager_eap_type_e eap_type); gchar *_wifi_eap_auth_type_to_string(wifi_manager_eap_auth_type_e eap_auth_type); int _wifi_set_autoscan(bool autoscan); diff --git a/packaging/capi-network-wifi-manager.spec b/packaging/capi-network-wifi-manager.spec index 7437aeb..ffd2027 100755 --- a/packaging/capi-network-wifi-manager.spec +++ b/packaging/capi-network-wifi-manager.spec @@ -1,6 +1,6 @@ Name: capi-network-wifi-manager Summary: Network Wi-Fi library in TIZEN C API -Version: 1.0.44 +Version: 1.0.45 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/network_dbus.c b/src/network_dbus.c index 0868308..4f2377e 100755 --- a/src/network_dbus.c +++ b/src/network_dbus.c @@ -2864,7 +2864,7 @@ int _net_dbus_config_get_passphrase(const gchar *config_id, gchar **passphrase) int _net_dbus_config_save_configurations(const gchar *config_id, const gchar *name, const gchar *ssid, const gchar *passphrase, const gchar *proxy_address, - net_ip_info_config_s *ip_info, gboolean is_hidden) + net_ip_info_config_s *ip_info, gboolean is_hidden, gboolean is_created) { __NETWORK_FUNC_ENTER__; @@ -2886,6 +2886,7 @@ int _net_dbus_config_save_configurations(const gchar *config_id, const gchar *na g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string(proxy_address)); if (is_hidden == TRUE) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_HIDDEN, g_variant_new_string("TRUE")); + g_variant_builder_add(b, "{sv}", WIFI_CONFIG_CREATED, g_variant_new_boolean(is_created)); switch (ip_info->ip_type) { case NET_IP_CONFIG_TYPE_STATIC: @@ -2988,7 +2989,7 @@ int _net_dbus_config_save_configurations(const gchar *config_id, const gchar *na int _net_dbus_config_save_eap_configurations(const gchar *config_id, const gchar *name, const gchar *ssid, const gchar *passphrase, - const gchar *proxy_address, net_eap_config_s *eap_config, gboolean is_hidden) + const gchar *proxy_address, net_eap_config_s *eap_config, gboolean is_hidden, gboolean is_created) { __NETWORK_FUNC_ENTER__; @@ -3006,6 +3007,7 @@ int _net_dbus_config_save_eap_configurations(const gchar *config_id, g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string(proxy_address)); if (is_hidden == TRUE) g_variant_builder_add(b, "{sv}", WIFI_CONFIG_HIDDEN, g_variant_new_string("TRUE")); + g_variant_builder_add(b, "{sv}", WIFI_CONFIG_CREATED, g_variant_new_boolean(is_created)); if (eap_config != NULL) { gchar* auth_type = NULL; @@ -3084,7 +3086,7 @@ int _net_dbus_config_remove_configurations(const gchar *config_id) } int _net_dbus_config_load_configurations(const gchar *config_id, gchar **name, - net_wifi_security_type_e *security_type, gchar **proxy_address, + gchar **passphrase, net_wifi_security_type_e *security_type, gchar **proxy_address, gboolean *is_hidden, net_ip_info_config_s **ip_info, void *last_error) { __NETWORK_FUNC_ENTER__; @@ -3113,6 +3115,8 @@ int _net_dbus_config_load_configurations(const gchar *config_id, gchar **name, if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { if (g_strcmp0(field, WIFI_CONFIG_NAME) == 0) { *name = g_strdup(g_variant_get_string(value, NULL)); + } else if (g_strcmp0(field, WIFI_CONFIG_PASSPHRASE) == 0) { + *passphrase = g_strdup(g_variant_get_string(value, NULL)); } else if (g_strcmp0(field, WIFI_CONFIG_SECURITY_TYPE) == 0) { *security_type = __net_wifi_security_type_to_int(g_variant_get_string(value, NULL)); } else if (g_strcmp0(field, WIFI_CONFIG_HIDDEN) == 0) { diff --git a/src/network_interface.c b/src/network_interface.c index b6c5f0f..0b6ff12 100755 --- a/src/network_interface.c +++ b/src/network_interface.c @@ -3456,7 +3456,7 @@ int net_config_get_passphrase(const gchar *config_id, gchar **passphrase) int net_config_save_configurations(const gchar *config_id, const gchar *name, const gchar *ssid, const gchar *passphrase, const gchar *proxy_address, - net_ip_info_config_s *ip_info, gboolean is_hidden) + net_ip_info_config_s *ip_info, gboolean is_hidden, gboolean is_created) { __NETWORK_FUNC_ENTER__; @@ -3469,7 +3469,7 @@ int net_config_save_configurations(const gchar *config_id, const gchar *name, } Error = _net_dbus_config_save_configurations(config_id, name, ssid, - passphrase, proxy_address, ip_info, is_hidden); + passphrase, proxy_address, ip_info, is_hidden, is_created); if (Error != NET_ERR_NONE) WIFI_LOG(WIFI_ERROR, //LCOV_EXCL_LINE "Failed to save configurations. Error [%s]", @@ -3482,7 +3482,7 @@ int net_config_save_configurations(const gchar *config_id, const gchar *name, //LCOV_EXCL_START int net_config_save_eap_configurations(const gchar *config_id, const gchar *name, const gchar *ssid, const gchar *passphrase, - const gchar *proxy_address, void *eap_config, gboolean is_hidden) + const gchar *proxy_address, void *eap_config, gboolean is_hidden, gboolean is_created) { __NETWORK_FUNC_ENTER__; @@ -3495,8 +3495,8 @@ int net_config_save_eap_configurations(const gchar *config_id, return NET_ERR_APP_NOT_REGISTERED; } - Error = _net_dbus_config_save_eap_configurations(config_id, - name, ssid, passphrase, proxy_address, net_eap_config, is_hidden); + Error = _net_dbus_config_save_eap_configurations(config_id, name, ssid, passphrase, + proxy_address, net_eap_config, is_hidden, is_created); if (Error != NET_ERR_NONE) WIFI_LOG(WIFI_ERROR, "Failed to save configurations. Error [%s]", @@ -3530,7 +3530,7 @@ int net_config_remove_configurations(const gchar *config_id) } int net_config_load_configurations(const gchar *config_id, gchar **name, - void *security_type, gchar **proxy_address, gboolean *is_hidden, + gchar **passphrase, void *security_type, gchar **proxy_address, gboolean *is_hidden, net_ip_info_config_s **ip_info, void *last_error) { __NETWORK_FUNC_ENTER__; @@ -3544,8 +3544,8 @@ int net_config_load_configurations(const gchar *config_id, gchar **name, return NET_ERR_APP_NOT_REGISTERED; //LCOV_EXCL_LINE } - Error = _net_dbus_config_load_configurations(config_id, name, sec_type, - proxy_address, is_hidden, ip_info, last_error); + Error = _net_dbus_config_load_configurations(config_id, name, passphrase, + sec_type, proxy_address, is_hidden, ip_info, last_error); if (Error != NET_ERR_NONE) WIFI_LOG(WIFI_ERROR, //LCOV_EXCL_LINE "Failed to load configurations. Error [%s]", diff --git a/src/wifi_config.c b/src/wifi_config.c index 4f2868d..c0f0908 100755 --- a/src/wifi_config.c +++ b/src/wifi_config.c @@ -46,6 +46,7 @@ EXPORT_API int wifi_manager_config_create(wifi_manager_h wifi, const char *name, h->name = g_strdup(name); h->passphrase = g_strdup(passphrase); h->security_type = security_type; + h->is_created = TRUE; h->is_saved = FALSE; h->is_hidden = FALSE; h->proxy_address = NULL; @@ -125,6 +126,7 @@ EXPORT_API int wifi_manager_config_clone(wifi_manager_config_h origin, wifi_mana h->name = g_strdup(config->name); h->passphrase = g_strdup(config->passphrase); h->security_type = config->security_type; + h->is_created = FALSE; h->is_saved = config->is_saved; h->is_hidden = config->is_hidden; h->proxy_address = g_strdup(config->proxy_address); @@ -251,13 +253,13 @@ EXPORT_API int wifi_manager_config_save(wifi_manager_h wifi, } if (h->security_type == WIFI_MANAGER_SECURITY_TYPE_EAP) { - ret = _wifi_save_eap_configurations(h->name, h->passphrase, - h->security_type, h->proxy_address, h->eap_config, h->is_hidden); + ret = _wifi_save_eap_configurations(h->name, h->passphrase, h->security_type, + h->proxy_address, h->eap_config, h->is_hidden, h->is_created); if (ret != WIFI_MANAGER_ERROR_NONE) WIFI_LOG(WIFI_ERROR, "Fail to wifi_save_eap_configurations"); //LCOV_EXCL_LINE } else { ret = _wifi_save_configuration(h->name, h->passphrase, h->security_type, - h->proxy_address, h->ip_info, h->is_hidden); + h->proxy_address, h->ip_info, h->is_hidden, h->is_created); if (ret != WIFI_MANAGER_ERROR_NONE) WIFI_LOG(WIFI_ERROR, "Fail to save configurations [%d]", ret); //LCOV_EXCL_LINE } diff --git a/src/wifi_internal.c b/src/wifi_internal.c index 47a1776..75ead15 100755 --- a/src/wifi_internal.c +++ b/src/wifi_internal.c @@ -537,13 +537,13 @@ static int __connect_with_wifi_info(net_profile_info_s *ap_info) } static int __load_configurations(const gchar *config_id, gchar **name, - wifi_manager_security_type_e *security_type, gchar **proxy_address, + gchar **passphrase, wifi_manager_security_type_e *security_type, gchar **proxy_address, gboolean *is_hidden, wifi_config_ip_info_s **ip_info, wifi_manager_error_e *last_error) { int rv; - rv = net_config_load_configurations(config_id, name, security_type, + rv = net_config_load_configurations(config_id, name, passphrase, security_type, proxy_address, is_hidden, (net_ip_info_config_s **)ip_info, last_error); if (rv == NET_ERR_ACCESS_DENIED) { @@ -2812,7 +2812,7 @@ int _wifi_config_get_config_id_list(GSList **list) int _wifi_save_configuration(const gchar *name, const gchar *passphrase, wifi_manager_security_type_e security_type, const gchar *proxy_address, - wifi_config_ip_info_s *ip_info, gboolean is_hidden) + wifi_config_ip_info_s *ip_info, gboolean is_hidden, gboolean is_created) { int rv; gchar *config_id = NULL; @@ -2836,7 +2836,7 @@ int _wifi_save_configuration(const gchar *name, const gchar *passphrase, ssid = __wifi_change_name_to_hexadecimal(name); rv = net_config_save_configurations(config_id, name, ssid, passphrase, - proxy_address, (void *)ip_info, is_hidden); + proxy_address, (void *)ip_info, is_hidden, is_created); if (rv == NET_ERR_ACCESS_DENIED) { WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE @@ -2889,7 +2889,7 @@ int _wifi_load_configurations(void) g_free(h);//LCOV_EXCL_LINE break;//LCOV_EXCL_LINE } - rv = __load_configurations(id, &h->name, &h->security_type, + rv = __load_configurations(id, &h->name, &h->passphrase, &h->security_type, &h->proxy_address, &h->is_hidden, &h->ip_info, &h->last_error); } @@ -2997,7 +2997,7 @@ int _wifi_remove_configuration(const gchar *config_id) //LCOV_EXCL_START int _wifi_save_eap_configurations(const gchar *name, const gchar *passphrase, wifi_manager_security_type_e security_type, const gchar *proxy_address, - wifi_eap_config_s *eap_config, gboolean is_hidden) + wifi_eap_config_s *eap_config, gboolean is_hidden, gboolean is_created) { int rv; gchar *config_id = NULL; @@ -3024,8 +3024,8 @@ int _wifi_save_eap_configurations(const gchar *name, const gchar *passphrase, ssid = __wifi_change_name_to_hexadecimal(name); - rv = net_config_save_eap_configurations(config_id, name, - ssid, passphrase, proxy_address, (void *)eap_config, is_hidden); + rv = net_config_save_eap_configurations(config_id, name, ssid, passphrase, + proxy_address, (void *)eap_config, is_hidden, is_created); if (rv == NET_ERR_ACCESS_DENIED) { WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE