BFD-FIB interactions
[vpp.git] / src / vnet / fib / fib_entry_delegate.h
index d9183c5..333d357 100644 (file)
@@ -42,6 +42,10 @@ typedef enum fib_entry_delegate_type_t_ {
      * to their respective cover
      */
     FIB_ENTRY_DELEGATE_COVERED,
+    /**
+     * BFD session state
+     */
+    FIB_ENTRY_DELEGATE_BFD,
     /**
      * Attached import/export functionality
      */
@@ -61,6 +65,28 @@ typedef enum fib_entry_delegate_type_t_ {
         }                                                     \
     }                                                         \
 }
+#define FOR_EACH_DELEGATE(_entry, _fdt, _fed, _body)          \
+{                                                             \
+    for (_fdt = FIB_ENTRY_DELEGATE_CHAIN_UNICAST_IP4;         \
+         _fdt <= FIB_ENTRY_DELEGATE_ATTACHED_EXPORT;          \
+         _fdt++)                                              \
+    {                                                         \
+        _fed = fib_entry_delegate_get(_entry, _fdt);          \
+        if (NULL != _fed) {                                   \
+            _body;                                            \
+        }                                                     \
+    }                                                         \
+}
+
+/**
+ * Distillation of the BFD session states into a go/no-go for using
+ * the associated tracked FIB entry
+ */
+typedef enum fib_bfd_state_t_
+{
+    FIB_BFD_STATE_UP,
+    FIB_BFD_STATE_DOWN,
+} fib_bfd_state_t;
 
 /**
  * A Delagate is a means to implmenet the Delagation design pattern; the extension of an
@@ -103,6 +129,11 @@ typedef struct fib_entry_delegate_t_
          * For the cover tracking. The node list;
          */
         fib_node_list_t fd_list;
+
+        /**
+         * BFD state
+         */
+        fib_bfd_state_t fd_bfd_state;
     };
 } fib_entry_delegate_t;
 
@@ -122,4 +153,6 @@ extern fib_forward_chain_type_t fib_entry_delegate_type_to_chain_type(
 extern fib_entry_delegate_type_t fib_entry_chain_type_to_delegate_type(
      fib_forward_chain_type_t type);
 
+extern u8 *format_fib_entry_deletegate(u8 * s, va_list * args);
+
 #endif