Fix LISP src/dst based policy
[vpp.git] / vnet / vnet / lisp-cp / gid_dictionary.h
index d9a857f..c5aaf8c 100644 (file)
@@ -35,6 +35,8 @@
 #define MAC_LOOKUP_DEFAULT_HASH_NUM_BUCKETS (64 * 1024)
 #define MAC_LOOKUP_DEFAULT_HASH_MEMORY_SIZE (32<<20)
 
+typedef void (*foreach_subprefix_match_cb_t) (u32, void *);
+
 typedef struct
 {
   BVT (clib_bihash) ip4_lookup_table;
@@ -48,8 +50,11 @@ typedef struct
   /* ip4 lookup table config parameters */
   u32 ip4_lookup_table_nbuckets;
   uword ip4_lookup_table_size;
+} gid_ip4_table_t;
 
-    BVT (clib_bihash) ip6_lookup_table;
+typedef struct
+{
+  BVT (clib_bihash) ip6_lookup_table;
 
   /* bitmap/vector of mask widths to search */
   uword *ip6_non_empty_dst_address_length_bitmap;
@@ -60,12 +65,33 @@ typedef struct
   /* ip6 lookup table config parameters */
   u32 ip6_lookup_table_nbuckets;
   uword ip6_lookup_table_size;
+} gid_ip6_table_t;
 
-    BVT (clib_bihash) mac_lookup_table;
+typedef struct gid_mac_table
+{
+  BVT (clib_bihash) mac_lookup_table;
 
   /* mac lookup table config parameters */
   u32 mac_lookup_table_nbuckets;
   uword mac_lookup_table_size;
+} gid_mac_table_t;
+
+typedef struct
+{
+  /** destination IP LPM ip4 lookup table */
+  gid_ip4_table_t dst_ip4_table;
+
+  /** pool of source IP LPM ip4 lookup tables */
+  gid_ip4_table_t *src_ip4_table_pool;
+
+  /** destination IP LPM ip6 lookup table */
+  gid_ip6_table_t dst_ip6_table;
+
+  /** pool of source IP LPM ip6 lookup tables */
+  gid_ip6_table_t *src_ip6_table_pool;
+
+  /** flat source/dest mac lookup table */
+  gid_mac_table_t sd_mac_table;
 
 } gid_dictionary_t;
 
@@ -74,9 +100,15 @@ gid_dictionary_add_del (gid_dictionary_t * db, gid_address_t * key, u32 value,
                        u8 is_add);
 
 u32 gid_dictionary_lookup (gid_dictionary_t * db, gid_address_t * key);
+u32 gid_dictionary_sd_lookup (gid_dictionary_t * db, gid_address_t * dst,
+                             gid_address_t * src);
 
 void gid_dictionary_init (gid_dictionary_t * db);
 
+void
+gid_dict_foreach_subprefix (gid_dictionary_t * db, gid_address_t * eid,
+                           foreach_subprefix_match_cb_t cb, void *arg);
+
 #endif /* VNET_LISP_GPE_GID_DICTIONARY_H_ */
 
 /*