+/**
+ * result of a lookup in the protection bihash
+ */
+typedef struct ipsec_tun_lkup_result_t_
+{
+ u32 tun_index;
+ u32 sa_index;
+ u32 sw_if_index;
+ ipsec_protect_flags_t flags;
+ u8 __pad[3];
+} ipsec_tun_lkup_result_t;
+
+typedef struct ipsec4_tunnel_kv_t
+{
+ /*
+ * Key fields: remote ip and spi on incoming packet
+ * all fields in NET byte order
+ */
+ u64 key;
+ ipsec_tun_lkup_result_t value;
+} __clib_packed ipsec4_tunnel_kv_t;
+
+STATIC_ASSERT_SIZEOF (ipsec4_tunnel_kv_t, sizeof (clib_bihash_kv_8_16_t));
+STATIC_ASSERT_OFFSET_OF (ipsec4_tunnel_kv_t, value,
+ STRUCT_OFFSET_OF (clib_bihash_kv_8_16_t, value));
+
+static inline void
+ipsec4_tunnel_mk_key (ipsec4_tunnel_kv_t * k,
+ const ip4_address_t * ip, u32 spi)
+{
+ k->key = (((u64) ip->as_u32) << 32 | spi);
+}
+
+static inline void
+ipsec4_tunnel_extract_key (const ipsec4_tunnel_kv_t * k,
+ ip4_address_t * ip, u32 * spi)
+{
+ *spi = (u32) k->key;
+ (*ip).as_u32 = k->key >> 32;
+}
+
+typedef struct ipsec6_tunnel_kv_t_
+{
+ /*
+ * Key fields: remote ip and spi on incoming packet
+ * all fields in NET byte order
+ */
+ struct
+ {
+ ip6_address_t remote_ip;
+ u32 spi;
+ u32 __pad;
+ } key;
+ ipsec_tun_lkup_result_t value;
+} __clib_packed ipsec6_tunnel_kv_t;
+
+STATIC_ASSERT_SIZEOF (ipsec6_tunnel_kv_t, sizeof (clib_bihash_kv_24_16_t));
+STATIC_ASSERT_OFFSET_OF (ipsec6_tunnel_kv_t, value,
+ STRUCT_OFFSET_OF (clib_bihash_kv_24_16_t, value));
+
+extern u8 *format_ipsec4_tunnel_kv (u8 * s, va_list * args);
+extern u8 *format_ipsec6_tunnel_kv (u8 * s, va_list * args);
+