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);
115 api_sw_interface_dump (vam);
125 u8 *cmdp, *argsp, *this_cmd;
129 int (*fp) (vat_main_t *);
135 _vec_len (vam->inbuf) = 0;
137 vam->input = &_input;
150 this_cmd = cmdp = vam->inbuf;
153 while (cmdp < (this_cmd +
vec_len (this_cmd)))
155 if (*cmdp ==
' ' || *cmdp ==
'\t' || *cmdp ==
'\n')
166 while (argsp < (this_cmd +
vec_len (this_cmd)))
168 if (*argsp !=
' ' && *argsp !=
'\t' && *argsp !=
'\n' && *argsp != 0)
179 if (argsp == (this_cmd +
vec_len (this_cmd) - 1))
182 while (argsp < (this_cmd +
vec_len (this_cmd)))
184 if (*argsp ==
' ' || *argsp ==
'\t' || *argsp ==
'\n')
202 arg_len = strlen ((
char *) argsp);
213 "%s error: %U\n", cmdp,
217 if (vam->regenerate_interface_table)
219 vam->regenerate_interface_table = 0;
220 api_sw_interface_dump (vam);
229 .path =
"binary-api",
230 .short_help =
"binary-api [help] <name> [<args>]",
279 void *vam_unused = va_arg (*args,
void *);
280 u32 *result = va_arg (*args,
u32 *);
282 u32 sw_if_index = ~0;
286 *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)
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
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
svm_queue_t * vl_input_queue
shared memory only: pointer to client input queue
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)
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.