]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/nexthop_group.h
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / nexthop_group.h
index 561fe9642592e7964fa40ce1dc74b886f992b9fd..473ecb34fc4df110bf0b3d27be0261f5e9a5ba21 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef __NEXTHOP_GROUP__
 #define __NEXTHOP_GROUP__
 
+#include <vty.h>
+
 /*
  * What is a nexthop group?
  *
@@ -33,9 +35,11 @@ struct nexthop_group {
        struct nexthop *nexthop;
 };
 
-void nexthop_group_init(void);
+struct nexthop_group *nexthop_group_new(void);
+void nexthop_group_delete(struct nexthop_group **nhg);
 
 void nexthop_add(struct nexthop **target, struct nexthop *nexthop);
+void nexthop_del(struct nexthop_group *nhg, struct nexthop *nexthop);
 void copy_nexthops(struct nexthop **tnh, struct nexthop *nh,
                   struct nexthop *rparent);
 
@@ -51,4 +55,59 @@ void copy_nexthops(struct nexthop **tnh, struct nexthop *nh,
        (nhop) = (head.nexthop);                                        \
        (nhop);                                                         \
        (nhop) = nexthop_next(nhop)
+
+#define ALL_NEXTHOPS_PTR(head, nhop)                                   \
+       (nhop) = ((head)->nexthop);                                     \
+       (nhop);                                                         \
+       (nhop) = nexthop_next(nhop)
+
+
+struct nexthop_hold {
+       char *nhvrf_name;
+       union sockunion addr;
+       char *intf;
+};
+
+struct nexthop_group_cmd {
+
+       RB_ENTRY(nexthop_group_cmd) nhgc_entry;
+
+       char name[80];
+
+       struct nexthop_group nhg;
+
+       struct list *nhg_list;
+
+       QOBJ_FIELDS
+};
+RB_HEAD(nhgc_entry_head, nexthp_group_cmd);
+RB_PROTOTYPE(nhgc_entry_head, nexthop_group_cmd, nhgc_entry,
+            nexthop_group_cmd_compare)
+DECLARE_QOBJ_TYPE(nexthop_group_cmd)
+
+/*
+ * Initialize nexthop_groups.  If you are interested in when
+ * a nexthop_group is added/deleted/modified, then set the
+ * appropriate callback functions to handle it in your
+ * code
+ */
+void nexthop_group_init(
+       void (*new)(const char *name),
+       void (*add_nexthop)(const struct nexthop_group_cmd *nhgc,
+                           const struct nexthop *nhop),
+       void (*del_nexthop)(const struct nexthop_group_cmd *nhgc,
+                           const struct nexthop *nhop),
+       void (*delete)(const char *name));
+
+void nexthop_group_enable_vrf(struct vrf *vrf);
+void nexthop_group_disable_vrf(struct vrf *vrf);
+void nexthop_group_interface_state_change(struct interface *ifp,
+                                         ifindex_t oldifindex);
+
+extern struct nexthop *nexthop_exists(struct nexthop_group *nhg,
+                                     struct nexthop *nh);
+
+extern struct nexthop_group_cmd *nhgc_find(const char *name);
+
+extern void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh);
 #endif