1 |
/* |
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; |
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 |
|
74 |
EXTERN void parse_error(const char *, ...); |
75 |
EXTERN struct ConfSection *find_conf_section(const char *); |
76 |
EXTERN struct ConfSection *add_conf_section(const char *, int); |
77 |
EXTERN void delete_conf_section(struct ConfSection *); |
78 |
EXTERN struct ConfField *find_conf_field(struct ConfSection *, char *); |
79 |
EXTERN void conf_assign(int, struct ConfField *, void *); |
80 |
EXTERN CONFF_HANDLER conf_assign_bool; |
81 |
EXTERN CONFF_HANDLER conf_assign_number; |
82 |
EXTERN CONFF_HANDLER conf_assign_string; |
83 |
EXTERN void add_conf_field(struct ConfSection *, const char *, int, |
84 |
CONFF_HANDLER *, void *); |