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 __DIR_PLUGINS_H
28 #define __DIR_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 */ /* return value */
66 bDirVarJob = 1, // string
67 bDirVarLevel = 2, // int
68 bDirVarType = 3, // int
69 bDirVarJobId = 4, // int
70 bDirVarClient = 5, // string
71 bDirVarNumVols = 6, // int
72 bDirVarPool = 7, // string
73 bDirVarStorage = 8, // string
74 bDirVarWriteStorage = 9, // string
75 bDirVarReadStorage = 10, // string
76 bDirVarCatalog = 11, // string
77 bDirVarMediaType = 12, // string
78 bDirVarJobName = 13, // string
79 bDirVarJobStatus = 14, // int
80 bDirVarPriority = 15, // int
81 bDirVarVolumeName = 16, // string
82 bDirVarCatalogRes = 17, // NYI
83 bDirVarJobErrors = 18, // int
84 bDirVarJobFiles = 19, // int
85 bDirVarSDJobFiles = 20, // int
86 bDirVarSDErrors = 21, // int
87 bDirVarFDJobStatus = 22, // int
88 bDirVarSDJobStatus = 23 // int
92 bwDirVarJobReport = 1,
93 bwDirVarVolumeName = 2,
100 bDirEventJobStart = 1,
102 bDirEventJobInit = 3,
104 bDirEventVolumePurged = 5,
105 bDirEventNewVolume = 6,
106 bDirEventNeedVolume = 7,
107 bDirEventVolumeFull = 8,
109 bDirEventGetScratch = 10
112 typedef struct s_bDirEvent {
116 typedef struct s_dirbaculaInfo {
121 /* Bacula interface version and function pointers */
122 typedef struct s_dirbaculaFuncs {
125 bRC (*registerBaculaEvents)(bpContext *ctx, ...);
126 bRC (*getBaculaValue)(bpContext *ctx, brDirVariable var, void *value);
127 bRC (*setBaculaValue)(bpContext *ctx, bwDirVariable 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, ...);
134 /* Bacula Core Routines -- not used within a plugin */
135 #ifdef DIRECTOR_DAEMON
136 void load_dir_plugins(const char *plugin_dir);
137 void new_plugins(JCR *jcr);
138 void free_plugins(JCR *jcr);
139 int generate_plugin_event(JCR *jcr, bDirEventType event, void *value=NULL);
143 /****************************************************************************
145 * Plugin definitions *
147 ****************************************************************************/
151 pDirVarDescription = 2
155 #define DIR_PLUGIN_MAGIC "*DirPluginData*"
156 #define DIR_PLUGIN_INTERFACE_VERSION 1
158 typedef struct s_dirpluginInfo {
161 const char *plugin_magic;
162 const char *plugin_license;
163 const char *plugin_author;
164 const char *plugin_date;
165 const char *plugin_version;
166 const char *plugin_description;
169 typedef struct s_dirpluginFuncs {
172 bRC (*newPlugin)(bpContext *ctx);
173 bRC (*freePlugin)(bpContext *ctx);
174 bRC (*getPluginValue)(bpContext *ctx, pDirVariable var, void *value);
175 bRC (*setPluginValue)(bpContext *ctx, pDirVariable var, void *value);
176 bRC (*handlePluginEvent)(bpContext *ctx, bDirEvent *event, void *value);
179 #define dirplug_func(plugin) ((pDirFuncs *)(plugin->pfuncs))
180 #define dirplug_info(plugin) ((pDirInfo *)(plugin->pinfo))
186 #endif /* __FD_PLUGINS_H */