\hypertarget{elektra_2plugin_8c}{}\section{plugin.\+c File Reference}
\label{elektra_2plugin_8c}\index{plugin.\+c@{plugin.\+c}}


Interna of plugin functionality.  


{\ttfamily \#include $<$kdbassert.\+h$>$}\newline
{\ttfamily \#include $<$kdberrors.\+h$>$}\newline
{\ttfamily \#include $<$kdbinternal.\+h$>$}\newline
{\ttfamily \#include $<$kdbversion.\+h$>$}\newline
Include dependency graph for elektra/plugin.c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{elektra_2plugin_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{elektra_2plugin_8c_a0c1bb87ce27fcf307fa71468206872c2}{elektra\+Process\+Plugin} (Key $\ast$cur, int $\ast$plugin\+Number, char $\ast$$\ast$plugin\+Name, char $\ast$$\ast$reference\+Name, Key $\ast$error\+Key)
\item 
int \hyperlink{elektra_2plugin_8c_a2d7f402a564d2164783890d3e742b319}{elektra\+Process\+Plugins} (Plugin $\ast$$\ast$plugins, Key\+Set $\ast$modules, Key\+Set $\ast$reference\+Plugins, Key\+Set $\ast$config, Key\+Set $\ast$system\+Config, Key\+Set $\ast$global, Key $\ast$error\+Key)
\begin{DoxyCompactList}\small\item\em Load a plugin. \end{DoxyCompactList}\item 
Plugin $\ast$ \hyperlink{elektra_2plugin_8c_a32a70a7876542c51d153164ac5108a57}{elektra\+Plugin\+Open} (const char $\ast$name, Key\+Set $\ast$modules, Key\+Set $\ast$config, Key $\ast$error\+Key)
\begin{DoxyCompactList}\small\item\em Opens a plugin. \end{DoxyCompactList}\item 
size\+\_\+t \hyperlink{elektra_2plugin_8c_a9c44a58fa46e132d04a513ff9c453201}{elektra\+Plugin\+Get\+Function} (Plugin $\ast$plugin, const char $\ast$name)
\begin{DoxyCompactList}\small\item\em Retrieves a function exported by a plugin. \end{DoxyCompactList}\item 
Plugin $\ast$ \hyperlink{elektra_2plugin_8c_a7b3681aca8accc06b86d25a31cc82643}{elektra\+Plugin\+Find\+Global} (K\+DB $\ast$handle, const char $\ast$plugin\+Name)
\begin{DoxyCompactList}\small\item\em Searches the global plugins for a given plugin name. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Interna of plugin functionality. 

\begin{DoxyCopyright}{Copyright}
B\+SD License (see L\+I\+C\+E\+N\+S\+E.\+md or \href{https://www.libelektra.org}{\tt https\+://www.\+libelektra.\+org}) 
\end{DoxyCopyright}


\subsection{Function Documentation}
\mbox{\Hypertarget{elektra_2plugin_8c_a7b3681aca8accc06b86d25a31cc82643}\label{elektra_2plugin_8c_a7b3681aca8accc06b86d25a31cc82643}} 
\index{elektra/plugin.\+c@{elektra/plugin.\+c}!elektra\+Plugin\+Find\+Global@{elektra\+Plugin\+Find\+Global}}
\index{elektra\+Plugin\+Find\+Global@{elektra\+Plugin\+Find\+Global}!elektra/plugin.\+c@{elektra/plugin.\+c}}
\subsubsection{\texorpdfstring{elektra\+Plugin\+Find\+Global()}{elektraPluginFindGlobal()}}
{\footnotesize\ttfamily Plugin$\ast$ elektra\+Plugin\+Find\+Global (\begin{DoxyParamCaption}\item[{K\+DB $\ast$}]{handle,  }\item[{const char $\ast$}]{plugin\+Name }\end{DoxyParamCaption})}



Searches the global plugins for a given plugin name. 

N\+O\+TE\+: if the list plugin occupies the prerollback position, this queries the list plugin first, and only if we don\textquotesingle{}t find anything there, we look directly in the global plugins array


\begin{DoxyParams}{Parameters}
{\em handle} & The K\+DB handle to search \\
\hline
{\em plugin\+Name} & The plugin name to look for\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the plugin handle, if found or N\+U\+LL otherwise 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra_2plugin_8c_a9c44a58fa46e132d04a513ff9c453201}\label{elektra_2plugin_8c_a9c44a58fa46e132d04a513ff9c453201}} 
\index{elektra/plugin.\+c@{elektra/plugin.\+c}!elektra\+Plugin\+Get\+Function@{elektra\+Plugin\+Get\+Function}}
\index{elektra\+Plugin\+Get\+Function@{elektra\+Plugin\+Get\+Function}!elektra/plugin.\+c@{elektra/plugin.\+c}}
\subsubsection{\texorpdfstring{elektra\+Plugin\+Get\+Function()}{elektraPluginGetFunction()}}
{\footnotesize\ttfamily size\+\_\+t elektra\+Plugin\+Get\+Function (\begin{DoxyParamCaption}\item[{Plugin $\ast$}]{plugin,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Retrieves a function exported by a plugin. 


\begin{DoxyParams}{Parameters}
{\em plugin} & Plugin handle \\
\hline
{\em name} & Function name \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Pointer to function. N\+U\+LL if function not found or not enough memory available 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra_2plugin_8c_a32a70a7876542c51d153164ac5108a57}\label{elektra_2plugin_8c_a32a70a7876542c51d153164ac5108a57}} 
\index{elektra/plugin.\+c@{elektra/plugin.\+c}!elektra\+Plugin\+Open@{elektra\+Plugin\+Open}}
\index{elektra\+Plugin\+Open@{elektra\+Plugin\+Open}!elektra/plugin.\+c@{elektra/plugin.\+c}}
\subsubsection{\texorpdfstring{elektra\+Plugin\+Open()}{elektraPluginOpen()}}
{\footnotesize\ttfamily Plugin$\ast$ elektra\+Plugin\+Open (\begin{DoxyParamCaption}\item[{const char $\ast$}]{name,  }\item[{Key\+Set $\ast$}]{modules,  }\item[{Key\+Set $\ast$}]{config,  }\item[{Key $\ast$}]{error\+Key }\end{DoxyParamCaption})}



Opens a plugin. 

The config will be used as is. So be sure to transfer ownership of the config to it, with e.\+g. \hyperlink{group__keyset_gac59e4b328245463f1451f68d5106151c}{ks\+Dup()}. elektra\+Plugin\+Close() will delete the config.

\begin{DoxyReturn}{Returns}
a pointer to a new created plugin or 0 on error 
\end{DoxyReturn}
\mbox{\Hypertarget{elektra_2plugin_8c_a0c1bb87ce27fcf307fa71468206872c2}\label{elektra_2plugin_8c_a0c1bb87ce27fcf307fa71468206872c2}} 
\index{elektra/plugin.\+c@{elektra/plugin.\+c}!elektra\+Process\+Plugin@{elektra\+Process\+Plugin}}
\index{elektra\+Process\+Plugin@{elektra\+Process\+Plugin}!elektra/plugin.\+c@{elektra/plugin.\+c}}
\subsubsection{\texorpdfstring{elektra\+Process\+Plugin()}{elektraProcessPlugin()}}
{\footnotesize\ttfamily int elektra\+Process\+Plugin (\begin{DoxyParamCaption}\item[{Key $\ast$}]{cur,  }\item[{int $\ast$}]{plugin\+Number,  }\item[{char $\ast$$\ast$}]{plugin\+Name,  }\item[{char $\ast$$\ast$}]{reference\+Name,  }\item[{Key $\ast$}]{error\+Key }\end{DoxyParamCaption})}


\begin{DoxyRetVals}{Return values}
{\em 1} & and an allocated string of the plugin\+Name if a new plugins should be created. \\
\hline
{\em 2} & and an allocated string of the reference\+Name if an old plugin should be used \\
\hline
{\em 3} & and both if a new plugin should be created and made available for later back referencing. \\
\hline
{\em -\/1} & on error \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{elektra_2plugin_8c_a2d7f402a564d2164783890d3e742b319}\label{elektra_2plugin_8c_a2d7f402a564d2164783890d3e742b319}} 
\index{elektra/plugin.\+c@{elektra/plugin.\+c}!elektra\+Process\+Plugins@{elektra\+Process\+Plugins}}
\index{elektra\+Process\+Plugins@{elektra\+Process\+Plugins}!elektra/plugin.\+c@{elektra/plugin.\+c}}
\subsubsection{\texorpdfstring{elektra\+Process\+Plugins()}{elektraProcessPlugins()}}
{\footnotesize\ttfamily int elektra\+Process\+Plugins (\begin{DoxyParamCaption}\item[{Plugin $\ast$$\ast$}]{plugins,  }\item[{Key\+Set $\ast$}]{modules,  }\item[{Key\+Set $\ast$}]{reference\+Plugins,  }\item[{Key\+Set $\ast$}]{config,  }\item[{Key\+Set $\ast$}]{system\+Config,  }\item[{Key\+Set $\ast$}]{global,  }\item[{Key $\ast$}]{error\+Key }\end{DoxyParamCaption})}



Load a plugin. 

The array of plugins must be set to 0. Its length is N\+R\+\_\+\+O\+F\+\_\+\+P\+L\+U\+G\+I\+NS.

system\+Config will only be used, not deleted.


\begin{DoxyParams}{Parameters}
{\em config} & the config with the information how the plugins should be put together \\
\hline
{\em system\+Config} & the shared (system) config for the plugins. Every plugin additional get this config. \\
\hline
{\em global} & the global keyset of the K\+DB instance\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on failure \\
\hline
\end{DoxyRetVals}
