]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/dird_conf.h
570a3251af2a52c80bb4b57c6dbbf4298bfebe64
[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, 2001, 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   DBport;                      /* Port -- not yet implemented */
143    char *address;
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 PruneJobs;                     /* Force pruning of Jobs */
169    int PruneFiles;                    /* Force pruning of Files */
170    int PruneVolumes;                  /* Force pruning of Volumes */
171    int SpoolAttributes;               /* Set to spool attributes in SD */
172
173    struct s_res_msgs   *messages;     /* How and where to send messages */
174    struct s_res_sch    *schedule;     /* When -- Automatic schedule */
175    struct s_res_client *client;       /* Who to backup */
176    struct s_res_fs     *fileset;      /* What to backup -- Fileset */
177    struct s_res_store  *storage;      /* Where is device -- Storage daemon */
178    struct s_res_pool   *pool;         /* Where is media -- Media Pool */
179 };
180 typedef struct s_res_job JOB;
181
182 /* 
183  *   FileSet Resource
184  *
185  */
186 struct s_res_fs {
187    RES   hdr;
188
189    char **include_array;
190    int num_includes;
191    int include_size;
192    char **exclude_array;
193    int num_excludes;
194    int exclude_size;
195    int have_MD5;                      /* set if MD5 initialized */
196    struct MD5Context md5c;            /* MD5 of include/exclude */
197    char MD5[50];                      /* base 64 representation of MD5 */
198 };
199 typedef struct s_res_fs FILESET;
200
201 /*
202  * FileOptions Resource (options for Includes)
203  */
204 struct s_res_fo {
205    RES  hdr;
206
207    char opts[50];                     /* Options string */
208    struct s_applyto *applyto;         /* applyto strings */
209 }; 
210 typedef struct s_res_fo FILEOPTIONS;
211  
212
213 /* 
214  *   Schedule Resource
215  *
216  */
217 struct s_res_sch {
218    RES   hdr;
219
220    struct s_run *run;
221 };
222 typedef struct s_res_sch SCHED;
223
224 /*
225  *   Group Resource (not used)
226  *
227  */
228 struct s_res_group {
229    RES   hdr;
230 };
231 typedef struct s_res_group GROUP;
232
233 /*
234  *   Counter Resource
235  */
236 struct s_res_counter {
237    RES   hdr;
238
239    int32_t MinValue;                  /* Minimum value */
240    int32_t MaxValue;                  /* Maximum value */
241    int     Global;                    /* global/local */
242    char  *WrapCounter;                /* Wrap counter name */
243 };
244 typedef struct s_res_counter COUNTER;
245
246 /*
247  *   Pool Resource   
248  *
249  */
250 struct s_res_pool {
251    RES   hdr;
252
253    struct s_res_counter counter;      /* Counter resources */
254    char *pool_type;                   /* Pool type */
255    char *label_format;                /* Label format string */
256    int   use_catalog;                 /* maintain catalog for media */
257    int   catalog_files;               /* maintain file entries in catalog */
258    int   use_volume_once;             /* write on volume only once */
259    int   accept_any_volume;           /* accept any volume */
260    uint32_t max_volumes;              /* max number of volumes */
261    utime_t VolRetention;              /* volume retention period in seconds */
262    utime_t VolUseDuration;            /* duration volume can be used */
263    uint32_t MaxVolJobs;               /* Maximum jobs on the Volume */
264    uint32_t MaxVolFiles;              /* Maximum files on the Volume */
265    uint64_t MaxVolBytes;              /* Maximum bytes on the Volume */
266    int   AutoPrune;                   /* default for pool auto prune */
267    int   Recycle;                     /* default for media recycle yes/no */
268 };
269 typedef struct s_res_pool POOL;
270
271
272 /* Define the Union of all the above
273  * resource structure definitions.
274  */
275 union u_res {
276    struct s_res_dir     res_dir;
277    struct s_res_client  res_client;
278    struct s_res_store   res_store;
279    struct s_res_cat     res_cat;
280    struct s_res_job     res_job;
281    struct s_res_fs      res_fs;
282    struct s_res_sch     res_sch;
283    struct s_res_group   res_group;
284    struct s_res_pool    res_pool;
285    struct s_res_msgs    res_msgs;
286    struct s_res_counter res_counter;
287    struct s_res_fo      res_fo;
288    RES hdr;
289 };
290
291 typedef union u_res URES;
292
293
294 /* Run structure contained in Schedule Resource */
295 struct s_run {
296    struct s_run *next;                /* points to next run record */
297    int level;                         /* level override */
298    int job_type;  
299    POOL *pool;                        /* Pool override */
300    STORE *storage;                    /* Storage override */
301    MSGS *msgs;                        /* Messages override */
302    char *since;
303    int level_no;
304    int minute;                        /* minute to run job */
305    time_t last_run;                   /* last time run */
306    time_t next_run;                   /* next time to run */
307    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
308    char mday[nbytes_for_bits(31)];    /* bit set for each day of month */
309    char month[nbytes_for_bits(12)];   /* bit set for each month */
310    char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
311    char wpos[nbytes_for_bits(5)];     /* week position */
312 };
313 typedef struct s_run RUN;