diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2010-07-30 16:08:44 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-08-02 19:16:11 +0200 |
commit | d885703619a775d053e0170eb2acb080fa205841 (patch) | |
tree | 21a6ad89488e289e2c5fb7a0bfdeaa9998091c06 /src/provider.c | |
parent | de41f828cf9decef412165c2895cb6ddc73be455 (diff) | |
download | connman-d885703619a775d053e0170eb2acb080fa205841.tar.gz connman-d885703619a775d053e0170eb2acb080fa205841.tar.bz2 connman-d885703619a775d053e0170eb2acb080fa205841.zip |
Link providers with services
With each provider we now have a VPN type service.
Diffstat (limited to 'src/provider.c')
-rw-r--r-- | src/provider.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/provider.c b/src/provider.c index 81c7b4dc..66fb6281 100644 --- a/src/provider.c +++ b/src/provider.c @@ -37,6 +37,7 @@ static GSList *driver_list = NULL; struct connman_provider { struct connman_element element; + struct connman_service *vpn_service; char *identifier; char *path; enum connman_provider_state state; @@ -140,6 +141,8 @@ static void connman_provider_setup_vpn_ipv4(struct connman_provider *provider, struct connman_provider *connman_provider_ref(struct connman_provider *provider) { + DBG("provider %p", provider); + if (connman_element_ref(&provider->element) == NULL) return NULL; @@ -148,6 +151,8 @@ struct connman_provider *connman_provider_ref(struct connman_provider *provider) void connman_provider_unref(struct connman_provider *provider) { + DBG("provider %p", provider); + connman_element_unref(&provider->element); } @@ -241,6 +246,9 @@ static int connman_provider_disconnect(struct connman_provider *provider) __connman_provider_indicate_state(provider, CONNMAN_PROVIDER_STATE_DISCONNECT); + + __connman_service_indicate_state(provider->vpn_service, + CONNMAN_SERVICE_STATE_DISCONNECT); if (err < 0) { if (err != -EINPROGRESS) return err; @@ -512,11 +520,15 @@ int connman_provider_set_connected(struct connman_provider *provider, } __connman_provider_indicate_state(provider, CONNMAN_PROVIDER_STATE_READY); + __connman_service_indicate_state(provider->vpn_service, + CONNMAN_SERVICE_STATE_READY); } else { reply_pending(provider, ECONNABORTED); connman_element_unregister_children(&provider->element); __connman_provider_indicate_state(provider, CONNMAN_PROVIDER_STATE_DISCONNECT); + __connman_service_indicate_state(provider->vpn_service, + CONNMAN_SERVICE_STATE_DISCONNECT); } return 0; @@ -543,6 +555,7 @@ static void provider_free(gpointer user_data) g_free(provider->domain); g_free(provider->identifier); g_free(provider->dns); + __connman_service_put(provider->vpn_service); } static void unregister_provider(gpointer data) @@ -561,6 +574,8 @@ static void provider_destruct(struct connman_element *element) { struct connman_provider *provider = element->private; + DBG("provider %p", provider); + provider_free(provider); } @@ -768,6 +783,10 @@ int __connman_provider_create_and_connect(DBusMessage *msg) g_dbus_send_reply(connection, msg, DBUS_TYPE_OBJECT_PATH, &provider->path, DBUS_TYPE_INVALID); + + provider->vpn_service = + __connman_service_create_from_provider(provider); + return 0; failed: @@ -779,6 +798,14 @@ failed: return err; } +const char * __connman_provider_get_ident(struct connman_provider *provider) +{ + if (provider == NULL) + return NULL; + + return provider->identifier; +} + int connman_provider_set_string(struct connman_provider *provider, const char *key, const char *value) { |