ip: Router ID included in flow hash
[vpp.git] / src / plugins / cnat / cnat_session.h
index 4699dcc..e352fe6 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef __CNAT_SESSION_H__
 #define __CNAT_SESSION_H__
 
-#include <vnet/udp/udp.h>
+#include <vnet/udp/udp_packet.h>
 
 #include <cnat/cnat_types.h>
 #include <cnat/cnat_client.h>
@@ -91,18 +91,36 @@ typedef struct cnat_session_t_
      * Timestamp index this session was last used
      */
     u32 cs_ts_index;
-    /**
-     * Indicates a return path session that was source NATed
-     * on the way in.
-     */
-    u32 flags;
+
+    union
+    {
+       /**
+        * session flags if cs_lbi == INDEX_INVALID
+        */
+      u32 flags;
+       /**
+        * Persist translation->ct_lb.dpoi_next_node
+        * when cs_lbi != INDEX_INVALID
+        */
+      u32 ct_index;
+    };
   } value;
 } cnat_session_t;
 
 typedef enum cnat_session_flag_t_
 {
+  /**
+   * Indicates a return path session that was source NATed
+   * on the way in.
+   */
   CNAT_SESSION_FLAG_HAS_SNAT = (1 << 0),
+  /**
+   * This session source port was allocated, free it on cleanup
+   */
   CNAT_SESSION_FLAG_ALLOC_PORT = (1 << 1),
+  /**
+   * This session doesn't have a client, do not attempt to free it
+   */
   CNAT_SESSION_FLAG_NO_CLIENT = (1 << 2),
 } cnat_session_flag_t;
 
@@ -151,6 +169,11 @@ extern int cnat_session_purge (void);
  */
 extern void cnat_session_free (cnat_session_t * session);
 
+/**
+ * Port cleanup callback
+ */
+extern void (*cnat_free_port_cb) (u16 port, ip_protocol_t iproto);
+
 /*
  * fd.io coding-style-patch-verification: ON
  *