connection_profile_h profile);
int _connection_libnet_get_default_device_type(net_device_t *net_type);
int _connection_libnet_get_default_ip_address(char **ip_address);
+int _connection_libnet_get_default_proxy(char **proxy_address);
void _connection_inter_mutex_lock(void);
void _connection_inter_mutex_unlock(void);
switch (address_family) {
case CONNECTION_ADDRESS_FAMILY_IPV4:
- *proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
+ if (_connection_libnet_get_default_proxy(proxy) !=
+ CONNECTION_ERROR_NONE)
+ return CONNECTION_ERROR_OPERATION_FAILED;
break;
case CONNECTION_ADDRESS_FAMILY_IPV6:
CONNECTION_LOG(CONNECTION_ERROR, "Not supported yet\n");
}
if (*proxy == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "vconf_get_str Failed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Get Proxy Failed\n");
return CONNECTION_ERROR_OPERATION_FAILED;
}
profile_list->profiles = NULL;
}
+static net_proxy_type_t __libnet_proxy_type_string2type(const char *str)
+{
+ if (str == NULL)
+ return NET_PROXY_TYPE_UNKNOWN;
+
+ if (g_strcmp0(str, "direct") == 0)
+ return NET_PROXY_TYPE_DIRECT;
+ if (g_strcmp0(str, "manual") == 0)
+ return NET_PROXY_TYPE_MANUAL;
+ if (g_strcmp0(str, "auto") == 0)
+ return NET_PROXY_TYPE_AUTO;
+
+ return NET_PROXY_TYPE_UNKNOWN;
+}
+
static net_device_t __libnet_service_type_string2type(const char *str)
{
if (str == NULL)
return CONNECTION_ERROR_NONE;
}
+
+int _connection_libnet_get_default_proxy(char **proxy_address)
+{
+ int rv;
+ struct connman_service *default_service;
+ const struct service_proxy *proxy;
+ net_proxy_type_t proxy_type;
+
+ rv = __libnet_get_default_service(&default_service);
+ if (rv == CONNECTION_ERROR_NO_CONNECTION)
+ return CONNECTION_ERROR_NO_CONNECTION;
+
+ proxy = connman_service_get_proxy_info(default_service);
+ if (proxy->method == NULL)
+ return CONNECTION_ERROR_OPERATION_FAILED;
+
+ proxy_type = __libnet_proxy_type_string2type(proxy->method);
+
+ if (proxy_type == NET_PROXY_TYPE_AUTO && proxy->url != NULL)
+ *proxy_address = g_strdup(proxy->url);
+ else if (proxy_type == NET_PROXY_TYPE_MANUAL && proxy->servers != NULL)
+ *proxy_address = g_strdup(proxy->servers[0]);
+ else
+ return CONNECTION_ERROR_OPERATION_FAILED;
+
+ if (*proxy_address == NULL)
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
+
+ return CONNECTION_ERROR_NONE;
+}