31 #define LOG(kind, ...) GNUNET_log_from (kind, "util-plugin", __VA_ARGS__)
86 _ (
"Initialization of plugin mechanism failed: %s!\n"),
90 opath = lt_dlgetsearchpath ();
102 lt_dlsetsearchpath (cpath);
108 lt_dlsetsearchpath (path);
149 mptr = lt_dlsym (plug->
handle,
152 mptr = lt_dlsym (plug->
handle,
156 _ (
"`%s' failed to resolve method '%s' with error: %s\n"),
186 libhandle = lt_dlopenext (library_name);
187 if (NULL == libhandle)
190 plug.
name = (
char *) library_name;
196 lt_dlclose (libhandle);
199 lt_dlclose (libhandle);
230 libhandle = lt_dlopenext (library_name);
231 if (NULL == libhandle)
234 _ (
"`%s' failed for library `%s' with error: %s\n"),
247 if ( (NULL ==
init) ||
250 lt_dlclose (libhandle);
279 while ( (NULL != pos) &&
280 (0 != strcmp (pos->
name,
351 const char *slashpos;
359 while (NULL != (slashpos = strstr (libname,
361 libname = slashpos + 1;
362 n = strlen (libname);
368 (0 == strcmp (&libname[n - 3],
".la")) )
371 if (NULL != (dot = strstr (
basename,
".")))
414 _ (
"Could not determine plugin installation path.\n"));
static int ret
Return value of the commandline.
static char * init
Set to the name of a service to start.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
#define GNUNET_log(kind,...)
int GNUNET_DISK_directory_scan(const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
Scan a directory for files.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_ERROR
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_get(void)
char * GNUNET_OS_installation_get_path(enum GNUNET_OS_InstallationPathKind dirkind)
Get the path to a specific GNUnet installation directory or, with GNUNET_OS_IPK_SELF_PREFIX,...
void GNUNET_OS_init(const struct GNUNET_OS_ProjectData *pd)
Setup OS subsystem with project data.
@ GNUNET_OS_IPK_LIBDIR
Return the directory where libraries are installed.
void GNUNET_PLUGIN_load_all(const char *basename, void *arg, GNUNET_PLUGIN_LoaderCallback cb, void *cb_cls)
Load all compatible plugins with the given base name.
void * GNUNET_PLUGIN_unload(const char *library_name, void *arg)
Unload plugin (runs the done callback and returns whatever done returned).
int GNUNET_PLUGIN_test(const char *library_name)
Test if a plugin exists.
void * GNUNET_PLUGIN_load(const char *library_name, void *arg)
Setup plugin (runs the init callback and returns whatever init returned).
void GNUNET_PLUGIN_load_all_in_context(const struct GNUNET_OS_ProjectData *ctx, const char *basename, void *arg, GNUNET_PLUGIN_LoaderCallback cb, void *cb_cls)
Load all compatible plugins with the given base name while inside the given context (i....
void *(* GNUNET_PLUGIN_Callback)(void *arg)
Signature of any function exported by a plugin.
void(* GNUNET_PLUGIN_LoaderCallback)(void *cls, const char *library_name, void *lib_ret)
Signature of a function called by GNUNET_PLUGIN_load_all().
static void plugin_fini(void)
Shutdown libtool.
static GNUNET_PLUGIN_Callback resolve_function(struct PluginList *plug, const char *name)
Lookup a function in the plugin.
static int find_libraries(void *cls, const char *filename)
Function called on each plugin in the directory.
static void plugin_init(void)
Setup libtool paths.
static char * old_dlsearchpath
Libtool search path before we started.
static struct PluginList * plugins
List of plugins we have loaded.
static int initialized
Have we been initialized?
Project-specific data used to help the OS subsystem find installation paths.
Closure for find_libraries().
const char * basename
Prefix the plugin names we find have to match.
void * cb_cls
Closure for cb.
void * arg
Argument to give to 'init' when loading the plugin.
GNUNET_PLUGIN_LoaderCallback cb
Function to call for each plugin.
Linked list of active plugins.
char * name
Name of the library.
struct PluginList * next
This is a linked list.
void * handle
System handle.