diff options
author | Martin Mares <mj@ucw.cz> | 1999-05-17 22:06:19 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-05-17 22:06:19 +0200 |
commit | 4107df1d1b7454a16e6f45ea55aae13b01c9f566 (patch) | |
tree | 633f4f7a266cb62d0aea1a08d6f2d7538573e8cc /conf | |
parent | b23c5e0ff4e9071b2568bf2f7d437bc13273d17d (diff) | |
download | bird-4107df1d1b7454a16e6f45ea55aae13b01c9f566.tar bird-4107df1d1b7454a16e6f45ea55aae13b01c9f566.zip |
Implemented two new symbol handling functions:
o cf_define_symbol() -- it assigns a meaning to a symbol, bailing
out if it already has one.
o cf_find_symbol() -- finds symbol by name and creates it if not found.
Also modified filter/config.Y to make use of the first function.
Diffstat (limited to 'conf')
-rw-r--r-- | conf/cf-lex.l | 15 | ||||
-rw-r--r-- | conf/conf.h | 5 |
2 files changed, 20 insertions, 0 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l index ca7bfae..94c2b2a 100644 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@ -183,6 +183,12 @@ cf_find_sym(byte *c, unsigned int h0) } struct symbol * +cf_find_symbol(byte *c) +{ + return cf_find_sym(c, cf_hash(c)); +} + +struct symbol * cf_default_name(char *prefix, int *counter) { char buf[32]; @@ -199,6 +205,15 @@ cf_default_name(char *prefix, int *counter) } void +cf_define_symbol(struct symbol *sym, int type, void *def) +{ + if (sym->class) + cf_error("Symbol already defined"); + sym->class = type; + sym->def = def; +} + +void cf_lex_init(int flag) { if (allow_new_symbols = flag) diff --git a/conf/conf.h b/conf/conf.h index 83d92c3..8604324 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -17,6 +17,8 @@ struct config { pool *pool; /* Pool the configuration is stored in */ linpool *mem; /* Linear pool containing configuration data */ list protos; /* Configured protocol instances (struct proto_config) */ + list tables; /* Configured routing tables (struct rtable_config) */ + struct rtable_config *master_rtc; /* Configuration of master routing table */ u32 router_id; /* Our Router ID */ char *err_msg; /* Parser error message */ int err_lino; /* Line containing error */ @@ -60,6 +62,7 @@ struct symbol { #define SYM_STAT 3 /* statement */ #define SYM_FUNCTION 5 #define SYM_FILTER 6 +#define SYM_TABLE 7 #define SYM_VARIABLE 0x100 /* Reserved 0x100..0x1ff */ @@ -68,7 +71,9 @@ extern int conf_lino; void cf_lex_init_tables(void); int cf_lex(void); void cf_lex_init(int flag); +struct symbol *cf_find_symbol(byte *c); struct symbol *cf_default_name(char *prefix, int *counter); +void cf_define_symbol(struct symbol *symbol, int type, void *def); /* Parser */ |