summaryrefslogtreecommitdiffstats
path: root/nest/proto.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-12-01 13:00:15 +0100
committerMartin Mares <mj@ucw.cz>1999-12-01 13:00:15 +0100
commit9685deb910c9e7400915209c1924e100b1feb5d5 (patch)
tree49e9108f91a43aab1e0a283418439ccb7232c7a9 /nest/proto.c
parent5954dcfab74c8d8a2774f259c9940c1d87e76518 (diff)
downloadbird-9685deb910c9e7400915209c1924e100b1feb5d5.tar
bird-9685deb910c9e7400915209c1924e100b1feb5d5.zip
`show protocols' now shows time of last state change and protocol-dependent
status information (obtained via newly introduced hook protocol->get_status).
Diffstat (limited to 'nest/proto.c')
-rw-r--r--nest/proto.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/nest/proto.c b/nest/proto.c
index 0766608..94bbbfd 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -53,6 +53,7 @@ proto_enqueue(list *l, struct proto *p)
q = (struct proto *) q->n.next;
insert_node(&p->n, q->n.prev);
}
+ p->last_state_change = now;
}
static void
@@ -446,27 +447,22 @@ proto_state_name(struct proto *p)
#undef P
}
-static char *
-proto_goal_name(struct proto *p)
-{
- if (p->disabled)
- return " <disabled>";
- if (p->core_goal == p->core_state)
- return "";
- if (p->core_goal == FS_HAPPY)
- return " <starting>";
- return " <shutting down>";
-}
-
static void
proto_do_show(struct proto *p, int verbose)
{
- cli_msg(-1002, "%-8s %-8s %-8s %s%s",
+ byte buf[256], reltime[TM_RELTIME_BUFFER_SIZE];
+
+ buf[0] = 0;
+ if (p->proto->get_status)
+ p->proto->get_status(p, buf);
+ tm_format_reltime(reltime, p->last_state_change);
+ cli_msg(-1002, "%-8s %-8s %-8s %-5s %-5s %s",
p->name,
p->proto->name,
p->table->name,
proto_state_name(p),
- proto_goal_name(p));
+ reltime,
+ buf);
if (verbose)
{
cli_msg(-1006, "\tPreference: %d", p->preference);
@@ -492,7 +488,7 @@ proto_show(struct symbol *s, int verbose)
cli_msg(9002, "%s is not a protocol", s->name);
return;
}
- cli_msg(-2002, "name proto table state");
+ cli_msg(-2002, "name proto table state since info");
if (s)
proto_do_show(((struct proto_config *)s->def)->proto, verbose);
else