14 vat_main_t *vam = va_arg (*args, vat_main_t *);
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");
41 #if VPP_API_TEST_BUILTIN > 0 45 vat_registered_features_t *f;
49 f = vam->feature_function_registrations;
53 error = f->function (vam);
70 vam->my_client_index = (
u32) ~ 0;
104 if (vam->my_client_index != ~0)
123 regp->
name =
format (0,
"%s",
"vpp-internal");
133 api_sw_interface_dump (vam);
143 u8 *cmdp, *argsp, *this_cmd;
147 int (*fp) (vat_main_t *);
152 _vec_len (vam->inbuf) = 0;
154 vam->input = &_input;
167 this_cmd = cmdp = vam->inbuf;
170 while (cmdp < (this_cmd +
vec_len (this_cmd)))
172 if (*cmdp ==
' ' || *cmdp ==
'\t' || *cmdp ==
'\n')
183 while (argsp < (this_cmd +
vec_len (this_cmd)))
185 if (*argsp !=
' ' && *argsp !=
'\t' && *argsp !=
'\n' && *argsp != 0)
196 if (argsp == (this_cmd +
vec_len (this_cmd) - 1))
199 while (argsp < (this_cmd +
vec_len (this_cmd)))
201 if (*argsp ==
' ' || *argsp ==
'\t' || *argsp ==
'\n')
219 arg_len = strlen ((
char *) argsp);
230 "%s error: %U\n", cmdp,
234 if (vam->regenerate_interface_table)
236 vam->regenerate_interface_table = 0;
237 api_sw_interface_dump (vam);
246 .path =
"binary-api",
247 .short_help =
"binary-api [help] <name> [<args>]",
297 void *vam_unused = va_arg (*args,
void *);
299 u32 *result = va_arg (*args,
u32 *);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Message range (belonging to a plugin)
uword output_function_arg
#define hash_set(h, key, value)
vnet_main_t * vnet_get_main(void)
static u8 * format_api_error(u8 *s, va_list *args)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void maybe_register_api_client(vat_main_t *vam)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
unformat_function_t unformat_vnet_sw_interface
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
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.
vl_api_registration_t ** vl_clients
vlib/vpp only: vector of client registrations
description fragment has unexpected format
static u32 vl_msg_api_handle_from_index_and_epoch(u32 index, u32 epoch)
#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...)
svm_region_t * vlib_rp
Current binary api segment descriptor.
struct vl_shmem_hdr_ * shmem_hdr
Binary API shared-memory segment header pointer.
#define hash_create_string(elts, value_bytes)
vl_registration_type_t registration_type
type
void vl_msg_pop_heap(void *oldheap)
svm_queue_t * vl_input_queue
shared memory only: pointer to client input queue
clib_error_t * vat_builtin_main_init(vlib_main_t *vm)
API main structure, used by both vpp and binary API clients.
An API client registration, only in vpp/vlib.
uword unformat_sw_if_index(unformat_input_t *input, va_list *args)
Shared memory connection.
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
vector of message ranges
#define clib_warning(format, args...)
void vat_suspend(vlib_main_t *vm, f64 interval)
svm_queue_t * vl_input_queue
#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)
static void * clib_mem_alloc(uword size)
u16 first_msg_id
first assigned message ID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
int vat_plugin_init(vat_main_t *vam)
u32 vl_api_registration_pool_index
Index in VLIB's brain (not shared memory).
#define hash_get_mem(h, key)
static api_main_t * vlibapi_get_main(void)
void api_cli_output(void *notused, const char *fmt,...)
u16 vl_client_get_first_plugin_msg_id(const char *plugin_name)
void * vl_msg_push_heap(void)
vlib_cli_output_function_t * output_function
uword * msg_range_by_name
Message range by name hash.
vl_api_interface_index_t sw_if_index