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 struct 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
71 RES *next; /* pointer to next resource of this type */
72 char *name; /* resource name */
73 char *desc; /* resource description */
74 int rcode; /* resource id or type */
75 int refcnt; /* reference count for releasing */
76 char item_present[MAX_RES_ITEMS]; /* set if item is present in conf file */
81 * Master Resource configuration structure definition
82 * This is the structure that defines the
83 * resources that are available to this daemon.
86 const char *name; /* resource name */
87 RES_ITEM *items; /* list of resource keywords */
88 int rcode; /* code if needed */
91 /* Common Resource definitions */
93 #define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1 /* maximum resource name length */
95 #define ITEM_REQUIRED 0x1 /* item required */
96 #define ITEM_DEFAULT 0x2 /* default supplied */
97 #define ITEM_NO_EQUALS 0x4 /* Don't scan = after name */
99 /* Message Resource */
102 char *mail_cmd; /* mail command */
103 char *operator_cmd; /* Operator command */
104 DEST *dest_chain; /* chain of destinations */
105 char send_msg[nbytes_for_bits(M_MAX+1)]; /* bit array of types */
109 /* Define the Union of all the above common
110 * resource structure definitions.
118 /* Configuration routines */
119 int parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error = NULL, int err_type=M_ERROR_TERM);
120 void free_config_resources(void);
121 RES **save_config_resources(void);
122 RES **new_res_head();
125 /* Resource routines */
126 RES *GetResWithName(int rcode, char *name);
127 RES *GetNextRes(int rcode, RES *res);
128 void b_LockRes(const char *file, int line);
129 void b_UnlockRes(const char *file, int line);
130 void dump_resource(int type, RES *res, void sendmsg(void *sock, const char *fmt, ...), void *sock);
131 void free_resource(RES *res, int type);
132 void init_resource(int type, RES_ITEM *item);
133 void save_resource(int type, RES_ITEM *item, int pass);
134 const char *res_to_str(int rcode);
136 /* Loop through each resource of type, returning in var */
138 #define foreach_res(var, type) \
139 for((var)=NULL; ((var)=(typeof(var))GetNextRes((type), (RES *)var));)
141 #define foreach_res(var, type) \
142 for(var=NULL; (*((void **)&(var))=(void *)GetNextRes((type), (RES *)var));)
147 void store_str(LEX *lc, RES_ITEM *item, int index, int pass);
148 void store_dir(LEX *lc, RES_ITEM *item, int index, int pass);
149 void store_password(LEX *lc, RES_ITEM *item, int index, int pass);
150 void store_name(LEX *lc, RES_ITEM *item, int index, int pass);
151 void store_strname(LEX *lc, RES_ITEM *item, int index, int pass);
152 void store_res(LEX *lc, RES_ITEM *item, int index, int pass);
153 void store_alist_res(LEX *lc, RES_ITEM *item, int index, int pass);
154 void store_alist_str(LEX *lc, RES_ITEM *item, int index, int pass);
155 void store_int(LEX *lc, RES_ITEM *item, int index, int pass);
156 void store_pint(LEX *lc, RES_ITEM *item, int index, int pass);
157 void store_msgs(LEX *lc, RES_ITEM *item, int index, int pass);
158 void store_int64(LEX *lc, RES_ITEM *item, int index, int pass);
159 void store_bit(LEX *lc, RES_ITEM *item, int index, int pass);
160 void store_bool(LEX *lc, RES_ITEM *item, int index, int pass);
161 void store_time(LEX *lc, RES_ITEM *item, int index, int pass);
162 void store_size(LEX *lc, RES_ITEM *item, int index, int pass);
163 void store_defs(LEX *lc, RES_ITEM *item, int index, int pass);
164 void store_label(LEX *lc, RES_ITEM *item, int index, int pass);