5 * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef __CONNMAN_PLUGIN_H
23 #define __CONNMAN_PLUGIN_H
25 #include <connman/version.h>
26 #include <connman/log.h>
32 #ifndef CONNMAN_API_SUBJECT_TO_CHANGE
33 #error "Please define CONNMAN_API_SUBJECT_TO_CHANGE to acknowledge your \
34 understanding that ConnMan hasn't reached a stable API."
37 #define CONNMAN_PLUGIN_PRIORITY_LOW -100
38 #define CONNMAN_PLUGIN_PRIORITY_DEFAULT 0
39 #define CONNMAN_PLUGIN_PRIORITY_HIGH 100
43 * @title: Plugin premitives
44 * @short_description: Functions for declaring plugins
47 struct connman_plugin_desc {
49 const char *description;
59 * CONNMAN_PLUGIN_DEFINE:
61 * @description: plugin description
62 * @version: plugin version string
63 * @init: init function called on plugin loading
64 * @exit: exit function called on plugin removal
66 * Macro for defining a plugin descriptor
69 * #include <connman/plugin.h>
71 * static int example_init(void)
76 * static void example_exit(void)
80 * CONNMAN_PLUGIN_DEFINE(example, "Example plugin", CONNMAN_VERSION,
81 * example_init, example_exit)
84 #ifdef CONNMAN_PLUGIN_BUILTIN
85 #define CONNMAN_PLUGIN_DEFINE(name, description, version, priority, init, exit) \
86 struct connman_plugin_desc __connman_builtin_ ## name = { \
87 #name, description, version, priority, init, exit \
90 #define CONNMAN_PLUGIN_DEFINE(name, description, version, priority, init, exit) \
91 extern struct connman_debug_desc __start___debug[] \
92 __attribute__ ((visibility("hidden"))); \
93 extern struct connman_debug_desc __stop___debug[] \
94 __attribute__ ((visibility("hidden"))); \
95 extern struct connman_plugin_desc connman_plugin_desc \
96 __attribute__ ((visibility("default"))); \
97 struct connman_plugin_desc connman_plugin_desc = { \
98 #name, description, version, priority, init, exit, \
99 __start___debug, __stop___debug \
107 #endif /* __CONNMAN_PLUGIN_H */