[PATCH v3 26/42] vpn-provider: Send ConnectionAdded signal when needed

Jukka Rissanen jukka.rissanen at linux.intel.com
Wed Nov 7 03:48:52 PST 2012


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

diff --git a/vpn/vpn-provider.c b/vpn/vpn-provider.c
index c675181..0f53ff1 100644
--- a/vpn/vpn-provider.c
+++ b/vpn/vpn-provider.c
@@ -1225,6 +1225,25 @@ static void append_properties(DBusMessageIter *iter,
 	connman_dbus_dict_close(iter, &dict);
 }
 
+static void connection_added_signal(struct vpn_provider *provider)
+{
+	DBusMessage *signal;
+	DBusMessageIter iter;
+
+	signal = dbus_message_new_signal(VPN_MANAGER_PATH,
+			VPN_MANAGER_INTERFACE, "ConnectionAdded");
+	if (signal == NULL)
+		return;
+
+	dbus_message_iter_init_append(signal, &iter);
+	dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
+							&provider->path);
+	append_properties(&iter, provider);
+
+	dbus_connection_send(connection, signal, NULL);
+	dbus_message_unref(signal);
+}
+
 static connman_bool_t check_host(char **hosts, char *host)
 {
 	int i;
@@ -1664,6 +1683,8 @@ int __vpn_provider_create(DBusMessage *msg)
 				DBUS_TYPE_OBJECT_PATH, &provider->path,
 				DBUS_TYPE_INVALID);
 
+	connection_added_signal(provider);
+
 	return 0;
 }
 
-- 
1.7.11.4




More information about the connman mailing list