Dump routes (VPP-500)
[vpp.git] / vnet / vnet / fib / fib_types.h
index 250aad7..83123a5 100644 (file)
@@ -68,48 +68,10 @@ typedef enum fib_protocol_t_ {
         _item <= FIB_PROTOCOL_IP6;        \
         _item++)
 
-
-/**
- * Link Type. This maps directly into the ethertype.
- */
-typedef enum fib_link_t_ {
-#if CLIB_DEBUG > 0
-    FIB_LINK_IP4 = 1,
-#else
-    FIB_LINK_IP4 = 0,
-#endif
-    FIB_LINK_IP6,
-    FIB_LINK_ETHERNET,
-    FIB_LINK_MPLS,
-}  __attribute__ ((packed)) fib_link_t;
-
-/**
- * Definition outside of enum so it does not need to be included in non-defaulted
- * switch statements
- */
-#define FIB_LINK_NUM (FIB_LINK_MPLS+1)
-
-#define FIB_LINKS {                  \
-    [FIB_LINK_ETHERNET] = "ethernet", \
-    [FIB_LINK_IP4] = "ipv4",         \
-    [FIB_LINK_IP6] = "ipv6",          \
-    [FIB_LINK_MPLS] = "mpls",         \
-}
-
-#define FOR_EACH_FIB_LINK(_item)    \
-    for (_item = FIB_LINK_IP4;      \
-        _item <= FIB_LINK_MPLS;    \
-        _item++)
-
-#define FOR_EACH_FIB_IP_LINK(_item)  \
-    for (_item = FIB_LINK_IP4;      \
-        _item <= FIB_LINK_IP6;      \
-        _item++)
-
 /**
  * @brief Convert from a protocol to a link type
  */
-fib_link_t fib_proto_to_link (fib_protocol_t proto);
+vnet_link_t fib_proto_to_link (fib_protocol_t proto);
 
 /**
  * FIB output chain type. When a child object requests a forwarding contribution
@@ -157,14 +119,19 @@ typedef enum fib_forward_chain_type_t_ {
 #define FIB_FORW_CHAIN_MPLS_NUM (FIB_FORW_CHAIN_TYPE_MPLS_EOS+1)
 
 #define FOR_EACH_FIB_FORW_CHAIN(_item)                   \
-    for (_item = FIB_FORW_CHAIN_TYPE_ETHERNET;           \
+    for (_item = FIB_FORW_CHAIN_TYPE_UNICAST_IP4;        \
+        _item <= FIB_FORW_CHAIN_TYPE_ETHERNET;           \
+        _item++)
+
+#define FOR_EACH_FIB_FORW_MPLS_CHAIN(_item)              \
+    for (_item = FIB_FORW_CHAIN_TYPE_UNICAST_IP4;        \
         _item <= FIB_FORW_CHAIN_TYPE_MPLS_EOS;           \
         _item++)
 
 /**
  * @brief Convert from a chain type to the adjacencies link type
  */
-extern fib_link_t fib_forw_chain_type_to_link_type(fib_forward_chain_type_t fct);
+extern vnet_link_t fib_forw_chain_type_to_link_type(fib_forward_chain_type_t fct);
 
 /**
  * @brief Convert from a payload-protocol to a chain type.
@@ -217,8 +184,8 @@ typedef struct fib_prefix_t_ {
     };
 } fib_prefix_t;
 
-_Static_assert(STRUCT_OFFSET_OF(fib_prefix_t, fp_addr) == 4,
-              "FIB Prefix's address is 4 byte aligned.");
+STATIC_ASSERT(STRUCT_OFFSET_OF(fib_prefix_t, fp_addr) == 4,
+             "FIB Prefix's address is 4 byte aligned.");
 
 /**
  * \brief Compare two prefixes for equality
@@ -243,7 +210,6 @@ extern u8 * format_fib_prefix(u8 * s, va_list * args);
 extern u8 * format_fib_forw_chain_type(u8 * s, va_list * args);
 
 extern dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto);
-extern dpo_proto_t fib_link_to_dpo_proto(fib_link_t linkt);
 extern fib_protocol_t dpo_proto_to_fib(dpo_proto_t dpo_proto);
 
 /**
@@ -278,7 +244,7 @@ typedef enum fib_special_type_t_ {
         _item <= FIB_SPEICAL_TYPE_LAST; _item++)
 
 extern u8 * format_fib_protocol(u8 * s, va_list ap);
-extern u8 * format_fib_link(u8 *s, va_list ap);
+extern u8 * format_vnet_link(u8 *s, va_list ap);
 
 /**
  * Path flags from the control plane
@@ -350,4 +316,13 @@ typedef struct fib_route_path_t_ {
     mpls_label_t frp_label;
 } fib_route_path_t;
 
+/**
+ * @brief 
+ * A representation of a fib path for fib_path_encode to convey the information to the caller
+ */
+typedef struct fib_route_path_encode_t_ {
+    fib_route_path_t rpath;
+    dpo_id_t dpo;
+} fib_route_path_encode_t;
+
 #endif