2 Bacula® - The Network Backup Solution
4 Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from many
7 others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 Bacula® is a registered trademark of Kern Sibbald.
17 * Director specific configuration and defines
19 * Written by Kern Sibbald, Feb MM
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 int32_t level; /* level */
69 int32_t 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 */
96 dlist *DIRsrc_addr; /* address to source connections from */
97 char *password; /* Password for UA access */
98 char *query_file; /* SQL query file */
99 char *working_directory; /* WorkingDirectory */
100 const char *scripts_directory; /* ScriptsDirectory */
101 const char *plugin_directory; /* Plugin Directory */
102 char *pid_directory; /* PidDirectory */
103 char *subsys_directory; /* SubsysDirectory */
104 MSGS *messages; /* Daemon message handler */
105 uint32_t MaxConcurrentJobs; /* Max concurrent jobs for whole director */
106 uint32_t MaxSpawnedJobs; /* Max Jobs that can be started by Migration/Copy */
107 uint32_t MaxConsoleConnect; /* Max concurrent console session */
108 utime_t FDConnectTimeout; /* timeout for connect in seconds */
109 utime_t SDConnectTimeout; /* timeout in seconds */
110 utime_t heartbeat_interval; /* Interval to send heartbeats */
111 char *tls_ca_certfile; /* TLS CA Certificate File */
112 char *tls_ca_certdir; /* TLS CA Certificate Directory */
113 char *tls_certfile; /* TLS Server Certificate File */
114 char *tls_keyfile; /* TLS Server Key File */
115 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
116 alist *tls_allowed_cns; /* TLS Allowed Clients */
117 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
118 utime_t stats_retention; /* Stats retention period in seconds */
119 bool tls_authenticate; /* Authenticated with TLS */
120 bool tls_enable; /* Enable TLS */
121 bool tls_require; /* Require TLS */
122 bool tls_verify_peer; /* TLS Verify Client Certificate */
123 char *verid; /* Custom Id to print in version command */
128 inline char *DIRRES::name() const { return hdr.name; }
132 * This resource is a bit different from the other resources
133 * because it is not defined in the Director
134 * by DEVICE { ... }, but rather by a "reference" such as
135 * DEVICE = xxx; Then when the Director connects to the
136 * SD, it requests the information about the device.
142 bool found; /* found with SD */
143 int32_t num_writers; /* number of writers */
144 int32_t max_writers; /* = 1 for files */
145 int32_t reserved; /* number of reserves */
146 int32_t num_drives; /* for autochanger */
147 bool autochanger; /* set if device is autochanger */
148 bool open; /* drive open */
149 bool append; /* in append mode */
150 bool read; /* in read mode */
151 bool labeled; /* Volume name valid */
152 bool offline; /* not available */
153 bool autoselect; /* can be selected via autochanger */
155 char ChangerName[MAX_NAME_LENGTH];
156 char VolumeName[MAX_NAME_LENGTH];
157 char MediaType[MAX_NAME_LENGTH];
163 inline char *DEVICE::name() const { return hdr.name; }
166 * Console ACL positions
180 Num_ACL /* keep last */
189 char *password; /* UA server password */
190 alist *ACL_lists[Num_ACL]; /* pointers to ACLs */
191 char *tls_ca_certfile; /* TLS CA Certificate File */
192 char *tls_ca_certdir; /* TLS CA Certificate Directory */
193 char *tls_certfile; /* TLS Server Certificate File */
194 char *tls_keyfile; /* TLS Server Key File */
195 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
196 alist *tls_allowed_cns; /* TLS Allowed Clients */
197 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
198 bool tls_authenticate; /* Authenticated with TLS */
199 bool tls_enable; /* Enable TLS */
200 bool tls_require; /* Require TLS */
201 bool tls_verify_peer; /* TLS Verify Client Certificate */
207 inline char *CONRES::name() const { return hdr.name; }
218 uint32_t db_port; /* Port */
219 char *db_address; /* host name for remote access */
220 char *db_socket; /* Socket for local access */
224 char *db_driver; /* Select appropriate driver */
225 uint32_t mult_db_connections; /* set if multiple connections wanted */
226 bool disable_batch_insert; /* set if batch inserts should be disabled */
230 char *display(POOLMEM *dst); /* Get catalog information */
233 inline char *CAT::name() const { return hdr.name; }
244 uint32_t FDport; /* Where File daemon listens */
245 utime_t FileRetention; /* file retention period in seconds */
246 utime_t JobRetention; /* job retention period in seconds */
247 utime_t heartbeat_interval; /* Interval to send heartbeats */
249 char *fd_storage_address; /* Storage address to use from FD side */
251 CAT *catalog; /* Catalog resource */
252 int32_t MaxConcurrentJobs; /* Maximum concurrent jobs */
253 int32_t NumConcurrentJobs; /* number of concurrent jobs running */
254 char *tls_ca_certfile; /* TLS CA Certificate File */
255 char *tls_ca_certdir; /* TLS CA Certificate Directory */
256 char *tls_certfile; /* TLS Client Certificate File */
257 char *tls_keyfile; /* TLS Client Key File */
258 alist *tls_allowed_cns; /* TLS Allowed Clients */
259 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
260 bool tls_authenticate; /* Authenticated with TLS */
261 bool tls_enable; /* Enable TLS */
262 bool tls_require; /* Require TLS */
263 bool AutoPrune; /* Do automatic pruning? */
264 bool sd_calls_client; /* SD calls the client */
265 int64_t max_bandwidth; /* Limit speed on this client */
271 inline char *CLIENT::name() const { return hdr.name; }
282 uint32_t SDport; /* port where Directors connect */
283 uint32_t SDDport; /* data port for File daemon */
285 char *fd_storage_address; /* Storage address to use from FD side */
288 alist *device; /* Alternate devices for this Storage */
289 int32_t MaxConcurrentJobs; /* Maximum concurrent jobs */
290 int32_t MaxConcurrentReadJobs; /* Maximum concurrent jobs reading */
291 int32_t NumConcurrentJobs; /* number of concurrent jobs running */
292 int32_t NumConcurrentReadJobs; /* number of jobs reading */
293 char *tls_ca_certfile; /* TLS CA Certificate File */
294 char *tls_ca_certdir; /* TLS CA Certificate Directory */
295 char *tls_certfile; /* TLS Client Certificate File */
296 char *tls_keyfile; /* TLS Client Key File */
297 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
298 bool tls_authenticate; /* Authenticated with TLS */
299 bool tls_enable; /* Enable TLS */
300 bool tls_require; /* Require TLS */
301 bool enabled; /* Set if device is enabled */
302 bool autochanger; /* set if autochanger */
303 bool AllowCompress; /* set if this Storage should allow jobs to enable compression */
304 int64_t StorageId; /* Set from Storage DB record */
305 utime_t heartbeat_interval; /* Interval to send heartbeats */
306 uint32_t drives; /* number of drives in autochanger */
309 char *dev_name() const;
313 inline char *STORE::dev_name() const
315 DEVICE *dev = (DEVICE *)device->first();
319 inline char *STORE::name() const { return hdr.name; }
322 * This is a sort of "unified" store that has both the
323 * storage pointer and the text of where the pointer was
329 POOLMEM *store_source;
332 USTORE() { store = NULL; store_source = get_pool_memory(PM_MESSAGE);
333 *store_source = 0; };
334 ~USTORE() { destroy(); }
335 void set_source(const char *where);
339 inline void USTORE::destroy()
342 free_pool_memory(store_source);
348 inline void USTORE::set_source(const char *where)
351 store_source = get_pool_memory(PM_MESSAGE);
353 pm_strcpy(store_source, where);
364 uint32_t JobType; /* job type (backup, verify, restore */
365 uint32_t JobLevel; /* default backup/verify level */
366 int32_t Priority; /* Job priority */
367 uint32_t RestoreJobId; /* What -- JobId to restore */
368 int32_t RescheduleTimes; /* Number of times to reschedule job */
369 uint32_t replace; /* How (overwrite, ..) */
370 uint32_t selection_type;
372 char *RestoreWhere; /* Where on disk to restore -- directory */
373 char *RegexWhere; /* RegexWhere option */
374 char *strip_prefix; /* remove prefix from filename */
375 char *add_prefix; /* add prefix to filename */
376 char *add_suffix; /* add suffix to filename -- .old */
377 char *RestoreBootstrap; /* Bootstrap file */
378 char *PluginOptions; /* Options to pass to plugin */
380 char *WriteBootstrap; /* Where to write bootstrap Job updates */
381 char *WriteVerifyList; /* List of changed files */
383 utime_t MaxRunTime; /* max run time in seconds */
384 utime_t MaxWaitTime; /* max blocking time in seconds */
385 utime_t FullMaxRunTime; /* Max Full job run time */
386 utime_t DiffMaxRunTime; /* Max Differential job run time */
387 utime_t IncMaxRunTime; /* Max Incremental job run time */
388 utime_t MaxStartDelay; /* max start delay in seconds */
389 utime_t MaxRunSchedTime; /* max run time in seconds from Scheduled time*/
390 utime_t RescheduleInterval; /* Reschedule interval */
391 utime_t MaxFullInterval; /* Maximum time interval between Fulls */
392 utime_t MaxDiffInterval; /* Maximum time interval between Diffs */
393 utime_t DuplicateJobProximity; /* Permitted time between duplicicates */
394 int64_t spool_size; /* Size of spool file for this job */
395 int32_t MaxConcurrentJobs; /* Maximum concurrent jobs */
396 int32_t NumConcurrentJobs; /* number of concurrent jobs running */
397 uint32_t MaxSpawnedJobs; /* Max Jobs that can be started by Migration/Copy */
398 bool allow_mixed_priority; /* Allow jobs with higher priority concurrently with this */
400 MSGS *messages; /* How and where to send messages */
401 SCHED *schedule; /* When -- Automatic schedule */
402 CLIENT *client; /* Who to backup */
403 FILESET *fileset; /* What to backup -- Fileset */
404 alist *storage; /* Where is device -- list of Storage to be used */
405 POOL *pool; /* Where is media -- Media Pool */
406 POOL *next_pool; /* Next Pool for Copy/Migrate/VirtualFull */
407 POOL *full_pool; /* Pool for Full backups */
408 POOL *inc_pool; /* Pool for Incremental backups */
409 POOL *diff_pool; /* Pool for Differental backups */
410 char *selection_pattern;
412 JOB *verify_job; /* Job name to verify */
414 JOB *jobdefs; /* Job defaults */
415 alist *run_cmds; /* Run commands */
416 alist *RunScripts; /* Run {client} program {after|before} Job */
418 bool where_use_regexp; /* true if RestoreWhere is a BREGEXP */
419 bool RescheduleOnError; /* Set to reschedule on error */
420 bool RescheduleIncompleteJobs; /* Set to reschedule incomplete Jobs */
421 bool PrefixLinks; /* prefix soft links with Where path */
422 bool PruneJobs; /* Force pruning of Jobs */
423 bool PruneFiles; /* Force pruning of Files */
424 bool PruneVolumes; /* Force pruning of Volumes */
425 bool SpoolAttributes; /* Set to spool attributes in SD */
426 bool spool_data; /* Set to spool data in SD */
427 bool rerun_failed_levels; /* Upgrade to rerun failed levels */
428 bool PreferMountedVolumes; /* Prefer vols mounted rather than new one */
429 bool write_part_after_job; /* Set to write part after job in SD */
430 bool enabled; /* Set if job enabled */
431 bool accurate; /* Set if it is an accurate backup job */
432 bool AllowDuplicateJobs; /* Allow duplicate jobs */
433 bool AllowHigherDuplicates; /* Permit Higher Level */
434 bool CancelLowerLevelDuplicates; /* Cancel lower level backup jobs */
435 bool CancelQueuedDuplicates; /* Cancel queued jobs */
436 bool CancelRunningDuplicates; /* Cancel Running jobs */
437 bool PurgeMigrateJob; /* Purges source job on completion */
438 bool IgnoreDuplicateJobChecking; /* Ignore Duplicate Job Checking */
440 alist *base; /* Base jobs */
441 int64_t max_bandwidth; /* Speed limit on this job */
447 inline char *JOB::name() const { return hdr.name; }
452 /* File options structure */
454 char opts[MAX_FOPTS]; /* options string */
455 alist regex; /* regex string(s) */
456 alist regexdir; /* regex string(s) for directories */
457 alist regexfile; /* regex string(s) for files */
458 alist wild; /* wild card strings */
459 alist wilddir; /* wild card strings for directories */
460 alist wildfile; /* wild card strings for files */
461 alist wildbase; /* wild card strings for files without '/' */
462 alist base; /* list of base names */
463 alist fstype; /* file system type limitation */
464 alist drivetype; /* drive type limitation */
465 char *reader; /* reader program */
466 char *writer; /* writer program */
467 char *plugin; /* plugin program */
471 /* This is either an include item or an exclude item */
473 FOPTS *current_opts; /* points to current options structure */
474 FOPTS **opts_list; /* options list */
475 int32_t num_opts; /* number of options items */
476 alist name_list; /* filename list -- holds char * */
477 alist plugin_list; /* filename list for plugins */
478 char *ignoredir; /* ignoredir string */
489 bool new_include; /* Set if new include used */
490 INCEXE **include_items; /* array of incexe structures */
491 int32_t num_includes; /* number in array */
492 INCEXE **exclude_items;
493 int32_t num_excludes;
494 bool have_MD5; /* set if MD5 initialized */
495 struct MD5Context md5c; /* MD5 of include/exclude */
496 char MD5[30]; /* base 64 representation of MD5 */
497 bool ignore_fs_changes; /* Don't force Full if FS changed */
498 bool enable_vss; /* Enable Volume Shadow Copy */
504 inline char *FILESET::name() const { return hdr.name; }
518 inline char *SCHED::name() const { return hdr.name; }
527 int32_t MinValue; /* Minimum value */
528 int32_t MaxValue; /* Maximum value */
529 int32_t CurrentValue; /* Current value */
530 COUNTER *WrapCounter; /* Wrap counter name */
531 CAT *Catalog; /* Where to store */
532 bool created; /* Created in DB */
537 inline char *COUNTER::name() const { return hdr.name; }
547 char *pool_type; /* Pool type */
548 char *label_format; /* Label format string */
549 char *cleaning_prefix; /* Cleaning label prefix */
550 int32_t LabelType; /* Bacula/ANSI/IBM label type */
551 uint32_t max_volumes; /* max number of volumes */
552 utime_t VolRetention; /* volume retention period in seconds */
553 utime_t VolUseDuration; /* duration volume can be used */
554 uint32_t MaxVolJobs; /* Maximum jobs on the Volume */
555 uint32_t MaxVolFiles; /* Maximum files on the Volume */
556 uint64_t MaxVolBytes; /* Maximum bytes on the Volume */
557 utime_t MigrationTime; /* Time to migrate to next pool */
558 uint64_t MigrationHighBytes; /* When migration starts */
559 uint64_t MigrationLowBytes; /* When migration stops */
560 POOL *NextPool; /* Next pool for migration */
561 alist *storage; /* Where is device -- list of Storage to be used */
562 bool use_catalog; /* maintain catalog for media */
563 bool catalog_files; /* maintain file entries in catalog */
564 bool use_volume_once; /* write on volume only once */
565 bool purge_oldest_volume; /* purge oldest volume */
566 bool recycle_oldest_volume; /* attempt to recycle oldest volume */
567 bool recycle_current_volume; /* attempt recycle of current volume */
568 bool AutoPrune; /* default for pool auto prune */
569 bool Recycle; /* default for media recycle yes/no */
570 uint32_t action_on_purge; /* action on purge, e.g. truncate the disk volume */
571 POOL *RecyclePool; /* RecyclePool destination when media is purged */
572 POOL *ScratchPool; /* ScratchPool source when requesting media */
573 alist *CopyPool; /* List of copy pools */
574 CAT *catalog; /* Catalog to be used */
575 utime_t FileRetention; /* file retention period in seconds */
576 utime_t JobRetention; /* job retention period in seconds */
582 inline char *POOL::name() const { return hdr.name; }
587 /* Define the Union of all the above
588 * resource structure definitions.
604 RUNSCRIPT res_runscript;
609 /* Run structure contained in Schedule Resource */
612 RUN *next; /* points to next run record */
613 uint32_t level; /* level override */
614 int32_t Priority; /* priority override */
616 utime_t MaxRunSchedTime; /* max run time in sec from Sched time */
617 bool MaxRunSchedTime_set; /* MaxRunSchedTime given */
618 bool spool_data; /* Data spooling override */
619 bool spool_data_set; /* Data spooling override given */
620 bool accurate; /* accurate */
621 bool accurate_set; /* accurate given */
622 bool write_part_after_job; /* Write part after job override */
623 bool write_part_after_job_set; /* Write part after job override given */
624 bool priority_set; /* priority override given */
625 bool level_set; /* level override given */
627 POOL *pool; /* Pool override */
628 POOL *next_pool; /* Next pool override */
629 POOL *full_pool; /* Pool override */
630 POOL *inc_pool; /* Pool override */
631 POOL *diff_pool; /* Pool override */
632 STORE *storage; /* Storage override */
633 MSGS *msgs; /* Messages override */
636 uint32_t minute; /* minute to run job */
637 time_t last_run; /* last time run */
638 time_t next_run; /* next time to run */
639 char hour[nbytes_for_bits(24)]; /* bit set for each hour */
640 char mday[nbytes_for_bits(32)]; /* bit set for each day of month */
641 char month[nbytes_for_bits(12)]; /* bit set for each month */
642 char wday[nbytes_for_bits(7)]; /* bit set for each day of the week */
643 char wom[nbytes_for_bits(6)]; /* week of month */
644 char woy[nbytes_for_bits(54)]; /* week of year */
647 #define GetPoolResWithName(x) ((POOL *)GetResWithName(R_POOL, (x)))
648 #define GetStoreResWithName(x) ((STORE *)GetResWithName(R_STORAGE, (x)))
649 #define GetClientResWithName(x) ((CLIENT *)GetResWithName(R_CLIENT, (x)))
650 #define GetJobResWithName(x) ((JOB *)GetResWithName(R_JOB, (x)))
651 #define GetFileSetResWithName(x) ((FILESET *)GetResWithName(R_FILESET, (x)))
652 #define GetCatalogResWithName(x) ((CAT *)GetResWithName(R_CATALOG, (x)))