]> git.ipfire.org Git - thirdparty/bird.git/blobdiff - nest/protocol.h
Doc: Remove some superfluous slashes
[thirdparty/bird.git] / nest / protocol.h
index 8660cc2c51cb30d87880783f40517f23f421cff8..5aca9a4eafcfae0f8d9adc0c1232248e102d499b 100644 (file)
@@ -12,6 +12,7 @@
 #include "lib/lists.h"
 #include "lib/resource.h"
 #include "lib/timer.h"
+#include "nest/route.h"
 #include "conf/conf.h"
 
 struct iface;
@@ -76,7 +77,7 @@ void protos_dump_all(void);
 
 extern struct protocol
   proto_device, proto_radv, proto_rip, proto_static,
-  proto_ospf, proto_pipe, proto_bgp, proto_bfd;
+  proto_ospf, proto_pipe, proto_bgp, proto_bfd, proto_babel;
 
 /*
  *     Routing Protocol Instance
@@ -94,6 +95,7 @@ struct proto_config {
   unsigned preference, disabled;       /* Generic parameters */
   int in_keep_filtered;                        /* Routes rejected in import filter are kept */
   u32 router_id;                       /* Protocol specific router ID */
+  struct iface *vrf;                   /* Related VRF instance, NULL if global */
   struct rtable_config *table;         /* Table we're attached to */
   struct filter *in_filter, *out_filter; /* Attached filters */
   struct proto_limit *rx_limit;                /* Limit for receiving routes from protocol
@@ -158,9 +160,11 @@ struct proto {
   byte gr_wait;                                /* Route export to protocol is postponed until graceful restart */
   byte down_sched;                     /* Shutdown is scheduled for later (PDS_*) */
   byte down_code;                      /* Reason for shutdown (PDC_* codes) */
+  byte merge_limit;                    /* Maximal number of nexthops for RA_MERGED */
   u32 hash_key;                                /* Random key used for hashing of neighbors */
   bird_clock_t last_state_change;      /* Time of last state transition */
   char *last_state_name_announced;     /* Last state name we've announced to the user */
+  char *message;                       /* State-change message, allocated from proto_pool */
   struct proto_stats stats;            /* Current protocol statistics */
 
   /*
@@ -200,6 +204,7 @@ struct proto {
    *      rte_recalculate Called at the beginning of the best route selection
    *      rte_better   Compare two rte's and decide which one is better (1=first, 0=second).
    *       rte_same    Compare two rte's and decide whether they are identical (1=yes, 0=no).
+   *       rte_mergable        Compare two rte's and decide whether they could be merged (1=yes, 0=no).
    *      rte_insert   Called whenever a rte is inserted to a routing table.
    *      rte_remove   Called whenever a rte is removed from the routing table.
    */
@@ -207,9 +212,11 @@ struct proto {
   int (*rte_recalculate)(struct rtable *, struct network *, struct rte *, struct rte *, struct rte *);
   int (*rte_better)(struct rte *, struct rte *);
   int (*rte_same)(struct rte *, struct rte *);
+  int (*rte_mergable)(struct rte *, struct rte *);
   void (*rte_insert)(struct network *, struct rte *);
   void (*rte_remove)(struct network *, struct rte *);
 
+  struct iface *vrf;                   /* Related VRF instance, NULL if global */
   struct rtable *table;                        /* Our primary routing table */
   struct rte_src *main_source;         /* Primary route source */
   struct announce_hook *main_ahook;    /* Primary announcement hook */
@@ -244,6 +251,7 @@ struct proto_spec {
 void *proto_new(struct proto_config *, unsigned size);
 void *proto_config_new(struct protocol *, int class);
 void proto_copy_config(struct proto_config *dest, struct proto_config *src);
+void proto_set_message(struct proto *p, char *msg, int len);
 void proto_request_feeding(struct proto *p);
 
 static inline void
@@ -261,15 +269,15 @@ void proto_graceful_restart_unlock(struct proto *p);
 void proto_show_limit(struct proto_limit *l, const char *dsc);
 void proto_show_basic_info(struct proto *p);
 
-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);
-void proto_cmd_restart(struct proto *, unsigned int, int);
-void proto_cmd_reload(struct proto *, unsigned int, int);
-void proto_cmd_debug(struct proto *, unsigned int, int);
-void proto_cmd_mrtdump(struct proto *, unsigned int, int);
+void proto_cmd_show(struct proto *, uintptr_t, int);
+void proto_cmd_disable(struct proto *, uintptr_t, int);
+void proto_cmd_enable(struct proto *, uintptr_t, int);
+void proto_cmd_restart(struct proto *, uintptr_t, int);
+void proto_cmd_reload(struct proto *, uintptr_t, int);
+void proto_cmd_debug(struct proto *, uintptr_t, int);
+void proto_cmd_mrtdump(struct proto *, uintptr_t, int);
 
-void proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, unsigned int, int), int restricted, unsigned int arg);
+void proto_apply_cmd(struct proto_spec ps, void (* cmd)(struct proto *, uintptr_t, int), int restricted, uintptr_t arg);
 struct proto *proto_get_named(struct symbol *, struct protocol *);
 
 #define CMD_RELOAD     0
@@ -282,6 +290,17 @@ proto_get_router_id(struct proto_config *pc)
   return pc->router_id ? pc->router_id : pc->global->router_id;
 }
 
+static inline struct ea_list *
+rte_make_tmp_attrs(struct rte *rt, struct linpool *pool)
+{
+  struct ea_list *(*mta)(struct rte *rt, struct linpool *pool);
+  mta = rt->attrs->src->proto->make_tmp_attrs;
+  return mta ? mta(rt, pool) : NULL;
+}
+
+/* Moved from route.h to avoid dependency conflicts */
+static inline void rte_update(struct proto *p, net *net, rte *new) { rte_update2(p->main_ahook, net, new, p->main_source); }
+
 extern list active_proto_list;
 
 /*