]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/dird_conf.h
Clean up old structs in dird + remove Slot invalidation code
[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 /* Needed for forward references */
81 struct SCHED;
82 struct CLIENT;
83 struct FILESET;
84 struct POOL;
85 struct RUN;
86
87 /* 
88  *   Director Resource  
89  *
90  */
91 struct DIRRES {
92    RES   hdr;
93    int   DIRport;                     /* where we listen -- UA port server port */
94    char *DIRaddr;                     /* bind address */
95    char *password;                    /* Password for UA access */
96    int enable_ssl;                    /* Use SSL for UA */
97    char *query_file;                  /* SQL query file */
98    char *working_directory;           /* WorkingDirectory */
99    char *pid_directory;               /* PidDirectory */
100    char *subsys_directory;            /* SubsysDirectory */
101    int require_ssl;                   /* Require SSL for all connections */
102    struct s_res_msgs *messages;       /* Daemon message handler */
103    uint32_t MaxConcurrentJobs;        /* Max concurrent jobs for whole director */
104    utime_t FDConnectTimeout;          /* timeout for connect in seconds */
105    utime_t SDConnectTimeout;          /* timeout in seconds */
106 };
107
108 /* 
109  *    Console Resource
110  */
111 struct CONRES {
112    RES   hdr;
113    char *password;                    /* UA server password */
114    int enable_ssl;                    /* Use SSL */
115 };
116
117
118 /*
119  *   Catalog Resource
120  *
121  */
122 struct CAT {
123    RES   hdr;
124
125    int   db_port;                     /* Port -- not yet implemented */
126    char *db_address;                  /* host name for remote access */
127    char *db_socket;                   /* Socket for local access */
128    char *db_password;
129    char *db_user;
130    char *db_name;
131 };
132
133
134 /*
135  *   Client Resource
136  *
137  */
138 struct CLIENT {
139    RES   hdr;
140
141    int   FDport;                      /* Where File daemon listens */
142    int   AutoPrune;                   /* Do automatic pruning? */
143    utime_t FileRetention;             /* file retention period in seconds */
144    utime_t JobRetention;              /* job retention period in seconds */
145    char *address;
146    char *password;
147    CAT *catalog;                      /* Catalog resource */
148    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
149    semlock_t sem;                     /* client semaphore */
150    int enable_ssl;                    /* Use SSL */
151 };
152
153 /*
154  *   Store Resource
155  * 
156  */
157 struct STORE {
158    RES   hdr;
159
160    int   SDport;                      /* port where Directors connect */
161    int   SDDport;                     /* data port for File daemon */
162    char *address;
163    char *password;
164    char *media_type;
165    char *dev_name;   
166    int  autochanger;                  /* set if autochanger */
167    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
168    semlock_t sem;                     /* storage semaphore */
169    int enable_ssl;                    /* Use SSL */
170 };
171
172
173 /*
174  *   Job Resource
175  *
176  */
177 struct JOB {
178    RES   hdr;
179
180    int   JobType;                     /* job type (backup, verify, restore */
181    int   level;                       /* default backup/verify level */
182    int   RestoreJobId;                /* What -- JobId to restore */
183    char *RestoreWhere;                /* Where on disk to restore -- directory */
184    char *RestoreBootstrap;            /* Bootstrap file */
185    char *RunBeforeJob;                /* Run program before Job */
186    char *RunAfterJob;                 /* Run program after Job */
187    char *WriteBootstrap;              /* Where to write bootstrap Job updates */
188    int   replace;                     /* How (overwrite, ..) */
189    utime_t MaxRunTime;                /* max run time in seconds */
190    utime_t MaxStartDelay;             /* max start delay in seconds */
191    int PrefixLinks;                   /* prefix soft links with Where path */
192    int PruneJobs;                     /* Force pruning of Jobs */
193    int PruneFiles;                    /* Force pruning of Files */
194    int PruneVolumes;                  /* Force pruning of Volumes */
195    int SpoolAttributes;               /* Set to spool attributes in SD */
196    uint32_t MaxConcurrentJobs;        /* Maximume concurrent jobs */
197   
198    MSGS                *messages;     /* How and where to send messages */
199    SCHED               *schedule;     /* When -- Automatic schedule */
200    CLIENT              *client;       /* Who to backup */
201    FILESET             *fileset;      /* What to backup -- Fileset */
202    STORE               *storage;      /* Where is device -- Storage daemon */
203    POOL                *pool;         /* Where is media -- Media Pool */
204
205    semlock_t sem;                     /* Job semaphore */
206 };
207
208 #define MAX_FOPTS 30
209
210 struct s_fopts_item {
211    char opts[MAX_FOPTS];              /* options string */
212    char *match;                       /* match string */
213    char **base_list;                  /* list of base job names */
214    int  num_base;                     /* number of bases in list */
215 };
216 typedef struct s_fopts_item FOPTS;
217
218
219 /* This is either an include item or an exclude item */
220 struct s_incexc_item {
221    FOPTS *current_opts;               /* points to current options structure */
222    FOPTS **opts_list;                 /* options list */
223    int num_opts;                      /* number of options items */
224    char **name_list;                  /* filename list */
225    int max_names;                     /* malloc'ed size of name list */
226    int num_names;                     /* number of names in the list */
227 };
228 typedef struct s_incexc_item INCEXE;
229
230 /* 
231  *   FileSet Resource
232  *
233  */
234 struct FILESET {
235    RES   hdr;
236
237    int finclude;                      /* Set if finclude/fexclude used */
238    INCEXE **include_items;            /* array of incexe structures */
239    int num_includes;                  /* number in array */
240    INCEXE **exclude_items;
241    int num_excludes;
242    int have_MD5;                      /* set if MD5 initialized */
243    struct MD5Context md5c;            /* MD5 of include/exclude */
244    char MD5[30];                      /* base 64 representation of MD5 */
245 };
246
247  
248 /* 
249  *   Schedule Resource
250  *
251  */
252 struct SCHED {
253    RES   hdr;
254
255    RUN *run;
256 };
257
258 /*
259  *   Group Resource (not used)
260  *
261  */
262 struct GROUP {
263    RES   hdr;
264 };
265
266 /*
267  *   Counter Resource
268  */
269 struct COUNTER {
270    RES   hdr;
271
272    int32_t MinValue;                  /* Minimum value */
273    int32_t MaxValue;                  /* Maximum value */
274    int     Global;                    /* global/local */
275    char  *WrapCounter;                /* Wrap counter name */
276 };
277
278 /*
279  *   Pool Resource   
280  *
281  */
282 struct POOL {
283    RES   hdr;
284
285    COUNTER counter;                   /* Counter resources */
286    char *pool_type;                   /* Pool type */
287    char *label_format;                /* Label format string */
288    char *cleaning_prefix;             /* Cleaning label prefix */
289    int   use_catalog;                 /* maintain catalog for media */
290    int   catalog_files;               /* maintain file entries in catalog */
291    int   use_volume_once;             /* write on volume only once */
292    int   accept_any_volume;           /* accept any volume */
293    int   recycle_oldest_volume;       /* recycle oldest volume */
294    uint32_t max_volumes;              /* max number of volumes */
295    utime_t VolRetention;              /* volume retention period in seconds */
296    utime_t VolUseDuration;            /* duration volume can be used */
297    uint32_t MaxVolJobs;               /* Maximum jobs on the Volume */
298    uint32_t MaxVolFiles;              /* Maximum files on the Volume */
299    uint64_t MaxVolBytes;              /* Maximum bytes on the Volume */
300    int   AutoPrune;                   /* default for pool auto prune */
301    int   Recycle;                     /* default for media recycle yes/no */
302 };
303
304
305 /* Define the Union of all the above
306  * resource structure definitions.
307  */
308 union URES {
309    DIRRES               res_dir;
310    CONRES               res_con;
311    CLIENT               res_client;
312    STORE                res_store;
313    CAT                  res_cat;
314    JOB                  res_job;
315    FILESET              res_fs;
316    SCHED                res_sch;
317    GROUP                res_group;
318    POOL                 res_pool;
319    MSGS                 res_msgs;
320    COUNTER              res_counter;
321    RES hdr;
322 };
323
324
325
326 /* Run structure contained in Schedule Resource */
327 struct RUN {
328    RUN *next;                         /* points to next run record */
329    int level;                         /* level override */
330    int job_type;  
331    POOL *pool;                        /* Pool override */
332    STORE *storage;                    /* Storage override */
333    MSGS *msgs;                        /* Messages override */
334    char *since;
335    int level_no;
336    int minute;                        /* minute to run job */
337    time_t last_run;                   /* last time run */
338    time_t next_run;                   /* next time to run */
339    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
340    char mday[nbytes_for_bits(31)];    /* bit set for each day of month */
341    char month[nbytes_for_bits(12)];   /* bit set for each month */
342    char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
343    char wpos[nbytes_for_bits(5)];     /* week position */
344 };