]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/dird_conf.h
- Corrected some typos in the make_xxx_tables.in files.
[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-2005 Kern Sibbald
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_DEVICE,
47    R_FIRST = R_DIRECTOR,
48    R_LAST  = R_DEVICE                 /* keep this updated */
49 };
50
51
52 /*
53  * Some resource attributes
54  */
55 enum {
56    R_NAME = 1020,
57    R_ADDRESS,
58    R_PASSWORD,
59    R_TYPE,
60    R_BACKUP
61 };
62
63
64 /* Used for certain KeyWord tables */
65 struct s_kw {
66    const char *name;
67    int token;
68 };
69
70 /* Job Level keyword structure */
71 struct s_jl {
72    const char *level_name;                  /* level keyword */
73    int  level;                        /* level */
74    int  job_type;                     /* JobType permitting this level */
75 };
76
77 /* Job Type keyword structure */
78 struct s_jt {
79    const char *type_name;
80    int job_type;
81 };
82
83 /* Definition of the contents of each Resource */
84 /* Needed for forward references */
85 struct SCHED;
86 struct CLIENT;
87 struct FILESET;
88 struct POOL;
89 struct RUN;
90 struct DEVICE;
91
92 /*
93  *   Director Resource
94  *
95  */
96 class DIRRES {
97 public:
98    RES   hdr;
99    dlist *DIRaddrs;
100    char *password;                    /* Password for UA access */
101    int enable_ssl;                    /* Use SSL for UA */
102    char *query_file;                  /* SQL query file */
103    char *working_directory;           /* WorkingDirectory */
104    const char *scripts_directory;     /* ScriptsDirectory */
105    char *pid_directory;               /* PidDirectory */
106    char *subsys_directory;            /* SubsysDirectory */
107    int require_ssl;                   /* Require SSL for all connections */
108    MSGS *messages;                    /* Daemon message handler */
109    uint32_t MaxConcurrentJobs;        /* Max concurrent jobs for whole director */
110    utime_t FDConnectTimeout;          /* timeout for connect in seconds */
111    utime_t SDConnectTimeout;          /* timeout in seconds */
112 };
113
114 /*
115  * Device Resource
116  *  This resource is a bit different from the other resources
117  *  because it is not defined in the Director 
118  *  by DEVICE { ... }, but rather by a "reference" such as
119  *  DEVICE = xxx; Then when the Director connects to the
120  *  SD, it requests the information about the device.
121  */
122 class DEVICE {
123 public:
124    RES hdr;
125
126    bool found;                        /* found with SD */
127    int num_writers;
128    int num_waiting;
129    int use_count;
130    bool open;
131    bool append;                       /* in append mode */
132    bool read;
133    bool labeled;
134    bool autochanger;
135    bool offline;
136    char VolumeName[MAX_NAME_LENGTH];
137    char MediaType[MAX_NAME_LENGTH];
138 };
139
140 /*
141  * Console ACL positions
142  */
143 enum {
144    Job_ACL = 0,
145    Client_ACL,
146    Storage_ACL,
147    Schedule_ACL,
148    Run_ACL,
149    Pool_ACL,
150    Command_ACL,
151    FileSet_ACL,
152    Catalog_ACL,
153    Num_ACL                            /* keep last */
154 };
155
156 /*
157  *    Console Resource
158  */
159 class CONRES {
160 public:
161    RES   hdr;
162    char *password;                    /* UA server password */
163    int enable_ssl;                    /* Use SSL */
164    alist *ACL_lists[Num_ACL];         /* pointers to ACLs */
165 };
166
167
168 /*
169  *   Catalog Resource
170  *
171  */
172 class CAT {
173 public:
174    RES   hdr;
175
176    int   db_port;                     /* Port -- not yet implemented */
177    char *db_address;                  /* host name for remote access */
178    char *db_socket;                   /* Socket for local access */
179    char *db_password;
180    char *db_user;
181    char *db_name;
182    int   mult_db_connections;         /* set if multiple connections wanted */
183 };
184
185
186 /*
187  *   Client Resource
188  *
189  */
190 class CLIENT {
191 public:
192    RES   hdr;
193
194    int   FDport;                      /* Where File daemon listens */
195    int   AutoPrune;                   /* Do automatic pruning? */
196    utime_t FileRetention;             /* file retention period in seconds */
197    utime_t JobRetention;              /* job retention period in seconds */
198    char *address;
199    char *password;
200    CAT *catalog;                      /* Catalog resource */
201    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
202    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
203    int enable_ssl;                    /* Use SSL */
204 };
205
206 /*
207  *   Store Resource
208  *
209  */
210 class STORE {
211 public:
212    RES   hdr;
213
214    int   SDport;                      /* port where Directors connect */
215    int   SDDport;                     /* data port for File daemon */
216    char *address;
217    char *password;
218    char *media_type;
219    alist *device;                     /* Device name(s) */
220    int  autochanger;                  /* set if autochanger */
221    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
222    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
223    int enable_ssl;                    /* Use SSL */
224
225    int64_t StorageId;                 /* Set from Storage DB record */
226
227    char *dev_name() const;
228    char *name() const;
229 };
230
231 inline char *STORE::dev_name() const
232
233    DEVICE *dev = (DEVICE *)device->first();
234    return dev->hdr.name;
235 }
236
237 inline char *STORE::name() const { return hdr.name; }
238
239
240 /*
241  *   Job Resource
242  */
243 class JOB {
244 public:
245    RES   hdr;
246
247    int   JobType;                     /* job type (backup, verify, restore */
248    int   JobLevel;                    /* default backup/verify level */
249    int   Priority;                    /* Job priority */
250    int   RestoreJobId;                /* What -- JobId to restore */
251    char *RestoreWhere;                /* Where on disk to restore -- directory */
252    char *RestoreBootstrap;            /* Bootstrap file */
253    char *RunBeforeJob;                /* Run program before Job */
254    char *RunAfterJob;                 /* Run program after Job */
255    char *RunAfterFailedJob;           /* Run program after Job that errs */
256    char *ClientRunBeforeJob;          /* Run client program before Job */
257    char *ClientRunAfterJob;           /* Run client program after Job */
258    char *WriteBootstrap;              /* Where to write bootstrap Job updates */
259    int   replace;                     /* How (overwrite, ..) */
260    utime_t MaxRunTime;                /* max run time in seconds */
261    utime_t MaxWaitTime;               /* max blocking time in seconds */
262    utime_t FullMaxWaitTime;           /* Max Full job wait time */
263    utime_t DiffMaxWaitTime;           /* Max Differential job wait time */
264    utime_t IncMaxWaitTime;            /* Max Incremental job wait time */
265    utime_t MaxStartDelay;             /* max start delay in seconds */
266    int PrefixLinks;                   /* prefix soft links with Where path */
267    int PruneJobs;                     /* Force pruning of Jobs */
268    int PruneFiles;                    /* Force pruning of Files */
269    int PruneVolumes;                  /* Force pruning of Volumes */
270    int SpoolAttributes;               /* Set to spool attributes in SD */
271    int spool_data;                    /* Set to spool data in SD */
272    int rerun_failed_levels;           /* Upgrade to rerun failed levels */
273    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
274    int RescheduleOnError;             /* Set to reschedule on error */
275    int RescheduleTimes;               /* Number of times to reschedule job */
276    utime_t RescheduleInterval;        /* Reschedule interval */
277    utime_t JobRetention;              /* job retention period in seconds */
278    bool write_part_after_job;         /* Set to write part after job in SD */
279    
280    MSGS      *messages;               /* How and where to send messages */
281    SCHED     *schedule;               /* When -- Automatic schedule */
282    CLIENT    *client;                 /* Who to backup */
283    FILESET   *fileset;                /* What to backup -- Fileset */
284    alist     *storage;                /* Where is device -- Storage daemon */
285    POOL      *pool;                   /* Where is media -- Media Pool */
286    POOL      *full_pool;              /* Pool for Full backups */
287    POOL      *inc_pool;               /* Pool for Incremental backups */
288    POOL      *dif_pool;               /* Pool for Differental backups */
289    JOB       *verify_job;             /* Job name to verify */
290    JOB       *jobdefs;                /* Job defaults */
291    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
292 };
293
294 #undef  MAX_FOPTS
295 #define MAX_FOPTS 34
296
297 /* File options structure */
298 struct FOPTS {
299    char opts[MAX_FOPTS];              /* options string */
300    alist regex;                       /* regex string(s) */
301    alist regexdir;                    /* regex string(s) for directories */
302    alist regexfile;                   /* regex string(s) for files */
303    alist wild;                        /* wild card strings */
304    alist wilddir;                     /* wild card strings for directories */
305    alist wildfile;                    /* wild card strings for files */
306    alist base;                        /* list of base names */
307    alist fstype;                      /* file system type limitation */
308    char *reader;                      /* reader program */
309    char *writer;                      /* writer program */
310 };
311
312
313 /* This is either an include item or an exclude item */
314 struct INCEXE {
315    FOPTS *current_opts;               /* points to current options structure */
316    FOPTS **opts_list;                 /* options list */
317    int num_opts;                      /* number of options items */
318    alist name_list;                   /* filename list -- holds char * */
319 };
320
321 /*
322  *   FileSet Resource
323  *
324  */
325 class FILESET {
326 public:
327    RES   hdr;
328
329    bool new_include;                  /* Set if new include used */
330    INCEXE **include_items;            /* array of incexe structures */
331    int num_includes;                  /* number in array */
332    INCEXE **exclude_items;
333    int num_excludes;
334    bool have_MD5;                     /* set if MD5 initialized */
335    struct MD5Context md5c;            /* MD5 of include/exclude */
336    char MD5[30];                      /* base 64 representation of MD5 */
337    int ignore_fs_changes;             /* Don't force Full if FS changed */
338 };
339
340
341 /*
342  *   Schedule Resource
343  *
344  */
345 class SCHED {
346 public:
347    RES   hdr;
348
349    RUN *run;
350 };
351
352 /*
353  *   Counter Resource
354  */
355 class COUNTER {
356 public:
357    RES   hdr;
358
359    int32_t  MinValue;                 /* Minimum value */
360    int32_t  MaxValue;                 /* Maximum value */
361    int32_t  CurrentValue;             /* Current value */
362    COUNTER *WrapCounter;              /* Wrap counter name */
363    CAT     *Catalog;                  /* Where to store */
364    bool     created;                  /* Created in DB */
365 };
366
367 /*
368  *   Pool Resource
369  *
370  */
371 class POOL {
372 public:
373    RES   hdr;
374
375    char *pool_type;                   /* Pool type */
376    char *label_format;                /* Label format string */
377    char *cleaning_prefix;             /* Cleaning label prefix */
378    int   LabelType;                   /* Bacula/ANSI/IBM label type */
379    int   use_catalog;                 /* maintain catalog for media */
380    int   catalog_files;               /* maintain file entries in catalog */
381    int   use_volume_once;             /* write on volume only once */
382    int   accept_any_volume;           /* accept any volume */
383    int   purge_oldest_volume;         /* purge oldest volume */
384    int   recycle_oldest_volume;       /* attempt to recycle oldest volume */
385    int   recycle_current_volume;      /* attempt recycle of current volume */
386    uint32_t max_volumes;              /* max number of volumes */
387    utime_t VolRetention;              /* volume retention period in seconds */
388    utime_t VolUseDuration;            /* duration volume can be used */
389    uint32_t MaxVolJobs;               /* Maximum jobs on the Volume */
390    uint32_t MaxVolFiles;              /* Maximum files on the Volume */
391    uint64_t MaxVolBytes;              /* Maximum bytes on the Volume */
392    int   AutoPrune;                   /* default for pool auto prune */
393    int   Recycle;                     /* default for media recycle yes/no */
394 };
395
396
397
398
399 /* Define the Union of all the above
400  * resource structure definitions.
401  */
402 union URES {
403    DIRRES     res_dir;
404    CONRES     res_con;
405    CLIENT     res_client;
406    STORE      res_store;
407    CAT        res_cat;
408    JOB        res_job;
409    FILESET    res_fs;
410    SCHED      res_sch;
411    POOL       res_pool;
412    MSGS       res_msgs;
413    COUNTER    res_counter;
414    DEVICE     res_dev;
415    RES        hdr;
416 };
417
418
419
420 /* Run structure contained in Schedule Resource */
421 class RUN {
422 public:
423    RUN *next;                         /* points to next run record */
424    int level;                         /* level override */
425    int Priority;                      /* priority override */
426    int job_type;
427    bool spool_data;                   /* Data spooling override */
428    bool spool_data_set;               /* Data spooling override given */
429    bool write_part_after_job;         /* Write part after job override */
430    bool write_part_after_job_set;     /* Write part after job override given */
431    
432    POOL *pool;                        /* Pool override */
433    POOL *full_pool;                   /* Pool override */
434    POOL *inc_pool;                    /* Pool override */
435    POOL *dif_pool;                    /* Pool override */
436    STORE *storage;                    /* Storage override */
437    MSGS *msgs;                        /* Messages override */
438    char *since;
439    int level_no;
440    int minute;                        /* minute to run job */
441    time_t last_run;                   /* last time run */
442    time_t next_run;                   /* next time to run */
443    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
444    char mday[nbytes_for_bits(31)];    /* bit set for each day of month */
445    char month[nbytes_for_bits(12)];   /* bit set for each month */
446    char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
447    char wom[nbytes_for_bits(5)];      /* week of month */
448    char woy[nbytes_for_bits(54)];     /* week of year */
449 };