| 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 |
adx |
366 |
#define CT_NLIST 6 |
| 35 |
adx |
209 |
|
| 36 |
|
|
typedef void CONFS_HANDLER(void); |
| 37 |
|
|
typedef void CONFF_HANDLER(void *, void *); |
| 38 |
|
|
|
| 39 |
|
|
struct ConfParserContext { |
| 40 |
|
|
FBFILE *f; |
| 41 |
|
|
char *filename; |
| 42 |
|
|
int lineno; |
| 43 |
|
|
}; |
| 44 |
|
|
|
| 45 |
|
|
struct ConfSection { |
| 46 |
|
|
const char *name; |
| 47 |
|
|
CONFS_HANDLER *before; |
| 48 |
|
|
CONFS_HANDLER *after; |
| 49 |
|
|
int pass; |
| 50 |
|
|
dlink_list fields; |
| 51 |
|
|
dlink_node node; |
| 52 |
|
|
}; |
| 53 |
|
|
|
| 54 |
|
|
struct ConfField { |
| 55 |
|
|
const char *name; |
| 56 |
|
|
int type; |
| 57 |
|
|
CONFF_HANDLER *handler; |
| 58 |
|
|
void *param; |
| 59 |
|
|
dlink_node node; |
| 60 |
|
|
}; |
| 61 |
|
|
|
| 62 |
|
|
void init_conf(void); |
| 63 |
|
|
void yyerror(const char *); |
| 64 |
|
|
int yylex(void); |
| 65 |
|
|
int conf_yy_input(char *, int); |
| 66 |
|
|
void conf_clear_ident_list(void); |
| 67 |
|
|
|
| 68 |
|
|
EXTERN int conf_pass, conf_cold; |
| 69 |
|
|
EXTERN struct ConfParserContext conf_curctx; |
| 70 |
|
|
EXTERN char conf_linebuf[]; |
| 71 |
|
|
EXTERN int conf_include_sptr; |
| 72 |
|
|
EXTERN struct Callback *reset_conf; |
| 73 |
|
|
EXTERN struct Callback *verify_conf; |
| 74 |
adx |
212 |
EXTERN struct Callback *switch_conf_pass; |
| 75 |
adx |
209 |
|
| 76 |
|
|
EXTERN void parse_error(const char *, ...); |
| 77 |
|
|
EXTERN void parse_fatal(const char *, ...); |
| 78 |
|
|
EXTERN struct ConfSection *find_conf_section(const char *); |
| 79 |
|
|
EXTERN struct ConfSection *add_conf_section(const char *, int); |
| 80 |
|
|
EXTERN void delete_conf_section(struct ConfSection *); |
| 81 |
|
|
EXTERN struct ConfField *find_conf_field(struct ConfSection *, char *); |
| 82 |
|
|
EXTERN void conf_assign(int, struct ConfField *, void *); |
| 83 |
|
|
EXTERN CONFF_HANDLER conf_assign_bool; |
| 84 |
|
|
EXTERN CONFF_HANDLER conf_assign_number; |
| 85 |
|
|
EXTERN CONFF_HANDLER conf_assign_string; |
| 86 |
|
|
EXTERN void add_conf_field(struct ConfSection *, const char *, int, |
| 87 |
|
|
CONFF_HANDLER *, void *); |