MPLS Mcast
[vpp.git] / src / vnet / mfib / mfib_table.h
index 4faa69e..83aa04e 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <vnet/ip/ip.h>
 #include <vnet/adj/adj.h>
+#include <vnet/dpo/replicate_dpo.h>
 
 #include <vnet/mfib/mfib_types.h>
 
@@ -121,6 +122,7 @@ extern fib_node_index_t mfib_table_lookup_exact_match(u32 fib_index,
 extern fib_node_index_t mfib_table_entry_update(u32 fib_index,
                                                 const mfib_prefix_t *prefix,
                                                 mfib_source_t source,
+                                                fib_rpf_id_t rpf_id,
                                                 mfib_entry_flags_t flags);
 
 /**
@@ -212,6 +214,37 @@ extern void mfib_table_entry_delete(u32 fib_index,
 extern void mfib_table_entry_delete_index(fib_node_index_t entry_index,
                                           mfib_source_t source);
 
+/**
+ * @brief
+ *  Add a 'special' entry to the mFIB that links to the DPO passed
+ *  A special entry is an entry that the FIB is not expect to resolve
+ *  via the usual mechanisms (i.e. recurisve or neighbour adj DB lookup).
+ *  Instead the client/source provides the index of a replicate DPO to link to.
+ *
+  * @param fib_index
+ *  The index of the FIB
+ *
+ * @param prefix
+ *  The prefix to add
+ *
+ * @param source
+ *  The ID of the client/source adding the entry.
+ *
+ * @param flags
+ *  Flags for the entry.
+ *
+ * @param rep_dpo
+ *  The replicate DPO index to link to.
+ *
+ * @return
+ *  the index of the fib_entry_t that is created (or existed already).
+ */
+extern fib_node_index_t mfib_table_entry_special_add(u32 fib_index,
+                                                     const mfib_prefix_t *prefix,
+                                                     mfib_source_t source,
+                                                     mfib_entry_flags_t flags,
+                                                     index_t rep_dpo);
+
 /**
  * @brief
  *  Flush all entries from a table for the source
@@ -328,4 +361,20 @@ extern u32 mfib_table_get_num_entries(u32 fib_index,
 extern mfib_table_t *mfib_table_get(fib_node_index_t index,
                                     fib_protocol_t proto);
 
+/**
+ * @brief Call back function when walking entries in a FIB table
+ */
+typedef int (*mfib_table_walk_fn_t)(fib_node_index_t fei,
+                                    void *ctx);
+
+/**
+ * @brief Walk all entries in a FIB table
+ * N.B: This is NOT safe to deletes. If you need to delete, walk the whole
+ * table and store elements in a vector, then delete the elements
+ */
+extern void mfib_table_walk(u32 fib_index,
+                            fib_protocol_t proto,
+                            mfib_table_walk_fn_t fn,
+                            void *ctx);
+
 #endif