.TH "kdbplugin.h" 3elektra "Fri Aug 4 2023" "Version 0.11.0" "Elektra" \" -*- nroff -*-
.ad l
.nh
.SH NAME
kdbplugin.h \- Methods for plugin programing\&.  

.SH SYNOPSIS
.br
.PP
\fC#include <kdb\&.h>\fP
.br
\fC#include <errno\&.h>\fP
.br
\fC#include <kdbmacros\&.h>\fP
.br
\fC#include <string\&.h>\fP
.br

.SS "Macros"

.in +1c
.ti -1c
.RI "#define \fBELEKTRA_PLUGIN_FUNCTION\fP(function)   ELEKTRA_PLUGIN_FUNCTION2 (ELEKTRA_PLUGIN_NAME_C, function)"
.br
.RI "Declare a plugin's function name suitable for compilation variants (see doc/tutorials)\&. "
.ti -1c
.RI "#define \fBELEKTRA_README\fP   ELEKTRA_README2 (ELEKTRA_PLUGIN_NAME_C)"
.br
.RI "The filename for inclusion of the readme for compilation variants (see doc/tutorials)\&. "
.ti -1c
.RI "#define \fBELEKTRA_PLUGIN_STATUS_ERROR\fP   \-1"
.br
.RI "An error occurred inside the plugin function\&. "
.ti -1c
.RI "#define \fBELEKTRA_PLUGIN_STATUS_SUCCESS\fP   1"
.br
.RI "Everything went fine\&. "
.ti -1c
.RI "#define \fBELEKTRA_PLUGIN_STATUS_NO_UPDATE\fP   0"
.br
.RI "Everything went fine and the function \fBdid not\fP update the given keyset/configuration\&. "
.ti -1c
.RI "#define \fBELEKTRA_PLUGIN_STATUS_CACHE_HIT\fP   2"
.br
.RI "Everything went fine and we have a cache hit\&. "
.in -1c
.SS "Enumerations"

.in +1c
.ti -1c
.RI "enum \fBplugin_t\fP { \fBELEKTRA_PLUGIN_OPEN\fP =1, \fBELEKTRA_PLUGIN_CLOSE\fP =1<<1, \fBELEKTRA_PLUGIN_GET\fP =1<<2, \fBELEKTRA_PLUGIN_SET\fP =1<<3, \fBELEKTRA_PLUGIN_ERROR\fP =1<<4, \fBELEKTRA_PLUGIN_COMMIT\fP =1<<5, \fBELEKTRA_PLUGIN_INIT\fP =1<<6, \fBELEKTRA_PLUGIN_END\fP =0 }"
.br
.RI "Switches to denote the backend methods\&. "
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "Plugin * \fBelektraPluginExport\fP (const char *pluginName,\&.\&.\&.)"
.br
.RI "Allows one to Export Methods for a Plugin\&. "
.ti -1c
.RI "KeySet * \fBelektraPluginGetConfig\fP (Plugin *handle)"
.br
.RI "Returns the configuration of that plugin\&. "
.ti -1c
.RI "void \fBelektraPluginSetData\fP (Plugin *plugin, void *handle)"
.br
.RI "Store a pointer to plugin specific data\&. "
.ti -1c
.RI "void * \fBelektraPluginGetData\fP (Plugin *plugin)"
.br
.RI "Get a pointer to the plugin specific data stored before\&. "
.ti -1c
.RI "KeySet * \fBelektraPluginGetGlobalKeySet\fP (Plugin *plugin)"
.br
.RI "Get a pointer to the global keyset\&. "
.ti -1c
.RI "ElektraKdbPhase \fBelektraPluginGetPhase\fP (Plugin *plugin)"
.br
.RI "Returns the current phase of the current KDB operation\&. "
.ti -1c
.RI "Plugin * \fBelektraPluginFromMountpoint\fP (Plugin *plugin, const char *ref)"
.br
.RI "Retrieves the handle for another plugin in the same mountpoint based on a reference\&. "
.ti -1c
.RI "const char * \fBelektraPluginPhaseName\fP (ElektraKdbPhase phase)"
.br
.RI "Gets a string with the name of the given constant for a plugin phase\&. "
.in -1c
.SH "Detailed Description"
.PP 
Methods for plugin programing\&. 


