1 |
adx |
209 |
/* |
2 |
|
|
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
|
|
* manager.h: A header for the configuration manager. |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2003 by Piotr Nizynski, Advanced IRC Services Project |
6 |
|
|
* Copyright (C) 2005 by the Hybrid Development Team. |
7 |
|
|
* |
8 |
|
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
11 |
|
|
* (at your option) any later version. |
12 |
|
|
* |
13 |
|
|
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program; if not, write to the Free Software |
20 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
21 |
|
|
* USA |
22 |
|
|
* |
23 |
|
|
* $Id$ |
24 |
|
|
*/ |
25 |
|
|
|
26 |
|
|
#define CONF_BUFSIZE 512 |
27 |
|
|
|
28 |
|
|
#define CT_NUMBER 0 |
29 |
|
|
#define CT_BOOL 1 |
30 |
|
|
#define CT_TIME 2 |
31 |
|
|
#define CT_SIZE 3 |
32 |
|
|
#define CT_STRING 4 |
33 |
|
|
#define CT_LIST 5 |
34 |
|
|
|
35 |
|
|
typedef void CONFS_HANDLER(void); |
36 |
|
|
typedef void CONFF_HANDLER(void *, void *); |
37 |
|
|
|
38 |
|
|
struct ConfParserContext { |
39 |
|
|
FBFILE *f; |
40 |
|
|
char *filename; |
41 |
|
|
int lineno; |
42 |
|
|
}; |
43 |
|
|
|
44 |
|
|
struct ConfSection { |
45 |
|
|
const char *name; |
46 |
|
|
CONFS_HANDLER *before; |
47 |
|
|
CONFS_HANDLER *after; |
48 |
|
|
int pass; |
49 |
|
|
dlink_list fields; |
50 |
|
|
dlink_node node; |
51 |
|
|
}; |
52 |
|
|
|
53 |
|
|
struct ConfField { |
54 |
|
|
const char *name; |
55 |
|
|
int type; |
56 |
|
|
CONFF_HANDLER *handler; |
57 |
|
|
void *param; |
58 |
|
|
dlink_node node; |
59 |
|
|
}; |
60 |
|
|
|
61 |
|
|
void init_conf(void); |
62 |
|
|
void yyerror(const char *); |
63 |
|
|
int yylex(void); |
64 |
|
|
int conf_yy_input(char *, int); |
65 |
|
|
void conf_clear_ident_list(void); |
66 |
|
|
|
67 |
|
|
EXTERN int conf_pass, conf_cold; |
68 |
|
|
EXTERN struct ConfParserContext conf_curctx; |
69 |
|
|
EXTERN char conf_linebuf[]; |
70 |
|
|
EXTERN int conf_include_sptr; |
71 |
|
|
EXTERN struct Callback *reset_conf; |
72 |
|
|
EXTERN struct Callback *verify_conf; |
73 |
adx |
212 |
EXTERN struct Callback *switch_conf_pass; |
74 |
adx |
209 |
|
75 |
|
|
EXTERN void parse_error(const char *, ...); |
76 |
|
|
EXTERN void parse_fatal(const char *, ...); |
77 |
|
|
EXTERN struct ConfSection *find_conf_section(const char *); |
78 |
|
|
EXTERN struct ConfSection *add_conf_section(const char *, int); |
79 |
|
|
EXTERN void delete_conf_section(struct ConfSection *); |
80 |
|
|
EXTERN struct ConfField *find_conf_field(struct ConfSection *, char *); |
81 |
|
|
EXTERN void conf_assign(int, struct ConfField *, void *); |
82 |
|
|
EXTERN CONFF_HANDLER conf_assign_bool; |
83 |
|
|
EXTERN CONFF_HANDLER conf_assign_number; |
84 |
|
|
EXTERN CONFF_HANDLER conf_assign_string; |
85 |
|
|
EXTERN void add_conf_field(struct ConfSection *, const char *, int, |
86 |
|
|
CONFF_HANDLER *, void *); |