X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvat%2Fvat.h;h=10199e3e9e6b08b37035e1f64ac06304c635e026;hb=f0e67d78ae23ff3d5751ea10e9e76cb6e81ba4a5;hp=32de90e44117665bf8ecfa2df227c5049781e489;hpb=2e55823af6c1cc6856e4a1f2cea659170bd76fb7;p=vpp.git diff --git a/src/vat/vat.h b/src/vat/vat.h index 32de90e4411..10199e3e9e6 100644 --- a/src/vat/vat.h +++ b/src/vat/vat.h @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include "vat/json_format.h" @@ -232,6 +234,8 @@ typedef struct struct vat_registered_features_t *feature_function_registrations; + int (*api_sw_interface_dump) (); + /* 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__ */