14 vat_main_t *vam = va_arg (*args, vat_main_t *);
15 i32 error = va_arg (*args,
u32);
18 p =
hash_get (vam->error_string_by_error_number, -error);
21 s =
format (s,
"%s", p[0]);
23 s =
format (s,
"%d", error);
34 #define _(n,v,s) hash_set (vam->error_string_by_error_number, -v, s); 38 hash_set (vam->error_string_by_error_number, 99,
"Misc");
49 vam->my_client_index = (
u32) ~ 0;
78 u8 *cmdp, *argsp, *this_cmd;
82 int (*fp) (vat_main_t *);
88 _vec_len (vam->inbuf) = 0;
103 this_cmd = cmdp = vam->inbuf;
106 while (cmdp < (this_cmd +
vec_len (this_cmd)))
108 if (*cmdp ==
' ' || *cmdp ==
'\t' || *cmdp ==
'\n')
119 while (argsp < (this_cmd +
vec_len (this_cmd)))
121 if (*argsp !=
' ' && *argsp !=
'\t' && *argsp !=
'\n' && *argsp != 0)
132 if (argsp == (this_cmd +
vec_len (this_cmd) - 1))
135 while (argsp < (this_cmd +
vec_len (this_cmd)))
137 if (*argsp ==
' ' || *argsp ==
'\t' || *argsp ==
'\n')
155 arg_len = strlen ((
char *) argsp);
166 "%s error: %U\n", cmdp,
170 if (vam->regenerate_interface_table)
172 vam->regenerate_interface_table = 0;
173 api_sw_interface_dump (vam);
182 .path =
"binary-api",
183 .short_help =
"binary-api [help] <name> [<args>]",
232 u32 *result = va_arg (*args,
u32 *);
234 u32 sw_if_index = ~0;
240 *result = sw_if_index;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
uword output_function_arg
#define hash_set(h, key, value)
vnet_main_t * vnet_get_main(void)
unix_shared_memory_queue_t * vl_input_queue
static u8 * format_api_error(u8 *s, va_list *args)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
unformat_function_t unformat_vnet_sw_interface
unix_shared_memory_queue_t * vl_input_queue
static clib_error_t * api_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
#define VLIB_INIT_FUNCTION(x)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
struct vl_shmem_hdr_ * shmem_hdr
#define hash_create_string(elts, value_bytes)
u16 vl_client_get_first_plugin_msg_id(char *plugin_name)
uword unformat_sw_if_index(unformat_input_t *input, va_list *args)
static vlib_process_t * vlib_get_current_process(vlib_main_t *vm)
#define vec_free(V)
Free vector's memory (no header).
vl_api_msg_range_t * msg_ranges
#define clib_warning(format, args...)
void vat_suspend(vlib_main_t *vm, f64 interval)
#define foreach_vnet_api_error
#define VLIB_CLI_COMMAND(x,...)
#define hash_create(elts, value_bytes)
void vat_plugin_hash_create(void)
static void init_error_string_table(vat_main_t *vam)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static clib_error_t * api_main_init(vlib_main_t *vm)
int vat_plugin_init(vat_main_t *vam)
#define hash_get_mem(h, key)
void api_cli_output(void *notused, const char *fmt,...)
vlib_cli_output_function_t * output_function
uword * msg_range_by_name