summaryrefslogtreecommitdiffstats
path: root/nest/protocol.h
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-04-01 12:19:47 +0200
committerMartin Mares <mj@ucw.cz>2000-04-01 12:19:47 +0200
commit3991d84e8fa9118a43149d4d3304726eb786bd46 (patch)
treea1fdbcdb43b3bc63f228593f017f0389c09f3d0f /nest/protocol.h
parentf8809249906811683e7e8d2a7b8cdcccde86742a (diff)
downloadbird-3991d84e8fa9118a43149d4d3304726eb786bd46.tar
bird-3991d84e8fa9118a43149d4d3304726eb786bd46.zip
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.
Diffstat (limited to 'nest/protocol.h')
-rw-r--r--nest/protocol.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/nest/protocol.h b/nest/protocol.h
index b02ea02..2e64112 100644
--- a/nest/protocol.h
+++ b/nest/protocol.h
@@ -24,6 +24,7 @@ struct config;
struct proto;
struct event;
struct ea_list;
+struct eattr;
struct symbol;
/*
@@ -35,6 +36,7 @@ struct protocol {
char *name;
char *template; /* Template for automatic generation of names */
int name_counter; /* Counter for automatic name generation */
+ int attr_class; /* Attribute class known to this protocol */
void (*preconfig)(struct protocol *, struct config *); /* Just before configuring */
void (*postconfig)(struct proto_config *); /* After configuring each instance */
@@ -46,16 +48,19 @@ struct protocol {
int (*shutdown)(struct proto *); /* Stop the instance */
void (*get_status)(struct proto *, byte *buf); /* Get instance status (for `show protocols' command) */
void (*get_route_info)(struct rte *, byte *buf); /* Get route information (for `show route' command) */
- void (*show_route_data)(struct rte *); /* Print verbose route information (`show route' again) */
+ int (*get_attr)(struct eattr *, byte *buf); /* ASCIIfy dynamic attribute (returns GA_*) */
};
void protos_build(void);
+void proto_build(struct protocol *);
void protos_preconfig(struct config *);
void protos_postconfig(struct config *);
void protos_commit(struct config *new, struct config *old, int force_restart);
void protos_dump_all(void);
-extern list protocol_list;
+#define GA_UNKNOWN 0 /* Attribute not recognized */
+#define GA_NAME 1 /* Result = name */
+#define GA_FULL 2 /* Result = both name and value */
/*
* Known protocols
@@ -146,7 +151,6 @@ struct proto {
/* Hic sunt protocol-specific data */
};
-void proto_build(struct proto_config *);
void *proto_new(struct proto_config *, unsigned size);
void *proto_config_new(struct protocol *, unsigned size);