]> git.ipfire.org Git - thirdparty/bird.git/blob - proto/rip/config.Y
f_new_dynamic_attr gets third argument, type as filters know it.
[thirdparty/bird.git] / proto / rip / config.Y
1 /*
2 * BIRD -- RIP Configuration
3 *
4 * Can be freely distributed and used under the terms of the GNU GPL.
5 */
6
7 /*
8 To add:
9
10 version1 switch
11
12 */
13
14
15 CF_HDR
16
17 #include "proto/rip/rip.h"
18 #include "nest/iface.h"
19
20 #define RIP_CFG ((struct rip_proto_config *) this_proto)
21 #define RIP_IPATT ((struct rip_patt *) this_ipatt)
22
23 CF_DECLS
24
25 CF_KEYWORDS(RIP, INFINITY, METRIC, PORT, PERIOD, GARBAGETIME, PASSWORDS,
26 MODE, BROADCAST, QUIET, NOLISTEN, VERSION1,
27 AUTHENTICATION, NONE, PLAINTEXT, MD5,
28 HONOUR, NEVER, NEIGHBOUR, ALWAYS,
29 RIP_METRIC, RIP_TAG)
30
31 %type <i> rip_mode rip_auth
32
33 CF_GRAMMAR
34
35 CF_ADDTO(proto, RIP_CFG '}')
36
37 RIP_CFG_start: proto_start RIP {
38 RIP_CFG = proto_config_new(&proto_rip, sizeof(struct rip_proto_config));
39 rip_init_config(RIP_CFG);
40 }
41 ;
42
43 RIP_CFG:
44 RIP_CFG_start proto_name '{'
45 | RIP_CFG proto_item ';'
46 | RIP_CFG INFINITY expr ';' { RIP_CFG->infinity = $3; }
47 | RIP_CFG PORT expr ';' { RIP_CFG->port = $3; }
48 | RIP_CFG PERIOD expr ';' { RIP_CFG->period = $3; }
49 | RIP_CFG GARBAGETIME expr ';' { RIP_CFG->garbage_time = $3; }
50 | RIP_CFG AUTHENTICATION rip_auth ';' {RIP_CFG->authtype = $3; }
51 | RIP_CFG PASSWORDS '{' password_list '}' {RIP_CFG->passwords = $4; }
52 | RIP_CFG HONOUR ALWAYS ';' { RIP_CFG->honour = HO_ALWAYS; }
53 | RIP_CFG HONOUR NEIGHBOUR ';' { RIP_CFG->honour = HO_NEIGHBOUR; }
54 | RIP_CFG HONOUR NEVER ';' { RIP_CFG->honour = HO_NEVER; }
55 | RIP_CFG rip_iface_list ';'
56 ;
57
58 rip_auth:
59 PLAINTEXT { $$=AT_PLAINTEXT; }
60 | MD5 { $$=AT_MD5; }
61 | NONE { $$=AT_NONE; }
62 ;
63
64 rip_mode:
65 BROADCAST { $$=IM_BROADCAST; }
66 | QUIET { $$=IM_QUIET; }
67 | NOLISTEN { $$=IM_NOLISTEN; }
68 | VERSION1 { $$=IM_VERSION1 | IM_BROADCAST; }
69 ;
70
71 rip_iface_item:
72 | METRIC expr { RIP_IPATT->metric = $2; }
73 | MODE rip_mode { RIP_IPATT->mode |= $2; }
74 ;
75
76 rip_iface_opts:
77 '{'
78 | rip_iface_opts rip_iface_item ';'
79 ;
80
81 rip_iface_opt_list: /* EMPTY */ | rip_iface_opts '}' ;
82
83 rip_iface_init:
84 /* EMPTY */ {
85 struct rip_patt *k = cfg_allocz(sizeof(struct rip_patt));
86 k->metric = 1;
87 add_tail(&RIP_CFG->iface_list, &k->i.n);
88 this_ipatt = &k->i;
89 }
90 ;
91
92 rip_iface:
93 rip_iface_init iface_patt rip_iface_opt_list
94 ;
95
96 rip_iface_list:
97 INTERFACE rip_iface
98 | rip_iface_list ',' rip_iface
99 ;
100
101 CF_ADDTO(dynamic_attr, RIP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_RIP_METRIC); })
102 CF_ADDTO(dynamic_attr, RIP_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_RIP_TAG); })
103
104 CF_CODE
105
106 CF_END