]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Hopefully ended translating to new interface
authorPavel Machek <pavel@ucw.cz>
Mon, 1 Mar 1999 21:18:01 +0000 (21:18 +0000)
committerPavel Machek <pavel@ucw.cz>
Mon, 1 Mar 1999 21:18:01 +0000 (21:18 +0000)
proto/rip/config.Y
proto/rip/rip.c
proto/rip/rip.h

index c1ed78e75b8918944d7126e4c62c527e0e724468..2030a62eca9e93c91ad727163d6c84856123ecbb 100644 (file)
@@ -24,7 +24,7 @@ CF_HDR
 void rip_dev_add_iface(char *);
 struct rip_patt *rip_get_iface(void);
 
-#define RIP_PROTO ((struct rip_proto_config *) this_proto)
+#define RIP_CFG ((struct rip_proto_config *) this_proto)
 
 CF_DECLS
 
@@ -34,22 +34,22 @@ CF_KEYWORDS(RIP, INFINITY, METRIC, PORT, PERIOD, GARBAGETIME, MODE, MULTICAST, B
 
 CF_GRAMMAR
 
-CF_ADDTO(proto, rip_proto '}')
+CF_ADDTO(proto, RIP_CFG '}')
 
-rip_proto_start: proto_start RIP {
-     RIP_PROTO = proto_new(&proto_rip, sizeof(struct rip_proto));
-     rip_init_instance(RIP_PROTO);
+RIP_CFG_start: proto_start RIP {
+     RIP_CFG = proto_config_new(&proto_rip, sizeof(struct rip_proto_config));
+     rip_init_config(RIP_CFG);
    }
  ;
 
-rip_proto:
-   rip_proto_start proto_name '{'
- | rip_proto proto_item ';'
- | rip_proto INFINITY expr ';' { RIP_PROTO->infinity = $3; }
- | rip_proto PORT expr ';'     { RIP_PROTO->port = $3; }
- | rip_proto PERIOD expr ';'   { RIP_PROTO->period = $3; }
- | rip_proto GARBAGETIME expr ';' { RIP_PROTO->garbage_time = $3; }
- | rip_proto rip_iface_list ';'
+RIP_CFG:
+   RIP_CFG_start proto_name '{'
+ | RIP_CFG proto_item ';'
+ | RIP_CFG INFINITY expr ';'   { RIP_CFG->infinity = $3; }
+ | RIP_CFG PORT expr ';'       { RIP_CFG->port = $3; }
+ | RIP_CFG PERIOD expr ';'     { RIP_CFG->period = $3; }
+ | RIP_CFG GARBAGETIME expr ';' { RIP_CFG->garbage_time = $3; }
+ | RIP_CFG rip_iface_list ';'
  ;
 
 
@@ -91,13 +91,13 @@ rip_dev_add_iface(char *n)
   struct rip_patt *k = cfg_alloc(sizeof(struct rip_patt));
 
   k->i.pattern = cfg_strdup(n);
-  add_tail(&RIP_PROTO->iface_list, &k->i.n);
+  add_tail(&RIP_CFG->iface_list, &k->i.n);
 }
 
 struct rip_patt *
 rip_get_iface(void)
 {
-  struct rip_patt *k = TAIL(RIP_PROTO->iface_list);
+  struct rip_patt *k = TAIL(RIP_CFG->iface_list);
   if (!k)
     cf_error( "This cannot happen" );
   return k;
index cb0add451d77f0e7d902f96c726d156eb4d6e681..9c04cf4c59fab7d14410e0ec2a99670eeb98a86d 100644 (file)
@@ -410,7 +410,7 @@ rip_start(struct proto *p)
 static struct proto *
 rip_init(struct proto_config *cfg)
 {
-  struct proto *p = proto_new(cfg, sizeof(struct proto));
+  struct proto *p = proto_new(cfg, sizeof(struct rip_proto));
 
   return p;
 }
@@ -422,6 +422,8 @@ rip_dump(struct proto *p)
   node *w, *e;
   struct rip_interface *rif;
   i = 0;
+
+  CHK_MAGIC;
   WALK_LIST( w, P->connections ) {
     struct rip_connection *n = (void *) w;
     debug( "RIP: connection #%d: %I\n", n->num, n->addr );
@@ -598,14 +600,16 @@ rip_init_instance(struct proto *p)
   p->rta_same = rip_rta_same;
   p->rte_insert = rip_rte_insert;
   p->rte_remove = rip_rte_remove;
+}
 
-#warning FIXME: this is almost certianly wrong, I need to setup config elsewhere
-  P_CF->infinity       = 16;
-  P_CF->port   = 520;
-  P_CF->period = 30;
-  P_CF->garbage_time = 120+180;
-
-  init_list(&P_CF->iface_list);
+void
+rip_init_config(struct rip_proto_config *c)
+{
+  init_list(&c->iface_list);
+  c->infinity  = 16;
+  c->port      = 520;
+  c->period    = 30;
+  c->garbage_time = 120+180;
 }
 
 static void
index e79c95d308c9839b61eeb67f634d2e01ef01a80b..9c66981e215d10612f38f82d1f8dac66c8a2bc14 100644 (file)
@@ -83,6 +83,7 @@ struct rip_patt {
 };
 
 struct rip_proto_config {
+  struct proto_config c;
   list iface_list;     /* Patterns configured */
 
   int infinity;                /* User configurable data */
@@ -106,4 +107,5 @@ struct rip_proto {
 #define CHK_MAGIC do { if (P->magic != RIP_MAGIC) bug( "Not enough magic\n" ); } while (0)
 
 void rip_init_instance(struct proto *p);
+void rip_init_config(struct rip_proto_config *c);
 struct rip_interface *new_iface(struct proto *p, struct iface *new, unsigned long flags);