--- embedaddon/bird/conf/conf.h 2017/08/22 12:33:54 1.1 +++ embedaddon/bird/conf/conf.h 2021/03/17 19:50:23 1.1.1.2 @@ -11,6 +11,7 @@ #include "lib/resource.h" #include "lib/timer.h" +#include "lib/hash.h" /* Configuration structure */ @@ -47,11 +48,12 @@ struct config { u32 watchdog_timeout; /* Watchdog timeout (in seconds, 0 = disabled) */ char *err_msg; /* Parser error message */ int err_lino; /* Line containing error */ + int err_chno; /* Character where the parser stopped */ char *err_file_name; /* File name containing error */ char *file_name; /* Name of main configuration file */ int file_fd; /* File descriptor of main configuration file */ - struct symbol **sym_hash; /* Lexer: symbol hash table */ - struct symbol **sym_fallback; /* Lexer: fallback symbol hash table */ + HASH(struct symbol) sym_hash; /* Lexer: symbol hash table */ + struct config *fallback; /* Link to regular config for CLI parsing */ int obstacle_count; /* Number of items blocking freeing of this config */ int shutdown; /* This is a pseudo-config for daemon shutdown */ bird_clock_t load_time; /* When we've got this configuration */ @@ -112,6 +114,12 @@ struct symbol { char name[1]; }; +struct sym_scope { + struct sym_scope *next; /* Next on scope stack */ + struct symbol *name; /* Name of this scope */ + int active; /* Currently entered */ +}; + #define SYM_MAX_LEN 64 /* Remember to update cf_symbol_class_name() */ @@ -134,6 +142,8 @@ struct include_file_stack { char *file_name; /* File name */ int fd; /* File descriptor */ int lino; /* Current line num */ + int chno; /* Current char num (on current line) */ + int toklen; /* Current token length */ int depth; /* Include depth, 0 = cannot include */ struct include_file_stack *prev; /* Previous record in stack */ @@ -142,7 +152,6 @@ struct include_file_stack { extern struct include_file_stack *ifs; - int cf_lex(void); void cf_lex_init(int is_cli, struct config *c); void cf_lex_unwind(void); @@ -154,7 +163,6 @@ struct symbol *cf_default_name(char *template, int *co struct symbol *cf_define_symbol(struct symbol *symbol, int type, void *def); void cf_push_scope(struct symbol *); void cf_pop_scope(void); -struct symbol *cf_walk_symbols(struct config *cf, struct symbol *sym, int *pos); char *cf_symbol_class_name(struct symbol *sym); static inline int cf_symbol_is_constant(struct symbol *sym)