VPP-197: LISP Source/Dest control plane support
[vpp.git] / vnet / vnet / lisp-cp / lisp_cp_messages.h
index 6142a04..1de62d6 100644 (file)
@@ -214,12 +214,6 @@ char *map_request_hdr_to_char(map_request_hdr_t *h);
  * MAP-REPLY MESSAGE
  */
 
- /*  Map Reply action codes */
- #define LISP_ACTION_NO_ACTION           0
- #define LISP_ACTION_FORWARD             1
- #define LISP_ACTION_DROP                2
- #define LISP_ACTION_SEND_MAP_REQUEST    3
-
  /*
   * Map-Reply Message Format
   *
@@ -416,12 +410,12 @@ void mapping_record_init_hdr(mapping_record_hdr_t *h);
 #define MAP_REC_EID(h) (u8 *)(h)+sizeof(mapping_record_hdr_t)
 #define MAP_REC_VERSION(h) (h)->version_hi << 8 | (h)->version_low
 
-typedef enum lisp_actions
+typedef enum
 {
-  ACT_NO_ACTION = 0,
-  ACT_NATIVE_FWD,
-  ACT_SEND_MREQ,
-  ACT_DROP
+  LISP_NO_ACTION,
+  LISP_FORWARD_NATIVE,
+  LISP_SEND_MAP_REQUEST,
+  LISP_DROP
 } lisp_action_e;
 
 typedef enum lisp_authoritative
@@ -430,4 +424,50 @@ typedef enum lisp_authoritative
   A_AUTHORITATIVE
 } lisp_authoritative_e;
 
+/*
+ * LISP Canonical Address Format Encodings
+ *
+ *   0                   1                   2                   3
+ *   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *  |           AFI = 16387         |     Rsvd1     |     Flags     |
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *  |    Type       |     Rsvd2     |            Length             |
+ *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
+typedef struct _lcaf_hdr_t
+{
+  u8 reserved1;
+  u8 flags;
+  u8 type;
+  u8 reserved2;
+  u16 len;
+} __attribute__ ((__packed__)) lcaf_hdr_t;
+
+#define LCAF_TYPE(h) ((lcaf_hdr_t *)(h))->type
+#define LCAF_LENGTH(h) ((lcaf_hdr_t *)(h))->len
+#define LCAF_RES2(h) ((lcaf_hdr_t *)(h))->reserved2
+#define LCAF_FLAGS(h) ((lcaf_hdr_t *)(h))->flags
+#define LCAF_PAYLOAD(h) (u8 *)(h)+sizeof(lcaf_hdr_t)
+
+/*
+ * Source/Dest Key Canonical Address Format:
+ *
+ *   0                   1                   2                   3
+ *   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *   |            Reserved           |   Source-ML   |    Dest-ML    |
+ *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+typedef struct _lcaf_src_dst_hdr_t
+{
+  u16 reserved;
+  u8 src_mask_len;
+  u8 dst_mask_len;
+} __attribute__ ((__packed__)) lcaf_src_dst_hdr_t;
+
+#define LCAF_SD_SRC_ML(_h) (_h)->src_mask_len
+#define LCAF_SD_DST_ML(_h) (_h)->dst_mask_len
+
 #endif /* VNET_LISP_GPE_LISP_CP_MESSAGES_H_ */