]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/plugins/dir/plugin-dir.h
A bit of crypto cleanup. More later.
[bacula/bacula] / bacula / src / plugins / dir / plugin-dir.h
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
5
6    The main author of Bacula is Kern Sibbald, with contributions from
7    many others, a complete list can be found in the file AUTHORS.
8    This program is Free Software; you can redistribute it and/or
9    modify it under the terms of version two of the GNU General Public
10    License as published by the Free Software Foundation, which is 
11    listed in the file LICENSE.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23    Bacula® is a registered trademark of John Walker.
24    The licensor of Bacula is the Free Software Foundation Europe
25    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26    Switzerland, email:ftf@fsfeurope.org.
27 */
28 /*
29  * Interface definition for Bacula Plugins
30  *
31  * Kern Sibbald, October 2007
32  *
33  */
34  
35 #ifndef __PLUGIN_FD_H 
36 #define __PLUGIN_FD_H
37
38 #include <sys/types.h>
39 #ifndef __CONFIG_H
40 #define __CONFIG_H
41 #include "config.h"
42 #endif
43 #include "bc_types.h"
44 #include "lib/plugin.h"
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50
51 /****************************************************************************
52  *                                                                          *
53  *                Bacula definitions                                        *
54  *                                                                          *
55  ****************************************************************************/
56
57 /* Bacula Variable Ids */
58 typedef enum {
59   bVarJobId = 1
60 } bVariable;
61
62 typedef enum {
63   bEventJobStart      = 1,
64   bEventJobInit       = 2,
65   bEventJobRun        = 3,
66   bEventJobEnd        = 4,
67   bEventNewVolume     = 5,
68   bEventVolumePurged  = 6,
69   bEventReload        = 7
70 } bEventType;
71
72 typedef struct s_bEvent {
73    uint32_t eventType;
74 } bEvent;
75
76
77 /* Bacula interface version and function pointers */
78 typedef struct s_baculaFuncs {  
79    uint32_t size;
80    uint32_t interface;
81    bpError (*getBaculaValue)(bpContext *ctx, bVariable var, void *value);
82    bpError (*setBaculaValue)(bpContext *ctx, bVariable var, void *value);
83    bpError (*allocBaculaMem)(bpContext *ctx, uint32_t size, char *addr);
84    bpError (*freeBaculaMem)(bpContext *ctx, char *addr);
85 } bFuncs;
86
87
88 /****************************************************************************
89  *                                                                          *
90  *                Plugin definitions                                        *
91  *                                                                          *
92  ****************************************************************************/
93
94 typedef enum {
95   pVarName = 1,
96   pVarDescription = 2
97 } pVariable;
98
99
100 #define PLUGIN_MAGIC     "*PluginData*" 
101 #define PLUGIN_INTERFACE  1
102
103 typedef struct s_pluginFuncs {  
104    uint32_t size;
105    uint32_t interface;
106    char *plugin_magic;
107    char *plugin_license;
108    char *plugin_author;
109    char *plugin_date;
110    char *plugin_version;
111    char *plugin_description;
112    bpError (*newPlugin)(bpContext *ctx);
113    bpError (*freePlugin)(bpContext *ctx);
114    bpError (*getPluginValue)(bpContext *ctx, pVariable var, void *value);
115    bpError (*setPluginValue)(bpContext *ctx, pVariable var, void *value);
116    bpError (*handlePluginEvent)(bpContext *ctx, bEvent *event);
117 } pFuncs;
118
119 #define pref(plugin) ((pFuncs *)(plugin->pfuncs))
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif /* __PLUGIN_FD_H */