#include <lib/zclient.h>
#include <lib/nexthop_group.h>
+#include "pbr_map.h"
+
+#define PBR_NHC_NAMELEN PBR_MAP_NAMELEN + 10
+
struct pbr_nexthop_group_cache {
- char name[PBR_MAP_NAMELEN];
+ char name[PBR_NHC_NAMELEN];
uint32_t table_id;
struct pbr_nexthop_cache {
struct pbr_nexthop_group_cache *parent;
- struct nexthop nexthop;
+ struct nexthop *nexthop;
bool valid;
};
extern void pbr_nht_set_tableid_range(uint32_t low, uint32_t high);
/*
- * Get the next tableid to use for installation
+ * Get the next tableid to use for installation.
+ *
+ * peek
+ * If set to true, retrieves the next ID without marking it used. The next
+ * call will return the same ID.
*/
-extern uint32_t pbr_nht_get_next_tableid(void);
+extern uint32_t pbr_nht_get_next_tableid(bool peek);
/*
* Get the next rule number to use for installation
*/
extern bool pbr_nht_nexthop_valid(struct nexthop_group *nhg);
extern bool pbr_nht_nexthop_group_valid(const char *name);
-extern void pbr_nht_add_group(const char *name);
+extern struct pbr_nexthop_group_cache *pbr_nht_add_group(const char *name);
extern void pbr_nht_change_group(const char *name);
extern void pbr_nht_delete_group(const char *name);
-extern void pbr_nht_add_individual_nexthop(const char *name, uint32_t seqno);
-extern void pbr_nht_delete_individual_nexthop(const char *name, uint32_t seqno);
+extern void pbr_nht_add_individual_nexthop(struct pbr_map_sequence *pbrms);
+extern void pbr_nht_delete_individual_nexthop(struct pbr_map_sequence *pbrms);
/*
* Given the tableid of the installed default
* route, find the nexthop-group associated with
*/
extern void pbr_nht_nexthop_update(struct zapi_route *nhr);
+/*
+ * When we get a callback from zebra about an interface status update.
+ */
+extern void pbr_nht_nexthop_interface_update(struct interface *ifp);
+
extern void pbr_nht_init(void);
#endif