2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2017 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many 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 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
20 * Interface definition for Bacula Plugins
22 * Kern Sibbald, October 2007
25 #ifndef __DIR_PLUGINS_H
26 #define __DIR_PLUGINS_H
30 /* Workaround for SGI IRIX 6.5 */
31 #define _LANGUAGE_C_PLUS_PLUS 1
34 #define _THREAD_SAFE 1
35 #define _POSIX_PTHREAD_SEMANTICS 1
36 #define _FILE_OFFSET_BITS 64
37 #define _LARGEFILE_SOURCE 1
38 #define _LARGE_FILES 1
41 #include <sys/types.h>
47 #include "lib/plugins.h"
56 /****************************************************************************
58 * Bacula definitions *
60 ****************************************************************************/
62 /* Bacula Variable Ids */ /* return value */
64 bDirVarJob = 1, // string
65 bDirVarLevel = 2, // int
66 bDirVarType = 3, // int
67 bDirVarJobId = 4, // int
68 bDirVarClient = 5, // string
69 bDirVarNumVols = 6, // int
70 bDirVarPool = 7, // string
71 bDirVarStorage = 8, // string
72 bDirVarWriteStorage = 9, // string
73 bDirVarReadStorage = 10, // string
74 bDirVarCatalog = 11, // string
75 bDirVarMediaType = 12, // string
76 bDirVarJobName = 13, // string
77 bDirVarJobStatus = 14, // int
78 bDirVarPriority = 15, // int
79 bDirVarVolumeName = 16, // string
80 bDirVarCatalogRes = 17, // NYI
81 bDirVarJobErrors = 18, // int
82 bDirVarJobFiles = 19, // int
83 bDirVarSDJobFiles = 20, // int
84 bDirVarSDErrors = 21, // int
85 bDirVarFDJobStatus = 22, // int
86 bDirVarSDJobStatus = 23 // int
90 bwDirVarJobReport = 1,
91 bwDirVarVolumeName = 2,
98 bDirEventJobStart = 1,
100 bDirEventJobInit = 3,
102 bDirEventVolumePurged = 5,
103 bDirEventNewVolume = 6,
104 bDirEventNeedVolume = 7,
105 bDirEventVolumeFull = 8,
107 bDirEventGetScratch = 10
110 typedef struct s_bDirEvent {
114 typedef struct s_dirbaculaInfo {
119 /* Bacula interface version and function pointers */
120 typedef struct s_dirbaculaFuncs {
123 bRC (*registerBaculaEvents)(bpContext *ctx, ...);
124 bRC (*getBaculaValue)(bpContext *ctx, brDirVariable var, void *value);
125 bRC (*setBaculaValue)(bpContext *ctx, bwDirVariable var, void *value);
126 bRC (*JobMessage)(bpContext *ctx, const char *file, int line,
127 int type, utime_t mtime, const char *fmt, ...);
128 bRC (*DebugMessage)(bpContext *ctx, const char *file, int line,
129 int level, const char *fmt, ...);
132 /* Bacula Core Routines -- not used within a plugin */
133 #ifdef DIRECTOR_DAEMON
134 void load_dir_plugins(const char *plugin_dir);
135 void new_plugins(JCR *jcr);
136 void free_plugins(JCR *jcr);
137 int generate_plugin_event(JCR *jcr, bDirEventType event, void *value=NULL);
141 /****************************************************************************
143 * Plugin definitions *
145 ****************************************************************************/
149 pDirVarDescription = 2
153 #define DIR_PLUGIN_MAGIC "*DirPluginData*"
154 #define DIR_PLUGIN_INTERFACE_VERSION 1
156 typedef struct s_dirpluginInfo {
159 const char *plugin_magic;
160 const char *plugin_license;
161 const char *plugin_author;
162 const char *plugin_date;
163 const char *plugin_version;
164 const char *plugin_description;
167 typedef struct s_dirpluginFuncs {
170 bRC (*newPlugin)(bpContext *ctx);
171 bRC (*freePlugin)(bpContext *ctx);
172 bRC (*getPluginValue)(bpContext *ctx, pDirVariable var, void *value);
173 bRC (*setPluginValue)(bpContext *ctx, pDirVariable var, void *value);
174 bRC (*handlePluginEvent)(bpContext *ctx, bDirEvent *event, void *value);
177 #define dirplug_func(plugin) ((pDirFuncs *)(plugin->pfuncs))
178 #define dirplug_info(plugin) ((pDirInfo *)(plugin->pinfo))
184 #endif /* __FD_PLUGINS_H */