]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/dird_conf.h
Basic Restore bootstrap implemented -- kes25Jun02
[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
46 #define R_LAST                        R_MSGS
47
48 /*
49  * Some resource attributes
50  */
51 #define R_NAME                        1020
52 #define R_ADDRESS                     1021
53 #define R_PASSWORD                    1022
54 #define R_TYPE                        1023
55 #define R_BACKUP                      1024
56
57
58 /* Used for certain KeyWord tables */
59 struct s_kw {       
60    char *name;
61    int token;   
62 };
63
64 /* Job Level keyword structure */
65 struct s_jl {
66    char *level_name;                  /* level keyword */
67    int  level;                        /* level */
68    int  job_type;                     /* JobType permitting this level */
69 };
70
71 /* Job Type keyword structure */
72 struct s_jt {
73    char *type_name;
74    int job_type;
75 };
76
77 /* Definition of the contents of each Resource */
78
79 /* 
80  *   Director Resource  
81  *
82  */
83 struct s_res_dir {
84    RES   hdr;
85    int   DIRport;                     /* where we listen -- UA port server port */
86    char *password;                    /* Password for UA access */
87    char *query_file;                  /* SQL query file */
88    char *working_directory;           /* WorkingDirectory */
89    char *pid_directory;               /* PidDirectory */
90    char *subsys_directory;            /* SubsysDirectory */
91    struct s_res_msgs *messages;       /* Daemon message handler */
92    int   MaxConcurrentJobs;
93    btime_t FDConnectTimeout;          /* timeout for connect in seconds */
94    btime_t SDConnectTimeout;          /* timeout in seconds */
95 };
96 typedef struct s_res_dir DIRRES;
97
98 /*
99  *   Client Resource
100  *
101  */
102 struct s_res_client {
103    RES   hdr;
104
105    int   FDport;                      /* Where File daemon listens */
106    int   AutoPrune;                   /* Do automatic pruning? */
107    btime_t FileRetention;             /* file retention period in seconds */
108    btime_t JobRetention;              /* job retention period in seconds */
109    char *address;
110    char *password;
111    struct s_res_cat    *catalog;       /* Catalog resource */
112 };
113 typedef struct s_res_client CLIENT;
114
115 /*
116  *   Store Resource
117  * 
118  */
119 struct s_res_store {
120    RES   hdr;
121
122    int   SDport;                      /* port where Directors connect */
123    int   SDDport;                     /* data port for File daemon */
124    char *address;
125    char *password;
126    char *media_type;
127    char *dev_name;   
128 };
129 typedef struct s_res_store STORE;
130
131 /*
132  *   Catalog Resource
133  *
134  */
135 struct s_res_cat {
136    RES   hdr;
137
138    int   DBport;                      /* Port -- not yet implemented */
139    char *address;
140    char *db_password;
141    char *db_user;
142    char *db_name;
143 };
144 typedef struct s_res_cat CAT;
145
146 /*
147  *   Job Resource
148  *
149  */
150 struct s_res_job {
151    RES   hdr;
152
153    int   JobType;                     /* job type (backup, verify, restore */
154    int   level;                       /* default backup/verify level */
155    int   RestoreJobId;                /* What -- JobId to restore */
156    char *RestoreWhere;                /* Where on disk to restore -- directory */
157    char *RestoreBootstrap;            /* Bootstrap file */
158    int   RestoreOptions;              /* How (overwrite, ..) */
159    btime_t MaxRunTime;                /* max run time in seconds */
160    btime_t MaxStartDelay;             /* max start delay in seconds */
161    int PruneJobs;                     /* Force pruning of Jobs */
162    int PruneFiles;                    /* Force pruning of Files */
163    int PruneVolumes;                  /* Force pruning of Volumes */
164
165    struct s_res_msgs   *messages;     /* How and where to send messages */
166    struct s_res_sch    *schedule;     /* When -- Automatic schedule */
167    struct s_res_client *client;       /* Who to backup */
168    struct s_res_fs     *fs;           /* What to backup -- Fileset */
169    struct s_res_store  *storage;      /* Where is device -- Storage daemon */
170    struct s_res_pool   *pool;         /* Where is media -- Media Pool */
171 };
172 typedef struct s_res_job JOB;
173
174 /* 
175  *   FileSet Resource
176  *
177  */
178 struct s_res_fs {
179    RES   hdr;
180
181    char **include_array;
182    int num_includes;
183    int include_size;
184    char **exclude_array;
185    int num_excludes;
186    int exclude_size;
187    int have_MD5;                      /* set if MD5 initialized */
188    struct MD5Context md5c;            /* MD5 of include/exclude */
189 };
190 typedef struct s_res_fs FILESET;
191  
192
193 /* 
194  *   Schedule Resource
195  *
196  */
197 struct s_res_sch {
198    RES   hdr;
199
200    struct s_run *run;
201 };
202 typedef struct s_res_sch SCHED;
203
204 /*
205  *   Group Resource (not used)
206  *
207  */
208 struct s_res_group {
209    RES   hdr;
210 };
211 typedef struct s_res_group GROUP;
212
213 /*
214  *   Pool Resource   
215  *
216  */
217 struct s_res_pool {
218    RES   hdr;
219
220    char *pool_type;
221    char *label_format;                /* Label format string */
222    int   use_catalog;                 /* maintain catalog for media */
223    int   catalog_files;               /* maintain file entries in catalog */
224    int   use_volume_once;             /* write on volume only once */
225    int   accept_any_volume;           /* accept any volume */
226    int   max_volumes;                 /* max number of volumes */
227    btime_t VolRetention;              /* volume retention period in seconds */
228    int   AutoPrune;                   /* default for pool auto prune */
229    int   Recycle;                     /* default for media recycle yes/no */
230 };
231 typedef struct s_res_pool POOL;
232
233
234 /* Define the Union of all the above
235  * resource structure definitions.
236  */
237 union u_res {
238    struct s_res_dir     res_dir;
239    struct s_res_client  res_client;
240    struct s_res_store   res_store;
241    struct s_res_cat     res_cat;
242    struct s_res_job     res_job;
243    struct s_res_fs      res_fs;
244    struct s_res_sch     res_sch;
245    struct s_res_group   res_group;
246    struct s_res_pool    res_pool;
247    struct s_res_msgs    res_msgs;
248    RES hdr;
249 };
250
251 typedef union u_res URES;
252
253
254 /* Run structure contained in Schedule Resource */
255 struct s_run {
256    struct s_run *next;                /* points to next run record */
257    int level;                         /* level override */
258    int job_type;  
259    POOL *pool;                        /* Pool override */
260    STORE *storage;                    /* Storage override */
261    MSGS *msgs;                        /* Messages override */
262    char *since;
263    int level_no;
264    int minute;                        /* minute to run job */
265    time_t last_run;                   /* last time run */
266    time_t next_run;                   /* next time to run */
267    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
268    char mday[nbytes_for_bits(31)];    /* bit set for each day of month */
269    char month[nbytes_for_bits(12)];   /* bit set for each month */
270    char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
271 };
272 typedef struct s_run RUN;