Implement LISP control plane messages
[vpp.git] / vnet / vnet / lisp-cp / lisp_types.h
index cd1d1b9..7df0e65 100644 (file)
 #include <vnet/ip/ip.h>
 #include <vnet/lisp-cp/lisp_cp_messages.h>
 
+#define SHA1_AUTH_DATA_LEN                  20
+#define SHA256_AUTH_DATA_LEN                32
+
+typedef enum
+{
+  HMAC_NO_KEY = 0,
+  HMAC_SHA_1_96,
+  HMAC_SHA_256_128
+} lisp_key_type_t;
+
+uword unformat_hmac_key_id (unformat_input_t * input, va_list * args);
+u8 *format_hmac_key_id (u8 * s, va_list * args);
+
 typedef enum
 {
   IP4,
@@ -90,11 +103,11 @@ typedef enum
   LCAF_TYPES
 } lcaf_type_t;
 
-typedef enum
+typedef enum fid_addr_type_t_
 {
   FID_ADDR_IP_PREF,
   FID_ADDR_MAC
-} fid_addr_type_t;
+} __attribute__ ((packed)) fid_addr_type_t;
 
 /* flat address type */
 typedef struct
@@ -104,7 +117,7 @@ typedef struct
     ip_prefix_t ippref;
     u8 mac[6];
   };
-  u8 type;                     /* fid_addr_type_t */
+  fid_addr_type_t type;
 } fid_address_t;
 
 typedef fid_address_t dp_address_t;
@@ -126,6 +139,8 @@ typedef struct
 #define sd_dst_ippref(_a) fid_addr_ippref(&sd_dst(_a))
 #define sd_src_mac(_a) fid_addr_mac(&sd_src(_a))
 #define sd_dst_mac(_a) fid_addr_mac(&sd_dst(_a))
+#define sd_src_type(_a) fid_addr_type(&sd_src(_a))
+#define sd_dst_type(_a) fid_addr_type(&sd_dst(_a))
 
 typedef struct
 {
@@ -184,6 +199,8 @@ u16 ip_address_size_to_write (ip_address_t * a);
 u16 ip_address_iana_afi (ip_address_t * a);
 u8 ip_address_max_len (u8 ver);
 u32 ip_address_put (u8 * b, ip_address_t * a);
+void ip_address_to_46 (const ip_address_t * addr,
+                      ip46_address_t * a, fib_protocol_t * proto);
 
 /* LISP AFI codes  */
 typedef enum
@@ -224,6 +241,8 @@ void gid_address_ip_set (gid_address_t * dst, void *src, u8 version);
 #define gid_address_sd(_a) (_a)->sd
 #define gid_address_sd_src(_a) sd_src(&gid_address_sd(_a))
 #define gid_address_sd_dst(_a) sd_dst(&gid_address_sd(_a))
+#define gid_address_sd_src_type(_a) sd_src_type(&gid_address_sd(_a))
+#define gid_address_sd_dst_type(_a) sd_dst_type(&gid_address_sd(_a))
 
 /* 'sub'address functions */
 #define foreach_gid_address_type_fcns  \
@@ -264,6 +283,7 @@ typedef struct
   u8 weight;
   u8 mpriority;
   u8 mweight;
+  u8 probed;
 } locator_t;
 
 u32 locator_parse (void *ptr, locator_t * loc);
@@ -286,7 +306,11 @@ typedef struct
   gid_address_t eid;
 
   /* index of local locator set */
-  u32 locator_set_index;
+  union
+  {
+    u32 locator_set_index;
+    locator_t *locators;       /* used for map register message */
+  };
 
   u32 ttl;
   u8 action;
@@ -295,6 +319,8 @@ typedef struct
   u8 local;
   /* valid only for remote mappings */
   u8 is_static;
+  u8 *key;
+  lisp_key_type_t key_id;
 } mapping_t;
 
 uword
@@ -311,6 +337,11 @@ typedef struct locator_pair
   u8 weight;
 } locator_pair_t;
 
+void
+build_src_dst (gid_address_t * sd, gid_address_t * src, gid_address_t * dst);
+
+void gid_address_from_ip (gid_address_t * g, ip_address_t * ip);
+
 #endif /* VNET_LISP_GPE_LISP_TYPES_H_ */
 
 /*