summaryrefslogtreecommitdiff
path: root/nest/protocol.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-02-07 14:27:23 +0100
committerMaria Matejka <mq@ucw.cz>2023-02-07 14:27:23 +0100
commita2fd889a3b95960311560a3796be5cdf92affcfc (patch)
treea2a1a2fbe6a957a37e0b6e2241d072555e07b95a /nest/protocol.h
parentf7c2a886c9fb73b2749d5e270f15b79c44e72a62 (diff)
parent0bb04d5390f21b0c96fc4894ba5d5510c541f0ef (diff)
Merge commit '0bb04d5390f21b0c96fc4894ba5d5510c541f0ef' into HEAD
Diffstat (limited to 'nest/protocol.h')
-rw-r--r--nest/protocol.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/nest/protocol.h b/nest/protocol.h
index 101e0926..fdd0373a 100644
--- a/nest/protocol.h
+++ b/nest/protocol.h
@@ -9,9 +9,10 @@
#ifndef _BIRD_PROTOCOL_H_
#define _BIRD_PROTOCOL_H_
-#include "lib/lists.h"
+#include "lib/tlists.h"
#include "lib/resource.h"
#include "lib/event.h"
+#include "nest/iface.h"
#include "lib/settle.h"
#include "nest/rt.h"
#include "nest/limit.h"
@@ -59,6 +60,7 @@ struct protocol {
void (*dump)(struct proto *); /* Debugging dump */
int (*start)(struct proto *); /* Start the instance */
int (*shutdown)(struct proto *); /* Stop the instance */
+ void (*cleanup)(struct proto *); /* Cleanup the instance right before tearing it all down */
void (*get_status)(struct proto *, byte *buf); /* Get instance status (for `show protocols' command) */
// int (*get_attr)(const 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) */
@@ -128,8 +130,10 @@ struct proto {
struct rte_src *main_source; /* Primary route source */
struct rte_owner sources; /* Route source owner structure */
struct iface *vrf; /* Related VRF instance, NULL if global */
+ TLIST_LIST(proto_neigh) neighbors; /* List of neighbor structures */
+ struct iface_subscription iface_sub; /* Interface notification subscription */
- const char *name; /* Name of this instance (== cf->name) */
+ const char *name; /* Name of this instance (== cf->name) */
u32 debug; /* Debugging flags */
u32 mrtdump; /* MRTDump flags */
uint active_channels; /* Number of active channels */
@@ -167,10 +171,7 @@ struct proto {
* feed_end Notify channel about finish of route feeding.
*/
- void (*if_notify)(struct proto *, unsigned flags, struct iface *i);
- void (*ifa_notify)(struct proto *, unsigned flags, struct ifa *a);
void (*rt_notify)(struct proto *, struct channel *, const net_addr *net, struct rte *new, const struct rte *old);
- void (*neigh_notify)(struct neighbor *neigh);
int (*preexport)(struct channel *, struct rte *rt);
void (*reload_routes)(struct channel *);
void (*feed_begin)(struct channel *, int initial);
@@ -337,7 +338,13 @@ void proto_notify_state(struct proto *p, unsigned state);
*/
static inline int proto_is_inactive(struct proto *p)
-{ return (p->active_channels == 0) && (p->active_loops == 0) && (p->sources.uc == 0); }
+{
+ return (p->active_channels == 0)
+ && (p->active_loops == 0)
+ && (p->sources.uc == 0)
+ && EMPTY_TLIST(proto_neigh, &p->neighbors)
+ ;
+}
/*