2 This file is part of GNUnet.
3 (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other contributing authors)
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.
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.
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.
22 * @file include/gnunet_plugin_lib.h
23 * @brief plugin loading and unloading
24 * @author Christian Grothoff
27 #ifndef GNUNET_PLUGIN_LIB_H
28 #define GNUNET_PLUGIN_LIB_H
33 #if 0 /* keep Emacsens' auto-indent happy */
38 #include "gnunet_common.h"
39 #include "gnunet_configuration_lib.h"
43 * Signature of any function exported by a plugin.
45 * @param arg argument to the function (context)
46 * @return some pointer, NULL if the plugin was
47 * shutdown or if there was an error, otherwise
48 * the plugin's API on success
50 typedef void *(*GNUNET_PLUGIN_Callback) (void *arg);
54 * Test if a plugin exists.
56 * Note that the library must export a symbol called
57 * "library_name_init" for the test to succeed.
59 * @param library_name name of the plugin to test if it is installed
60 * @return GNUNET_YES if the plugin exists, GNUNET_NO if not
63 GNUNET_PLUGIN_test (const char *library_name);
66 * Setup plugin (runs the "init" callback and returns whatever "init"
67 * returned). If "init" returns NULL, the plugin is unloaded.
69 * Note that the library must export symbols called
70 * "library_name_init" and "library_name_done". These will be called
71 * when the library is loaded and unloaded respectively.
73 * @param library_name name of the plugin to load
74 * @param arg argument to the plugin initialization function
75 * @return whatever the initialization function returned, NULL on error
78 GNUNET_PLUGIN_load (const char *library_name, void *arg);
82 * Unload plugin (runs the "done" callback and returns whatever "done"
83 * returned). The plugin is then unloaded.
85 * @param library_name name of the plugin to unload
86 * @param arg argument to the plugin shutdown function
87 * @return whatever the shutdown function returned, typically NULL
88 * or a "char *" representing the error message
91 GNUNET_PLUGIN_unload (const char *library_name, void *arg);
94 #if 0 /* keep Emacsens' auto-indent happy */
102 /* ifndef GNUNET_PLUGIN_LIB_H */
104 /* end of gnunet_plugin_lib.h */