aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAlessio Vanni <vannilla@firemail.cc>2021-04-04 16:51:09 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2021-04-05 18:15:14 +0200
commit45720bde1c56c414fec8a1c3d5775208c3b32139 (patch)
tree74dc74c8d1639c50901320b688bb3cae81d47266 /src/include
parent879cfdc43babb80a0c0618dfe3afa960fbed6e7d (diff)
downloadgnunet-45720bde1c56c414fec8a1c3d5775208c3b32139.tar.gz
gnunet-45720bde1c56c414fec8a1c3d5775208c3b32139.zip
Implement function to load plugins within a specific context
When `GNUNET_OS_init' is called to change the application project data, lazy-loading plugins will fail as it will not find the requested files. The function will temporarily swap the project data with the argument value and will search for plugins, within the installation directory tree inferred from that structure. Applications can still use `GNUNET_PLUGIN_load_all' to load their plugins from within their own installation directory tree, though services are recommended to use the `in_context' version to avoid falling in the same pit. Signed-off-by: Martin Schanzenbach <mschanzenbach@posteo.de>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_plugin_lib.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/include/gnunet_plugin_lib.h b/src/include/gnunet_plugin_lib.h
index ffffcab8b..d265eb343 100644
--- a/src/include/gnunet_plugin_lib.h
+++ b/src/include/gnunet_plugin_lib.h
@@ -122,6 +122,28 @@ GNUNET_PLUGIN_load_all (const char *basename,
122 122
123 123
124/** 124/**
125 * Load all compatible plugins with the given base name while inside the given
126 * context (i.e. a specific project data structure.)
127 *
128 * Note that the library must export symbols called `basename_ANYTHING_init`
129 * and `basename_ANYTHING__done`. These will be called when the library is
130 * loaded and unloaded respectively.
131 *
132 * @param ctx the context used to find the plugins
133 * @param basename basename of the plugins to load
134 * @param arg argument to the plugin initialization function
135 * @param cb function to call for each plugin found
136 * @param cb_cls closure for @a cb
137 */
138void
139GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx,
140 const char *basename,
141 void *arg,
142 GNUNET_PLUGIN_LoaderCallback cb,
143 void *cb_cls);
144
145
146/**
125 * Unload plugin (runs the "done" callback and returns whatever "done" 147 * Unload plugin (runs the "done" callback and returns whatever "done"
126 * returned). The plugin is then unloaded. 148 * returned). The plugin is then unloaded.
127 * 149 *