diff options
Diffstat (limited to 'src/util/plugin.c')
-rw-r--r-- | src/util/plugin.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/util/plugin.c b/src/util/plugin.c index d169bc911..feb661f24 100644 --- a/src/util/plugin.c +++ b/src/util/plugin.c | |||
@@ -388,6 +388,11 @@ find_libraries (void *cls, | |||
388 | * `basename_ANYTHING_init` and `basename_ANYTHING__done`. These will | 388 | * `basename_ANYTHING_init` and `basename_ANYTHING__done`. These will |
389 | * be called when the library is loaded and unloaded respectively. | 389 | * be called when the library is loaded and unloaded respectively. |
390 | * | 390 | * |
391 | * If you are writing a service to which third-party applications can connect, | ||
392 | * like GNUnet's own GNS service for example, you should use | ||
393 | * #GNUNET_PLUGIN_load_all_in_context instead of this function, passing your | ||
394 | * service's project data as context. | ||
395 | * | ||
391 | * @param basename basename of the plugins to load | 396 | * @param basename basename of the plugins to load |
392 | * @param arg argument to the plugin initialization function | 397 | * @param arg argument to the plugin initialization function |
393 | * @param cb function to call for each plugin found | 398 | * @param cb function to call for each plugin found |
@@ -420,4 +425,32 @@ GNUNET_PLUGIN_load_all (const char *basename, | |||
420 | } | 425 | } |
421 | 426 | ||
422 | 427 | ||
428 | /** | ||
429 | * Load all compatible plugins with the given base name while inside the given | ||
430 | * context (i.e. a specific project data structure.) | ||
431 | * | ||
432 | * Note that the library must export symbols called `basename_ANYTHING_init` | ||
433 | * and `basename_ANYTHING__done`. These will be called when the library is | ||
434 | * loaded and unloaded respectively. | ||
435 | * | ||
436 | * @param ctx the context used to find the plugins | ||
437 | * @param basename basename of the plugins to load | ||
438 | * @param arg argument to the plugin initialization function | ||
439 | * @param cb function to call for each plugin found | ||
440 | * @param cb_cls closure for @a cb | ||
441 | */ | ||
442 | void | ||
443 | GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx, | ||
444 | const char *basename, | ||
445 | void *arg, | ||
446 | GNUNET_PLUGIN_LoaderCallback cb, | ||
447 | void *cb_cls) | ||
448 | { | ||
449 | const struct GNUNET_OS_ProjectData *cpd = GNUNET_OS_project_data_get (); | ||
450 | GNUNET_OS_init (ctx); | ||
451 | GNUNET_PLUGIN_load_all (basename, arg, cb, cb_cls); | ||
452 | GNUNET_OS_init (cpd); | ||
453 | } | ||
454 | |||
455 | |||
423 | /* end of plugin.c */ | 456 | /* end of plugin.c */ |