]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/dird_conf.h
Retention period updates
[bacula/bacula] / bacula / src / dird / dird_conf.h
1 /*
2  * Director specific configuration and defines
3  *
4  *     Kern Sibbald, Feb MM
5  */
6 /*
7    Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
8
9    This program is free software; you can redistribute it and/or
10    modify it under the terms of the GNU General Public License as
11    published by the Free Software Foundation; either version 2 of
12    the License, or (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17    General Public License for more details.
18
19    You should have received a copy of the GNU General Public
20    License along with this program; if not, write to the Free
21    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22    MA 02111-1307, USA.
23
24  */
25
26 /* NOTE:  #includes at the end of this file */
27
28 /*
29  * Resource codes -- they must be sequential for indexing   
30  */
31 #define R_FIRST                       1001
32
33 #define R_DIRECTOR                    1001
34 #define R_CLIENT                      1002
35 #define R_JOB                         1003
36 #define R_STORAGE                     1004
37 #define R_CATALOG                     1005
38 #define R_SCHEDULE                    1006
39 #define R_FILESET                     1007
40 #define R_GROUP                       1008
41 #define R_POOL                        1009
42 #define R_MSGS                        1010
43
44 #define R_LAST                        R_MSGS
45
46 /*
47  * Some resource attributes
48  */
49 #define R_NAME                        1020
50 #define R_ADDRESS                     1021
51 #define R_PASSWORD                    1022
52 #define R_TYPE                        1023
53 #define R_BACKUP                      1024
54
55
56 /* Used for certain KeyWord tables */
57 struct s_kw {       
58    char *name;
59    int token;   
60 };
61
62 /* Job Level keyword structure */
63 struct s_jl {
64    char *level_name;
65    int  level;
66    int  job_class;
67 };
68
69
70 /* Definition of the contents of each Resource */
71
72 /* 
73  *   Director Resource  
74  *
75  */
76 struct s_res_dir {
77    RES   hdr;
78    int   DIRport;                     /* where we listen -- UA port server port */
79    char *password;                    /* Password for UA access */
80    char *query_file;                  /* SQL query file */
81    char *working_directory;           /* WorkingDirectory */
82    char *pid_directory;               /* PidDirectory */
83    char *subsys_directory;            /* SubsysDirectory */
84    struct s_res_msgs *messages;
85    int   MaxConcurrentJobs;
86    btime_t FDConnectTimeout;          /* timeout for connect in seconds */
87    btime_t SDConnectTimeout;          /* timeout in seconds */
88 };
89 typedef struct s_res_dir DIRRES;
90
91 /*
92  *   Client Resource
93  *
94  */
95 struct s_res_client {
96    RES   hdr;
97
98    int   FDport;                      /* Where File daemon listens */
99    int   AutoPrune;                   /* Do automatic pruning? */
100    btime_t FileRetention;             /* file retention period in seconds */
101    btime_t JobRetention;              /* job retention period in seconds */
102    char *address;
103    char *password;
104    struct s_res_cat    *catalog;       /* Catalog resource */
105 };
106 typedef struct s_res_client CLIENT;
107
108 /*
109  *   Store Resource
110  * 
111  */
112 struct s_res_store {
113    RES   hdr;
114
115    int   SDport;                      /* port where Directors connect */
116    int   SDDport;                     /* data port for File daemon */
117    char *address;
118    char *password;
119    char *media_type;
120    char *dev_name;   
121 };
122 typedef struct s_res_store STORE;
123
124 /*
125  *   Catalog Resource
126  *
127  */
128 struct s_res_cat {
129    RES   hdr;
130
131    int   DBport;                      /* Port -- not yet implemented */
132    char *address;
133    char *db_password;
134    char *db_user;
135    char *db_name;
136 };
137 typedef struct s_res_cat CAT;
138
139 /*
140  *   Job Resource
141  *
142  */
143 struct s_res_job {
144    RES   hdr;
145
146    int   JobType;                     /* job type (backup, verify, restore */
147    int   level;                       /* default backup/verify level */
148    int   RestoreJobId;                /* What -- JobId to restore */
149    char *RestoreWhere;                /* Where on disk to restore -- directory */
150    int   RestoreOptions;              /* How (overwrite, ..) */
151    btime_t MaxRunTime;                /* max run time in seconds */
152    btime_t MaxStartDelay;             /* max start delay in seconds */
153
154    struct s_res_msgs   *messages;     /* How and where to send messages */
155    struct s_res_sch    *schedule;     /* When -- Automatic schedule */
156    struct s_res_client *client;       /* Who to backup */
157    struct s_res_fs     *fs;           /* What to backup -- Fileset */
158    struct s_res_store  *storage;      /* Where is device -- Storage daemon */
159    struct s_res_pool   *pool;         /* Where is media -- Media Pool */
160 };
161 typedef struct s_res_job JOB;
162
163 /* 
164  *   FileSet Resource
165  *
166  */
167 struct s_res_fs {
168    RES   hdr;
169
170    char **include_array;
171    int num_includes;
172    int include_size;
173    char **exclude_array;
174    int num_excludes;
175    int exclude_size;
176    int have_MD5;                      /* set if MD5 initialized */
177    struct MD5Context md5c;            /* MD5 of include/exclude */
178 };
179 typedef struct s_res_fs FILESET;
180  
181
182 /* 
183  *   Schedule Resource
184  *
185  */
186 struct s_res_sch {
187    RES   hdr;
188
189    struct s_run *run;
190 };
191 typedef struct s_res_sch SCHED;
192
193 /*
194  *   Group Resource (not used)
195  *
196  */
197 struct s_res_group {
198    RES   hdr;
199 };
200 typedef struct s_res_group GROUP;
201
202 /*
203  *   Pool Resource   
204  *
205  */
206 struct s_res_pool {
207    RES   hdr;
208
209    char *pool_type;
210    char *label_format;                /* Label format string */
211    int   use_catalog;                 /* maintain catalog for media */
212    int   catalog_files;               /* maintain file entries in catalog */
213    int   use_volume_once;             /* write on volume only once */
214    int   accept_any_volume;           /* accept any volume */
215    int   max_volumes;                 /* max number of volumes */
216    btime_t VolumeRetention;           /* volume retention period in seconds */
217    int   AutoRecycle;                 /* default for pool auto recycle */
218    int   Recycle;                     /* default for media recycle yes/no */
219 };
220 typedef struct s_res_pool POOL;
221
222
223 /* Define the Union of all the above
224  * resource structure definitions.
225  */
226 union u_res {
227    struct s_res_dir     res_dir;
228    struct s_res_client  res_client;
229    struct s_res_store   res_store;
230    struct s_res_cat     res_cat;
231    struct s_res_job     res_job;
232    struct s_res_fs      res_fs;
233    struct s_res_sch     res_sch;
234    struct s_res_group   res_group;
235    struct s_res_pool    res_pool;
236    struct s_res_msgs    res_msgs;
237    RES hdr;
238 };
239
240 typedef union u_res URES;
241
242
243 /* Run structure contained in Schedule Resource */
244 struct s_run {
245    struct s_run *next;                /* points to next run record */
246    int level;
247    int job_class;  
248    char *since;
249    int level_no;
250    int minute;                        /* minute to run job */
251    time_t last_run;                   /* last time run */
252    time_t next_run;                   /* next time to run */
253    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
254    char mday[nbytes_for_bits(31)];    /* bit set for each day of month */
255    char month[nbytes_for_bits(12)];   /* bit set for each month */
256    char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
257 };
258 typedef struct s_run RUN;