aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat/vat.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vat/vat.h')
-rw-r--r--src/vat/vat.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/vat/vat.h b/src/vat/vat.h
index 32de90e4411..d8045752b35 100644
--- a/src/vat/vat.h
+++ b/src/vat/vat.h
@@ -33,6 +33,8 @@
#include <vlib/unix/unix.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
+#include <vlibmemory/memclnt.api_enum.h>
+#include <vlibmemory/memclnt.api_types.h>
#include "vat/json_format.h"
@@ -129,7 +131,7 @@ typedef struct
struct vat_registered_features_t;
-typedef struct
+typedef struct vat_main_
{
/* vpe input queue */
svm_queue_t *vl_input_queue;
@@ -232,6 +234,8 @@ typedef struct
struct vat_registered_features_t *feature_function_registrations;
+ int (*api_sw_interface_dump) (struct vat_main_ *);
+
/* Convenience */
vlib_main_t *vlib_main;
} vat_main_t;
@@ -295,6 +299,25 @@ static void __vlib_add_config_function_##x (void) \
.function = x, \
}
+#if VPP_API_TEST_BUILTIN == 0
+static_always_inline uword
+api_unformat_sw_if_index (unformat_input_t *input, va_list *args)
+{
+ vat_main_t *vam = va_arg (*args, vat_main_t *);
+ u32 *result = va_arg (*args, u32 *);
+ u8 *if_name;
+ uword *p;
+
+ if (!unformat (input, "%s", &if_name))
+ return 0;
+
+ p = hash_get_mem (vam->sw_if_index_by_interface_name, if_name);
+ if (p == 0)
+ return 0;
+ *result = p[0];
+ return 1;
+}
+#endif /* VPP_API_TEST_BUILTIN */
#endif /* __included_vat_h__ */