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