#ifndef __NEXTHOP_GROUP__
#define __NEXTHOP_GROUP__
+#include <vty.h>
+
/*
* What is a 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);
(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