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