$darkmode
Elektra 0.11.0
Macros | Enumerations | Functions
kdbplugin.h File Reference

Methods for plugin programing. More...

#include <kdb.h>
#include <errno.h>
#include <kdbmacros.h>
#include <string.h>
Include dependency graph for kdbplugin.h:
This graph shows which files directly or indirectly include this file:

Macros

#define ELEKTRA_PLUGIN_FUNCTION(function)   ELEKTRA_PLUGIN_FUNCTION2 (ELEKTRA_PLUGIN_NAME_C, function)
 Declare a plugin's function name suitable for compilation variants (see doc/tutorials). More...
 
#define ELEKTRA_README   ELEKTRA_README2 (ELEKTRA_PLUGIN_NAME_C)
 The filename for inclusion of the readme for compilation variants (see doc/tutorials). More...
 
#define ELEKTRA_PLUGIN_STATUS_ERROR   -1
 An error occurred inside the plugin function.
 
#define ELEKTRA_PLUGIN_STATUS_SUCCESS   1
 Everything went fine.
 
#define ELEKTRA_PLUGIN_STATUS_NO_UPDATE   0
 Everything went fine and the function did not update the given keyset/configuration.
 
#define ELEKTRA_PLUGIN_STATUS_CACHE_HIT   2
 Everything went fine and we have a cache hit.
 

Enumerations

enum  plugin_t {
  ELEKTRA_PLUGIN_OPEN =1 , ELEKTRA_PLUGIN_CLOSE =1<<1 , ELEKTRA_PLUGIN_GET =1<<2 , ELEKTRA_PLUGIN_SET =1<<3 ,
  ELEKTRA_PLUGIN_ERROR =1<<4 , ELEKTRA_PLUGIN_COMMIT =1<<5 , ELEKTRA_PLUGIN_INIT =1<<6 , ELEKTRA_PLUGIN_END =0
}
 Switches to denote the backend methods. More...
 

Functions

Plugin * elektraPluginExport (const char *pluginName,...)
 Allows one to Export Methods for a Plugin. More...
 
KeySet * elektraPluginGetConfig (Plugin *handle)
 Returns the configuration of that plugin. More...
 
void elektraPluginSetData (Plugin *plugin, void *handle)
 Store a pointer to plugin specific data. More...
 
void * elektraPluginGetData (Plugin *plugin)
 Get a pointer to the plugin specific data stored before. More...
 
KeySet * elektraPluginGetGlobalKeySet (Plugin *plugin)
 Get a pointer to the global keyset. More...
 
ElektraKdbPhase elektraPluginGetPhase (Plugin *plugin)
 Returns the current phase of the current KDB operation. More...
 
Plugin * elektraPluginFromMountpoint (Plugin *plugin, const char *ref)
 Retrieves the handle for another plugin in the same mountpoint based on a reference. More...
 
const char * elektraPluginPhaseName (ElektraKdbPhase phase)
 Gets a string with the name of the given constant for a plugin phase. More...
 

Detailed Description

Methods for plugin programing.

Enumeration Type Documentation

◆ plugin_t

enum plugin_t

Switches to denote the backend methods.

Used in calls to elektraPluginExport().

Enumerator
ELEKTRA_PLUGIN_OPEN 

Next arg is backend for kdbOpen()

ELEKTRA_PLUGIN_CLOSE 

Next arg is backend for kdbClose()

ELEKTRA_PLUGIN_GET 

Next arg is backend for kdbGet()

ELEKTRA_PLUGIN_SET 

Next arg is backend for kdbSet()

ELEKTRA_PLUGIN_ERROR 

Next arg is backend for kdbError()

ELEKTRA_PLUGIN_COMMIT 

Next arg is backend for kdbCommit()

ELEKTRA_PLUGIN_INIT 

Next arg is backend for kdbInit()

ELEKTRA_PLUGIN_END 

End of arguments

Function Documentation

◆ elektraPluginFromMountpoint()

Plugin* elektraPluginFromMountpoint ( Plugin *  plugin,
const char *  ref 
)

Retrieves the handle for another plugin in the same mountpoint based on a reference.

The plugins of a mountpoint are defined via system:/elektra/mountpoint/<mp>/pluigns/<ref> keys in the declaration of the mountpoint. To use this function, you must provide the <ref> part as ref.

Parameters
pluginactive plugin handle
refreference to another plugin
Returns
the plugin referenced by ref
Return values
NULLif plugin, or ref are NULL, or no plugin was found for ref

◆ elektraPluginGetPhase()

ElektraKdbPhase elektraPluginGetPhase ( Plugin *  plugin)

Returns the current phase of the current KDB operation.

During kdbGet() this will be one of the ELEKTRA_KDB_GET_PHASE_* constants and during kdbSet() it will be one of the ELEKTRA_KDB_SET_PHASE_* constants.

Parameters
pluginplugin handle
Returns
current phase
Return values
0if plugin is NULL

◆ elektraPluginPhaseName()

const char* elektraPluginPhaseName ( ElektraKdbPhase  phase)

Gets a string with the name of the given constant for a plugin phase.

Parameters
phaseThe ElektraKdbPhase value for which a string representation should be returned
Returns
A string with the name of the given phase. The returned string is a constant value and must never be freed!
Return values
???if an unknown value for the phase was given