2 Bacula® - The Network Backup Solution
4 Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from many
7 others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 Bacula® is a registered trademark of Kern Sibbald.
17 * Interface definition for Bacula Plugins
19 * Kern Sibbald, October 2007
23 #ifndef __SD_PLUGINS_H
24 #define __SD_PLUGINS_H
28 /* Workaround for SGI IRIX 6.5 */
29 #define _LANGUAGE_C_PLUS_PLUS 1
32 #define _THREAD_SAFE 1
33 #define _POSIX_PTHREAD_SEMANTICS 1
34 #define _FILE_OFFSET_BITS 64
35 #define _LARGEFILE_SOURCE 1
36 #define _LARGE_FILES 1
39 #include <sys/types.h>
45 #include "lib/plugins.h"
54 /****************************************************************************
56 * Bacula definitions *
58 ****************************************************************************/
60 /* Bacula Variable Ids */
75 bsdVarVolumeName = 14,
76 bsdVarCatalogRes = 15,
79 bsdVarSDJobFiles = 18,
81 bsdVarFDJobStatus = 20,
82 bsdVarSDJobStatus = 21
92 bsdwVarVolumeName = 2,
101 bsdEventDeviceInit = 3,
102 bsdEventDeviceOpen = 4,
103 bsdEventDeviceTryOpen = 5,
104 bsdEventDeviceClose = 6
108 bsdGlobalEventDeviceInit = 1
109 } bsdGlobalEventType;
112 typedef struct s_bsdEvent {
116 typedef struct s_sdbaculaInfo {
121 /* Bacula interface version and function pointers */
122 typedef struct s_sdbaculaFuncs {
125 bRC (*registerBaculaEvents)(bpContext *ctx, ...);
126 bRC (*getBaculaValue)(bpContext *ctx, bsdrVariable var, void *value);
127 bRC (*setBaculaValue)(bpContext *ctx, bsdwVariable var, void *value);
128 bRC (*JobMessage)(bpContext *ctx, const char *file, int line,
129 int type, utime_t mtime, const char *fmt, ...);
130 bRC (*DebugMessage)(bpContext *ctx, const char *file, int line,
131 int level, const char *fmt, ...);
132 char *(*EditDeviceCodes)(DCR *dcr, char *omsg,
133 const char *imsg, const char *cmd);
134 bRC (*getBaculaGlobal)(bsdrGlobalVariable var, void *value);
137 /* Bacula Subroutines */
138 void load_sd_plugins(const char *plugin_dir);
139 void new_plugins(JCR *jcr);
140 void free_plugins(JCR *jcr);
141 int generate_plugin_event(JCR *jcr, bsdEventType event, void *value=NULL);
142 int generate_global_plugin_event(bsdGlobalEventType event, void *value=NULL);
145 /****************************************************************************
147 * Plugin definitions *
149 ****************************************************************************/
153 psdVarDescription = 2
157 # define SD_PLUGIN_MAGIC "*BaculaSDPluginData*"
159 #define SD_PLUGIN_INTERFACE_VERSION ( 12 )
161 typedef struct s_sdpluginInfo {
164 const char *plugin_magic;
165 const char *plugin_license;
166 const char *plugin_author;
167 const char *plugin_date;
168 const char *plugin_version;
169 const char *plugin_description;
173 * Functions that must be defined in every plugin
175 typedef struct s_sdpluginFuncs {
178 bRC (*newPlugin)(bpContext *ctx);
179 bRC (*freePlugin)(bpContext *ctx);
180 bRC (*getPluginValue)(bpContext *ctx, psdVariable var, void *value);
181 bRC (*setPluginValue)(bpContext *ctx, psdVariable var, void *value);
182 bRC (*handlePluginEvent)(bpContext *ctx, bsdEvent *event, void *value);
183 bRC (*handleGlobalPluginEvent)(bsdEvent *event, void *value);
186 #define sdplug_func(plugin) ((psdFuncs *)(plugin->pfuncs))
187 #define sdplug_info(plugin) ((psdInfo *)(plugin->pinfo))
193 #endif /* __SD_PLUGINS_H */