]>
Commit | Line | Data |
---|---|---|
fe7cec12 MM |
1 | /* |
2 | * BIRD Internet Routing Daemon -- Configuration File Handling | |
3 | * | |
31b3e1bb | 4 | * (c) 1998--1999 Martin Mares <mj@ucw.cz> |
fe7cec12 MM |
5 | * |
6 | * Can be freely distributed and used under the terms of the GNU GPL. | |
7 | */ | |
8 | ||
9 | #ifndef _BIRD_CONF_H_ | |
10 | #define _BIRD_CONF_H_ | |
11 | ||
12 | #include "lib/resource.h" | |
13 | ||
31b3e1bb MM |
14 | /* Configuration structure */ |
15 | ||
16 | struct config { | |
17 | pool *pool; /* Pool the configuration is stored in */ | |
18 | linpool *mem; /* Linear pool containing configuration data */ | |
19 | list protos; /* Configured protocol instances (struct proto_config) */ | |
20 | u32 router_id; /* Our Router ID */ | |
31b3e1bb MM |
21 | char *err_msg; /* Parser error message */ |
22 | int err_lino; /* Line containing error */ | |
23 | char *file_name; /* Name of configuration file */ | |
24 | }; | |
25 | ||
26 | extern struct config *config, *new_config; | |
27 | /* Please don't use these variables in protocols. Use proto_config->global instead. */ | |
28 | ||
29 | struct config *config_alloc(byte *name); | |
30 | int config_parse(struct config *); | |
31 | void config_free(struct config *); | |
32 | void config_commit(struct config *); | |
33 | void cf_error(char *msg, ...) NORET; | |
34 | ||
49e4a4d1 MM |
35 | /* Pools */ |
36 | ||
fe7cec12 | 37 | extern pool *cfg_pool; |
b35d72ac | 38 | extern linpool *cfg_mem; |
fe7cec12 | 39 | |
b35d72ac MM |
40 | #define cfg_alloc(size) lp_alloc(cfg_mem, size) |
41 | #define cfg_allocu(size) lp_allocu(cfg_mem, size) | |
42 | #define cfg_allocz(size) lp_allocz(cfg_mem, size) | |
43 | char *cfg_strdup(char *c); | |
49e4a4d1 | 44 | |
fe7cec12 MM |
45 | /* Lexer */ |
46 | ||
47 | extern int (*cf_read_hook)(byte *buf, unsigned int max); | |
48 | ||
49 | struct symbol { | |
50 | struct symbol *next; | |
51 | int class; | |
0b62c3a7 | 52 | int aux; |
fe7cec12 MM |
53 | void *def; |
54 | char name[1]; | |
55 | }; | |
56 | ||
57 | #define SYM_VOID 0 | |
8450be97 | 58 | #define SYM_PROTO 1 |
0b62c3a7 | 59 | #define SYM_NUMBER 2 |
72380a34 PM |
60 | #define SYM_STAT 3 /* statement */ |
61 | #define SYM_VARIABLE_INT 4 | |
62 | #define SYM_FUNCTION 5 | |
63 | #define SYM_FILTER 6 | |
fe7cec12 | 64 | |
31b3e1bb MM |
65 | extern int conf_lino; |
66 | ||
fe7cec12 MM |
67 | void cf_lex_init_tables(void); |
68 | int cf_lex(void); | |
69 | void cf_lex_init(int flag); | |
8450be97 | 70 | struct symbol *cf_default_name(char *prefix); |
fe7cec12 MM |
71 | |
72 | /* Parser */ | |
73 | ||
74 | int cf_parse(void); | |
75 | ||
76 | #endif |