diff options
Diffstat (limited to 'conf/conf.h')
-rw-r--r-- | conf/conf.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/conf/conf.h b/conf/conf.h index 6c784d7e..df772681 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -12,6 +12,8 @@ #include "lib/resource.h" #include "lib/timer.h" +#define BIRD_FNAME_MAX 255 /* Would be better to use some UNIX define */ + /* Configuration structure */ struct config { @@ -38,7 +40,9 @@ struct config { int cli_debug; /* Tracing of CLI connections and commands */ char *err_msg; /* Parser error message */ int err_lino; /* Line containing error */ - char *file_name; /* Name of configuration file */ + 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 */ int obstacle_count; /* Number of items blocking freeing of this config */ @@ -83,7 +87,8 @@ char *cfg_strdup(char *c); /* Lexer */ -extern int (*cf_read_hook)(byte *buf, unsigned int max); +extern int (*cf_read_hook)(byte *buf, unsigned int max, int fd); +extern int (*cf_open_hook)(char *filename); struct symbol { struct symbol *next; @@ -106,10 +111,20 @@ struct symbol { #define SYM_VARIABLE 0x100 /* 0x100-0x1ff are variable types */ -extern int conf_lino; +struct include_file_stack { + void *stack; /* Internal lexer state */ + unsigned int conf_lino; /* Current file lineno (at include) */ + char conf_fname[BIRD_FNAME_MAX]; /* Current file name */ + int conf_fd; /* Current file descriptor */ + struct include_file_stack *prev; + struct include_file_stack *next; +}; + +struct include_file_stack *ifs; + int cf_lex(void); -void cf_lex_init(int is_cli); +void cf_lex_init(int is_cli, struct config *c); struct symbol *cf_find_symbol(byte *c); struct symbol *cf_default_name(char *template, int *counter); struct symbol *cf_define_symbol(struct symbol *symbol, int type, void *def); |