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 as
13 published by the Free Software Foundation; either version 2 of
14 the License, or (at your option) any later version.
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.
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,
28 /* NOTE: #includes at the end of this file */
31 * Resource codes -- they must be sequential for indexing
48 R_LAST = R_DEVICE /* keep this updated */
53 * Some resource attributes
64 /* Used for certain KeyWord tables */
70 /* Job Level keyword structure */
72 const char *level_name; /* level keyword */
73 int level; /* level */
74 int 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 */
100 char *password; /* Password for UA access */
101 char *query_file; /* SQL query file */
102 char *working_directory; /* WorkingDirectory */
103 const char *scripts_directory; /* ScriptsDirectory */
104 char *pid_directory; /* PidDirectory */
105 char *subsys_directory; /* SubsysDirectory */
106 MSGS *messages; /* Daemon message handler */
107 uint32_t MaxConcurrentJobs; /* Max concurrent jobs for whole director */
108 utime_t FDConnectTimeout; /* timeout for connect in seconds */
109 utime_t SDConnectTimeout; /* timeout in seconds */
110 int tls_enable; /* Enable TLS */
111 int tls_require; /* Require TLS */
112 int tls_verify_peer; /* TLS Verify Client Certificate */
113 char *tls_ca_certfile; /* TLS CA Certificate File */
114 char *tls_ca_certdir; /* TLS CA Certificate Directory */
115 char *tls_certfile; /* TLS Server Certificate File */
116 char *tls_keyfile; /* TLS Server Key File */
117 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
118 alist *tls_allowed_cns; /* TLS Allowed Clients */
120 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
125 * This resource is a bit different from the other resources
126 * because it is not defined in the Director
127 * by DEVICE { ... }, but rather by a "reference" such as
128 * DEVICE = xxx; Then when the Director connects to the
129 * SD, it requests the information about the device.
135 bool found; /* found with SD */
136 int num_writers; /* number of writers */
137 int max_writers; /* = 1 for files */
138 int reserved; /* number of reserves */
139 int num_drives; /* for autochanger */
140 bool autochanger; /* set if device is autochanger */
141 bool open; /* drive open */
142 bool append; /* in append mode */
143 bool read; /* in read mode */
144 bool labeled; /* Volume name valid */
145 bool offline; /* not available */
146 bool autoselect; /* can be selected via autochanger */
148 char ChangerName[MAX_NAME_LENGTH];
149 char VolumeName[MAX_NAME_LENGTH];
150 char MediaType[MAX_NAME_LENGTH];
154 * Console ACL positions
166 Num_ACL /* keep last */
175 char *password; /* UA server password */
176 alist *ACL_lists[Num_ACL]; /* pointers to ACLs */
177 int tls_enable; /* Enable TLS */
178 int tls_require; /* Require TLS */
179 int tls_verify_peer; /* TLS Verify Client Certificate */
180 char *tls_ca_certfile; /* TLS CA Certificate File */
181 char *tls_ca_certdir; /* TLS CA Certificate Directory */
182 char *tls_certfile; /* TLS Server Certificate File */
183 char *tls_keyfile; /* TLS Server Key File */
184 char *tls_dhfile; /* TLS Diffie-Hellman Parameters */
185 alist *tls_allowed_cns; /* TLS Allowed Clients */
187 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
199 int db_port; /* Port -- not yet implemented */
200 char *db_address; /* host name for remote access */
201 char *db_socket; /* Socket for local access */
205 int mult_db_connections; /* set if multiple connections wanted */
217 int FDport; /* Where File daemon listens */
218 int AutoPrune; /* Do automatic pruning? */
219 utime_t FileRetention; /* file retention period in seconds */
220 utime_t JobRetention; /* job retention period in seconds */
223 CAT *catalog; /* Catalog resource */
224 uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
225 uint32_t NumConcurrentJobs; /* number of concurrent jobs running */
226 int tls_enable; /* Enable TLS */
227 int tls_require; /* Require TLS */
228 char *tls_ca_certfile; /* TLS CA Certificate File */
229 char *tls_ca_certdir; /* TLS CA Certificate Directory */
230 char *tls_certfile; /* TLS Client Certificate File */
231 char *tls_keyfile; /* TLS Client Key File */
233 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
244 int SDport; /* port where Directors connect */
245 int SDDport; /* data port for File daemon */
249 alist *device; /* Alternate devices for this Storage */
250 int autochanger; /* set if autochanger */
251 uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
252 uint32_t NumConcurrentJobs; /* number of concurrent jobs running */
253 int tls_enable; /* Enable TLS */
254 int tls_require; /* Require TLS */
255 char *tls_ca_certfile; /* TLS CA Certificate File */
256 char *tls_ca_certdir; /* TLS CA Certificate Directory */
257 char *tls_certfile; /* TLS Client Certificate File */
258 char *tls_keyfile; /* TLS Client Key File */
260 TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
262 int64_t StorageId; /* Set from Storage DB record */
265 char *dev_name() const;
269 inline char *STORE::dev_name() const
271 DEVICE *dev = (DEVICE *)device->first();
272 return dev->hdr.name;
275 inline char *STORE::name() const { return hdr.name; }
285 int JobType; /* job type (backup, verify, restore */
286 int JobLevel; /* default backup/verify level */
287 int Priority; /* Job priority */
288 int RestoreJobId; /* What -- JobId to restore */
289 char *RestoreWhere; /* Where on disk to restore -- directory */
290 char *RestoreBootstrap; /* Bootstrap file */
291 char *RunBeforeJob; /* Run program before Job */
292 char *RunAfterJob; /* Run program after Job */
293 char *RunAfterFailedJob; /* Run program after Job that errs */
294 char *ClientRunBeforeJob; /* Run client program before Job */
295 char *ClientRunAfterJob; /* Run client program after Job */
296 char *WriteBootstrap; /* Where to write bootstrap Job updates */
297 int replace; /* How (overwrite, ..) */
298 utime_t MaxRunTime; /* max run time in seconds */
299 utime_t MaxWaitTime; /* max blocking time in seconds */
300 utime_t FullMaxWaitTime; /* Max Full job wait time */
301 utime_t DiffMaxWaitTime; /* Max Differential job wait time */
302 utime_t IncMaxWaitTime; /* Max Incremental job wait time */
303 utime_t MaxStartDelay; /* max start delay in seconds */
304 int PrefixLinks; /* prefix soft links with Where path */
305 int PruneJobs; /* Force pruning of Jobs */
306 int PruneFiles; /* Force pruning of Files */
307 int PruneVolumes; /* Force pruning of Volumes */
308 int SpoolAttributes; /* Set to spool attributes in SD */
309 int spool_data; /* Set to spool data in SD */
310 int rerun_failed_levels; /* Upgrade to rerun failed levels */
311 int PreferMountedVolumes; /* Prefer vols mounted rather than new one */
312 uint32_t MaxConcurrentJobs; /* Maximume concurrent jobs */
313 int RescheduleOnError; /* Set to reschedule on error */
314 int RescheduleTimes; /* Number of times to reschedule job */
315 utime_t RescheduleInterval; /* Reschedule interval */
316 utime_t JobRetention; /* job retention period in seconds */
317 bool write_part_after_job; /* Set to write part after job in SD */
319 MSGS *messages; /* How and where to send messages */
320 SCHED *schedule; /* When -- Automatic schedule */
321 CLIENT *client; /* Who to backup */
322 FILESET *fileset; /* What to backup -- Fileset */
323 alist *storage; /* Where is device -- list of Storage to be used */
324 POOL *pool; /* Where is media -- Media Pool */
325 POOL *full_pool; /* Pool for Full backups */
326 POOL *inc_pool; /* Pool for Incremental backups */
327 POOL *dif_pool; /* Pool for Differental backups */
328 JOB *verify_job; /* Job name to verify */
329 JOB *jobdefs; /* Job defaults */
330 alist *run_cmds; /* Run commands */
331 uint32_t NumConcurrentJobs; /* number of concurrent jobs running */
337 /* File options structure */
339 char opts[MAX_FOPTS]; /* options string */
340 alist regex; /* regex string(s) */
341 alist regexdir; /* regex string(s) for directories */
342 alist regexfile; /* regex string(s) for files */
343 alist wild; /* wild card strings */
344 alist wilddir; /* wild card strings for directories */
345 alist wildfile; /* wild card strings for files */
346 alist base; /* list of base names */
347 alist fstype; /* file system type limitation */
348 char *reader; /* reader program */
349 char *writer; /* writer program */
353 /* This is either an include item or an exclude item */
355 FOPTS *current_opts; /* points to current options structure */
356 FOPTS **opts_list; /* options list */
357 int num_opts; /* number of options items */
358 alist name_list; /* filename list -- holds char * */
369 bool new_include; /* Set if new include used */
370 INCEXE **include_items; /* array of incexe structures */
371 int num_includes; /* number in array */
372 INCEXE **exclude_items;
374 bool have_MD5; /* set if MD5 initialized */
375 struct MD5Context md5c; /* MD5 of include/exclude */
376 char MD5[30]; /* base 64 representation of MD5 */
377 int ignore_fs_changes; /* Don't force Full if FS changed */
399 int32_t MinValue; /* Minimum value */
400 int32_t MaxValue; /* Maximum value */
401 int32_t CurrentValue; /* Current value */
402 COUNTER *WrapCounter; /* Wrap counter name */
403 CAT *Catalog; /* Where to store */
404 bool created; /* Created in DB */
415 char *pool_type; /* Pool type */
416 char *label_format; /* Label format string */
417 char *cleaning_prefix; /* Cleaning label prefix */
418 int LabelType; /* Bacula/ANSI/IBM label type */
419 int use_catalog; /* maintain catalog for media */
420 int catalog_files; /* maintain file entries in catalog */
421 int use_volume_once; /* write on volume only once */
422 int accept_any_volume; /* accept any volume */
423 int purge_oldest_volume; /* purge oldest volume */
424 int recycle_oldest_volume; /* attempt to recycle oldest volume */
425 int recycle_current_volume; /* attempt recycle of current volume */
426 uint32_t max_volumes; /* max number of volumes */
427 utime_t VolRetention; /* volume retention period in seconds */
428 utime_t VolUseDuration; /* duration volume can be used */
429 uint32_t MaxVolJobs; /* Maximum jobs on the Volume */
430 uint32_t MaxVolFiles; /* Maximum files on the Volume */
431 uint64_t MaxVolBytes; /* Maximum bytes on the Volume */
432 int AutoPrune; /* default for pool auto prune */
433 int Recycle; /* default for media recycle yes/no */
439 /* Define the Union of all the above
440 * resource structure definitions.
460 /* Run structure contained in Schedule Resource */
463 RUN *next; /* points to next run record */
464 int level; /* level override */
465 int Priority; /* priority override */
467 bool spool_data; /* Data spooling override */
468 bool spool_data_set; /* Data spooling override given */
469 bool write_part_after_job; /* Write part after job override */
470 bool write_part_after_job_set; /* Write part after job override given */
472 POOL *pool; /* Pool override */
473 POOL *full_pool; /* Pool override */
474 POOL *inc_pool; /* Pool override */
475 POOL *dif_pool; /* Pool override */
476 STORE *storage; /* Storage override */
477 MSGS *msgs; /* Messages override */
480 int minute; /* minute to run job */
481 time_t last_run; /* last time run */
482 time_t next_run; /* next time to run */
483 char hour[nbytes_for_bits(24)]; /* bit set for each hour */
484 char mday[nbytes_for_bits(31)]; /* bit set for each day of month */
485 char month[nbytes_for_bits(12)]; /* bit set for each month */
486 char wday[nbytes_for_bits(7)]; /* bit set for each day of the week */
487 char wom[nbytes_for_bits(5)]; /* week of month */
488 char woy[nbytes_for_bits(54)]; /* week of year */