const gchar *proxy_address, net_eap_config_s *eap_config, gboolean is_hidden);
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, gboolean *is_hidden, void *last_error);
+ 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,
gboolean *is_hidden, net_eap_config_s **eap_config, void *last_error);
const gchar *proxy_address, void *eap_config, gboolean is_hidden);
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, void *last_error);
+ 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,
gboolean *is_hidden, void **eap_config, void *last_error);
}
int _net_dbus_config_load_configurations(const gchar *config_id, gchar **name,
- net_wifi_security_type_e *security_type, gchar **proxy_address, gboolean *is_hidden, void *last_error)
+ 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__;
gchar *field;
GVariant *value;
int *wifi_last_error = (int *)last_error;
+ int order = 0;
message = _net_invoke_dbus_method(
NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
*proxy_address = NULL;
else
*proxy_address = g_strdup(r_proxy_address);
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_METHOD) == 0) {
+ const gchar *type = g_variant_get_string(value, NULL);
+ if (g_strcmp0(type, "manual") == 0)
+ (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_STATIC;
+ else if (g_strcmp0(type, "dhcp") == 0)
+ (*ip_info)->ip_type = NET_IP_CONFIG_TYPE_DYNAMIC;
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_ADDRESS) == 0) {
+ const gchar *ip_address = g_variant_get_string(value, NULL);
+ (*ip_info)->ip_address = g_strdup(ip_address);
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_SUBNET_MASK) == 0) {
+ const gchar *subnet_mask = g_variant_get_string(value, NULL);
+ (*ip_info)->subnet_mask = g_strdup(subnet_mask);
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_GATEWAY_ADDRESS) == 0) {
+ const gchar *gateway_address = g_variant_get_string(value, NULL);
+ (*ip_info)->gateway_address = g_strdup(gateway_address);
+ } else if (g_strcmp0(field, WIFI_CONFIG_IPV4_DNS_METHOD) == 0) {
+ const gchar *type = g_variant_get_string(value, NULL);
+ if (g_strcmp0(type, "manual") == 0)
+ (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_STATIC;
+ else if (g_strcmp0(type, "dhcp") == 0)
+ (*ip_info)->dns_type = NET_DNS_CONFIG_TYPE_DYNAMIC;
+ } else if (g_strcmp0(field, WIFI_CONFIG_DNS_ADDRESS) == 0) {
+ const gchar *dns_address = g_variant_get_string(value, NULL);
+ (*ip_info)->dns_address[order] = g_strdup(dns_address);
+ order += 1;
+ (*ip_info)->dns_count = order > NET_DNS_ADDR_MAX ?
+ NET_DNS_ADDR_MAX : order;
+ order %= NET_DNS_ADDR_MAX;
} else if (g_strcmp0(field, WIFI_CONFIG_FAILURE) == 0) {
*wifi_last_error = __net_wifi_last_error_to_enum(g_variant_get_string(value, NULL));
}
}
int net_config_load_configurations(const gchar *config_id, gchar **name,
- void *security_type, gchar **proxy_address, gboolean *is_hidden, void *last_error)
+ void *security_type, gchar **proxy_address, gboolean *is_hidden,
+ net_ip_info_config_s **ip_info, void *last_error)
{
__NETWORK_FUNC_ENTER__;
}
Error = _net_dbus_config_load_configurations(config_id, name, sec_type,
- proxy_address, is_hidden, last_error);
+ 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]",
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_config_get_ip_config_type(wifi_manager_config_h config,
+ wifi_manager_address_family_e address_family,
+ wifi_manager_ip_config_type_e *type)
+{
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ wifi_config_s *h = (wifi_config_s *)config;
+
+ if (_wifi_check_config_validity(config) == false || type == NULL ||
+ (address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV4 &&
+ address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV6)) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ *type = h->ip_info->ip_type;
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_config_set_ip_config_type(wifi_manager_config_h config,
wifi_manager_address_family_e address_family,
wifi_manager_ip_config_type_e type)
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_config_get_ip_address(wifi_manager_config_h config,
+ wifi_manager_address_family_e address_family, char **ip_address)
+{
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ wifi_config_s *h = (wifi_config_s *)config;
+
+ if (_wifi_check_config_validity(config) == false || ip_address == NULL ||
+ (address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV4 &&
+ address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV6)) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ *ip_address = strdup(h->ip_info->ip_address);
+ if (*ip_address == NULL) {
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
+ }
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_config_set_ip_address(wifi_manager_config_h config,
wifi_manager_address_family_e address_family, const char *ip_address)
{
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_config_get_subnet_mask(wifi_manager_config_h config,
+ wifi_manager_address_family_e address_family, char **subnet_mask)
+{
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ wifi_config_s *h = (wifi_config_s *)config;
+
+ if (_wifi_check_config_validity(config) == false || subnet_mask == NULL ||
+ (address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV4 &&
+ address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV6)) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ *subnet_mask = strdup(h->ip_info->subnet_mask);
+ if (*subnet_mask == NULL) {
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
+ }
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_config_set_subnet_mask(wifi_manager_config_h config,
wifi_manager_address_family_e address_family, const char *subnet_mask)
{
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_config_get_gateway_address(wifi_manager_config_h config,
+ wifi_manager_address_family_e address_family, char **gateway_address)
+{
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ wifi_config_s *h = (wifi_config_s *)config;
+
+ if (_wifi_check_config_validity(config) == false || gateway_address == NULL ||
+ (address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV4 &&
+ address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV6)) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ *gateway_address = strdup(h->ip_info->gateway_address);
+ if (*gateway_address == NULL) {
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
+ }
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_config_set_gateway_address(wifi_manager_config_h config,
wifi_manager_address_family_e address_family, const char *gateway_address)
{
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_config_get_dns_config_type(wifi_manager_config_h config,
+ wifi_manager_address_family_e address_family,
+ wifi_manager_dns_config_type_e *type)
+{
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ wifi_config_s *h = (wifi_config_s *)config;
+
+ if (_wifi_check_config_validity(config) == false || type == NULL ||
+ (address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV4 &&
+ address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV6)) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ *type = h->ip_info->dns_type;
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_config_set_dns_config_type(wifi_manager_config_h config,
wifi_manager_address_family_e address_family,
wifi_manager_dns_config_type_e type)
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_config_get_dns_address(wifi_manager_config_h config,
+ int order, wifi_manager_address_family_e address_family,
+ char **dns_address)
+{
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ wifi_config_s *h = (wifi_config_s *)config;
+
+ if (_wifi_check_config_validity(config) == false || dns_address == NULL ||
+ (address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV4 &&
+ address_family != WIFI_MANAGER_ADDRESS_FAMILY_IPV6) ||
+ order <= 0 || order > NET_DNS_ADDR_MAX) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ if (order > h->ip_info->dns_count) {
+ WIFI_LOG(WIFI_ERROR, "DNS Address of order %d doesn't exist", order); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ *dns_address = strdup(h->ip_info->dns_address[order-1]);
+ if (*dns_address == NULL) {
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
+ }
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_config_set_dns_address(wifi_manager_config_h config,
int order, wifi_manager_address_family_e address_family,
const char *dns_address)
}
static int __load_configurations(const gchar *config_id, gchar **name,
- wifi_manager_security_type_e *security_type, gchar **proxy_address, gboolean *is_hidden,
+ 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,
- proxy_address, is_hidden, last_error);
+ proxy_address, is_hidden, (net_ip_info_config_s **)ip_info,
+ last_error);
if (rv == NET_ERR_ACCESS_DENIED) {
WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
{
int rv;
GSList *config_ids = NULL;
+ int i;
__clear_config_list(&config_iterator);
rv = __load_eap_configurations(id, &h->name,
&h->security_type, &h->proxy_address, &h->is_hidden, &h->eap_config, &h->last_error);
} else {
- rv = __load_configurations(id, &h->name,
- &h->security_type, &h->proxy_address, &h->is_hidden, &h->last_error);
+ h->ip_info = g_new0(wifi_config_ip_info_s, 1);
+ if (h->ip_info == NULL) {
+ g_free(h);//LCOV_EXCL_LINE
+ break;//LCOV_EXCL_LINE
+ }
+ rv = __load_configurations(id, &h->name, &h->security_type,
+ &h->proxy_address, &h->is_hidden, &h->ip_info,
+ &h->last_error);
}
if (rv != WIFI_MANAGER_ERROR_NONE) {
g_free(h->name);
g_free(h->passphrase);
g_free(h->proxy_address);
+ if (h->ip_info) {
+ g_free(h->ip_info->ip_address);
+ g_free(h->ip_info->subnet_mask);
+ g_free(h->ip_info->gateway_address);
+ for (i = 0; i < h->ip_info->dns_count; i++)
+ g_free(h->ip_info->dns_address[i]);
+ g_free(h->ip_info);
+ }
+
if (h->eap_config) {
g_free(h->eap_config->ca_cert);
g_free(h->eap_config->client_cert);