]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/plugins/fd/plugin-fd.h
Plugin update
[bacula/bacula] / bacula / src / plugins / fd / plugin-fd.h
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2007-2008 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   bVarFDName    = 2,
61   bVarLevel     = 3,
62   bVarType      = 4,
63   bVarClient    = 5,
64   bVarJobName   = 6,
65   bVarJobStatus = 7,
66   bVarSinceTime = 8
67 } bVariable;
68
69 typedef enum {
70   bEventJobStart      = 1,
71   bEventJobEnd        = 2,
72 } bEventType;
73
74 typedef struct s_bEvent {
75    uint32_t eventType;
76 } bEvent;
77
78 typedef struct s_baculaInfo {
79    uint32_t size;
80    uint32_t interface;
81 } bInfo;
82
83 /* Bacula interface version and function pointers */
84 typedef struct s_baculaFuncs {  
85    uint32_t size;
86    uint32_t interface;
87    bpError (*registerBaculaEvents)(bpContext *ctx, ...);
88    bpError (*getBaculaValue)(bpContext *ctx, bVariable var, void *value);
89    bpError (*setBaculaValue)(bpContext *ctx, bVariable var, void *value);
90    bpError (*JobMessage)(bpContext *ctx, const char *file, int line, 
91        int type, time_t mtime, const char *msg);     
92    bpError (*DebugMessage)(bpContext *ctx, const char *file, int line,
93        int level, const char *msg);
94 } bFuncs;
95
96
97 /****************************************************************************
98  *                                                                          *
99  *                Plugin definitions                                        *
100  *                                                                          *
101  ****************************************************************************/
102
103 typedef enum {
104   pVarName = 1,
105   pVarDescription = 2
106 } pVariable;
107
108
109 #define PLUGIN_MAGIC     "*PluginData*" 
110 #define PLUGIN_INTERFACE  1
111
112 typedef struct s_pluginInfo {
113    uint32_t size;
114    uint32_t interface;
115    char *plugin_magic;
116    char *plugin_license;
117    char *plugin_author;
118    char *plugin_date;
119    char *plugin_version;
120    char *plugin_description;
121 } pInfo;
122
123 typedef struct s_pluginFuncs {  
124    uint32_t size;
125    uint32_t interface;
126    bpError (*newPlugin)(bpContext *ctx);
127    bpError (*freePlugin)(bpContext *ctx);
128    bpError (*getPluginValue)(bpContext *ctx, pVariable var, void *value);
129    bpError (*setPluginValue)(bpContext *ctx, pVariable var, void *value);
130    bpError (*handlePluginEvent)(bpContext *ctx, bEvent *event);
131 } pFuncs;
132
133 #define plug_func(plugin) ((pFuncs *)(plugin->pfuncs))
134 #define plug_info(plugin) ((pInfo *)(plugin->pinfo))
135
136 #ifdef __cplusplus
137 }
138 #endif
139
140 #endif /* __PLUGIN_FD_H */