diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2011-11-07 00:31:23 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2011-11-07 00:31:23 +0100 |
commit | a7f23f581f5e3efe92ec97dfca7d01c66f31ab04 (patch) | |
tree | 3a8f7cffb7abce83b7bce8be87d21be8a2fbff72 /nest/protocol.h | |
parent | 74add5df17c386bd109ebea7b1dac04d1651ae51 (diff) |
Implements protocol templates.
Based on the patch from Alexander V. Chernikov.
Extended to support almost all protocols.
Uses 'protocol bgp NAME from TEMPLATE { ... }' syntax.
Diffstat (limited to 'nest/protocol.h')
-rw-r--r-- | nest/protocol.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nest/protocol.h b/nest/protocol.h index f95905ae..a7518c2a 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -53,6 +53,7 @@ struct protocol { void (*get_route_info)(struct rte *, byte *buf, struct ea_list *attrs); /* Get route information (for `show route' command) */ int (*get_attr)(struct eattr *, byte *buf, int buflen); /* ASCIIfy dynamic attribute (returns GA_*) */ void (*show_proto_info)(struct proto *); /* Show protocol info (for `show protocols all' command) */ + void (*copy_config)(struct proto_config *, struct proto_config *); /* Copy config from given protocol instance */ }; void protos_build(void); @@ -85,12 +86,15 @@ struct proto_config { struct proto *proto; /* Instance we've created */ char *name; char *dsc; + int class; /* SYM_PROTO or SYM_TEMPLATE */ u32 debug, mrtdump; /* Debugging bitfields, both use D_* constants */ unsigned preference, disabled; /* Generic parameters */ u32 router_id; /* Protocol specific router ID */ struct rtable_config *table; /* Table we're attached to */ struct filter *in_filter, *out_filter; /* Attached filters */ + /* Check proto_reconfigure() and proto_copy_config() after changing struct proto_config */ + /* Protocol-specific data follow... */ }; @@ -203,9 +207,14 @@ struct proto_spec { void *proto_new(struct proto_config *, unsigned size); -void *proto_config_new(struct protocol *, unsigned size); +void *proto_config_new(struct protocol *, unsigned size, int class); +void proto_copy_config(struct proto_config *dest, struct proto_config *src); void proto_request_feeding(struct proto *p); +static inline void +proto_copy_rest(struct proto_config *dest, struct proto_config *src, unsigned size) +{ memcpy(dest + 1, src + 1, size - sizeof(struct proto_config)); } + void proto_cmd_show(struct proto *, unsigned int, int); void proto_cmd_disable(struct proto *, unsigned int, int); void proto_cmd_enable(struct proto *, unsigned int, int); |