]>
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) */ | |
4107df1d MM |
20 | list tables; /* Configured routing tables (struct rtable_config) */ |
21 | struct rtable_config *master_rtc; /* Configuration of master routing table */ | |
31b3e1bb | 22 | u32 router_id; /* Our Router ID */ |
31b3e1bb MM |
23 | char *err_msg; /* Parser error message */ |
24 | int err_lino; /* Line containing error */ | |
25 | char *file_name; /* Name of configuration file */ | |
26 | }; | |
27 | ||
28 | extern struct config *config, *new_config; | |
29 | /* Please don't use these variables in protocols. Use proto_config->global instead. */ | |
30 | ||
31 | struct config *config_alloc(byte *name); | |
32 | int config_parse(struct config *); | |
bc2fb680 | 33 | int cli_parse(struct config *); |
31b3e1bb MM |
34 | void config_free(struct config *); |
35 | void config_commit(struct config *); | |
36 | void cf_error(char *msg, ...) NORET; | |
37 | ||
49e4a4d1 MM |
38 | /* Pools */ |
39 | ||
b35d72ac | 40 | extern linpool *cfg_mem; |
fe7cec12 | 41 | |
b35d72ac MM |
42 | #define cfg_alloc(size) lp_alloc(cfg_mem, size) |
43 | #define cfg_allocu(size) lp_allocu(cfg_mem, size) | |
44 | #define cfg_allocz(size) lp_allocz(cfg_mem, size) | |
45 | char *cfg_strdup(char *c); | |
49e4a4d1 | 46 | |
fe7cec12 MM |
47 | /* Lexer */ |
48 | ||
49 | extern int (*cf_read_hook)(byte *buf, unsigned int max); | |
50 | ||
51 | struct symbol { | |
52 | struct symbol *next; | |
c8f61a01 | 53 | struct sym_scope *scope; |
fe7cec12 | 54 | int class; |
0b62c3a7 | 55 | int aux; |
6542ece9 | 56 | void *aux2; |
fe7cec12 MM |
57 | void *def; |
58 | char name[1]; | |
59 | }; | |
60 | ||
61 | #define SYM_VOID 0 | |
8450be97 | 62 | #define SYM_PROTO 1 |
0b62c3a7 | 63 | #define SYM_NUMBER 2 |
72380a34 | 64 | #define SYM_STAT 3 /* statement */ |
72380a34 PM |
65 | #define SYM_FUNCTION 5 |
66 | #define SYM_FILTER 6 | |
4107df1d | 67 | #define SYM_TABLE 7 |
fe7cec12 | 68 | |
ba921648 PM |
69 | #define SYM_VARIABLE 0x100 /* Reserved 0x100..0x1ff */ |
70 | ||
31b3e1bb MM |
71 | extern int conf_lino; |
72 | ||
fe7cec12 MM |
73 | void cf_lex_init_tables(void); |
74 | int cf_lex(void); | |
bc2fb680 | 75 | void cf_lex_init(int is_cli); |
4107df1d | 76 | struct symbol *cf_find_symbol(byte *c); |
4ba84ebc | 77 | struct symbol *cf_default_name(char *prefix, int *counter); |
4107df1d | 78 | void cf_define_symbol(struct symbol *symbol, int type, void *def); |
df8b85e3 MM |
79 | void cf_push_scope(struct symbol *); |
80 | void cf_pop_scope(void); | |
fe7cec12 MM |
81 | |
82 | /* Parser */ | |
83 | ||
84 | int cf_parse(void); | |
85 | ||
86 | #endif |