]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/dird_conf.h
Misc see kes-1.31 13May03
[bacula/bacula] / bacula / src / dird / dird_conf.h
1 /*
2  * Director specific configuration and defines
3  *
4  *     Kern Sibbald, Feb MM
5  *
6  *    Version $Id$
7  */
8 /*
9    Copyright (C) 2000-2003 2002 Kern Sibbald and John Walker
10
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.
15
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.
20
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,
24    MA 02111-1307, USA.
25
26  */
27
28 /* NOTE:  #includes at the end of this file */
29
30 /*
31  * Resource codes -- they must be sequential for indexing   
32  */
33 #define R_FIRST                       1001
34
35 #define R_DIRECTOR                    1001
36 #define R_CLIENT                      1002
37 #define R_JOB                         1003
38 #define R_STORAGE                     1004
39 #define R_CATALOG                     1005
40 #define R_SCHEDULE                    1006
41 #define R_FILESET                     1007
42 #define R_GROUP                       1008
43 #define R_POOL                        1009
44 #define R_MSGS                        1010
45 #define R_COUNTER                     1011
46 #define R_CONSOLE                     1012
47
48 #define R_LAST                        R_CONSOLE
49
50 /*
51  * Some resource attributes
52  */
53 #define R_NAME                        1020
54 #define R_ADDRESS                     1021
55 #define R_PASSWORD                    1022
56 #define R_TYPE                        1023
57 #define R_BACKUP                      1024
58
59
60 /* Used for certain KeyWord tables */
61 struct s_kw {       
62    char *name;
63    int token;   
64 };
65
66 /* Job Level keyword structure */
67 struct s_jl {
68    char *level_name;                  /* level keyword */
69    int  level;                        /* level */
70    int  job_type;                     /* JobType permitting this level */
71 };
72
73 /* Job Type keyword structure */
74 struct s_jt {
75    char *type_name;
76    int job_type;
77 };
78
79 /* Definition of the contents of each Resource */
80
81 /* 
82  *   Director Resource  
83  *
84  */
85 struct s_res_dir {
86    RES   hdr;
87    int   DIRport;                     /* where we listen -- UA port server port */
88    char *DIRaddr;                     /* bind address */
89    char *password;                    /* Password for UA access */
90    int enable_ssl;                    /* Use SSL for UA */
91    char *query_file;                  /* SQL query file */
92    char *working_directory;           /* WorkingDirectory */
93    char *pid_directory;               /* PidDirectory */
94    char *subsys_directory;            /* SubsysDirectory */
95    int require_ssl;                   /* Require SSL for all connections */
96    struct s_res_msgs *messages;       /* Daemon message handler */
97    uint32_t MaxConcurrentJobs;        /* Max concurrent jobs for whole director */
98    utime_t FDConnectTimeout;          /* timeout for connect in seconds */
99    utime_t SDConnectTimeout;          /* timeout in seconds */
100 };
101 typedef struct s_res_dir DIRRES;
102
103 /* 
104  *    Console Resource
105  */
106 struct s_res_con {
107    RES   hdr;
108    char *password;                    /* UA server password */
109    int enable_ssl;                    /* Use SSL */
110 };
111 typedef struct s_res_con CONRES;
112
113
114 /*
115  *   Client Resource
116  *
117  */
118 struct s_res_client {
119    RES   hdr;
120
121    int   FDport;                      /* Where File daemon listens */
122    int   AutoPrune;                   /* Do automatic pruning? */
123    utime_t FileRetention;             /* file retention period in seconds */
124    utime_t JobRetention;              /* job retention period in seconds */
125    char *address;
126    char *password;
127    struct s_res_cat    *catalog;      /* Catalog resource */
128    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
129    semlock_t sem;                     /* client semaphore */
130    int enable_ssl;                    /* Use SSL */
131 };
132 typedef struct s_res_client CLIENT;
133
134 /*
135  *   Store Resource
136  * 
137  */
138 struct s_res_store {
139    RES   hdr;
140
141    int   SDport;                      /* port where Directors connect */
142    int   SDDport;                     /* data port for File daemon */
143    char *address;
144    char *password;
145    char *media_type;
146    char *dev_name;   
147    int  autochanger;                  /* set if autochanger */
148    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
149    semlock_t sem;                     /* storage semaphore */
150    int enable_ssl;                    /* Use SSL */
151 };
152 typedef struct s_res_store STORE;
153
154 /*
155  *   Catalog Resource
156  *
157  */
158 struct s_res_cat {
159    RES   hdr;
160
161    int   db_port;                     /* Port -- not yet implemented */
162    char *db_address;                  /* host name for remote access */
163    char *db_socket;                   /* Socket for local access */
164    char *db_password;
165    char *db_user;
166    char *db_name;
167 };
168 typedef struct s_res_cat CAT;
169
170 /*
171  *   Job Resource
172  *
173  */
174 struct s_res_job {
175    RES   hdr;
176
177    int   JobType;                     /* job type (backup, verify, restore */
178    int   level;                       /* default backup/verify level */
179    int   RestoreJobId;                /* What -- JobId to restore */
180    char *RestoreWhere;                /* Where on disk to restore -- directory */
181    char *RestoreBootstrap;            /* Bootstrap file */
182    char *RunBeforeJob;                /* Run program before Job */
183    char *RunAfterJob;                 /* Run program after Job */
184    char *WriteBootstrap;              /* Where to write bootstrap Job updates */
185    int   replace;                     /* How (overwrite, ..) */
186    utime_t MaxRunTime;                /* max run time in seconds */
187    utime_t MaxStartDelay;             /* max start delay in seconds */
188    int PrefixLinks;                   /* prefix soft links with Where path */
189    int PruneJobs;                     /* Force pruning of Jobs */
190    int PruneFiles;                    /* Force pruning of Files */
191    int PruneVolumes;                  /* Force pruning of Volumes */
192    int SpoolAttributes;               /* Set to spool attributes in SD */
193    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
194   
195    struct s_res_msgs   *messages;     /* How and where to send messages */
196    struct s_res_sch    *schedule;     /* When -- Automatic schedule */
197    struct s_res_client *client;       /* Who to backup */
198    struct s_res_fs     *fileset;      /* What to backup -- Fileset */
199    struct s_res_store  *storage;      /* Where is device -- Storage daemon */
200    struct s_res_pool   *pool;         /* Where is media -- Media Pool */
201
202    semlock_t sem;                     /* Job semaphore */
203 };
204 typedef struct s_res_job JOB;
205
206 #define MAX_FOPTS 30
207
208 struct s_fopts_item {
209    char opts[MAX_FOPTS];              /* options string */
210    char *match;                       /* match string */
211    char **base_list;                  /* list of base job names */
212    int  num_base;                     /* number of bases in list */
213 };
214 typedef struct s_fopts_item FOPTS;
215
216
217 /* This is either an include item or an exclude item */
218 struct s_incexc_item {
219    FOPTS *current_opts;               /* points to current options structure */
220    FOPTS **opts_list;                 /* options list */
221    int num_opts;                      /* number of options items */
222    char **name_list;                  /* filename list */
223    int max_names;                     /* malloc'ed size of name list */
224    int num_names;                     /* number of names in the list */
225 };
226 typedef struct s_incexc_item INCEXE;
227
228 /* 
229  *   FileSet Resource
230  *
231  */
232 struct s_res_fs {
233    RES   hdr;
234
235    int finclude;                      /* Set if finclude/fexclude used */
236    INCEXE **include_items;            /* array of incexe structures */
237    int num_includes;                  /* number in array */
238    INCEXE **exclude_items;
239    int num_excludes;
240    int have_MD5;                      /* set if MD5 initialized */
241    struct MD5Context md5c;            /* MD5 of include/exclude */
242    char MD5[30];                      /* base 64 representation of MD5 */
243 };
244 typedef struct s_res_fs FILESET;
245
246  
247 /* 
248  *   Schedule Resource
249  *
250  */
251 struct s_res_sch {
252    RES   hdr;
253
254    struct s_run *run;
255 };
256 typedef struct s_res_sch SCHED;
257
258 /*
259  *   Group Resource (not used)
260  *
261  */
262 struct s_res_group {
263    RES   hdr;
264 };
265 typedef struct s_res_group GROUP;
266
267 /*
268  *   Counter Resource
269  */
270 struct s_res_counter {
271    RES   hdr;
272
273    int32_t MinValue;                  /* Minimum value */
274    int32_t MaxValue;                  /* Maximum value */
275    int     Global;                    /* global/local */
276    char  *WrapCounter;                /* Wrap counter name */
277 };
278 typedef struct s_res_counter COUNTER;
279
280 /*
281  *   Pool Resource   
282  *
283  */
284 struct s_res_pool {
285    RES   hdr;
286
287    struct s_res_counter counter;      /* Counter resources */
288    char *pool_type;                   /* Pool type */
289    char *label_format;                /* Label format string */
290    char *cleaning_prefix;             /* Cleaning label prefix */
291    int   use_catalog;                 /* maintain catalog for media */
292    int   catalog_files;               /* maintain file entries in catalog */
293    int   use_volume_once;             /* write on volume only once */
294    int   accept_any_volume;           /* accept any volume */
295    int   recycle_oldest_volume;       /* recycle oldest volume */
296    uint32_t max_volumes;              /* max number of volumes */
297    utime_t VolRetention;              /* volume retention period in seconds */
298    utime_t VolUseDuration;            /* duration volume can be used */
299    uint32_t MaxVolJobs;               /* Maximum jobs on the Volume */
300    uint32_t MaxVolFiles;              /* Maximum files on the Volume */
301    uint64_t MaxVolBytes;              /* Maximum bytes on the Volume */
302    int   AutoPrune;                   /* default for pool auto prune */
303    int   Recycle;                     /* default for media recycle yes/no */
304 };
305 typedef struct s_res_pool POOL;
306
307
308 /* Define the Union of all the above
309  * resource structure definitions.
310  */
311 union u_res {
312    struct s_res_dir     res_dir;
313    struct s_res_con     res_con;
314    struct s_res_client  res_client;
315    struct s_res_store   res_store;
316    struct s_res_cat     res_cat;
317    struct s_res_job     res_job;
318    struct s_res_fs      res_fs;
319    struct s_res_sch     res_sch;
320    struct s_res_group   res_group;
321    struct s_res_pool    res_pool;
322    struct s_res_msgs    res_msgs;
323    struct s_res_counter res_counter;
324    RES hdr;
325 };
326
327 typedef union u_res URES;
328
329
330 /* Run structure contained in Schedule Resource */
331 struct s_run {
332    struct s_run *next;                /* points to next run record */
333    int level;                         /* level override */
334    int job_type;  
335    POOL *pool;                        /* Pool override */
336    STORE *storage;                    /* Storage override */
337    MSGS *msgs;                        /* Messages override */
338    char *since;
339    int level_no;
340    int minute;                        /* minute to run job */
341    time_t last_run;                   /* last time run */
342    time_t next_run;                   /* next time to run */
343    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
344    char mday[nbytes_for_bits(31)];    /* bit set for each day of month */
345    char month[nbytes_for_bits(12)];   /* bit set for each month */
346    char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
347    char wpos[nbytes_for_bits(5)];     /* week position */
348 };
349 typedef struct s_run RUN;