Elektra  0.9.2
Functions
elektra/plugin.c File Reference

Interna of plugin functionality. More...

#include <kdbassert.h>
#include <kdberrors.h>
#include <kdbinternal.h>
#include <kdbversion.h>
Include dependency graph for elektra/plugin.c:

Functions

int elektraProcessPlugin (Key *cur, int *pluginNumber, char **pluginName, char **referenceName, Key *errorKey)
 
int elektraProcessPlugins (Plugin **plugins, KeySet *modules, KeySet *referencePlugins, KeySet *config, KeySet *systemConfig, KeySet *global, Key *errorKey)
 Load a plugin. More...
 
Plugin * elektraPluginOpen (const char *name, KeySet *modules, KeySet *config, Key *errorKey)
 Opens a plugin. More...
 
size_t elektraPluginGetFunction (Plugin *plugin, const char *name)
 Retrieves a function exported by a plugin. More...
 
Plugin * elektraPluginFindGlobal (KDB *handle, const char *pluginName)
 Searches the global plugins for a given plugin name. More...
 

Detailed Description

Interna of plugin functionality.

Function Documentation

◆ elektraPluginFindGlobal()

Plugin* elektraPluginFindGlobal ( KDB *  handle,
const char *  pluginName 
)

Searches the global plugins for a given plugin name.

NOTE: if the list plugin occupies the prerollback position, this queries the list plugin first, and only if we don't find anything there, we look directly in the global plugins array

Parameters
handleThe KDB handle to search
pluginNameThe plugin name to look for
Returns
the plugin handle, if found or NULL otherwise

◆ elektraPluginGetFunction()

size_t elektraPluginGetFunction ( Plugin *  plugin,
const char *  name 
)

Retrieves a function exported by a plugin.

Parameters
pluginPlugin handle
nameFunction name
Returns
Pointer to function. NULL if function not found or not enough memory available

◆ elektraPluginOpen()

Plugin* elektraPluginOpen ( const char *  name,
KeySet *  modules,
KeySet *  config,
Key *  errorKey 
)

Opens a plugin.

The config will be used as is. So be sure to transfer ownership of the config to it, with e.g. ksDup(). elektraPluginClose() will delete the config.

Returns
a pointer to a new created plugin or 0 on error

◆ elektraProcessPlugin()

int elektraProcessPlugin ( Key *  cur,
int *  pluginNumber,
char **  pluginName,
char **  referenceName,
Key *  errorKey 
)
Return values
1and an allocated string of the pluginName if a new plugins should be created.
2and an allocated string of the referenceName if an old plugin should be used
3and both if a new plugin should be created and made available for later back referencing.
-1on error

◆ elektraProcessPlugins()

int elektraProcessPlugins ( Plugin **  plugins,
KeySet *  modules,
KeySet *  referencePlugins,
KeySet *  config,
KeySet *  systemConfig,
KeySet *  global,
Key *  errorKey 
)

Load a plugin.

The array of plugins must be set to 0. Its length is NR_OF_PLUGINS.

systemConfig will only be used, not deleted.

Parameters
configthe config with the information how the plugins should be put together
systemConfigthe shared (system) config for the plugins. Every plugin additional get this config.
globalthe global keyset of the KDB instance
Return values
-1on failure