<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2008 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>Loading Plugins</TITLE> <META NAME="description" CONTENT="Loading Plugins"> <META NAME="keywords" CONTENT="developers"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2008"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="developers.css"> <LINK REL="next" HREF="loadPlugin.html"> <LINK REL="previous" HREF="Normal_vs_Command_Plugins.html"> <LINK REL="up" HREF="Bacula_FD_Plugin_API.html"> <LINK REL="next" HREF="loadPlugin.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html670" HREF="loadPlugin.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html664" HREF="Bacula_FD_Plugin_API.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html658" HREF="Normal_vs_Command_Plugins.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html666" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html668" HREF="GNU_Free_Documentation_Lice.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html671" HREF="loadPlugin.html">loadPlugin</A> <B> Up:</B> <A NAME="tex2html665" HREF="Bacula_FD_Plugin_API.html">Bacula FD Plugin API</A> <B> Previous:</B> <A NAME="tex2html659" HREF="Normal_vs_Command_Plugins.html">Normal vs Command Plugins</A> <B> <A NAME="tex2html667" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html669" HREF="GNU_Free_Documentation_Lice.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION00420000000000000000"> Loading Plugins</A> </H1> Once the File daemon loads the plugins, it asks the OS for the two entry points (loadPlugin and unloadPlugin) then calls the <B>loadPlugin</B> entry point (see below). <P> Bacula passes information to the plugin through this call and it gets back information that it needs to use the plugin. Later, Bacula will call particular functions that are defined by the <B>loadPlugin</B> interface. <P> When Bacula is finished with the plugin (when Bacula is going to exit), it will call the <B>unloadPlugin</B> entry point. <P> The two entry points are: <P> <PRE> bRC loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs) and bRC unloadPlugin() </PRE> <P> both these external entry points to the shared object are defined as C entry points to avoid name mangling complications with C++. However, the shared object can actually be written in any language (preferrably C or C++) providing that it follows C language calling conventions. <P> The definitions for <B>bRC</B> and the arguments are <B>src/filed/fd-plugins.h</B> and so this header file needs to be included in your plugin. It along with <B>src/lib/plugins.h</B> define basically the whole plugin interface. Within this header file, it includes the following files: <P> <PRE> #include <sys/types.h> #include "config.h" #include "bc_types.h" #include "lib/plugins.h" #include <sys/stat.h> </PRE> <P> Aside from the <B>bc_types.h</B> and <B>confit.h</B> headers, the plugin definition uses the minimum code from Bacula. The bc_types.h file is required to ensure that the data type defintions in arguments correspond to the Bacula core code. <P> The return codes are defined as: <PRE> typedef enum { bRC_OK = 0, /* OK */ bRC_Stop = 1, /* Stop calling other plugins */ bRC_Error = 2, /* Some kind of error */ bRC_More = 3, /* More files to backup */ } bRC; </PRE> <P> At a future point in time, we hope to make the Bacula libbac.a into a shared object so that the plugin can use much more of Bacula's infrastructure, but for this first cut, we have tried to minimize the dependence on Bacula. <P> <HR> <!--Navigation Panel--> <A NAME="tex2html670" HREF="loadPlugin.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html664" HREF="Bacula_FD_Plugin_API.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html658" HREF="Normal_vs_Command_Plugins.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html666" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html668" HREF="GNU_Free_Documentation_Lice.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html671" HREF="loadPlugin.html">loadPlugin</A> <B> Up:</B> <A NAME="tex2html665" HREF="Bacula_FD_Plugin_API.html">Bacula FD Plugin API</A> <B> Previous:</B> <A NAME="tex2html659" HREF="Normal_vs_Command_Plugins.html">Normal vs Command Plugins</A> <B> <A NAME="tex2html667" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html669" HREF="GNU_Free_Documentation_Lice.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> 2010-06-14 </ADDRESS> </BODY> </HTML>