2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2015 Kern Sibbald
5 Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
7 The original author of Bacula is Kern Sibbald, with contributions
8 from many others, a complete list can be found in the file AUTHORS.
10 You may use this file and others of this release according to the
11 license defined in the LICENSE file, which includes the Affero General
12 Public License, v3.0 ("AGPLv3") and some additional permissions and
13 terms pursuant to its AGPLv3 Section 7.
15 This notice must be preserved when any source code is
16 conveyed and/or propagated.
18 Bacula(R) is a registered trademark of Kern Sibbald.
21 * Interface definition for Bacula Plugins
23 * Kern Sibbald, October 2007
27 #ifndef __SD_PLUGINS_H
28 #define __SD_PLUGINS_H
32 /* Workaround for SGI IRIX 6.5 */
33 #define _LANGUAGE_C_PLUS_PLUS 1
36 #define _THREAD_SAFE 1
37 #define _POSIX_PTHREAD_SEMANTICS 1
38 #define _FILE_OFFSET_BITS 64
39 #define _LARGEFILE_SOURCE 1
40 #define _LARGE_FILES 1
43 #include <sys/types.h>
49 #include "lib/plugins.h"
58 /****************************************************************************
60 * Bacula definitions *
62 ****************************************************************************/
64 /* Bacula Variable Ids */
79 bsdVarVolumeName = 14,
80 bsdVarCatalogRes = 15,
83 bsdVarSDJobFiles = 18,
85 bsdVarFDJobStatus = 20,
86 bsdVarSDJobStatus = 21
91 bsdwVarVolumeName = 2,
100 bsdEventDeviceInit = 3,
101 bsdEventDeviceOpen = 4,
102 bsdEventDeviceTryOpen = 5,
103 bsdEventDeviceClose = 6
107 bsdGlobalEventDeviceInit = 1
108 } bsdGlobalEventType;
111 typedef struct s_bsdEvent {
115 typedef struct s_sdbaculaInfo {
120 /* Bacula interface version and function pointers */
121 typedef struct s_sdbaculaFuncs {
124 bRC (*registerBaculaEvents)(bpContext *ctx, ...);
125 bRC (*getBaculaValue)(bpContext *ctx, bsdrVariable var, void *value);
126 bRC (*setBaculaValue)(bpContext *ctx, bsdwVariable var, void *value);
127 bRC (*JobMessage)(bpContext *ctx, const char *file, int line,
128 int type, utime_t mtime, const char *fmt, ...);
129 bRC (*DebugMessage)(bpContext *ctx, const char *file, int line,
130 int level, const char *fmt, ...);
131 char *(*EditDeviceCodes)(DCR *dcr, char *omsg,
132 const char *imsg, const char *cmd);
135 /* Bacula Subroutines */
136 void load_sd_plugins(const char *plugin_dir);
137 void new_plugins(JCR *jcr);
138 void free_plugins(JCR *jcr);
139 int generate_plugin_event(JCR *jcr, bsdEventType event, void *value=NULL);
140 int generate_global_plugin_event(bsdGlobalEventType event, void *value=NULL);
143 /****************************************************************************
145 * Plugin definitions *
147 ****************************************************************************/
151 psdVarDescription = 2
155 #define SD_PLUGIN_MAGIC "*BaculaSDPluginData*"
157 #define SD_PLUGIN_INTERFACE_VERSION ( 12 )
159 typedef struct s_sdpluginInfo {
162 const char *plugin_magic;
163 const char *plugin_license;
164 const char *plugin_author;
165 const char *plugin_date;
166 const char *plugin_version;
167 const char *plugin_description;
171 * Functions that must be defined in every plugin
173 typedef struct s_sdpluginFuncs {
176 bRC (*newPlugin)(bpContext *ctx);
177 bRC (*freePlugin)(bpContext *ctx);
178 bRC (*getPluginValue)(bpContext *ctx, psdVariable var, void *value);
179 bRC (*setPluginValue)(bpContext *ctx, psdVariable var, void *value);
180 bRC (*handlePluginEvent)(bpContext *ctx, bsdEvent *event, void *value);
181 bRC (*handleGlobalPluginEvent)(bsdEvent *event, void *value);
184 #define sdplug_func(plugin) ((psdFuncs *)(plugin->pfuncs))
185 #define sdplug_info(plugin) ((psdInfo *)(plugin->pinfo))
191 #endif /* __SD_PLUGINS_H */