2 * Director specific configuration and defines
9 Copyright (C) 2000-2005 Kern Sibbald
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License
13 version 2 as amended with additional clauses defined in the
14 file LICENSE in the main source directory.
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
19 the file LICENSE for additional details.
23 /* NOTE: #includes at the end of this file */
26 * Resource codes -- they must be sequential for indexing
43 R_LAST = R_DEVICE /* keep this updated */
48 * Some resource attributes
59 /* Used for certain KeyWord tables */
65 /* Job Level keyword structure */
67 const char *level_name; /* level keyword */
68 int level; /* level */
69 int job_type; /* JobType permitting this level */
72 /* Job Type keyword structure */
74 const char *type_name;
78 /* Definition of the contents of each Resource */
79 /* Needed for forward references */
95 char *password; /* Password for UA access */
96 char *query_file; /* SQL query file */
97 char *working_directory; /* WorkingDirectory */
98 const char *scripts_directory; /* ScriptsDirectory */
99 char *pid_directory; /* PidDirectory */
100 char *subsys_directory; /* SubsysDirectory */
101 MSGS *messages; /* Daemon message handler */
102 uint32_t MaxConcurrentJobs; /* Max concurrent jobs for whole director */
103 utime_t FDConnectTimeout; /* timeout for connect in seconds */
104 utime_t SDConnectTimeout; /* timeout in seconds */
105 int tls_enable; /* Enable TLS */
106 int tls_require; /* Require TLS */
107 int tls_verify_peer; /* TLS Verify Client Certificate */
108 char *tls_ca_certfile; /* TLS CA Certificate File */
109 char *tls_ca_certdir; /* TLS CA Certificate Directory */
110 char *tls_certfile; /* TLS Server Certificate File */
111 char *tls_keyfile; /* TLS Server Key File */
112 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
113 alist *tls_allowed_cns; /* TLS Allowed Clients */
114 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
119 * This resource is a bit different from the other resources
120 * because it is not defined in the Director
121 * by DEVICE { ... }, but rather by a "reference" such as
122 * DEVICE = xxx; Then when the Director connects to the
123 * SD, it requests the information about the device.
129 bool found; /* found with SD */
130 int num_writers; /* number of writers */
131 int max_writers; /* = 1 for files */
132 int reserved; /* number of reserves */
133 int num_drives; /* for autochanger */
134 bool autochanger; /* set if device is autochanger */
135 bool open; /* drive open */
136 bool append; /* in append mode */
137 bool read; /* in read mode */
138 bool labeled; /* Volume name valid */
139 bool offline; /* not available */
140 bool autoselect; /* can be selected via autochanger */
142 char ChangerName[MAX_NAME_LENGTH];
143 char VolumeName[MAX_NAME_LENGTH];
144 char MediaType[MAX_NAME_LENGTH];
148 * Console ACL positions
160 Num_ACL /* keep last */
169 char *password; /* UA server password */
170 alist *ACL_lists[Num_ACL]; /* pointers to ACLs */
171 int tls_enable; /* Enable TLS */
172 int tls_require; /* Require TLS */
173 int tls_verify_peer; /* TLS Verify Client Certificate */
174 char *tls_ca_certfile; /* TLS CA Certificate File */
175 char *tls_ca_certdir; /* TLS CA Certificate Directory */
176 char *tls_certfile; /* TLS Server Certificate File */
177 char *tls_keyfile; /* TLS Server Key File */
178 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
179 alist *tls_allowed_cns; /* TLS Allowed Clients */
180 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
192 int db_port; /* Port -- not yet implemented */
193 char *db_address; /* host name for remote access */
194 char *db_socket; /* Socket for local access */
198 int mult_db_connections; /* set if multiple connections wanted */
210 int FDport; /* Where File daemon listens */
211 int AutoPrune; /* Do automatic pruning? */
212 utime_t FileRetention; /* file retention period in seconds */
213 utime_t JobRetention; /* job retention period in seconds */
216 CAT *catalog; /* Catalog resource */
217 uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
218 uint32_t NumConcurrentJobs; /* number of concurrent jobs running */
219 int tls_enable; /* Enable TLS */
220 int tls_require; /* Require TLS */
221 char *tls_ca_certfile; /* TLS CA Certificate File */
222 char *tls_ca_certdir; /* TLS CA Certificate Directory */
223 char *tls_certfile; /* TLS Client Certificate File */
224 char *tls_keyfile; /* TLS Client Key File */
225 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
236 int SDport; /* port where Directors connect */
237 int SDDport; /* data port for File daemon */
241 alist *device; /* Alternate devices for this Storage */
242 int autochanger; /* set if autochanger */
243 int drives; /* number of drives in autochanger */
244 uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
245 uint32_t NumConcurrentJobs; /* number of concurrent jobs running */
246 int tls_enable; /* Enable TLS */
247 int tls_require; /* Require TLS */
248 char *tls_ca_certfile; /* TLS CA Certificate File */
249 char *tls_ca_certdir; /* TLS CA Certificate Directory */
250 char *tls_certfile; /* TLS Client Certificate File */
251 char *tls_keyfile; /* TLS Client Key File */
252 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
253 int64_t StorageId; /* Set from Storage DB record */
256 char *dev_name() const;
260 inline char *STORE::dev_name() const
262 DEVICE *dev = (DEVICE *)device->first();
263 return dev->hdr.name;
266 inline char *STORE::name() const { return hdr.name; }
276 int JobType; /* job type (backup, verify, restore */
277 int JobLevel; /* default backup/verify level */
278 int Priority; /* Job priority */
279 int RestoreJobId; /* What -- JobId to restore */
280 char *RestoreWhere; /* Where on disk to restore -- directory */
281 char *RestoreBootstrap; /* Bootstrap file */
282 char *RunBeforeJob; /* Run program before Job */
283 char *RunAfterJob; /* Run program after Job */
284 char *RunAfterFailedJob; /* Run program after Job that errs */
285 char *ClientRunBeforeJob; /* Run client program before Job */
286 char *ClientRunAfterJob; /* Run client program after Job */
287 char *WriteBootstrap; /* Where to write bootstrap Job updates */
288 int replace; /* How (overwrite, ..) */
289 utime_t MaxRunTime; /* max run time in seconds */
290 utime_t MaxWaitTime; /* max blocking time in seconds */
291 utime_t FullMaxWaitTime; /* Max Full job wait time */
292 utime_t DiffMaxWaitTime; /* Max Differential job wait time */
293 utime_t IncMaxWaitTime; /* Max Incremental job wait time */
294 utime_t MaxStartDelay; /* max start delay in seconds */
295 int PrefixLinks; /* prefix soft links with Where path */
296 int PruneJobs; /* Force pruning of Jobs */
297 int PruneFiles; /* Force pruning of Files */
298 int PruneVolumes; /* Force pruning of Volumes */
299 int SpoolAttributes; /* Set to spool attributes in SD */
300 int spool_data; /* Set to spool data in SD */
301 int rerun_failed_levels; /* Upgrade to rerun failed levels */
302 int PreferMountedVolumes; /* Prefer vols mounted rather than new one */
303 uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
304 int RescheduleOnError; /* Set to reschedule on error */
305 int RescheduleTimes; /* Number of times to reschedule job */
306 utime_t RescheduleInterval; /* Reschedule interval */
307 utime_t JobRetention; /* job retention period in seconds */
308 bool write_part_after_job; /* Set to write part after job in SD */
310 MSGS *messages; /* How and where to send messages */
311 SCHED *schedule; /* When -- Automatic schedule */
312 CLIENT *client; /* Who to backup */
313 FILESET *fileset; /* What to backup -- Fileset */
314 alist *storage; /* Where is device -- list of Storage to be used */
315 POOL *pool; /* Where is media -- Media Pool */
316 POOL *full_pool; /* Pool for Full backups */
317 POOL *inc_pool; /* Pool for Incremental backups */
318 POOL *dif_pool; /* Pool for Differental backups */
319 JOB *verify_job; /* Job name to verify */
320 JOB *jobdefs; /* Job defaults */
321 alist *run_cmds; /* Run commands */
322 uint32_t NumConcurrentJobs; /* number of concurrent jobs running */
328 /* File options structure */
330 char opts[MAX_FOPTS]; /* options string */
331 alist regex; /* regex string(s) */
332 alist regexdir; /* regex string(s) for directories */
333 alist regexfile; /* regex string(s) for files */
334 alist wild; /* wild card strings */
335 alist wilddir; /* wild card strings for directories */
336 alist wildfile; /* wild card strings for files */
337 alist base; /* list of base names */
338 alist fstype; /* file system type limitation */
339 char *reader; /* reader program */
340 char *writer; /* writer program */
344 /* This is either an include item or an exclude item */
346 FOPTS *current_opts; /* points to current options structure */
347 FOPTS **opts_list; /* options list */
348 int num_opts; /* number of options items */
349 alist name_list; /* filename list -- holds char * */
360 bool new_include; /* Set if new include used */
361 INCEXE **include_items; /* array of incexe structures */
362 int num_includes; /* number in array */
363 INCEXE **exclude_items;
365 bool have_MD5; /* set if MD5 initialized */
366 struct MD5Context md5c; /* MD5 of include/exclude */
367 char MD5[30]; /* base 64 representation of MD5 */
368 int ignore_fs_changes; /* Don't force Full if FS changed */
369 int enable_vss; /* Enable Volume Shadow Copy */
391 int32_t MinValue; /* Minimum value */
392 int32_t MaxValue; /* Maximum value */
393 int32_t CurrentValue; /* Current value */
394 COUNTER *WrapCounter; /* Wrap counter name */
395 CAT *Catalog; /* Where to store */
396 bool created; /* Created in DB */
407 char *pool_type; /* Pool type */
408 char *label_format; /* Label format string */
409 char *cleaning_prefix; /* Cleaning label prefix */
410 int LabelType; /* Bacula/ANSI/IBM label type */
411 int use_catalog; /* maintain catalog for media */
412 int catalog_files; /* maintain file entries in catalog */
413 int use_volume_once; /* write on volume only once */
414 int accept_any_volume; /* accept any volume */
415 int purge_oldest_volume; /* purge oldest volume */
416 int recycle_oldest_volume; /* attempt to recycle oldest volume */
417 int recycle_current_volume; /* attempt recycle of current volume */
418 uint32_t max_volumes; /* max number of volumes */
419 utime_t VolRetention; /* volume retention period in seconds */
420 utime_t VolUseDuration; /* duration volume can be used */
421 uint32_t MaxVolJobs; /* Maximum jobs on the Volume */
422 uint32_t MaxVolFiles; /* Maximum files on the Volume */
423 uint64_t MaxVolBytes; /* Maximum bytes on the Volume */
424 int AutoPrune; /* default for pool auto prune */
425 int Recycle; /* default for media recycle yes/no */
431 /* Define the Union of all the above
432 * resource structure definitions.
452 /* Run structure contained in Schedule Resource */
455 RUN *next; /* points to next run record */
456 int level; /* level override */
457 int Priority; /* priority override */
459 bool spool_data; /* Data spooling override */
460 bool spool_data_set; /* Data spooling override given */
461 bool write_part_after_job; /* Write part after job override */
462 bool write_part_after_job_set; /* Write part after job override given */
464 POOL *pool; /* Pool override */
465 POOL *full_pool; /* Pool override */
466 POOL *inc_pool; /* Pool override */
467 POOL *dif_pool; /* Pool override */
468 STORE *storage; /* Storage override */
469 MSGS *msgs; /* Messages override */
472 int minute; /* minute to run job */
473 time_t last_run; /* last time run */
474 time_t next_run; /* next time to run */
475 char hour[nbytes_for_bits(24)]; /* bit set for each hour */
476 char mday[nbytes_for_bits(31)]; /* bit set for each day of month */
477 char month[nbytes_for_bits(12)]; /* bit set for each month */
478 char wday[nbytes_for_bits(7)]; /* bit set for each day of the week */
479 char wom[nbytes_for_bits(5)]; /* week of month */
480 char woy[nbytes_for_bits(54)]; /* week of year */