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