summaryrefslogtreecommitdiffstats
path: root/src/vnet/nhrp/nhrp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/nhrp/nhrp.h')
-rw-r--r--src/vnet/nhrp/nhrp.h43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/vnet/nhrp/nhrp.h b/src/vnet/nhrp/nhrp.h
index fa842feb658..5b46b0d8a92 100644
--- a/src/vnet/nhrp/nhrp.h
+++ b/src/vnet/nhrp/nhrp.h
@@ -20,21 +20,25 @@
#include <vnet/ip/ip.h>
-typedef struct nhrp_key_t_
-{
- ip46_address_t nk_peer;
- u32 nk_sw_if_index;
-} nhrp_key_t;
-
-typedef struct nhrp_entry_t_
-{
- nhrp_key_t *ne_key;
- fib_prefix_t ne_nh;
- u32 ne_fib_index;
-} nhrp_entry_t;
+/**
+ * An NHRP entry represents the mapping between a peer on an interface in the overlay
+ * and a next-hop address in the underlay.
+ * i.e. there's a multipoint tunnel providing the overlay (henace a peer on
+ * that tunnel) which is reachable via 'tunnel destination' address in the
+ * underlay.
+ */
+typedef struct nhrp_entry_t_ nhrp_entry_t;
+/** accessors for the opaque struct */
+extern u32 nhrp_entry_get_sw_if_index (const nhrp_entry_t * ne);
+extern u32 nhrp_entry_get_fib_index (const nhrp_entry_t * ne);
+extern const ip46_address_t *nhrp_entry_get_peer (const nhrp_entry_t * ne);
+extern const fib_prefix_t *nhrp_entry_get_nh (const nhrp_entry_t * ne);
extern u8 *format_nhrp_entry (u8 * s, va_list * args);
+/**
+ * Create a new NHRP entry
+ */
extern int nhrp_entry_add (u32 sw_if_index,
const ip46_address_t * peer,
u32 nh_table_id, const ip46_address_t * nh);
@@ -50,6 +54,21 @@ extern void nhrp_entry_adj_stack (const nhrp_entry_t * ne, adj_index_t ai);
typedef walk_rc_t (*nhrp_walk_cb_t) (index_t nei, void *ctx);
extern void nhrp_walk (nhrp_walk_cb_t fn, void *ctx);
+extern void nhrp_walk_itf (u32 sw_if_index, nhrp_walk_cb_t fn, void *ctx);
+
+/**
+ * Notifications for the creation and deletion of NHRP entries
+ */
+typedef void (*nhrp_entry_added_t) (const nhrp_entry_t * ne);
+typedef void (*nhrp_entry_deleted_t) (const nhrp_entry_t * ne);
+
+typedef struct nhrp_vft_t_
+{
+ nhrp_entry_added_t nv_added;
+ nhrp_entry_deleted_t nv_deleted;
+} nhrp_vft_t;
+
+extern void nhrp_register (const nhrp_vft_t * vft);
#endif