.PP
\fBCopyright\fP
.RS 4
BSD License (see LICENSE\&.md or https://www.libelektra.org) 
.RE
.PP

.SH "Enumeration Type Documentation"
.PP 
.SS "enum \fBplugin_t\fP"

.PP
Switches to denote the backend methods\&. Used in calls to \fBelektraPluginExport()\fP\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fIELEKTRA_PLUGIN_OPEN \fP\fP
Next arg is backend for \fBkdbOpen()\fP 
.TP
\fB\fIELEKTRA_PLUGIN_CLOSE \fP\fP
Next arg is backend for \fBkdbClose()\fP 
.TP
\fB\fIELEKTRA_PLUGIN_GET \fP\fP
Next arg is backend for \fBkdbGet()\fP 
.TP
\fB\fIELEKTRA_PLUGIN_SET \fP\fP
Next arg is backend for \fBkdbSet()\fP 
.TP
\fB\fIELEKTRA_PLUGIN_ERROR \fP\fP
Next arg is backend for kdbError() 
.TP
\fB\fIELEKTRA_PLUGIN_COMMIT \fP\fP
Next arg is backend for kdbCommit() 
.TP
\fB\fIELEKTRA_PLUGIN_INIT \fP\fP
Next arg is backend for kdbInit() 
.TP
\fB\fIELEKTRA_PLUGIN_END \fP\fP
End of arguments 
.SH "Function Documentation"
.PP 
.SS "Plugin* elektraPluginFromMountpoint (Plugin * plugin, const char * ref)"

.PP
Retrieves the handle for another plugin in the same mountpoint based on a reference\&. The plugins of a mountpoint are defined via \fCsystem:/elektra/mountpoint/<mp>/pluigns/<ref>\fP keys in the declaration of the mountpoint\&. To use this function, you must provide the \fC<ref>\fP part as \fCref\fP\&.
.PP
\fBParameters\fP
.RS 4
\fIplugin\fP active plugin handle 
.br
\fIref\fP reference to another plugin 
.RE
.PP
\fBReturns\fP
.RS 4
the plugin referenced by \fCref\fP 
.RE
.PP
\fBReturn values\fP
.RS 4
\fINULL\fP if \fCplugin\fP, or \fCref\fP are \fCNULL\fP, or no plugin was found for \fCref\fP 
.RE
.PP

.SS "ElektraKdbPhase elektraPluginGetPhase (Plugin * plugin)"

.PP
Returns the current phase of the current KDB operation\&. During \fBkdbGet()\fP this will be one of the \fCELEKTRA_KDB_GET_PHASE_*\fP constants and during \fBkdbSet()\fP it will be one of the \fCELEKTRA_KDB_SET_PHASE_*\fP constants\&.
.PP
\fBParameters\fP
.RS 4
\fIplugin\fP plugin handle 
.RE
.PP
\fBReturns\fP
.RS 4
current phase 
.RE
.PP
\fBReturn values\fP
.RS 4
\fI0\fP if \fCplugin\fP is \fCNULL\fP 
.RE
.PP

.SS "const char* elektraPluginPhaseName (ElektraKdbPhase phase)"

.PP
Gets a string with the name of the given constant for a plugin phase\&. 
.PP
\fBParameters\fP
.RS 4
\fIphase\fP The ElektraKdbPhase value for which a string representation should be returned
.RE
.PP
\fBReturns\fP
.RS 4
A string with the name of the given phase\&. The returned string is a constant value and must never be freed! 
.RE
.PP
\fBReturn values\fP
.RS 4
\fI???\fP if an unknown value for the phase was given 
.RE
.PP

.SH "Author"
.PP 
Generated automatically by Doxygen for Elektra from the source code\&.
