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