diff options
Diffstat (limited to 'src/include/gnunet_plugin_lib.h')
-rw-r--r-- | src/include/gnunet_plugin_lib.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/include/gnunet_plugin_lib.h b/src/include/gnunet_plugin_lib.h index d143a6ccf..ff795d975 100644 --- a/src/include/gnunet_plugin_lib.h +++ b/src/include/gnunet_plugin_lib.h | |||
@@ -62,6 +62,7 @@ typedef void *(*GNUNET_PLUGIN_Callback) (void *arg); | |||
62 | int | 62 | int |
63 | GNUNET_PLUGIN_test (const char *library_name); | 63 | GNUNET_PLUGIN_test (const char *library_name); |
64 | 64 | ||
65 | |||
65 | /** | 66 | /** |
66 | * Setup plugin (runs the "init" callback and returns whatever "init" | 67 | * Setup plugin (runs the "init" callback and returns whatever "init" |
67 | * returned). If "init" returns NULL, the plugin is unloaded. | 68 | * returned). If "init" returns NULL, the plugin is unloaded. |
@@ -79,6 +80,40 @@ GNUNET_PLUGIN_load (const char *library_name, void *arg); | |||
79 | 80 | ||
80 | 81 | ||
81 | /** | 82 | /** |
83 | * Signature of a function called by 'GNUNET_PLUGIN_load_all'. | ||
84 | * | ||
85 | * @param cls closure | ||
86 | * @param library_name full name of the library (to be used with | ||
87 | * 'GNUNET_PLUGIN_unload') | ||
88 | * @param lib_ret return value from the initialization function | ||
89 | * of the library (same as what 'GNUNET_PLUGIN_load' would | ||
90 | * have returned for the given library name) | ||
91 | */ | ||
92 | typedef void (*GNUNET_PLUGIN_LoaderCallback)(void *cls, | ||
93 | const char *library_name, | ||
94 | void *lib_ret); | ||
95 | |||
96 | |||
97 | /** | ||
98 | * Load all compatible plugins with the given base name. | ||
99 | * | ||
100 | * Note that the library must export symbols called | ||
101 | * "basename_ANYTHING_init" and "basename_ANYTHING__done". These will | ||
102 | * be called when the library is loaded and unloaded respectively. | ||
103 | * | ||
104 | * @param basename basename of the plugins to load | ||
105 | * @param arg argument to the plugin initialization function | ||
106 | * @param cb function to call for each plugin found | ||
107 | * @param cb_cls closure for 'cb' | ||
108 | */ | ||
109 | void | ||
110 | GNUNET_PLUGIN_load_all (const char *basename, | ||
111 | void *arg, | ||
112 | GNUNET_PLUGIN_LoaderCallback cb, | ||
113 | void *cb_cls); | ||
114 | |||
115 | |||
116 | /** | ||
82 | * Unload plugin (runs the "done" callback and returns whatever "done" | 117 | * Unload plugin (runs the "done" callback and returns whatever "done" |
83 | * returned). The plugin is then unloaded. | 118 | * returned). The plugin is then unloaded. |
84 | * | 119 | * |