includedir = @includedir@/connman
include_HEADERS = types.h log.h plugin.h security.h resolver.h \
- storage.h device.h network.h
+ storage.h device.h network.h notifier.h
nodist_include_HEADERS = version.h
--- /dev/null
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2007-2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __CONNMAN_NOTIFIER_H
+#define __CONNMAN_NOTIFIER_H
+
+#include <connman/device.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * SECTION:notifier
+ * @title: Notifier premitives
+ * @short_description: Functions for registering notifier modules
+ */
+
+#define CONNMAN_NOTIFIER_PRIORITY_LOW -100
+#define CONNMAN_NOTIFIER_PRIORITY_DEFAULT 0
+#define CONNMAN_NOTIFIER_PRIORITY_HIGH 100
+
+struct connman_notifier {
+ const char *name;
+ int priority;
+ int (*device_powered) (struct connman_device *device,
+ connman_bool_t powered);
+};
+
+extern int connman_notifier_register(struct connman_notifier *notifier);
+extern void connman_notifier_unregister(struct connman_notifier *notifier);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CONNMAN_NOTIFIER_H */
connmand_SOURCES = main.c connman.h log.c selftest.c error.c plugin.c \
profile.c element.c device.c network.c connection.c \
- security.c resolver.c storage.c manager.c agent.c \
- ipv4.c detect.c rtnl.c dbus.c
+ security.c resolver.c notifier.c storage.c manager.c \
+ agent.c ipv4.c detect.c rtnl.c dbus.c
if UDEV
connmand_SOURCES += udev.c
int __connman_profile_add_network(struct connman_network *network);
int __connman_profile_remove_network(struct connman_network *network);
+#include <connman/notifier.h>
+
+int __connman_notifier_init(void);
+void __connman_notifier_cleanup(void);
+
#include <connman/rtnl.h>
int __connman_rtnl_init(void);
element_root = g_node_new(element);
+ __connman_notifier_init();
__connman_network_init();
__connman_device_init();
__connman_device_cleanup();
__connman_network_cleanup();
+ __connman_notifier_cleanup();
g_node_traverse(element_root, G_POST_ORDER, G_TRAVERSE_ALL, -1,
free_driver, NULL);
--- /dev/null
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2007-2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "connman.h"
+
+static GSList *notifier_list = NULL;
+
+static gint compare_priority(gconstpointer a, gconstpointer b)
+{
+ const struct connman_notifier *notifier1 = a;
+ const struct connman_notifier *notifier2 = b;
+
+ return notifier2->priority - notifier1->priority;
+}
+
+/**
+ * connman_notifier_register:
+ * @notifier: notifier module
+ *
+ * Register a new notifier module
+ *
+ * Returns: %0 on success
+ */
+int connman_notifier_register(struct connman_notifier *notifier)
+{
+ DBG("notifier %p name %s", notifier, notifier->name);
+
+ notifier_list = g_slist_insert_sorted(notifier_list, notifier,
+ compare_priority);
+
+ return 0;
+}
+
+/**
+ * connman_notifier_unregister:
+ * @notifier: notifier module
+ *
+ * Remove a previously registered notifier module
+ */
+void connman_notifier_unregister(struct connman_notifier *notifier)
+{
+ DBG("notifier %p name %s", notifier, notifier->name);
+
+ notifier_list = g_slist_remove(notifier_list, notifier);
+}
+
+int __connman_notifier_init(void)
+{
+ DBG("");
+
+ return 0;
+}
+
+void __connman_notifier_cleanup(void)
+{
+ DBG("");
+}