3 * oFono - Open Source Telephony
5 * Copyright (C) 2008-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 __OFONO_PLUGIN_H
23 #define __OFONO_PLUGIN_H
25 #include <ofono/version.h>
26 #include <ofono/log.h>
32 #ifndef OFONO_API_SUBJECT_TO_CHANGE
33 #error "Please define OFONO_API_SUBJECT_TO_CHANGE to acknowledge your \
34 understanding that oFono hasn't reached a stable API."
37 #define OFONO_PLUGIN_PRIORITY_LOW -100
38 #define OFONO_PLUGIN_PRIORITY_DEFAULT 0
39 #define OFONO_PLUGIN_PRIORITY_HIGH 100
43 * @title: Plugin premitives
44 * @short_description: Functions for declaring plugins
47 struct ofono_plugin_desc {
49 const char *description;
59 * OFONO_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
68 #ifdef OFONO_PLUGIN_BUILTIN
69 #define OFONO_PLUGIN_DEFINE(name, description, version, priority, init, exit) \
70 struct ofono_plugin_desc __ofono_builtin_ ## name = { \
71 #name, description, version, priority, init, exit \
74 #define OFONO_PLUGIN_DEFINE(name, description, version, priority, init, exit) \
75 extern struct ofono_debug_desc __start___debug[] \
76 __attribute__ ((visibility("hidden"))); \
77 extern struct ofono_debug_desc __stop___debug[] \
78 __attribute__ ((visibility("hidden"))); \
79 extern struct ofono_plugin_desc ofono_plugin_desc \
80 __attribute__ ((visibility("default"))); \
81 struct ofono_plugin_desc ofono_plugin_desc = { \
82 #name, description, version, priority, init, exit, \
83 __start___debug, __stop___debug \
91 #endif /* __OFONO_PLUGIN_H */