Statistics
| Branch: | Revision:

iof-bird-daemon / proto / rip / config.Y @ b21f68b4

History | View | Annotate | Download (2.54 KB)

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
CF_DEFINES
21

    
22
#define RIP_CFG ((struct rip_proto_config *) this_proto)
23
#define RIP_IPATT ((struct rip_patt *) this_ipatt)
24

    
25
CF_DECLS
26

    
27
CF_KEYWORDS(RIP, INFINITY, METRIC, PORT, PERIOD, GARBAGE, TIMEOUT, PASSWORDS,
28
	    MODE, BROADCAST, MULTICAST, QUIET, NOLISTEN, VERSION1, 
29
	    AUTHENTICATION, NONE, PLAINTEXT, MD5,
30
	    HONOR, NEVER, NEIGHBOR, ALWAYS,
31
	    RIP_METRIC, RIP_TAG)
32

    
33
%type <i> rip_mode rip_auth
34

    
35
CF_GRAMMAR
36

    
37
CF_ADDTO(proto, rip_cfg '}' { RIP_CFG->passwords = get_passwords(); } )
38

    
39
rip_cfg_start: proto_start RIP {
40
     this_proto = proto_config_new(&proto_rip, sizeof(struct rip_proto_config));
41
     rip_init_config(RIP_CFG);
42
   }
43
 ;
44

    
45
rip_cfg:
46
   rip_cfg_start proto_name '{'
47
 | rip_cfg proto_item ';'
48
 | rip_cfg INFINITY expr ';'	{ RIP_CFG->infinity = $3; }
49
 | rip_cfg PORT expr ';'	{ RIP_CFG->port = $3; }
50
 | rip_cfg PERIOD expr ';'	{ RIP_CFG->period = $3; }
51
 | rip_cfg GARBAGE TIME expr ';' { RIP_CFG->garbage_time = $4; }
52
 | rip_cfg TIMEOUT TIME expr ';' { RIP_CFG->timeout_time = $4; }
53
 | rip_cfg AUTHENTICATION rip_auth ';' {RIP_CFG->authtype = $3; }
54
 | rip_cfg password_list ';'
55
 | rip_cfg HONOR ALWAYS ';'    { RIP_CFG->honor = HO_ALWAYS; }
56
 | rip_cfg HONOR NEIGHBOR ';'    { RIP_CFG->honor = HO_NEIGHBOR; }
57
 | rip_cfg HONOR NEVER ';'    { RIP_CFG->honor = HO_NEVER; }
58
 | rip_cfg rip_iface_list ';'
59
 ;
60

    
61
rip_auth:
62
   PLAINTEXT { $$=AT_PLAINTEXT; }
63
 | MD5 { $$=AT_MD5; }
64
 | NONE { $$=AT_NONE; }
65
 ;
66

    
67
rip_mode: 
68
    BROADCAST { $$=IM_BROADCAST; }
69
  | MULTICAST { $$=0; }
70
  | QUIET     { $$=IM_QUIET; }
71
  | NOLISTEN  { $$=IM_NOLISTEN; }
72
  | VERSION1  { $$=IM_VERSION1 | IM_BROADCAST; }
73
 ;
74

    
75
rip_iface_item:
76
 | METRIC expr { RIP_IPATT->metric = $2; }
77
 | MODE rip_mode { RIP_IPATT->mode |= $2; }
78
 ;
79

    
80
rip_iface_opts: 
81
   '{'
82
 | rip_iface_opts rip_iface_item ';'
83
 ;
84

    
85
rip_iface_opt_list: /* EMPTY */ | rip_iface_opts '}' ;
86

    
87
rip_iface_init:
88
   /* EMPTY */ {
89
     struct rip_patt *k = cfg_allocz(sizeof(struct rip_patt));
90
     k->metric = 1;
91
     add_tail(&RIP_CFG->iface_list, &k->i.n);
92
     this_ipatt = &k->i;
93
   }
94
 ;
95

    
96
rip_iface:
97
   rip_iface_init iface_patt rip_iface_opt_list
98
 ;
99

    
100
rip_iface_list:
101
   INTERFACE rip_iface
102
 | rip_iface_list ',' rip_iface
103
 ;
104

    
105
CF_ADDTO(dynamic_attr, RIP_METRIC { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_RIP_METRIC); })
106
CF_ADDTO(dynamic_attr, RIP_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_RIP_TAG); })
107

    
108
CF_CODE
109

    
110
CF_END