0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-19 11:55:21 +00:00

Proto struct now contain (down | starting | up) state.

This commit is contained in:
Martin Mares 1998-10-19 17:45:29 +00:00
parent 16a8ba30a9
commit f184ea6f7e
2 changed files with 7 additions and 0 deletions

View File

@ -71,10 +71,12 @@ static void
proto_start(struct proto *p) proto_start(struct proto *p)
{ {
rem_node(&p->n); rem_node(&p->n);
p->state = PRS_STARTING;
if (p->start) if (p->start)
p->start(p); p->start(p);
if_feed_baby(p); if_feed_baby(p);
rt_feed_baby(p); rt_feed_baby(p);
p->state = PRS_UP;
add_tail(&proto_list, &p->n); add_tail(&proto_list, &p->n);
} }

View File

@ -59,6 +59,7 @@ struct proto {
unsigned debug; /* Debugging flags */ unsigned debug; /* Debugging flags */
pool *pool; /* Local objects */ pool *pool; /* Local objects */
unsigned preference; /* Default route preference */ unsigned preference; /* Default route preference */
unsigned state; /* PRS_... */
void (*if_notify)(struct proto *, unsigned flags, struct iface *new, struct iface *old); void (*if_notify)(struct proto *, unsigned flags, struct iface *new, struct iface *old);
void (*rt_notify)(struct proto *, struct network *net, struct rte *new, struct rte *old); void (*rt_notify)(struct proto *, struct network *net, struct rte *new, struct rte *old);
@ -80,6 +81,10 @@ struct proto {
/* Hic sunt protocol-specific data */ /* Hic sunt protocol-specific data */
}; };
#define PRS_DOWN 0 /* Inactive */
#define PRS_STARTING 1
#define PRS_UP 2
void *proto_new(struct protocol *, unsigned size); void *proto_new(struct protocol *, unsigned size);
extern list proto_list, inactive_proto_list; extern list proto_list, inactive_proto_list;