From ddbcb927f255ef4720e87b7f14339add37e705ce Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 2 Jun 2000 17:24:11 +0000 Subject: Documented protocol hooks. --- nest/Doc | 2 +- nest/proto-hooks.c | 312 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 313 insertions(+), 1 deletion(-) create mode 100644 nest/proto-hooks.c diff --git a/nest/Doc b/nest/Doc index 70d996b7..626b3bdc 100644 --- a/nest/Doc +++ b/nest/Doc @@ -4,7 +4,7 @@ S rt-table.c S rt-attr.c D prog-proto.sgml S proto.c -#S proto-hooks.c +S proto-hooks.c S neighbor.c #S cli.c #S iface.c diff --git a/nest/proto-hooks.c b/nest/proto-hooks.c new file mode 100644 index 00000000..5df52297 --- /dev/null +++ b/nest/proto-hooks.c @@ -0,0 +1,312 @@ +/* + * BIRD -- Documentation for Protocol Hooks (dummy source file) + * + * (c) 2000 Martin Mares + * + * Can be freely distributed and used under the terms of the GNU GPL. + */ + +/** + * DOC: Protocol hooks + * + * Each protocol provides a rich set of hook functions referred to by pointers + * in either the &proto or &protocol structure. They are called by the core whenever + * it wants the protocol to perform some action or to notify the protocol about + * any change of its environment. All of the hooks can be set to %NULL which means + * to ignore the change or to take a default action. + */ + +/** + * preconfig - protocol preconfiguration + * @p: a routing protocol + * @c: new configuration + * + * The preconfig() hook is called before parsing of a new configuration. + */ +void preconfig(struct protocol *p, struct config *c) +{ DUMMY; } + +/** + * postconfig - instance post-configuration + * @c: instance configuration + * + * The postconfig() hook is called for each configured instance after + * parsing of the new configuration is finished. + */ +void postconfig(struct proto_config *c) +{ DUMMY; } + +/** + * init - initialize an instance + * @c: instance configuration + * + * The init() hook is called by the core to create a protocol instance + * according to supplied protocol configuration. + * + * Result: a pointer to the instance created + */ +struct proto *init(struct proto_config *c) +{ DUMMY; } + +/** + * reconfigure - request instance reconfiguration + * @p: an instance + * @c: new configuration + * + * The core calls the reconfigure() hook whenever it wants to ask the + * protocol for switching to a new configuration. If the reconfiguration + * is possible, the hook returns 1. Otherwise, it returns 0 and the core + * will shut down the instance and start a new one with the new configuration. + * + * After the protocol confirms reconfiguration, it must no longer keep any + * references to the old configuration since the memory it's stored in can + * be re-used at any time. + */ +int reconfigure(struct proto *p, struct proto_config *c) +{ DUMMY; } + +/** + * dump - dump protocol state + * @p: an instance + * + * This hook dumps the complete state of the instance to the + * debug output. + */ +void dump(struct proto *p) +{ DUMMY; } + +/** + * dump_attrs - dump protocol-dependent attributes + * @e: a route entry + * + * This hook dumps all attributes in the &rte which belong to this + * protocol to the debug output. + */ +void dump_attrs(rte *e) +{ DUMMY; } + +/** + * start - request instance startup + * @p: protocol instance + * + * The start() hook is called by the core when it wishes to start + * the instance. + * + * Result: new protocol state + */ +int start(struct proto *p) +{ DUMMY; } + +/** + * shutdown - request instance shutdown + * @p: protocol instance + * + * The stop() hook is called by the core when it wishes to shut + * the instance down for some reason. + * + * Returns: new protocol state + */ +int shutdown(struct proto *p) +{ DUMMY; } + +/** + * get_status - get instance status + * @p: protocol instance + * @buf: buffer to be filled with the status string + * + * This hook is called by the core if it wishes to obtain an brief one-line user friendly + * representation of the status of the instance to be printed by the