diff options
Diffstat (limited to 'src/include/gnunet_plugin_lib.h')
-rw-r--r-- | src/include/gnunet_plugin_lib.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/include/gnunet_plugin_lib.h b/src/include/gnunet_plugin_lib.h new file mode 100644 index 000000000..e4f603c4e --- /dev/null +++ b/src/include/gnunet_plugin_lib.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file include/gnunet_plugin_lib.h | ||
23 | * @brief plugin loading and unloading | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | |||
27 | #ifndef GNUNET_PLUGIN_LIB_H | ||
28 | #define GNUNET_PLUGIN_LIB_H | ||
29 | |||
30 | #ifdef __cplusplus | ||
31 | extern "C" | ||
32 | { | ||
33 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
34 | } | ||
35 | #endif | ||
36 | #endif | ||
37 | |||
38 | #include "gnunet_common.h" | ||
39 | #include "gnunet_configuration_lib.h" | ||
40 | |||
41 | |||
42 | /** | ||
43 | * Signature of any function exported by a plugin. | ||
44 | */ | ||
45 | typedef void *(*GNUNET_PLUGIN_Callback) (void *arg); | ||
46 | |||
47 | |||
48 | /** | ||
49 | * Setup plugin (runs the "init" callback and returns whatever "init" | ||
50 | * returned). If "init" returns NULL, the plugin is unloaded. | ||
51 | * | ||
52 | * Note that the library must export symbols called | ||
53 | * "library_name_init" and "library_name_done". These will be called | ||
54 | * when the library is loaded and unloaded respectively. | ||
55 | * | ||
56 | * @param library_name name of the plugin to load | ||
57 | * @param arg argument to the plugin initialization function | ||
58 | * @return whatever the initialization function returned | ||
59 | */ | ||
60 | void *GNUNET_PLUGIN_load (const char *library_name, void *arg); | ||
61 | |||
62 | |||
63 | /** | ||
64 | * Unload plugin (runs the "done" callback and returns whatever "done" | ||
65 | * returned). The plugin is then unloaded. | ||
66 | * | ||
67 | * @param library_name name of the plugin to unload | ||
68 | * @param arg argument to the plugin shutdown function | ||
69 | * @return whatever the shutdown function returned | ||
70 | */ | ||
71 | void *GNUNET_PLUGIN_unload (const char *library_name, void *arg); | ||
72 | |||
73 | |||
74 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
75 | { | ||
76 | #endif | ||
77 | #ifdef __cplusplus | ||
78 | } | ||
79 | #endif | ||
80 | |||
81 | |||
82 | /* ifndef GNUNET_PLUGIN_LIB_H */ | ||
83 | #endif | ||
84 | /* end of gnunet_plugin_lib.h */ | ||