]>
git.ipfire.org Git - thirdparty/bird.git/blob - conf/conf.h
24e3217d19ebd02703e58673dff70639ef4e4c84
2 * BIRD Internet Routing Daemon -- Configuration File Handling
4 * (c) 1998--2000 Martin Mares <mj@ucw.cz>
6 * Can be freely distributed and used under the terms of the GNU GPL.
12 #include "lib/resource.h"
13 #include "lib/timer.h"
15 /* Configuration structure */
18 pool
*pool
; /* Pool the configuration is stored in */
19 linpool
*mem
; /* Linear pool containing configuration data */
20 list protos
; /* Configured protocol instances (struct proto_config) */
21 list tables
; /* Configured routing tables (struct rtable_config) */
22 list logfiles
; /* Configured log fils (sysdep) */
23 struct rtable_config
*master_rtc
; /* Configuration of master routing table */
24 u32 router_id
; /* Our Router ID */
25 unsigned int proto_default_debug
; /* Default protocol debug mask */
26 int cli_debug
; /* Tracing of CLI connections and commands */
27 char *err_msg
; /* Parser error message */
28 int err_lino
; /* Line containing error */
29 char *file_name
; /* Name of configuration file */
30 struct symbol
**sym_hash
; /* Lexer: symbol hash table */
31 struct symbol
**sym_fallback
; /* Lexer: fallback symbol hash table */
32 int obstacle_count
; /* Number of items blocking freeing of this config */
33 int shutdown
; /* This is a pseudo-config for daemon shutdown */
34 bird_clock_t load_time
; /* When we've got this configuration */
37 /* Please don't use these variables in protocols. Use proto_config->global instead. */
38 extern struct config
*config
; /* Currently active configuration */
39 extern struct config
*new_config
; /* Configuration being parsed */
40 extern struct config
*old_config
; /* Old configuration when reconfiguration is in progress */
41 extern struct config
*future_config
; /* New config held here if recon requested during recon */
43 extern int shutting_down
;
44 extern bird_clock_t boot_time
;
46 struct config
*config_alloc(byte
*name
);
47 int config_parse(struct config
*);
48 int cli_parse(struct config
*);
49 void config_free(struct config
*);
50 int config_commit(struct config
*);
51 void cf_error(char *msg
, ...) NORET
;
52 void config_add_obstacle(struct config
*);
53 void config_del_obstacle(struct config
*);
54 void order_shutdown(void);
57 #define CONF_PROGRESS 1
59 #define CONF_SHUTDOWN 3
63 extern linpool
*cfg_mem
;
65 #define cfg_alloc(size) lp_alloc(cfg_mem, size)
66 #define cfg_allocu(size) lp_allocu(cfg_mem, size)
67 #define cfg_allocz(size) lp_allocz(cfg_mem, size)
68 char *cfg_strdup(char *c
);
72 extern int (*cf_read_hook
)(byte
*buf
, unsigned int max
);
76 struct sym_scope
*scope
;
84 /* Remember to update cf_symbol_class_name() */
88 #define SYM_FUNCTION 3
93 #define SYM_VARIABLE 0x100 /* 0x100-0x1ff are variable types */
98 void cf_lex_init(int is_cli
);
99 struct symbol
*cf_find_symbol(byte
*c
);
100 struct symbol
*cf_default_name(char *template, int *counter
);
101 void cf_define_symbol(struct symbol
*symbol
, int type
, void *def
);
102 void cf_push_scope(struct symbol
*);
103 void cf_pop_scope(void);
104 struct symbol
*cf_walk_symbols(struct config
*cf
, struct symbol
*sym
, int *pos
);
105 char *cf_symbol_class_name(struct symbol
*sym
);
113 void sysdep_preconfig(struct config
*);
114 int sysdep_commit(struct config
*, struct config
*);
115 void sysdep_shutdown_done(void);