1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Changed initialization of protocol list -- now we call proto_build() instead

of calling the protocols manually.

Implemented printing of dynamic attributes in `show route all'.

Each protocol can now register its own attribute class (protocol->attr_class,
set to EAP_xxx) and also a callback for naming and formatting of attributes.
The callback can return one of the following results:

	GA_UNKNOWN	Attribute not recognized.
	GA_NAME		Attribute name recognized and put to the buffer,
			generic code should format the value.
	GA_FULL		Both attribute name and value put to the buffer.

Please update protocols generating dynamic attributes to provide
the attr_class and formatting hook.
This commit is contained in:
Martin Mares
2000-04-01 10:19:47 +00:00
parent f880924990
commit 3991d84e8f
8 changed files with 99 additions and 18 deletions

View File

@@ -22,7 +22,7 @@
static pool *proto_pool;
list protocol_list;
static list protocol_list;
static list proto_list;
#define WALK_PROTO_LIST(p) do { \
@@ -343,6 +343,17 @@ protos_dump_all(void)
debug(" flushing %s\n", p->name);
}
void
proto_build(struct protocol *p)
{
add_tail(&protocol_list, &p->n);
if (p->attr_class)
{
ASSERT(!attr_class_to_protocol[p->attr_class]);
attr_class_to_protocol[p->attr_class] = p;
}
}
void
protos_build(void)
{
@@ -352,21 +363,21 @@ protos_build(void)
init_list(&inactive_proto_list);
init_list(&initial_proto_list);
init_list(&flush_proto_list);
add_tail(&protocol_list, &proto_device.n);
proto_build(&proto_device);
#ifdef CONFIG_RIP
add_tail(&protocol_list, &proto_rip.n);
proto_build(&proto_rip);
#endif
#ifdef CONFIG_STATIC
add_tail(&protocol_list, &proto_static.n);
proto_build(&proto_static);
#endif
#ifdef CONFIG_OSPF
add_tail(&protocol_list, &proto_ospf.n);
proto_build(&proto_ospf);
#endif
#ifdef CONFIG_PIPE
add_tail(&protocol_list, &proto_pipe.n);
proto_build(&proto_pipe);
#endif
#ifdef CONFIG_BGP
add_tail(&protocol_list, &proto_bgp.n);
proto_build(&proto_bgp);
#endif
proto_pool = rp_new(&root_pool, "Protocols");
proto_flush_event = ev_new(proto_pool);