summaryrefslogtreecommitdiff
path: root/src/provider.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-11-12 14:07:30 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-11-23 12:58:51 +0200
commit4034f337edbb89f87465a05066cace379f6cc14f (patch)
treed1a7f223fd3866c46ddc7e857e8d8bdf58c2d435 /src/provider.c
parenta7113388cbe5a919d0b5c4866257fef6f2107d36 (diff)
downloadconnman-4034f337edbb89f87465a05066cace379f6cc14f.tar.gz
connman-4034f337edbb89f87465a05066cace379f6cc14f.tar.bz2
connman-4034f337edbb89f87465a05066cace379f6cc14f.zip
provider: Refactor server and user route handling
The server and user route handling is refactored in order to reflect the vpn dbus API changes. The routes are now array of dicts in dbus API.
Diffstat (limited to 'src/provider.c')
-rw-r--r--src/provider.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/src/provider.c b/src/provider.c
index 64a871b5..cd11db97 100644
--- a/src/provider.c
+++ b/src/provider.c
@@ -38,25 +38,14 @@ static GHashTable *provider_hash = NULL;
static GSList *driver_list = NULL;
-struct connman_route {
- int family;
- char *host;
- char *netmask;
- char *gateway;
-};
-
struct connman_provider {
int refcount;
struct connman_service *vpn_service;
int index;
char *identifier;
int family;
- GHashTable *routes;
struct connman_provider_driver *driver;
void *driver_data;
- GHashTable *user_routes;
- gchar **user_networks;
- gsize num_user_networks;
};
void __connman_provider_append_properties(struct connman_provider *provider,
@@ -109,9 +98,6 @@ static void provider_destruct(struct connman_provider *provider)
DBG("provider %p", provider);
g_free(provider->identifier);
- g_strfreev(provider->user_networks);
- g_hash_table_destroy(provider->routes);
- g_hash_table_destroy(provider->user_routes);
g_free(provider);
}
@@ -248,6 +234,10 @@ static int set_connected(struct connman_provider *provider,
provider_indicate_state(provider,
CONNMAN_SERVICE_STATE_READY);
+ if (provider->driver != NULL && provider->driver->set_routes)
+ provider->driver->set_routes(provider,
+ CONNMAN_PROVIDER_ROUTE_ALL);
+
} else {
if (ipconfig != NULL) {
provider_indicate_state(provider,
@@ -396,13 +386,8 @@ __connman_provider_check_routes(struct connman_provider *provider)
if (provider == NULL)
return FALSE;
- if (provider->user_routes != NULL &&
- g_hash_table_size(provider->user_routes) > 0)
- return TRUE;
-
- if (provider->routes != NULL &&
- g_hash_table_size(provider->routes) > 0)
- return TRUE;
+ if (provider->driver != NULL && provider->driver->check_routes)
+ return provider->driver->check_routes(provider);
return FALSE;
}
@@ -601,27 +586,12 @@ static void provider_offline_mode(connman_bool_t enabled)
}
-static void destroy_route(gpointer user_data)
-{
- struct connman_route *route = user_data;
-
- g_free(route->host);
- g_free(route->netmask);
- g_free(route->gateway);
- g_free(route);
-}
-
static void provider_initialize(struct connman_provider *provider)
{
DBG("provider %p", provider);
provider->index = 0;
provider->identifier = NULL;
- provider->user_networks = NULL;
- provider->routes = g_hash_table_new_full(g_direct_hash, g_direct_equal,
- NULL, destroy_route);
- provider->user_routes = g_hash_table_new_full(g_str_hash, g_str_equal,
- g_free, destroy_route);
}
static struct connman_provider *provider_new(void)