5 Bacula® - The Network Backup Solution
7 Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
9 The main author of Bacula is Kern Sibbald, with contributions from
10 many others, a complete list can be found in the file AUTHORS.
11 This program is Free Software; you can redistribute it and/or
12 modify it under the terms of version two of the GNU General Public
13 License as published by the Free Software Foundation plus additions
14 that are listed in the file LICENSE.
16 This program is distributed in the hope that it will be useful, but
17 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.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 Bacula® is a registered trademark of John Walker.
27 The licensor of Bacula is the Free Software Foundation Europe
28 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
29 Switzerland, email:ftf@fsfeurope.org.
32 struct RES_ITEM; /* Declare forward referenced structure */
33 class RES; /* Declare forware referenced structure */
34 typedef void (MSG_RES_HANDLER)(LEX *lc, RES_ITEM *item, int index, int pass);
36 /* This is the structure that defines
37 * the record types (items) permitted within each
38 * resource. It is used to define the configuration
42 const char *name; /* Resource name i.e. Director, ... */
43 MSG_RES_HANDLER *handler; /* Routine storing the resource item */
45 char **value; /* Where to store the item */
56 int code; /* item code/additional info */
57 int flags; /* flags: default, required, ... */
58 int default_value; /* default value */
61 /* For storing name_addr items in res_items table */
62 #define ITEM(x) {(char **)&res_all.x}
64 #define MAX_RES_ITEMS 70 /* maximum resource items per RES */
66 /* This is the universal header that is
67 * at the beginning of every resource
72 RES *next; /* pointer to next resource of this type */
73 char *name; /* resource name */
74 char *desc; /* resource description */
75 int rcode; /* resource id or type */
76 int refcnt; /* reference count for releasing */
77 char item_present[MAX_RES_ITEMS]; /* set if item is present in conf file */
82 * Master Resource configuration structure definition
83 * This is the structure that defines the
84 * resources that are available to this daemon.
87 const char *name; /* resource name */
88 RES_ITEM *items; /* list of resource keywords */
89 int rcode; /* code if needed */
92 /* Common Resource definitions */
94 #define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1 /* maximum resource name length */
96 #define ITEM_REQUIRED 0x1 /* item required */
97 #define ITEM_DEFAULT 0x2 /* default supplied */
98 #define ITEM_NO_EQUALS 0x4 /* Don't scan = after name */
100 /* Message Resource */
104 char *mail_cmd; /* mail command */
105 char *operator_cmd; /* Operator command */
106 DEST *dest_chain; /* chain of destinations */
107 char send_msg[nbytes_for_bits(M_MAX+1)]; /* bit array of types */
113 inline char *MSGS::name() const { return hdr.name; }
116 /* Define the Union of all the above common
117 * resource structure definitions.
125 /* Configuration routines */
126 int parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error = NULL, int err_type=M_ERROR_TERM);
127 void free_config_resources(void);
128 RES **save_config_resources(void);
129 RES **new_res_head();
132 /* Resource routines */
133 RES *GetResWithName(int rcode, char *name);
134 RES *GetNextRes(int rcode, RES *res);
135 void b_LockRes(const char *file, int line);
136 void b_UnlockRes(const char *file, int line);
137 void dump_resource(int type, RES *res, void sendmsg(void *sock, const char *fmt, ...), void *sock);
138 void free_resource(RES *res, int type);
139 void init_resource(int type, RES_ITEM *item);
140 void save_resource(int type, RES_ITEM *item, int pass);
141 const char *res_to_str(int rcode);
143 /* Loop through each resource of type, returning in var */
145 #define foreach_res(var, type) \
146 for((var)=NULL; ((var)=(typeof(var))GetNextRes((type), (RES *)var));)
148 #define foreach_res(var, type) \
149 for(var=NULL; (*((void **)&(var))=(void *)GetNextRes((type), (RES *)var));)
154 void store_str(LEX *lc, RES_ITEM *item, int index, int pass);
155 void store_dir(LEX *lc, RES_ITEM *item, int index, int pass);
156 void store_password(LEX *lc, RES_ITEM *item, int index, int pass);
157 void store_name(LEX *lc, RES_ITEM *item, int index, int pass);
158 void store_strname(LEX *lc, RES_ITEM *item, int index, int pass);
159 void store_res(LEX *lc, RES_ITEM *item, int index, int pass);
160 void store_alist_res(LEX *lc, RES_ITEM *item, int index, int pass);
161 void store_alist_str(LEX *lc, RES_ITEM *item, int index, int pass);
162 void store_int(LEX *lc, RES_ITEM *item, int index, int pass);
163 void store_pint(LEX *lc, RES_ITEM *item, int index, int pass);
164 void store_msgs(LEX *lc, RES_ITEM *item, int index, int pass);
165 void store_int64(LEX *lc, RES_ITEM *item, int index, int pass);
166 void store_bit(LEX *lc, RES_ITEM *item, int index, int pass);
167 void store_bool(LEX *lc, RES_ITEM *item, int index, int pass);
168 void store_time(LEX *lc, RES_ITEM *item, int index, int pass);
169 void store_size(LEX *lc, RES_ITEM *item, int index, int pass);
170 void store_defs(LEX *lc, RES_ITEM *item, int index, int pass);
171 void store_label(LEX *lc, RES_ITEM *item, int index, int pass);