]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/dird_conf.h
d008a969f7a045993a7e3acecefedf17855e0028
[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    const char *scripts_directory;     /* ScriptsDirectory */
102    char *pid_directory;               /* PidDirectory */
103    char *subsys_directory;            /* SubsysDirectory */
104    int require_ssl;                   /* Require SSL for all connections */
105    MSGS *messages;                    /* Daemon message handler */
106    uint32_t MaxConcurrentJobs;        /* Max concurrent jobs for whole director */
107    utime_t FDConnectTimeout;          /* timeout for connect in seconds */
108    utime_t SDConnectTimeout;          /* timeout in seconds */
109 };
110
111
112 /*
113  * Console ACL positions
114  */
115 enum {
116    Job_ACL = 0,
117    Client_ACL,
118    Storage_ACL,
119    Schedule_ACL,
120    Run_ACL,
121    Pool_ACL,
122    Command_ACL,
123    FileSet_ACL,
124    Catalog_ACL,
125    Num_ACL                            /* keep last */
126 };
127
128 /* 
129  *    Console Resource
130  */
131 struct CONRES {
132    RES   hdr;
133    char *password;                    /* UA server password */
134    int enable_ssl;                    /* Use SSL */
135    alist *ACL_lists[Num_ACL];         /* pointers to ACLs */
136 };
137
138
139 /*
140  *   Catalog Resource
141  *
142  */
143 struct CAT {
144    RES   hdr;
145
146    int   db_port;                     /* Port -- not yet implemented */
147    char *db_address;                  /* host name for remote access */
148    char *db_socket;                   /* Socket for local access */
149    char *db_password;
150    char *db_user;
151    char *db_name;
152    int   mult_db_connections;         /* set if multiple connections wanted */
153 };
154
155
156 /*
157  *   Client Resource
158  *
159  */
160 struct CLIENT {
161    RES   hdr;
162
163    int   FDport;                      /* Where File daemon listens */
164    int   AutoPrune;                   /* Do automatic pruning? */
165    utime_t FileRetention;             /* file retention period in seconds */
166    utime_t JobRetention;              /* job retention period in seconds */
167    char *address;
168    char *password;
169    CAT *catalog;                      /* Catalog resource */
170    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
171    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
172    int enable_ssl;                    /* Use SSL */
173 };
174
175 /*
176  *   Store Resource
177  * 
178  */
179 struct STORE {
180    RES   hdr;
181
182    int   SDport;                      /* port where Directors connect */
183    int   SDDport;                     /* data port for File daemon */
184    char *address;
185    char *password;
186    char *media_type;
187    char *dev_name;   
188    int  autochanger;                  /* set if autochanger */
189    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
190    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
191    int enable_ssl;                    /* Use SSL */
192 };
193
194
195 #define MAX_STORE 2                   /* Max storage directives in Job */
196
197 /*
198  *   Job Resource
199  */
200 struct JOB {
201    RES   hdr;
202
203    int   JobType;                     /* job type (backup, verify, restore */
204    int   JobLevel;                    /* default backup/verify level */
205    int   Priority;                    /* Job priority */
206    int   RestoreJobId;                /* What -- JobId to restore */
207    char *RestoreWhere;                /* Where on disk to restore -- directory */
208    char *RestoreBootstrap;            /* Bootstrap file */
209    char *RunBeforeJob;                /* Run program before Job */
210    char *RunAfterJob;                 /* Run program after Job */
211    char *RunAfterFailedJob;           /* Run program after Job that errs */
212    char *ClientRunBeforeJob;          /* Run client program before Job */
213    char *ClientRunAfterJob;           /* Run client program after Job */
214    char *WriteBootstrap;              /* Where to write bootstrap Job updates */
215    int   replace;                     /* How (overwrite, ..) */
216    utime_t MaxRunTime;                /* max run time in seconds */
217    utime_t MaxWaitTime;               /* max blocking time in seconds */
218    utime_t MaxStartDelay;             /* max start delay in seconds */
219    int PrefixLinks;                   /* prefix soft links with Where path */
220    int PruneJobs;                     /* Force pruning of Jobs */
221    int PruneFiles;                    /* Force pruning of Files */
222    int PruneVolumes;                  /* Force pruning of Volumes */
223    int SpoolAttributes;               /* Set to spool attributes in SD */
224    int spool_data;                    /* Set to spool data in SD */
225    int rerun_failed_levels;           /* Upgrade to rerun failed levels */
226    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
227    int RescheduleOnError;             /* Set to reschedule on error */
228    int RescheduleTimes;               /* Number of times to reschedule job */
229    utime_t RescheduleInterval;        /* Reschedule interval */
230    utime_t JobRetention;              /* job retention period in seconds */
231   
232    MSGS      *messages;               /* How and where to send messages */
233    SCHED     *schedule;               /* When -- Automatic schedule */
234    CLIENT    *client;                 /* Who to backup */
235    FILESET   *fileset;                /* What to backup -- Fileset */
236    alist     *storage[MAX_STORE];     /* Where is device -- Storage daemon */
237    POOL      *pool;                   /* Where is media -- Media Pool */
238    POOL      *full_pool;              /* Pool for Full backups */
239    POOL      *inc_pool;               /* Pool for Incremental backups */
240    POOL      *dif_pool;               /* Pool for Differental backups */
241    JOB       *verify_job;             /* Job name to verify */
242    JOB       *jobdefs;                /* Job defaults */
243    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
244 };
245
246 #undef  MAX_FOPTS
247 #define MAX_FOPTS 34
248
249 /* File options structure */
250 struct FOPTS {
251    char opts[MAX_FOPTS];              /* options string */
252    alist regex;                       /* regex string(s) */
253    alist wild;                        /* wild card strings */
254    alist base;                        /* list of base names */
255    alist fstype;                      /* file system type limitation */
256    char *reader;                      /* reader program */
257    char *writer;                      /* writer program */
258 };
259
260
261 /* This is either an include item or an exclude item */
262 struct INCEXE {
263    FOPTS *current_opts;               /* points to current options structure */
264    FOPTS **opts_list;                 /* options list */
265    int num_opts;                      /* number of options items */
266    alist name_list;                   /* filename list -- holds char * */
267 };
268
269 /* 
270  *   FileSet Resource
271  *
272  */
273 struct FILESET {
274    RES   hdr;
275
276    bool new_include;                  /* Set if new include used */
277    INCEXE **include_items;            /* array of incexe structures */
278    int num_includes;                  /* number in array */
279    INCEXE **exclude_items;
280    int num_excludes;
281    bool have_MD5;                     /* set if MD5 initialized */
282    struct MD5Context md5c;            /* MD5 of include/exclude */
283    char MD5[30];                      /* base 64 representation of MD5 */
284    int ignore_fs_changes;             /* Don't force Full if FS changed */
285 };
286
287  
288 /* 
289  *   Schedule Resource
290  *
291  */
292 struct SCHED {
293    RES   hdr;
294
295    RUN *run;
296 };
297
298 /*
299  *   Counter Resource
300  */
301 struct COUNTER {
302    RES   hdr;
303
304    int32_t  MinValue;                 /* Minimum value */
305    int32_t  MaxValue;                 /* Maximum value */
306    int32_t  CurrentValue;             /* Current value */
307    COUNTER *WrapCounter;              /* Wrap counter name */
308    CAT     *Catalog;                  /* Where to store */
309    bool     created;                  /* Created in DB */
310 };
311
312 /*
313  *   Pool Resource   
314  *
315  */
316 struct POOL {
317    RES   hdr;
318
319    char *pool_type;                   /* Pool type */
320    char *label_format;                /* Label format string */
321    char *cleaning_prefix;             /* Cleaning label prefix */
322    int   use_catalog;                 /* maintain catalog for media */
323    int   catalog_files;               /* maintain file entries in catalog */
324    int   use_volume_once;             /* write on volume only once */
325    int   accept_any_volume;           /* accept any volume */
326    int   purge_oldest_volume;         /* purge oldest volume */
327    int   recycle_oldest_volume;       /* attempt to recycle oldest volume */
328    int   recycle_current_volume;      /* attempt recycle of current volume */
329    uint32_t max_volumes;              /* max number of volumes */
330    utime_t VolRetention;              /* volume retention period in seconds */
331    utime_t VolUseDuration;            /* duration volume can be used */
332    uint32_t MaxVolJobs;               /* Maximum jobs on the Volume */
333    uint32_t MaxVolFiles;              /* Maximum files on the Volume */
334    uint64_t MaxVolBytes;              /* Maximum bytes on the Volume */
335    int   AutoPrune;                   /* default for pool auto prune */
336    int   Recycle;                     /* default for media recycle yes/no */
337 };
338
339
340 /* Define the Union of all the above
341  * resource structure definitions.
342  */
343 union URES {
344    DIRRES     res_dir;
345    CONRES     res_con;
346    CLIENT     res_client;
347    STORE      res_store;
348    CAT        res_cat;
349    JOB        res_job;
350    FILESET    res_fs;
351    SCHED      res_sch;
352    POOL       res_pool;
353    MSGS       res_msgs;
354    COUNTER    res_counter;
355    RES        hdr;
356 };
357
358
359
360 /* Run structure contained in Schedule Resource */
361 struct RUN {
362    RUN *next;                         /* points to next run record */
363    int level;                         /* level override */
364    int Priority;                      /* priority override */
365    int job_type;  
366    bool spool_data;                   /* Data spooling override */
367    bool spool_data_set;               /* Data spooling override given */
368    POOL *pool;                        /* Pool override */
369    POOL *full_pool;                   /* Pool override */
370    POOL *inc_pool;                    /* Pool override */
371    POOL *dif_pool;                    /* Pool override */
372    STORE *storage;                    /* Storage override */
373    MSGS *msgs;                        /* Messages override */
374    char *since;
375    int level_no;
376    int minute;                        /* minute to run job */
377    time_t last_run;                   /* last time run */
378    time_t next_run;                   /* next time to run */
379    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
380    char mday[nbytes_for_bits(31)];    /* bit set for each day of month */
381    char month[nbytes_for_bits(12)];   /* bit set for each month */
382    char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
383    char wom[nbytes_for_bits(5)];      /* week of month */
384    char woy[nbytes_for_bits(54)];     /* week of year */
385 };