2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2015 Kern Sibbald
5 Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
7 The original author of Bacula is Kern Sibbald, with contributions
8 from many others, a complete list can be found in the file AUTHORS.
10 You may use this file and others of this release according to the
11 license defined in the LICENSE file, which includes the Affero General
12 Public License, v3.0 ("AGPLv3") and some additional permissions and
13 terms pursuant to its AGPLv3 Section 7.
15 This notice must be preserved when any source code is
16 conveyed and/or propagated.
18 Bacula(R) is a registered trademark of Kern Sibbald.
21 * Director specific configuration and defines
23 * Kern Sibbald, Feb MM
27 /* NOTE: #includes at the end of this file */
30 * Resource codes -- they must be sequential for indexing
45 R_DEVICE, /* This is the real last device class */
48 R_LAST = R_DEVICE /* keep this updated */
53 * Some resource attributes
63 /* Options for FileSet keywords */
70 /* Job Level keyword structure */
72 const char *level_name; /* level keyword */
73 int32_t level; /* level */
74 int32_t job_type; /* JobType permitting this level */
77 /* Job Type keyword structure */
79 const char *type_name;
83 /* Definition of the contents of each Resource */
84 /* Needed for forward references */
101 dlist *DIRsrc_addr; /* address to source connections from */
102 char *password; /* Password for UA access */
103 char *query_file; /* SQL query file */
104 char *working_directory; /* WorkingDirectory */
105 const char *scripts_directory; /* ScriptsDirectory */
106 const char *plugin_directory; /* Plugin Directory */
107 char *pid_directory; /* PidDirectory */
108 char *subsys_directory; /* SubsysDirectory */
109 MSGS *messages; /* Daemon message handler */
110 uint32_t MaxConcurrentJobs; /* Max concurrent jobs for whole director */
111 uint32_t MaxSpawnedJobs; /* Max Jobs that can be started by Migration/Copy */
112 uint32_t MaxConsoleConnect; /* Max concurrent console session */
113 uint32_t MaxReload; /* Maximum reload requests */
114 utime_t FDConnectTimeout; /* timeout for connect in seconds */
115 utime_t SDConnectTimeout; /* timeout in seconds */
116 utime_t heartbeat_interval; /* Interval to send heartbeats */
117 char *tls_ca_certfile; /* TLS CA Certificate File */
118 char *tls_ca_certdir; /* TLS CA Certificate Directory */
119 char *tls_certfile; /* TLS Server Certificate File */
120 char *tls_keyfile; /* TLS Server Key File */
121 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
122 alist *tls_allowed_cns; /* TLS Allowed Clients */
123 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
124 utime_t stats_retention; /* Stats retention period in seconds */
125 bool tls_authenticate; /* Authenticated with TLS */
126 bool tls_enable; /* Enable TLS */
127 bool tls_require; /* Require TLS */
128 bool tls_verify_peer; /* TLS Verify Client Certificate */
129 char *verid; /* Custom Id to print in version command */
134 inline char *DIRRES::name() const { return hdr.name; }
138 * This resource is a bit different from the other resources
139 * because it is not defined in the Director
140 * by DEVICE { ... }, but rather by a "reference" such as
141 * DEVICE = xxx; Then when the Director connects to the
142 * SD, it requests the information about the device.
148 bool found; /* found with SD */
149 int32_t num_writers; /* number of writers */
150 int32_t max_writers; /* = 1 for files */
151 int32_t reserved; /* number of reserves */
152 int32_t num_drives; /* for autochanger */
153 bool autochanger; /* set if device is autochanger */
154 bool open; /* drive open */
155 bool append; /* in append mode */
156 bool read; /* in read mode */
157 bool labeled; /* Volume name valid */
158 bool offline; /* not available */
159 bool autoselect; /* can be selected via autochanger */
161 char ChangerName[MAX_NAME_LENGTH];
162 char VolumeName[MAX_NAME_LENGTH];
163 char MediaType[MAX_NAME_LENGTH];
169 inline char *DEVICE::name() const { return hdr.name; }
172 * Console ACL positions
186 Num_ACL /* keep last */
195 char *password; /* UA server password */
196 alist *ACL_lists[Num_ACL]; /* pointers to ACLs */
197 char *tls_ca_certfile; /* TLS CA Certificate File */
198 char *tls_ca_certdir; /* TLS CA Certificate Directory */
199 char *tls_certfile; /* TLS Server Certificate File */
200 char *tls_keyfile; /* TLS Server Key File */
201 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
202 alist *tls_allowed_cns; /* TLS Allowed Clients */
203 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
204 bool tls_authenticate; /* Authenticated with TLS */
205 bool tls_enable; /* Enable TLS */
206 bool tls_require; /* Require TLS */
207 bool tls_verify_peer; /* TLS Verify Client Certificate */
213 inline char *CONRES::name() const { return hdr.name; }
224 uint32_t db_port; /* Port */
225 char *db_address; /* host name for remote access */
226 char *db_socket; /* Socket for local access */
230 char *db_driver; /* Select appropriate driver */
231 char *db_ssl_key; /* the path name to the key file */
232 char *db_ssl_cert; /* the path name to the certificate file */
233 char *db_ssl_ca; /* the path name to the certificate authority file */
234 char *db_ssl_capath; /* the path name to a directory that contains trusted SSL CA certificates in PEM format */
235 char *db_ssl_cipher; /* a list of permissible ciphers to use for SSL encryption */
236 uint32_t mult_db_connections; /* set for multiple db connections */
237 bool disable_batch_insert; /* set to disable batch inserts */
241 char *display(POOLMEM *dst); /* Get catalog information */
244 inline char *CAT::name() const { return hdr.name; }
255 uint32_t FDport; /* Where File daemon listens */
256 utime_t FileRetention; /* file retention period in seconds */
257 utime_t JobRetention; /* job retention period in seconds */
258 utime_t SnapRetention; /* Snapshot retention period in seconds */
259 utime_t heartbeat_interval; /* Interval to send heartbeats */
261 char *fd_storage_address; /* Storage address to use from FD side */
263 CAT *catalog; /* Catalog resource */
264 int32_t MaxConcurrentJobs; /* Maximum concurrent jobs */
265 int32_t NumConcurrentJobs; /* number of concurrent jobs running */
266 char *tls_ca_certfile; /* TLS CA Certificate File */
267 char *tls_ca_certdir; /* TLS CA Certificate Directory */
268 char *tls_certfile; /* TLS Client Certificate File */
269 char *tls_keyfile; /* TLS Client Key File */
270 alist *tls_allowed_cns; /* TLS Allowed Clients */
271 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
272 bool tls_authenticate; /* Authenticated with TLS */
273 bool tls_enable; /* Enable TLS */
274 bool tls_require; /* Require TLS */
275 bool enabled; /* Set if client enabled */
276 bool AutoPrune; /* Do automatic pruning? */
277 bool sd_calls_client; /* SD calls the client */
278 int64_t max_bandwidth; /* Limit speed on this client */
284 inline char *CLIENT::name() const { return hdr.name; }
295 uint32_t SDport; /* port where Directors connect */
296 uint32_t SDDport; /* data port for File daemon */
298 char *fd_storage_address; /* Storage address to use from FD side */
301 alist *device; /* Alternate devices for this Storage */
302 int32_t MaxConcurrentJobs; /* Maximum concurrent jobs */
303 int32_t MaxConcurrentReadJobs; /* Maximum concurrent jobs reading */
304 int32_t NumConcurrentJobs; /* number of concurrent jobs running */
305 int32_t NumConcurrentReadJobs; /* number of jobs reading */
306 char *tls_ca_certfile; /* TLS CA Certificate File */
307 char *tls_ca_certdir; /* TLS CA Certificate Directory */
308 char *tls_certfile; /* TLS Client Certificate File */
309 char *tls_keyfile; /* TLS Client Key File */
310 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
311 bool tls_authenticate; /* Authenticated with TLS */
312 bool tls_enable; /* Enable TLS */
313 bool tls_require; /* Require TLS */
314 bool enabled; /* Set if device is enabled */
315 bool AllowCompress; /* set if this Storage should allow jobs to enable compression */
316 bool autochanger; /* set if we are part of an autochanger */
317 int64_t StorageId; /* Set from Storage DB record */
318 utime_t heartbeat_interval; /* Interval to send heartbeats */
319 uint32_t drives; /* number of drives in autochanger */
322 char *dev_name() const;
326 inline char *STORE::dev_name() const
328 DEVICE *dev = (DEVICE *)device->first();
332 inline char *STORE::name() const { return hdr.name; }
335 * This is a sort of "unified" store that has both the
336 * storage pointer and the text of where the pointer was
342 POOLMEM *store_source;
345 USTORE() { store = NULL; store_source = get_pool_memory(PM_MESSAGE);
346 *store_source = 0; };
347 ~USTORE() { destroy(); }
348 void set_source(const char *where);
352 inline void USTORE::destroy()
355 free_pool_memory(store_source);
361 inline void USTORE::set_source(const char *where)
364 store_source = get_pool_memory(PM_MESSAGE);
366 pm_strcpy(store_source, where);
377 uint32_t JobType; /* job type (backup, verify, restore */
378 uint32_t JobLevel; /* default backup/verify level */
379 uint32_t RestoreJobId; /* What -- JobId to restore */
380 uint32_t replace; /* How (overwrite, ..) */
381 uint32_t selection_type;
383 int32_t Priority; /* Job priority */
384 int32_t RescheduleTimes; /* Number of times to reschedule job */
386 char *RestoreWhere; /* Where on disk to restore -- directory */
387 char *RegexWhere; /* RegexWhere option */
388 char *strip_prefix; /* remove prefix from filename */
389 char *add_prefix; /* add prefix to filename */
390 char *add_suffix; /* add suffix to filename -- .old */
391 char *RestoreBootstrap; /* Bootstrap file */
392 char *PluginOptions; /* Options to pass to plugin */
394 char *WriteBootstrap; /* Where to write bootstrap Job updates */
395 char *WriteVerifyList; /* List of changed files */
397 utime_t MaxRunTime; /* max run time in seconds */
398 utime_t MaxWaitTime; /* max blocking time in seconds */
399 utime_t FullMaxRunTime; /* Max Full job run time */
400 utime_t DiffMaxRunTime; /* Max Differential job run time */
401 utime_t IncMaxRunTime; /* Max Incremental job run time */
402 utime_t MaxStartDelay; /* max start delay in seconds */
403 utime_t MaxRunSchedTime; /* max run time in seconds from Scheduled time*/
404 utime_t RescheduleInterval; /* Reschedule interval */
405 utime_t MaxFullInterval; /* Maximum time interval between Fulls */
406 utime_t MaxVirtualFullInterval; /* Maximum time interval between Virtual Fulls */
407 utime_t MaxDiffInterval; /* Maximum time interval between Diffs */
408 utime_t DuplicateJobProximity; /* Permitted time between duplicicates */
409 utime_t SnapRetention; /* Snapshot retention period in seconds */
410 int64_t spool_size; /* Size of spool file for this job */
411 int32_t MaxConcurrentJobs; /* Maximum concurrent jobs */
412 int32_t NumConcurrentJobs; /* number of concurrent jobs running */
413 uint32_t MaxSpawnedJobs; /* Max Jobs that can be started by Migration/Copy */
414 bool allow_mixed_priority; /* Allow jobs with higher priority concurrently with this */
416 MSGS *messages; /* How and where to send messages */
417 SCHED *schedule; /* When -- Automatic schedule */
418 CLIENT *client; /* Who to backup */
419 FILESET *fileset; /* What to backup -- Fileset */
420 alist *storage; /* Where is device -- list of Storage to be used */
421 POOL *pool; /* Where is media -- Media Pool */
422 POOL *next_pool; /* Next Pool for Copy/Migrate/VirtualFull */
423 POOL *full_pool; /* Pool for Full backups */
424 POOL *vfull_pool; /* Pool for Virtual Full backups */
425 POOL *inc_pool; /* Pool for Incremental backups */
426 POOL *diff_pool; /* Pool for Differental backups */
427 char *selection_pattern;
429 JOB *verify_job; /* Job name to verify */
431 JOB *jobdefs; /* Job defaults */
432 alist *run_cmds; /* Run commands */
433 alist *RunScripts; /* Run {client} program {after|before} Job */
435 bool where_use_regexp; /* true if RestoreWhere is a BREGEXP */
436 bool RescheduleOnError; /* Set to reschedule on error */
437 bool RescheduleIncompleteJobs; /* Set to reschedule incomplete Jobs */
438 bool PrefixLinks; /* prefix soft links with Where path */
439 bool PruneJobs; /* Force pruning of Jobs */
440 bool PruneFiles; /* Force pruning of Files */
441 bool PruneVolumes; /* Force pruning of Volumes */
442 bool SpoolAttributes; /* Set to spool attributes in SD */
443 bool spool_data; /* Set to spool data in SD */
444 bool rerun_failed_levels; /* Upgrade to rerun failed levels */
445 bool PreferMountedVolumes; /* Prefer vols mounted rather than new one */
446 bool write_part_after_job; /* Set to write part after job in SD */
447 bool enabled; /* Set if job enabled */
448 bool accurate; /* Set if it is an accurate backup job */
449 bool AllowDuplicateJobs; /* Allow duplicate jobs */
450 bool AllowHigherDuplicates; /* Permit Higher Level */
451 bool CancelLowerLevelDuplicates; /* Cancel lower level backup jobs */
452 bool CancelQueuedDuplicates; /* Cancel queued jobs */
453 bool CancelRunningDuplicates; /* Cancel Running jobs */
454 bool PurgeMigrateJob; /* Purges source job on completion */
455 bool IgnoreDuplicateJobChecking; /* Set to ignore Duplicate Job Checking */
457 alist *base; /* Base jobs */
458 int64_t max_bandwidth; /* Speed limit on this job */
464 inline char *JOB::name() const { return hdr.name; }
466 /* Define FileSet Options keyword values */
479 INC_KW_REPLACE, /* restore options */
480 INC_KW_READFIFO, /* Causes fifo data to be read */
494 INC_KW_MAX /* Keep this last */
501 /* File options structure */
503 char opts[MAX_FOPTS]; /* options string */
504 alist regex; /* regex string(s) */
505 alist regexdir; /* regex string(s) for directories */
506 alist regexfile; /* regex string(s) for files */
507 alist wild; /* wild card strings */
508 alist wilddir; /* wild card strings for directories */
509 alist wildfile; /* wild card strings for files */
510 alist wildbase; /* wild card strings for files without '/' */
511 alist base; /* list of base names */
512 alist fstype; /* file system type limitation */
513 alist drivetype; /* drive type limitation */
514 char *reader; /* reader program */
515 char *writer; /* writer program */
516 char *plugin; /* plugin program */
520 /* This is either an include item or an exclude item */
522 char opt_present[INC_KW_MAX+1]; /* set if option is present in conf file */
523 FOPTS *current_opts; /* points to current options structure */
524 FOPTS **opts_list; /* options list */
525 int32_t num_opts; /* number of options items */
526 alist name_list; /* filename list -- holds char * */
527 alist plugin_list; /* filename list for plugins */
528 char *ignoredir; /* ignoredir string */
539 bool new_include; /* Set if new include used */
540 INCEXE **include_items; /* array of incexe structures */
541 int32_t num_includes; /* number in array */
542 INCEXE **exclude_items;
543 int32_t num_excludes;
544 bool have_MD5; /* set if MD5 initialized */
545 struct MD5Context md5c; /* MD5 of include/exclude */
546 char MD5[30]; /* base 64 representation of MD5 */
547 bool ignore_fs_changes; /* Don't force Full if FS changed */
548 bool enable_vss; /* Enable Volume Shadow Copy */
549 bool enable_snapshot; /* Enable Snapshot */
555 inline char *FILESET::name() const { return hdr.name; }
566 bool enabled; /* set if enabled */
571 inline char *SCHED::name() const { return hdr.name; }
580 int32_t MinValue; /* Minimum value */
581 int32_t MaxValue; /* Maximum value */
582 int32_t CurrentValue; /* Current value */
583 COUNTER *WrapCounter; /* Wrap counter name */
584 CAT *Catalog; /* Where to store */
585 bool created; /* Created in DB */
590 inline char *COUNTER::name() const { return hdr.name; }
600 char *pool_type; /* Pool type */
601 char *label_format; /* Label format string */
602 char *cleaning_prefix; /* Cleaning label prefix */
603 int32_t LabelType; /* Bacula/ANSI/IBM label type */
604 uint32_t max_volumes; /* max number of volumes */
605 utime_t VolRetention; /* volume retention period in seconds */
606 utime_t VolUseDuration; /* duration volume can be used */
607 uint32_t MaxVolJobs; /* Maximum jobs on the Volume */
608 uint32_t MaxVolFiles; /* Maximum files on the Volume */
609 uint64_t MaxVolBytes; /* Maximum bytes on the Volume */
610 utime_t MigrationTime; /* Time to migrate to next pool */
611 uint64_t MigrationHighBytes; /* When migration starts */
612 uint64_t MigrationLowBytes; /* When migration stops */
613 POOL *NextPool; /* Next pool for migration */
614 alist *storage; /* Where is device -- list of Storage to be used */
615 bool use_catalog; /* maintain catalog for media */
616 bool catalog_files; /* maintain file entries in catalog */
617 bool use_volume_once; /* write on volume only once */
618 bool purge_oldest_volume; /* purge oldest volume */
619 bool recycle_oldest_volume; /* attempt to recycle oldest volume */
620 bool recycle_current_volume; /* attempt recycle of current volume */
621 bool AutoPrune; /* default for pool auto prune */
622 bool Recycle; /* default for media recycle yes/no */
623 uint32_t action_on_purge; /* action on purge, e.g. truncate the disk volume */
624 POOL *RecyclePool; /* RecyclePool destination when media is purged */
625 POOL *ScratchPool; /* ScratchPool source when requesting media */
626 alist *CopyPool; /* List of copy pools */
627 CAT *catalog; /* Catalog to be used */
628 utime_t FileRetention; /* file retention period in seconds */
629 utime_t JobRetention; /* job retention period in seconds */
635 inline char *POOL::name() const { return hdr.name; }
638 /* Define the Union of all the above
639 * resource structure definitions.
655 RUNSCRIPT res_runscript;
660 /* Run structure contained in Schedule Resource */
663 RUN *next; /* points to next run record */
664 uint32_t level; /* level override */
665 int32_t Priority; /* priority override */
667 utime_t MaxRunSchedTime; /* max run time in sec from Sched time */
668 bool MaxRunSchedTime_set; /* MaxRunSchedTime given */
669 bool spool_data; /* Data spooling override */
670 bool spool_data_set; /* Data spooling override given */
671 bool accurate; /* accurate */
672 bool accurate_set; /* accurate given */
673 bool write_part_after_job; /* Write part after job override */
674 bool write_part_after_job_set; /* Write part after job override given */
675 bool priority_set; /* priority override given */
676 bool level_set; /* level override given */
678 POOL *pool; /* Pool override */
679 POOL *next_pool; /* Next pool override */
680 POOL *full_pool; /* Pool override */
681 POOL *vfull_pool; /* Pool override */
682 POOL *inc_pool; /* Pool override */
683 POOL *diff_pool; /* Pool override */
684 STORE *storage; /* Storage override */
685 MSGS *msgs; /* Messages override */
688 uint32_t minute; /* minute to run job */
689 time_t last_run; /* last time run */
690 time_t next_run; /* next time to run */
691 bool last_day_set; /* set if last_day is used */
692 char hour[nbytes_for_bits(24)]; /* bit set for each hour */
693 char mday[nbytes_for_bits(32)]; /* bit set for each day of month */
694 char month[nbytes_for_bits(12)]; /* bit set for each month */
695 char wday[nbytes_for_bits(7)]; /* bit set for each day of the week */
696 char wom[nbytes_for_bits(6)]; /* week of month */
697 char woy[nbytes_for_bits(54)]; /* week of year */
700 #define GetPoolResWithName(x) ((POOL *)GetResWithName(R_POOL, (x)))
701 #define GetStoreResWithName(x) ((STORE *)GetResWithName(R_STORAGE, (x)))
702 #define GetClientResWithName(x) ((CLIENT *)GetResWithName(R_CLIENT, (x)))
703 #define GetJobResWithName(x) ((JOB *)GetResWithName(R_JOB, (x)))
704 #define GetFileSetResWithName(x) ((FILESET *)GetResWithName(R_FILESET, (x)))
705 #define GetCatalogResWithName(x) ((CAT *)GetResWithName(R_CATALOG, (x)))
707 /* Imported subroutines */
708 void store_jobtype(LEX *lc, RES_ITEM *item, int index, int pass);
709 void store_level(LEX *lc, RES_ITEM *item, int index, int pass);
710 void store_replace(LEX *lc, RES_ITEM *item, int index, int pass);
711 void store_migtype(LEX *lc, RES_ITEM *item, int index, int pass);
712 void store_acl(LEX *lc, RES_ITEM *item, int index, int pass);
713 void store_ac_res(LEX *lc, RES_ITEM *item, int index, int pass);
714 void store_actiononpurge(LEX *lc, RES_ITEM *item, int index, int pass);
715 void store_inc(LEX *lc, RES_ITEM *item, int index, int pass);
716 void store_regex(LEX *lc, RES_ITEM *item, int index, int pass);
717 void store_wild(LEX *lc, RES_ITEM *item, int index, int pass);
718 void store_fstype(LEX *lc, RES_ITEM *item, int index, int pass);
719 void store_drivetype(LEX *lc, RES_ITEM *item, int index, int pass);
720 void store_opts(LEX *lc, RES_ITEM *item, int index, int pass);
721 void store_lopts(LEX *lc, RES_ITEM *item, int index, int pass);
722 void store_base(LEX *lc, RES_ITEM *item, int index, int pass);
723 void store_plugin(LEX *lc, RES_ITEM *item, int index, int pass);
724 void store_run(LEX *lc, RES_ITEM *item, int index, int pass);
725 void store_runscript(LEX *lc, RES_ITEM *item, int index, int pass);