2 * Director specific configuration and defines
9 Copyright (C) 2000-2006 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 char *tls_ca_certfile; /* TLS CA Certificate File */
106 char *tls_ca_certdir; /* TLS CA Certificate Directory */
107 char *tls_certfile; /* TLS Server Certificate File */
108 char *tls_keyfile; /* TLS Server Key File */
109 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
110 alist *tls_allowed_cns; /* TLS Allowed Clients */
111 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
112 bool tls_enable; /* Enable TLS */
113 bool tls_require; /* Require TLS */
114 bool tls_verify_peer; /* TLS Verify Client Certificate */
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 char *tls_ca_certfile; /* TLS CA Certificate File */
172 char *tls_ca_certdir; /* TLS CA Certificate Directory */
173 char *tls_certfile; /* TLS Server Certificate File */
174 char *tls_keyfile; /* TLS Server Key File */
175 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
176 alist *tls_allowed_cns; /* TLS Allowed Clients */
177 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
178 bool tls_enable; /* Enable TLS */
179 bool tls_require; /* Require TLS */
180 bool tls_verify_peer; /* TLS Verify Client Certificate */
192 int db_port; /* Port */
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 utime_t FileRetention; /* file retention period in seconds */
212 utime_t JobRetention; /* job retention period in seconds */
215 CAT *catalog; /* Catalog resource */
216 uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
217 uint32_t NumConcurrentJobs; /* number of concurrent jobs running */
218 char *tls_ca_certfile; /* TLS CA Certificate File */
219 char *tls_ca_certdir; /* TLS CA Certificate Directory */
220 char *tls_certfile; /* TLS Client Certificate File */
221 char *tls_keyfile; /* TLS Client Key File */
222 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
223 bool tls_enable; /* Enable TLS */
224 bool tls_require; /* Require TLS */
225 bool AutoPrune; /* Do automatic pruning? */
236 int SDport; /* port where Directors connect */
237 int SDDport; /* data port for File daemon */
241 alist *device; /* Alternate devices for this Storage */
242 uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
243 uint32_t NumConcurrentJobs; /* number of concurrent jobs running */
244 char *tls_ca_certfile; /* TLS CA Certificate File */
245 char *tls_ca_certdir; /* TLS CA Certificate Directory */
246 char *tls_certfile; /* TLS Client Certificate File */
247 char *tls_keyfile; /* TLS Client Key File */
248 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
249 bool tls_enable; /* Enable TLS */
250 bool tls_require; /* Require TLS */
251 bool enabled; /* Set if device is enabled */
252 bool autochanger; /* set if autochanger */
253 int64_t StorageId; /* Set from Storage DB record */
254 int drives; /* number of drives in autochanger */
257 char *dev_name() const;
261 inline char *STORE::dev_name() const
263 DEVICE *dev = (DEVICE *)device->first();
264 return dev->hdr.name;
267 inline char *STORE::name() const { return hdr.name; }
277 int JobType; /* job type (backup, verify, restore */
278 int JobLevel; /* default backup/verify level */
279 int Priority; /* Job priority */
280 int RestoreJobId; /* What -- JobId to restore */
281 char *RestoreWhere; /* Where on disk to restore -- directory */
282 char *RestoreBootstrap; /* Bootstrap file */
283 char *RunBeforeJob; /* Run program before Job */
284 char *RunAfterJob; /* Run program after Job */
285 char *RunAfterFailedJob; /* Run program after Job that errs */
286 char *ClientRunBeforeJob; /* Run client program before Job */
287 char *ClientRunAfterJob; /* Run client program after Job */
289 char *WriteBootstrap; /* Where to write bootstrap Job updates */
290 char *WriteVerifyList; /* List of changed files */
292 int replace; /* How (overwrite, ..) */
293 utime_t MaxRunTime; /* max run time in seconds */
294 utime_t MaxWaitTime; /* max blocking time in seconds */
295 utime_t FullMaxWaitTime; /* Max Full job wait time */
296 utime_t DiffMaxWaitTime; /* Max Differential job wait time */
297 utime_t IncMaxWaitTime; /* Max Incremental job wait time */
298 utime_t MaxStartDelay; /* max start delay in seconds */
299 utime_t RescheduleInterval; /* Reschedule interval */
300 utime_t JobRetention; /* job retention period in seconds */
301 uint32_t MaxConcurrentJobs; /* Maximum concurrent jobs */
302 int RescheduleTimes; /* Number of times to reschedule job */
303 bool RescheduleOnError; /* Set to reschedule on error */
304 bool PrefixLinks; /* prefix soft links with Where path */
305 bool PruneJobs; /* Force pruning of Jobs */
306 bool PruneFiles; /* Force pruning of Files */
307 bool PruneVolumes; /* Force pruning of Volumes */
308 bool SpoolAttributes; /* Set to spool attributes in SD */
309 bool spool_data; /* Set to spool data in SD */
310 bool rerun_failed_levels; /* Upgrade to rerun failed levels */
311 bool PreferMountedVolumes; /* Prefer vols mounted rather than new one */
312 bool write_part_after_job; /* Set to write part after job in SD */
313 bool enabled; /* Set if job enabled */
315 MSGS *messages; /* How and where to send messages */
316 SCHED *schedule; /* When -- Automatic schedule */
317 CLIENT *client; /* Who to backup */
318 FILESET *fileset; /* What to backup -- Fileset */
319 alist *storage; /* Where is device -- list of Storage to be used */
320 POOL *pool; /* Where is media -- Media Pool */
321 POOL *full_pool; /* Pool for Full backups */
322 POOL *inc_pool; /* Pool for Incremental backups */
323 POOL *dif_pool; /* Pool for Differental backups */
324 POOL *next_pool; /* Next Pool for Migration */
325 char *selection_pattern;
328 JOB *verify_job; /* Job name to verify */
330 JOB *jobdefs; /* Job defaults */
331 alist *run_cmds; /* Run commands */
332 uint32_t NumConcurrentJobs; /* number of concurrent jobs running */
338 /* File options structure */
340 char opts[MAX_FOPTS]; /* options string */
341 alist regex; /* regex string(s) */
342 alist regexdir; /* regex string(s) for directories */
343 alist regexfile; /* regex string(s) for files */
344 alist wild; /* wild card strings */
345 alist wilddir; /* wild card strings for directories */
346 alist wildfile; /* wild card strings for files */
347 alist base; /* list of base names */
348 alist fstype; /* file system type limitation */
349 char *reader; /* reader program */
350 char *writer; /* writer program */
354 /* This is either an include item or an exclude item */
356 FOPTS *current_opts; /* points to current options structure */
357 FOPTS **opts_list; /* options list */
358 int num_opts; /* number of options items */
359 alist name_list; /* filename list -- holds char * */
370 bool new_include; /* Set if new include used */
371 INCEXE **include_items; /* array of incexe structures */
372 int num_includes; /* number in array */
373 INCEXE **exclude_items;
375 bool have_MD5; /* set if MD5 initialized */
376 struct MD5Context md5c; /* MD5 of include/exclude */
377 char MD5[30]; /* base 64 representation of MD5 */
378 bool ignore_fs_changes; /* Don't force Full if FS changed */
379 bool enable_vss; /* Enable Volume Shadow Copy */
401 int32_t MinValue; /* Minimum value */
402 int32_t MaxValue; /* Maximum value */
403 int32_t CurrentValue; /* Current value */
404 COUNTER *WrapCounter; /* Wrap counter name */
405 CAT *Catalog; /* Where to store */
406 bool created; /* Created in DB */
417 char *pool_type; /* Pool type */
418 char *label_format; /* Label format string */
419 char *cleaning_prefix; /* Cleaning label prefix */
420 int LabelType; /* Bacula/ANSI/IBM label type */
421 uint32_t max_volumes; /* max number of volumes */
422 utime_t VolRetention; /* volume retention period in seconds */
423 utime_t VolUseDuration; /* duration volume can be used */
424 uint32_t MaxVolJobs; /* Maximum jobs on the Volume */
425 uint32_t MaxVolFiles; /* Maximum files on the Volume */
426 uint64_t MaxVolBytes; /* Maximum bytes on the Volume */
427 utime_t MigrationTime; /* Time to migrate to next pool */
428 uint32_t MigrationHighBytes; /* When migration starts */
429 uint32_t MigrationLowBytes; /* When migration stops */
430 POOL *NextPool; /* Next pool for migration */
431 alist *storage; /* Where is device -- list of Storage to be used */
432 bool use_catalog; /* maintain catalog for media */
433 bool catalog_files; /* maintain file entries in catalog */
434 bool use_volume_once; /* write on volume only once */
435 bool accept_any_volume; /* accept any volume */
436 bool purge_oldest_volume; /* purge oldest volume */
437 bool recycle_oldest_volume; /* attempt to recycle oldest volume */
438 bool recycle_current_volume; /* attempt recycle of current volume */
439 bool AutoPrune; /* default for pool auto prune */
440 bool Recycle; /* default for media recycle yes/no */
446 /* Define the Union of all the above
447 * resource structure definitions.
467 /* Run structure contained in Schedule Resource */
470 RUN *next; /* points to next run record */
471 int level; /* level override */
472 int Priority; /* priority override */
474 bool spool_data; /* Data spooling override */
475 bool spool_data_set; /* Data spooling override given */
476 bool write_part_after_job; /* Write part after job override */
477 bool write_part_after_job_set; /* Write part after job override given */
479 POOL *pool; /* Pool override */
480 POOL *full_pool; /* Pool override */
481 POOL *inc_pool; /* Pool override */
482 POOL *dif_pool; /* Pool override */
483 STORE *storage; /* Storage override */
484 MSGS *msgs; /* Messages override */
487 int minute; /* minute to run job */
488 time_t last_run; /* last time run */
489 time_t next_run; /* next time to run */
490 char hour[nbytes_for_bits(24)]; /* bit set for each hour */
491 char mday[nbytes_for_bits(31)]; /* bit set for each day of month */
492 char month[nbytes_for_bits(12)]; /* bit set for each month */
493 char wday[nbytes_for_bits(7)]; /* bit set for each day of the week */
494 char wom[nbytes_for_bits(5)]; /* week of month */
495 char woy[nbytes_for_bits(54)]; /* week of year */