[PATCH v2 14/16] vpn-provider: Register agent driver

Jukka Rissanen jukka.rissanen at linux.intel.com
Tue Nov 27 02:51:46 PST 2012


---
 vpn/vpn-provider.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/vpn/vpn-provider.c b/vpn/vpn-provider.c
index c6b86de..9bbb10f 100644
--- a/vpn/vpn-provider.c
+++ b/vpn/vpn-provider.c
@@ -33,6 +33,7 @@
 #include <netdb.h>
 
 #include "../src/connman.h"
+#include "connman/agent.h"
 #include "connman/vpn-dbus.h"
 #include "vpn-provider.h"
 #include "vpn.h"
@@ -2183,12 +2184,39 @@ const char *vpn_provider_get_path(struct vpn_provider *provider)
 	return provider->path;
 }
 
+static int agent_probe(struct connman_agent *agent)
+{
+	DBG("agent %p", agent);
+	return 0;
+}
+
+static void agent_remove(struct connman_agent *agent)
+{
+	DBG("agent %p", agent);
+}
+
+static struct connman_agent_driver agent_driver = {
+	.name		= "vpn",
+	.interface      = VPN_AGENT_INTERFACE,
+	.probe		= agent_probe,
+	.remove		= agent_remove,
+};
+
 int __vpn_provider_init(gboolean do_routes)
 {
+	int err;
+
 	DBG("");
 
 	handle_routes = do_routes;
 
+	err = connman_agent_driver_register(&agent_driver);
+	if (err < 0) {
+		connman_error("Cannot register agent driver for %s",
+						agent_driver.name);
+		return err;
+	}
+
 	connection = connman_dbus_get_connection();
 
 	provider_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
@@ -2206,5 +2234,7 @@ void __vpn_provider_cleanup(void)
 	g_hash_table_destroy(provider_hash);
 	provider_hash = NULL;
 
+	connman_agent_driver_unregister(&agent_driver);
+
 	dbus_connection_unref(connection);
 }
-- 
1.7.11.4




More information about the connman mailing list