/* * 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 can provide 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; } /** * start - request instance startup * @p: protocol instance * * The start() hook is called by the core when it wishes to start * the instance. Multitable protocols should lock their tables here. * * 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; } /** * cleanup - request instance cleanup * @p: protocol instance * * The cleanup() hook is called by the core when the protocol became * hungry/down, i.e. all protocol ahooks and routes are flushed. * Multitable protocols should unlock their tables here. */ void cleanup(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 accept_ra_types specifies which kind of route announcements * protocol wants to receive. */ void rt_notify(struct proto *p, net *net, rte *new, rte *old, ea_list *attrs) { DUMMY; } /** * neigh_notify - notify instance about neighbor status change * @neigh: a neighbor cache entry * * The neigh_notify() hook is called by the neighbor cache whenever * a neighbor changes its state, that is it gets disconnected or a * sticky neighbor gets connected. */ void neigh_notify(neighbor *neigh) { DUMMY; } /** * preexport - pre-filtering decisions before route export * @p: protocol instance the route is going to be exported to * @e: the route in question * @attrs: extended attributes of the route * @pool: linear pool for allocation of all temporary data * * The preexport() hook is called as the first step of a exporting * a route from a routing table to the protocol instance. It can modify * route attributes and force acceptance or rejection of the route before * the user-specified filters are run. See rte_announce() for a complete description * of the route distribution process. * * The standard use of this hook is to reject routes having originated * from the same instance and to set default values of the protocol's metrics. * * Result: 1 if the route has to be accepted, -1 if rejected and 0 if it * should be passed to the filters. */ int preexport(struct proto *p, rte **e, ea_list **attrs, struct linpool *pool) { DUMMY; } /** * rte_recalculate - prepare routes for comparison * @table: a routing table * @net: a network entry * @new: new route for the network * @old: old route for the network * @old_best: old best route for the network (may be NULL) * * This hook is called when a route change (from @old to @new for a * @net entry) is propagated to a @table. It may be used to prepare * routes for comparison by rte_better() in the best route * selection. @new may or may not be in @net->routes list, * @old is not there. * * Result: 1 if the ordering implied by rte_better() changes enough * that full best route calculation have to be done, 0 otherwise. */ int rte_recalculate(struct rtable *table, struct network *net, struct rte *new, struct rte *old, struct rte *old_best) { DUMMY; } /** * rte_better - compare metrics of two routes * @new: the new route * @old: the original route * * This hook gets called when the routing table contains two routes * for the same network which have originated from different instances * of a single protocol and it wants to select which one is preferred * over the other one. Protocols usually decide according to route metrics. * * Result: 1 if @new is better (more preferred) than @old, 0 otherwise. */ int rte_better(rte *new, rte *old) { DUMMY; } /** * rte_insert - notify instance about route insertion * @n: network * @e: route * * This hook is called whenever a &rte belonging to the instance * is accepted for insertion to a routing table. * * Please avoid using this function in new protocols. */ void rte_insert(net *n, rte *e) { DUMMY; } /** * rte_remove - notify instance about route removal * @n: network * @e: route * * This hook is called whenever a &rte belonging to the instance * is removed from a routing table. * * Please avoid using this function in new protocols. */ void rte_remove(net *n, rte *e) { DUMMY; }