5 Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of
10 the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public
18 License along with this program; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
24 struct res_items; /* Declare forward referenced structure */
25 typedef void (MSG_RES_HANDLER)(LEX *lc, struct res_items *item, int index, int pass);
27 /* This is the structure that defines
28 * the record types (items) permitted within each
29 * resource. It is used to define the configuration
33 char *name; /* Resource name i.e. Director, ... */
34 MSG_RES_HANDLER *handler; /* Routine storing the resource item */
35 void **value; /* Where to store the item */
36 int code; /* item code/additional info */
37 int flags; /* flags: default, required, ... */
38 int default_value; /* default value */
41 /* For storing name_addr items in res_items table */
42 #define ITEM(x) ((void **)&res_all.x)
44 #define MAX_RES_ITEMS 50 /* maximum resource items per RES */
46 /* This is the universal header that is
47 * at the beginning of every resource
51 RES *next; /* pointer to next resource of this type */
52 char *name; /* resource name */
53 char *desc; /* resource description */
54 int rcode; /* resource id or type */
55 int refcnt; /* reference count for releasing */
56 char item_present[MAX_RES_ITEMS]; /* set if item is present in conf file */
61 * Master Resource configuration structure definition
62 * This is the structure that defines the
63 * resources that are available to this daemon.
66 char *name; /* resource name */
67 struct res_items *items; /* list of resource keywords */
68 int rcode; /* code if needed */
69 RES *res_head; /* where to store it */
72 /* Common Resource definitions */
74 #define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1 /* maximum resource name length */
76 #define ITEM_REQUIRED 0x1 /* item required */
77 #define ITEM_DEFAULT 0x2 /* default supplied */
78 #define ITEM_NO_EQUALS 0x4 /* Don't scan = after name */
80 /* Message Resource */
83 char *mail_cmd; /* mail command */
84 char *operator_cmd; /* Operator command */
85 DEST *dest_chain; /* chain of destinations */
86 char send_msg[nbytes_for_bits(M_MAX+1)]; /* bit array of types */
90 /* Define the Union of all the above common
91 * resource structure definitions.
99 /* Configuration routines */
100 void parse_config(char *cf);
101 void free_config_resources(void);
103 /* Resource routines */
104 RES *GetResWithName(int rcode, char *name);
105 RES *GetNextRes(int rcode, RES *res);
107 void UnlockRes(void);
108 void dump_resource(int type, RES *res, void sendmsg(void *sock, char *fmt, ...), void *sock);
109 void free_resource(int type);
110 void init_resource(int type, struct res_items *item);
111 void save_resource(int type, struct res_items *item, int pass);
112 char *res_to_str(int rcode);
114 void store_str(LEX *lc, struct res_items *item, int index, int pass);
115 void store_dir(LEX *lc, struct res_items *item, int index, int pass);
116 void store_password(LEX *lc, struct res_items *item, int index, int pass);
117 void store_name(LEX *lc, struct res_items *item, int index, int pass);
118 void store_strname(LEX *lc, struct res_items *item, int index, int pass);
119 void store_res(LEX *lc, struct res_items *item, int index, int pass);
120 void store_int(LEX *lc, struct res_items *item, int index, int pass);
121 void store_pint(LEX *lc, struct res_items *item, int index, int pass);
122 void store_msgs(LEX *lc, struct res_items *item, int index, int pass);
123 void store_int64(LEX *lc, struct res_items *item, int index, int pass);
124 void store_yesno(LEX *lc, struct res_items *item, int index, int pass);
125 void store_time(LEX *lc, struct res_items *item, int index, int pass);
126 void store_size(LEX *lc, struct res_items *item, int index, int pass);
127 void store_defs(LEX *lc, struct res_items *item, int index, int pass);