From 4414d9a57a0dae3da0e0e0d924bf8cab89070716 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Sun, 28 May 2000 18:49:33 +0000 Subject: get_status() implemented. --- proto/ospf/ospf.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 893ee58..dd7ffab 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -176,11 +176,33 @@ ospf_rt_notify(struct proto *p, net *n, rte *new, rte *old, ea_list *attrs) } } +static void +ospf_get_status(struct proto *p, byte *buf) +{ + struct proto_ospf *po=(struct proto_ospf *)p; + + if (p->proto_state == PS_DOWN) buf[0] = 0; + else + { + struct ospf_iface *ifa; + struct ospf_neighbor *n; + int adj=0; + + WALK_LIST(ifa,po->iface_list) + WALK_LIST(n,ifa->neigh_list) + if(n->state==NEIGHBOR_FULL) adj=1; + + if(adj==0) strcpy(buf, "Alone"); + else strcpy(buf, "Running"); + } +} + struct protocol proto_ospf = { name: "OSPF", template: "ospf%d", init: ospf_init, dump: ospf_dump, start: ospf_start, - shutdown: ospf_shutdown + shutdown: ospf_shutdown, + get_status: ospf_get_status }; -- cgit v1.2.3