Commit bed4240c authored by Slava Monich's avatar Slava Monich

service: Expose default service to plugin

Public connman_service_get_default() can be called by plugins
and replaces internal __connman_service_get_default().

Conflicts:
	connman/src/service.c
parent a99317d6
......@@ -571,7 +571,7 @@ static struct gateway_data *find_default_gateway(void)
{
struct connman_service *service;
service = __connman_service_get_default();
service = connman_service_get_default();
if (!service)
return NULL;
......
......@@ -708,7 +708,6 @@ struct connman_service *__connman_service_lookup_from_ident(const char *identifi
bool __connman_service_create_from_network(struct connman_network *network);
struct connman_service *__connman_service_create_from_provider(struct connman_provider *provider);
bool __connman_service_index_is_default(int index);
struct connman_service *__connman_service_get_default(void);
void __connman_service_update_from_network(struct connman_network *network);
void __connman_service_remove_from_network(struct connman_network *network);
void __connman_service_read_ip4config(struct connman_service *service);
......
......@@ -2637,7 +2637,7 @@ static struct server_data *create_server(int index,
return NULL;
}
service = __connman_service_get_default();
service = connman_service_get_default();
vpn_index_list = __connman_service_get_depending_vpn_index(service);
if (protocol == IPPROTO_UDP) {
......
......@@ -139,7 +139,7 @@ static gboolean do_setup(gpointer data)
if (!default_interface)
DBG("No uplink connection, retrying prefix delegation");
ret = setup_prefix_delegation(__connman_service_get_default());
ret = setup_prefix_delegation(connman_service_get_default());
if (ret < 0 && ret != -EINPROGRESS)
return TRUE; /* delegation error, try again */
......@@ -155,7 +155,7 @@ static void dhcpv6_renew_callback(struct connman_network *network,
if (status == CONNMAN_DHCPV6_STATUS_SUCCEED)
dhcpv6_callback(network, status, data);
else
setup_prefix_delegation(__connman_service_get_default());
setup_prefix_delegation(connman_service_get_default());
}
static void cleanup(void)
......@@ -275,7 +275,7 @@ static void update_default_interface(struct connman_service *service)
static void update_ipconfig(struct connman_service *service,
struct connman_ipconfig *ipconfig)
{
if (!service || service != __connman_service_get_default())
if (!service || service != connman_service_get_default())
return;
if (ipconfig != __connman_service_get_ip6config(service))
......@@ -342,7 +342,7 @@ int __connman_ipv6pd_setup(const char *bridge)
DBG("Cannot receive router solicitation %d/%s",
err, strerror(-err));
service = __connman_service_get_default();
service = connman_service_get_default();
if (service) {
/*
* We have an uplink connection already, try to use it.
......
......@@ -624,7 +624,7 @@ static enum connman_service_proxy_method string2proxymethod(const char *method)
static void set_vpn_dependency(struct connman_service *vpn_service)
{
struct connman_service *service = __connman_service_get_default();
struct connman_service *service = connman_service_get_default();
if (!vpn_service || !service)
return;
......@@ -1850,7 +1850,7 @@ static void reset_stats(struct connman_service *service)
g_timer_reset(service->stats_timer);
}
struct connman_service *__connman_service_get_default(void)
struct connman_service *connman_service_get_default(void)
{
struct connman_service *service;
......@@ -1872,7 +1872,7 @@ bool __connman_service_index_is_default(int index)
if (index < 0)
return false;
service = __connman_service_get_default();
service = connman_service_get_default();
return __connman_service_get_index(service) == index;
}
......@@ -1917,7 +1917,7 @@ static void print_service_list_debug()
static void default_changed(void)
{
struct connman_service *service = __connman_service_get_default();
struct connman_service *service = connman_service_get_default();
DBG("");
print_service_list_debug();
......@@ -4543,7 +4543,7 @@ static DBusMessage *set_property(DBusConnection *conn,
service_save(service);
timeservers_configuration_changed(service);
if (service == __connman_service_get_default())
if (service == connman_service_get_default())
__connman_timeserver_sync(service);
} else if (g_str_equal(name, "Domains.Configuration")) {
......@@ -5177,7 +5177,7 @@ static gboolean run_vpn_auto_connect(gpointer data) {
struct connman_service *def_service;
attempts = GPOINTER_TO_INT(data);
def_service = __connman_service_get_default();
def_service = connman_service_get_default();
/*
* Stop auto connecting VPN if there is no transport service or the
......@@ -5641,7 +5641,7 @@ static void apply_relevant_default_downgrade(struct connman_service *service)
{
struct connman_service *def_service;
def_service = __connman_service_get_default();
def_service = connman_service_get_default();
if (!def_service)
return;
......@@ -6989,7 +6989,7 @@ static int service_indicate_state(struct connman_service *service)
if (old_state == new_state)
return -EALREADY;
def_service = __connman_service_get_default();
def_service = connman_service_get_default();
if (new_state == CONNMAN_SERVICE_STATE_ONLINE) {
service->connect_retry_timeout = 0;
......@@ -7051,7 +7051,7 @@ static int service_indicate_state(struct connman_service *service)
default_changed();
def_service = __connman_service_get_default();
def_service = connman_service_get_default();
service_update_preferred_order(def_service, service, new_state);
......@@ -7104,7 +7104,7 @@ static int service_indicate_state(struct connman_service *service)
reply_pending(service, ECONNABORTED);
def_service = __connman_service_get_default();
def_service = connman_service_get_default();
if (!__connman_notifier_is_connected() &&
def_service &&
......
......@@ -242,7 +242,7 @@ static gboolean ts_recheck(gpointer user_data)
{
GSList *ts;
ts = __connman_timeserver_get_all(__connman_service_get_default());
ts = __connman_timeserver_get_all(connman_service_get_default());
if (!ts) {
DBG("timeservers disabled");
......@@ -301,7 +301,7 @@ int __connman_timeserver_sync(struct connman_service *default_service)
if (default_service)
service = default_service;
else
service = __connman_service_get_default();
service = connman_service_get_default();
if (!service)
return -EINVAL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment