]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/dird_conf.h
- Added Rerun Failed Levels = yes/no
[bacula/bacula] / bacula / src / dird / dird_conf.h
1 /*
2  * Director specific configuration and defines
3  *
4  *     Kern Sibbald, Feb MM
5  *
6  *    Version $Id$
7  */
8 /*
9    Copyright (C) 2000-2004 Kern Sibbald and John Walker
10
11    This program is free software; you can redistribute it and/or
12    modify it under the terms of the GNU General Public License as
13    published by the Free Software Foundation; either version 2 of
14    the License, or (at your option) any later version.
15
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19    General Public License for more details.
20
21    You should have received a copy of the GNU General Public
22    License along with this program; if not, write to the Free
23    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
24    MA 02111-1307, USA.
25
26  */
27
28 /* NOTE:  #includes at the end of this file */
29
30 /*
31  * Resource codes -- they must be sequential for indexing   
32  */
33 enum {
34    R_DIRECTOR = 1001,
35    R_CLIENT,
36    R_JOB,
37    R_STORAGE,
38    R_CATALOG,
39    R_SCHEDULE,
40    R_FILESET,
41    R_POOL,
42    R_MSGS,
43    R_COUNTER,
44    R_CONSOLE,
45    R_JOBDEFS,
46    R_FIRST = R_DIRECTOR,
47    R_LAST  = R_JOBDEFS                /* keep this updated */
48 };
49
50
51 /*
52  * Some resource attributes
53  */
54 enum {
55    R_NAME = 1020,
56    R_ADDRESS,
57    R_PASSWORD,
58    R_TYPE,
59    R_BACKUP
60 };
61
62
63 /* Used for certain KeyWord tables */
64 struct s_kw {       
65    const char *name;
66    int token;   
67 };
68
69 /* Job Level keyword structure */
70 struct s_jl {
71    const char *level_name;                  /* level keyword */
72    int  level;                        /* level */
73    int  job_type;                     /* JobType permitting this level */
74 };
75
76 /* Job Type keyword structure */
77 struct s_jt {
78    const char *type_name;
79    int job_type;
80 };
81
82 /* Definition of the contents of each Resource */
83 /* Needed for forward references */
84 struct SCHED;
85 struct CLIENT;
86 struct FILESET;
87 struct POOL;
88 struct RUN;
89
90 /* 
91  *   Director Resource  
92  *
93  */
94 struct DIRRES {
95    RES   hdr;
96    dlist *DIRaddrs;
97    char *password;                    /* Password for UA access */
98    int enable_ssl;                    /* Use SSL for UA */
99    char *query_file;                  /* SQL query file */
100    char *working_directory;           /* WorkingDirectory */
101    char *pid_directory;               /* PidDirectory */
102    char *subsys_directory;            /* SubsysDirectory */
103    int require_ssl;                   /* Require SSL for all connections */
104    MSGS *messages;                    /* Daemon message handler */
105    uint32_t MaxConcurrentJobs;        /* Max concurrent jobs for whole director */
106    utime_t FDConnectTimeout;          /* timeout for connect in seconds */
107    utime_t SDConnectTimeout;          /* timeout in seconds */
108 };
109
110
111 /*
112  * Console ACL positions
113  */
114 enum {
115    Job_ACL = 0,
116    Client_ACL,
117    Storage_ACL,
118    Schedule_ACL,
119    Run_ACL,
120    Pool_ACL,
121    Command_ACL,
122    FileSet_ACL,
123    Catalog_ACL,
124    Num_ACL                            /* keep last */
125 };
126
127 /* 
128  *    Console Resource
129  */
130 struct CONRES {
131    RES   hdr;
132    char *password;                    /* UA server password */
133    int enable_ssl;                    /* Use SSL */
134    alist *ACL_lists[Num_ACL];         /* pointers to ACLs */
135 };
136
137
138 /*
139  *   Catalog Resource
140  *
141  */
142 struct CAT {
143    RES   hdr;
144
145    int   db_port;                     /* Port -- not yet implemented */
146    char *db_address;                  /* host name for remote access */
147    char *db_socket;                   /* Socket for local access */
148    char *db_password;
149    char *db_user;
150    char *db_name;
151    int   mult_db_connections;         /* set if multiple connections wanted */
152 };
153
154
155 /*
156  *   Client Resource
157  *
158  */
159 struct CLIENT {
160    RES   hdr;
161
162    int   FDport;                      /* Where File daemon listens */
163    int   AutoPrune;                   /* Do automatic pruning? */
164    utime_t FileRetention;             /* file retention period in seconds */
165    utime_t JobRetention;              /* job retention period in seconds */
166    char *address;
167    char *password;
168    CAT *catalog;                      /* Catalog resource */
169    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
170    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
171    int enable_ssl;                    /* Use SSL */
172 };
173
174 /*
175  *   Store Resource
176  * 
177  */
178 struct STORE {
179    RES   hdr;
180
181    int   SDport;                      /* port where Directors connect */
182    int   SDDport;                     /* data port for File daemon */
183    char *address;
184    char *password;
185    char *media_type;
186    char *dev_name;   
187    int  autochanger;                  /* set if autochanger */
188    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
189    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
190    int enable_ssl;                    /* Use SSL */
191 };
192
193
194 #define MAX_STORE 2                   /* Max storage directives in Job */
195
196 /*
197  *   Job Resource
198  */
199 struct JOB {
200    RES   hdr;
201
202    int   JobType;                     /* job type (backup, verify, restore */
203    int   JobLevel;                    /* default backup/verify level */
204    int   Priority;                    /* Job priority */
205    int   RestoreJobId;                /* What -- JobId to restore */
206    char *RestoreWhere;                /* Where on disk to restore -- directory */
207    char *RestoreBootstrap;            /* Bootstrap file */
208    char *RunBeforeJob;                /* Run program before Job */
209    char *RunAfterJob;                 /* Run program after Job */
210    char *RunAfterFailedJob;           /* Run program after Job that errs */
211    char *ClientRunBeforeJob;          /* Run client program before Job */
212    char *ClientRunAfterJob;           /* Run client program after Job */
213    char *WriteBootstrap;              /* Where to write bootstrap Job updates */
214    int   replace;                     /* How (overwrite, ..) */
215    utime_t MaxRunTime;                /* max run time in seconds */
216    utime_t MaxWaitTime;               /* max blocking time in seconds */
217    utime_t MaxStartDelay;             /* max start delay in seconds */
218    int PrefixLinks;                   /* prefix soft links with Where path */
219    int PruneJobs;                     /* Force pruning of Jobs */
220    int PruneFiles;                    /* Force pruning of Files */
221    int PruneVolumes;                  /* Force pruning of Volumes */
222    int SpoolAttributes;               /* Set to spool attributes in SD */
223    int spool_data;                    /* Set to spool data in SD */
224    int rerun_failed_levels;           /* Upgrade to rerun failed levels */
225    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
226    int RescheduleOnError;             /* Set to reschedule on error */
227    int RescheduleTimes;               /* Number of times to reschedule job */
228    utime_t RescheduleInterval;        /* Reschedule interval */
229    utime_t JobRetention;              /* job retention period in seconds */
230   
231    MSGS      *messages;               /* How and where to send messages */
232    SCHED     *schedule;               /* When -- Automatic schedule */
233    CLIENT    *client;                 /* Who to backup */
234    FILESET   *fileset;                /* What to backup -- Fileset */
235    alist     *storage[MAX_STORE];     /* Where is device -- Storage daemon */
236    POOL      *pool;                   /* Where is media -- Media Pool */
237    POOL      *full_pool;              /* Pool for Full backups */
238    POOL      *inc_pool;               /* Pool for Incremental backups */
239    POOL      *dif_pool;               /* Pool for Differental backups */
240    JOB       *verify_job;             /* Job name to verify */
241    JOB       *jobdefs;                /* Job defaults */
242    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
243 };
244
245 #undef  MAX_FOPTS
246 #define MAX_FOPTS 30
247
248 /* File options structure */
249 struct FOPTS {
250    char opts[MAX_FOPTS];              /* options string */
251    alist regex;                       /* regex string(s) */
252    alist wild;                        /* wild card strings */
253    alist base;                        /* list of base names */
254    char *reader;                      /* reader program */
255    char *writer;                      /* writer program */
256 };
257
258
259 /* This is either an include item or an exclude item */
260 struct INCEXE {
261    FOPTS *current_opts;               /* points to current options structure */
262    FOPTS **opts_list;                 /* options list */
263    int num_opts;                      /* number of options items */
264    alist name_list;                   /* filename list -- holds char * */
265 };
266
267 /* 
268  *   FileSet Resource
269  *
270  */
271 struct FILESET {
272    RES   hdr;
273
274    bool new_include;                  /* Set if new include used */
275    INCEXE **include_items;            /* array of incexe structures */
276    int num_includes;                  /* number in array */
277    INCEXE **exclude_items;
278    int num_excludes;
279    bool have_MD5;                     /* set if MD5 initialized */
280    struct MD5Context md5c;            /* MD5 of include/exclude */
281    char MD5[30];                      /* base 64 representation of MD5 */
282    int ignore_fs_changes;             /* Don't force Full if FS changed */
283 };
284
285  
286 /* 
287  *   Schedule Resource
288  *
289  */
290 struct SCHED {
291    RES   hdr;
292
293    RUN *run;
294 };
295
296 /*
297  *   Counter Resource
298  */
299 struct COUNTER {
300    RES   hdr;
301
302    int32_t  MinValue;                 /* Minimum value */
303    int32_t  MaxValue;                 /* Maximum value */
304    int32_t  CurrentValue;             /* Current value */
305    COUNTER *WrapCounter;              /* Wrap counter name */
306    CAT     *Catalog;                  /* Where to store */
307    bool     created;                  /* Created in DB */
308 };
309
310 /*
311  *   Pool Resource   
312  *
313  */
314 struct POOL {
315    RES   hdr;
316
317    char *pool_type;                   /* Pool type */
318    char *label_format;                /* Label format string */
319    char *cleaning_prefix;             /* Cleaning label prefix */
320    int   use_catalog;                 /* maintain catalog for media */
321    int   catalog_files;               /* maintain file entries in catalog */
322    int   use_volume_once;             /* write on volume only once */
323    int   accept_any_volume;           /* accept any volume */
324    int   purge_oldest_volume;         /* purge oldest volume */
325    int   recycle_oldest_volume;       /* attempt to recycle oldest volume */
326    int   recycle_current_volume;      /* attempt recycle of current volume */
327    uint32_t max_volumes;              /* max number of volumes */
328    utime_t VolRetention;              /* volume retention period in seconds */
329    utime_t VolUseDuration;            /* duration volume can be used */
330    uint32_t MaxVolJobs;               /* Maximum jobs on the Volume */
331    uint32_t MaxVolFiles;              /* Maximum files on the Volume */
332    uint64_t MaxVolBytes;              /* Maximum bytes on the Volume */
333    int   AutoPrune;                   /* default for pool auto prune */
334    int   Recycle;                     /* default for media recycle yes/no */
335 };
336
337
338 /* Define the Union of all the above
339  * resource structure definitions.
340  */
341 union URES {
342    DIRRES     res_dir;
343    CONRES     res_con;
344    CLIENT     res_client;
345    STORE      res_store;
346    CAT        res_cat;
347    JOB        res_job;
348    FILESET    res_fs;
349    SCHED      res_sch;
350    POOL       res_pool;
351    MSGS       res_msgs;
352    COUNTER    res_counter;
353    RES        hdr;
354 };
355
356
357
358 /* Run structure contained in Schedule Resource */
359 struct RUN {
360    RUN *next;                         /* points to next run record */
361    int level;                         /* level override */
362    int Priority;                      /* priority override */
363    int job_type;  
364    bool spool_data;                   /* Data spooling override */
365    bool spool_data_set;               /* Data spooling override given */
366    POOL *pool;                        /* Pool override */
367    POOL *full_pool;                   /* Pool override */
368    POOL *inc_pool;                    /* Pool override */
369    POOL *dif_pool;                    /* Pool override */
370    STORE *storage;                    /* Storage override */
371    MSGS *msgs;                        /* Messages override */
372    char *since;
373    int level_no;
374    int minute;                        /* minute to run job */
375    time_t last_run;                   /* last time run */
376    time_t next_run;                   /* next time to run */
377    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
378    char mday[nbytes_for_bits(31)];    /* bit set for each day of month */
379    char month[nbytes_for_bits(12)];   /* bit set for each month */
380    char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
381    char wom[nbytes_for_bits(5)];      /* week of month */
382    char woy[nbytes_for_bits(54)];     /* week of year */
383 };