]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/dird/dird_conf.h
Add address and socket for MySQL
[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 struct s_res_fo {
188    RES  hdr;
189
190    char opts[20];                     /* Options string */
191    int  replace;                      /* How (overwrite, ...) */
192    char **applyto;                    /* applyto strings */
193    int num_applyto;                   /* number of appyto strings */
194 }; 
195 typedef struct s_res_fo FILEOPTIONS;
196
197 struct s_incexc_item {
198    char opts[20];                     /* options string */
199    FILEOPTIONS **fileopts;            /* file options array */
200    int num_fileopts;                  /* number of above */
201    char name[1];                      /* include/exclude name */
202 };
203 typedef struct s_incexc_item INCEXE;
204
205 /* 
206  *   FileSet Resource
207  *
208  */
209 struct s_res_fs {
210    RES   hdr;
211
212    INCEXE **include_array;            /* array of incexe structures */
213    int num_includes;                  /* number in array */
214    int include_size;                  /* array size */
215    INCEXE **exclude_array;
216    int num_excludes;
217    int exclude_size;
218    int have_MD5;                      /* set if MD5 initialized */
219    struct MD5Context md5c;            /* MD5 of include/exclude */
220    char MD5[30];                      /* base 64 representation of MD5 */
221 };
222 typedef struct s_res_fs FILESET;
223
224  
225 /* 
226  *   Schedule Resource
227  *
228  */
229 struct s_res_sch {
230    RES   hdr;
231
232    struct s_run *run;
233 };
234 typedef struct s_res_sch SCHED;
235
236 /*
237  *   Group Resource (not used)
238  *
239  */
240 struct s_res_group {
241    RES   hdr;
242 };
243 typedef struct s_res_group GROUP;
244
245 /*
246  *   Counter Resource
247  */
248 struct s_res_counter {
249    RES   hdr;
250
251    int32_t MinValue;                  /* Minimum value */
252    int32_t MaxValue;                  /* Maximum value */
253    int     Global;                    /* global/local */
254    char  *WrapCounter;                /* Wrap counter name */
255 };
256 typedef struct s_res_counter COUNTER;
257
258 /*
259  *   Pool Resource   
260  *
261  */
262 struct s_res_pool {
263    RES   hdr;
264
265    struct s_res_counter counter;      /* Counter resources */
266    char *pool_type;                   /* Pool type */
267    char *label_format;                /* Label format string */
268    int   use_catalog;                 /* maintain catalog for media */
269    int   catalog_files;               /* maintain file entries in catalog */
270    int   use_volume_once;             /* write on volume only once */
271    int   accept_any_volume;           /* accept any volume */
272    uint32_t max_volumes;              /* max number of volumes */
273    utime_t VolRetention;              /* volume retention period in seconds */
274    utime_t VolUseDuration;            /* duration volume can be used */
275    uint32_t MaxVolJobs;               /* Maximum jobs on the Volume */
276    uint32_t MaxVolFiles;              /* Maximum files on the Volume */
277    uint64_t MaxVolBytes;              /* Maximum bytes on the Volume */
278    int   AutoPrune;                   /* default for pool auto prune */
279    int   Recycle;                     /* default for media recycle yes/no */
280 };
281 typedef struct s_res_pool POOL;
282
283
284 /* Define the Union of all the above
285  * resource structure definitions.
286  */
287 union u_res {
288    struct s_res_dir     res_dir;
289    struct s_res_client  res_client;
290    struct s_res_store   res_store;
291    struct s_res_cat     res_cat;
292    struct s_res_job     res_job;
293    struct s_res_fs      res_fs;
294    struct s_res_sch     res_sch;
295    struct s_res_group   res_group;
296    struct s_res_pool    res_pool;
297    struct s_res_msgs    res_msgs;
298    struct s_res_counter res_counter;
299    struct s_res_fo      res_fo;
300    RES hdr;
301 };
302
303 typedef union u_res URES;
304
305
306 /* Run structure contained in Schedule Resource */
307 struct s_run {
308    struct s_run *next;                /* points to next run record */
309    int level;                         /* level override */
310    int job_type;  
311    POOL *pool;                        /* Pool override */
312    STORE *storage;                    /* Storage override */
313    MSGS *msgs;                        /* Messages override */
314    char *since;
315    int level_no;
316    int minute;                        /* minute to run job */
317    time_t last_run;                   /* last time run */
318    time_t next_run;                   /* next time to run */
319    char hour[nbytes_for_bits(24)];    /* bit set for each hour */
320    char mday[nbytes_for_bits(31)];    /* bit set for each day of month */
321    char month[nbytes_for_bits(12)];   /* bit set for each month */
322    char wday[nbytes_for_bits(7)];     /* bit set for each day of the week */
323    char wpos[nbytes_for_bits(5)];     /* week position */
324 };
325 typedef struct s_run RUN;