VPP-598: tcp stack initial commit
[vpp.git] / src / vnet / lisp-gpe / lisp_gpe.h
index 3288c99..b5a50ec 100644 (file)
 #include <vnet/l2/l2_input.h>
 #include <vnet/ethernet/ethernet.h>
 #include <vnet/ip/ip4_packet.h>
-#include <vnet/ip/udp.h>
+#include <vnet/udp/udp.h>
 #include <vnet/lisp-cp/lisp_types.h>
 #include <vnet/lisp-gpe/lisp_gpe_packet.h>
 #include <vnet/adj/adj_types.h>
+#include <vppinfra/bihash_24_8.h>
+#include <vppinfra/bihash_template.h>
 
 /** IP4-UDP-LISP encap header */
 /* *INDENT-OFF* */
@@ -65,6 +67,9 @@ typedef enum
     LISP_GPE_INPUT_N_NEXT,
 } lisp_gpe_input_next_t;
 
+/* Arc to nsh-input added only if nsh-input exists */
+#define LISP_GPE_INPUT_NEXT_NSH_INPUT 4
+
 typedef enum
 {
 #define lisp_gpe_error(n,s) LISP_GPE_ERROR_##n,
@@ -85,6 +90,14 @@ typedef struct tunnel_lookup
   uword *vni_by_sw_if_index;
 } tunnel_lookup_t;
 
+
+typedef enum gpe_encap_mode_e
+{
+  GPE_ENCAP_LISP,
+  GPE_ENCAP_VXLAN,
+  GPE_ENCAP_COUNT
+} gpe_encap_mode_t;
+
 /** LISP-GPE global state*/
 typedef struct lisp_gpe_main
 {
@@ -119,6 +132,17 @@ typedef struct lisp_gpe_main
   /** Load-balance for a miss in the table */
   dpo_id_t l2_lb_cp_lkup;
 
+  /* NSH data structures
+   * ================== */
+
+    BVT (clib_bihash) nsh_fib;
+
+  tunnel_lookup_t nsh_ifaces;
+
+  const dpo_id_t *nsh_cp_lkup;
+
+  gpe_encap_mode_t encap_mode;
+
   /** convenience */
   vlib_main_t *vlib_main;
   vnet_main_t *vnet_main;
@@ -256,6 +280,8 @@ typedef enum lgpe_ip6_lookup_next
 u8 *format_vnet_lisp_gpe_status (u8 * s, va_list * args);
 
 lisp_api_gpe_fwd_entry_t *vnet_lisp_gpe_fwd_entries_get_by_vni (u32 vni);
+gpe_encap_mode_t vnet_gpe_get_encap_mode (void);
+int vnet_gpe_set_encap_mode (gpe_encap_mode_t mode);
 
 #endif /* included_vnet_lisp_gpe_h */