/* * BIRD -- Configuration Parser Top * * (c) 1998--2000 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ CF_HDR #define PARSER 1 #include "nest/bird.h" #include "conf/conf.h" #include "lib/resource.h" #include "lib/socket.h" #include "lib/timer.h" #include "lib/string.h" #include "nest/protocol.h" #include "nest/iface.h" #include "nest/route.h" #include "nest/cli.h" #include "filter/filter.h" /* FIXME: Turn on YYERROR_VERBOSE and work around lots of bison bugs? */ CF_DEFINES static void check_u16(uint val) { if (val > 0xFFFF) cf_error("Value %u out of range (0-65535)", val); } #define cf_assert(cond, ...) do { if (!(cond)) cf_error(__VA_ARGS__); } while (0) static inline void cf_assert_symbol(const struct symbol *sym, uint class) { switch (class) { case SYM_PROTO: cf_assert(sym->class == SYM_PROTO, "Protocol name required"); break; case SYM_TEMPLATE: cf_assert(sym->class == SYM_TEMPLATE, "Protocol template name required"); break; case SYM_FUNCTION: cf_assert(sym->class == SYM_FUNCTION, "Function name required"); break; case SYM_FILTER: cf_assert(sym->class == SYM_FILTER, "Filter name required"); break; case SYM_TABLE: cf_assert(sym->class == SYM_TABLE, "Table name required"); break; case SYM_ATTRIBUTE: cf_assert(sym->class == SYM_ATTRIBUTE, "Custom attribute name required"); break; case SYM_VARIABLE: cf_assert((sym->class & ~0xff) == SYM_VARIABLE, "Variable name required"); break; case SYM_CONSTANT: cf_assert((sym->class & ~0xff) == SYM_CONSTANT, "Constant name required"); break; default: bug("This shall not happen"); } } CF_DECLS %union { uint i; u32 i32; u64 i64; ip_addr a; ip4_addr ip4; ip6_addr ip6; net_addr net; net_addr *net_ptr; struct symbol *s; char *t; struct rtable_config *r; struct channel_config *cc; struct f_inst *x; struct f_inst *xp[2]; enum filter_return fret; enum ec_subtype ecs; struct f_dynamic_attr fda; struct f_static_attr fsa; struct f_lval flv; const struct f_line *fl; const struct filter *f; struct f_tree *e; struct f_trie *trie; struct f_val v; struct password_item *p; struct rt_show_data *ra; struct sym_show_data *sd; struct lsadb_show_data *ld; struct mrt_dump_data *md; struct iface *iface; void *g; btime time; struct f_prefix px; struct proto_spec ps; struct channel_limit cl; struct timeformat *tf; mpls_label_stack *mls; } %token END CLI_MARKER INVALID_TOKEN ELSECOL DDOT %token GEQ LEQ NEQ AND OR %token PO PC %token NUM ENUM %token IP4 %token IP6 %token VPN_RD %token CF_SYM_KNOWN CF_SYM_UNDEFINED %token TEXT %type ipa_scope %type expr bool pxlen4 %type