ipsec: IPSec protection for multi-point tunnel interfaces
[vpp.git] / src / vnet / adj / adj_delegate.h
index b57900b..d49c666 100644 (file)
@@ -36,14 +36,16 @@ typedef enum adj_delegate_type_t_ {
      * BFD session state
      */
     ADJ_DELEGATE_BFD,
+    /**
+     * Stacking of a midchain's nexthop
+     */
+    ADJ_DELEGATE_MIDCHAIN,
 } adj_delegate_type_t;
 
+#define ADJ_DELEGATE_LAST (ADJ_DELEGATE_MIDCHAIN)
+
 /**
- * Adj delegate. This object should be contained within all type specific
- * delegates.  i.e. this is the base class to all type specific derived classes.
- * With this model the delegate provider is free to manage the memory of the
- * delegate in the way it chooses. Specifically it can assign them from its own
- * pools and thus, for example, add the delegates to the FIB node graph.
+ * Adj delegate. This object is attached to the adjacency.
  */
 typedef struct adj_delegate_t_
 {
@@ -56,6 +58,12 @@ typedef struct adj_delegate_t_
      * The delagate type
      */
     adj_delegate_type_t ad_type;
+
+    /**
+     * The index passed by the provider to identify its delegate instance.
+     * As with all things VPP this is a pool index.
+     */
+    index_t ad_index;
 } adj_delegate_t;
 
 /**
@@ -69,12 +77,18 @@ typedef void (*adj_delegate_adj_deleted_t)(adj_delegate_t *aed);
  */
 typedef u8 * (*adj_delegate_format_t)(const adj_delegate_t *aed, u8 *s);
 
+/**
+ * Notification that an adjacency has been created
+ */
+typedef void (*adj_delegate_adj_created_t)(adj_index_t ai);
+
 /**
  * An ADJ delegate virtual function table
  */
 typedef struct adj_delegate_vft_t_ {
     adj_delegate_format_t adv_format;
     adj_delegate_adj_deleted_t adv_adj_deleted;
+    adj_delegate_adj_created_t adv_adj_created;
 } adj_delegate_vft_t;
 
 /**
@@ -91,14 +105,11 @@ extern void adj_delegate_remove(adj_index_t ai,
  *
  * @param ai The adjacency to add the delegate to
  * @param type The type of delegate being added
- * @param ad The delegate. The provider should allocate memory for this object
- *                         Typically this is a 'derived' class with the
- *                         adj_delegate_t struct embedded within.
+ * @param adi The provider's [pool] index of its attached objet
  */
 extern int adj_delegate_add(ip_adjacency_t *adj,
                             adj_delegate_type_t fdt,
-                            adj_delegate_t *ad);
-
+                            index_t adi);
 
 /**
  * @brief Get a delegate from an adjacency