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;
83 if (vam->my_client_index != ~0)
90 pthread_mutex_lock (&svm->
mutex);
95 memset (regp, 0,
sizeof (*regp));
104 regp->
name =
format (0,
"%s",
"vpp-internal");
107 pthread_mutex_unlock (&svm->
mutex);
122 u8 *cmdp, *argsp, *this_cmd;
126 int (*fp) (vat_main_t *);
134 _vec_len (vam->inbuf) = 0;
136 vam->input = &_input;
149 this_cmd = cmdp = vam->inbuf;
152 while (cmdp < (this_cmd +
vec_len (this_cmd)))
154 if (*cmdp ==
' ' || *cmdp ==
'\t' || *cmdp ==
'\n')
165 while (argsp < (this_cmd +
vec_len (this_cmd)))
167 if (*argsp !=
' ' && *argsp !=
'\t' && *argsp !=
'\n' && *argsp != 0)
178 if (argsp == (this_cmd +
vec_len (this_cmd) - 1))
181 while (argsp < (this_cmd +
vec_len (this_cmd)))
183 if (*argsp ==
' ' || *argsp ==
'\t' || *argsp ==
'\n')
201 arg_len = strlen ((
char *) argsp);
212 "%s error: %U\n", cmdp,
216 if (vam->regenerate_interface_table)
218 vam->regenerate_interface_table = 0;
219 api_sw_interface_dump (vam);
228 .path =
"binary-api",
229 .short_help =
"binary-api [help] <name> [<args>]",
278 u32 *result = va_arg (*args,
u32 *);
280 u32 sw_if_index = ~0;
284 *result = sw_if_index;
#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)
static void svm_pop_heap(void *oldheap)
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)
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.
#define VLIB_INIT_FUNCTION(x)
static void * svm_push_data_heap(svm_region_t *rp)
vl_api_registration_t ** vl_clients
vlib/vpp only: vector of client registrations
#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
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)
static vlib_process_t * vlib_get_current_process(vlib_main_t *vm)
#define vec_free(V)
Free vector's memory (no header).
unix_shared_memory_queue_t * vl_input_queue
shared memory only: pointer to client input queue
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)
#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)
static clib_error_t * api_main_init(vlib_main_t *vm)
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)
void api_cli_output(void *notused, const char *fmt,...)
u16 vl_client_get_first_plugin_msg_id(const char *plugin_name)
vlib_cli_output_function_t * output_function
uword * msg_range_by_name
Message range by name hash.
Shared memory connection.
static u32 vl_msg_api_handle_from_index_and_epoch(u32 index, u32 epoch)