vl_api_trace_plugin_msg_ids_t_print (vl_api_trace_plugin_msg_ids_t * a,
void *handle)
{
- u8 *plugin_name = vl_api_from_api_to_vec (&a->plugin_name);
- vl_print (handle, "vl_api_trace_plugin_msg_ids: %v first %u last %u\n",
- plugin_name,
+ vl_print (handle, "vl_api_trace_plugin_msg_ids: %s first %u last %u\n",
+ a->plugin_name,
clib_host_to_net_u16 (a->first_msg_id),
clib_host_to_net_u16 (a->last_msg_id));
- vec_free (plugin_name);
return handle;
}
vl_api_get_first_msg_id_reply_t *rmp;
vl_api_registration_t *regp;
uword *p;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
vl_api_msg_range_t *rp;
+ u8 name[64];
u16 first_msg_id = ~0;
int rv = -7; /* VNET_API_ERROR_INVALID_VALUE */
if (!regp)
return;
- u8 *name = vl_api_from_api_to_vec (&mp->name);
-
if (am->msg_range_by_name == 0)
goto out;
-
+ strncpy ((char *) name, (char *) mp->name, ARRAY_LEN (name));
+ name[ARRAY_LEN (name) - 1] = '\0';
p = hash_get_mem (am->msg_range_by_name, name);
if (p == 0)
goto out;
rv = 0;
out:
- vec_free (name);
rmp = vl_msg_api_alloc (sizeof (*rmp));
rmp->_vl_msg_id = ntohs (VL_API_GET_FIRST_MSG_ID_REPLY);
rmp->context = mp->context;
void
vl_api_api_versions_t_handler (vl_api_api_versions_t * mp)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
vl_api_api_versions_reply_t *rmp;
vl_api_registration_t *reg;
u32 nmsg = vec_len (am->api_version_list);
rmp->api_versions[i].major = htonl (vl->major);
rmp->api_versions[i].minor = htonl (vl->minor);
rmp->api_versions[i].patch = htonl (vl->patch);
- vl_api_to_api_string (strnlen (vl->name, 64), vl->name,
- &rmp->api_versions[i].name);
+ strncpy ((char *) rmp->api_versions[i].name, vl->name,
+ ARRAY_LEN (rmp->api_versions[i].name));
+ rmp->api_versions[i].name[ARRAY_LEN (rmp->api_versions[i].name) - 1] =
+ '\0';
}
vl_api_send_msg (reg, (u8 *) rmp);
send_one_plugin_msg_ids_msg (u8 * name, u16 first_msg_id, u16 last_msg_id)
{
vl_api_trace_plugin_msg_ids_t *mp;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
vl_shmem_hdr_t *shmem_hdr = am->shmem_hdr;
svm_queue_t *q;
clib_memset (mp, 0, sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_TRACE_PLUGIN_MSG_IDS);
- vl_api_to_api_string (strnlen_s ((char *) name, 64), (char *) name,
- &mp->plugin_name);
+ strncpy ((char *) mp->plugin_name, (char *) name,
+ sizeof (mp->plugin_name) - 1);
mp->first_msg_id = clib_host_to_net_u16 (first_msg_id);
mp->last_msg_id = clib_host_to_net_u16 (last_msg_id);
vl_api_save_msg_table (void)
{
u8 *serialized_message_table;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
u8 *chroot_file;
int fd, rv;
vl_shmem_hdr_t *shm;
svm_queue_t *q;
clib_error_t *e;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
f64 dead_client_scan_time;
f64 sleep_time, start_time;
f64 vector_rate;
* of the application to process the request, the client will
* sit and wait for Godot...
*/
- vector_rate = vlib_last_vector_length_per_node (vm);
+ vector_rate = (f64) vlib_last_vectors_per_main_loop (vm);
start_time = vlib_time_now (vm);
while (1)
{
case SOCKET_READ_EVENT:
for (i = 0; i < vec_len (event_data); i++)
{
+ vl_api_registration_t *regp;
+
a = pool_elt_at_index (socket_main.process_args, event_data[i]);
- vl_socket_process_api_msg (a->clib_file, a->regp,
- (i8 *) a->data);
+ regp = vl_socket_get_registration (a->reg_index);
+ if (regp)
+ {
+ vl_socket_process_api_msg (regp, (i8 *) a->data);
+ a = pool_elt_at_index (socket_main.process_args,
+ event_data[i]);
+ }
vec_free (a->data);
pool_put (socket_main.process_args, a);
}
.type = VLIB_NODE_TYPE_PROCESS,
.name = "api-rx-from-ring",
.state = VLIB_NODE_STATE_DISABLED,
+ .process_log2_n_stack_bytes = 18,
};
/* *INDENT-ON* */
static void
vl_api_trace_plugin_msg_ids_t_handler (vl_api_trace_plugin_msg_ids_t * mp)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
vl_api_msg_range_t *rp;
uword *p;
if (am->replay_in_progress == 0)
return;
- u8 *plugin_name = vl_api_from_api_to_vec (&mp->plugin_name);
- vec_add1 (plugin_name, 0);
-
- p = hash_get_mem (am->msg_range_by_name, plugin_name);
+ p = hash_get_mem (am->msg_range_by_name, mp->plugin_name);
if (p == 0)
{
clib_warning ("WARNING: traced plugin '%s' not in current image",
- plugin_name);
+ mp->plugin_name);
return;
}
if (rp->first_msg_id != clib_net_to_host_u16 (mp->first_msg_id))
{
clib_warning ("WARNING: traced plugin '%s' first message id %d not %d",
- plugin_name, clib_net_to_host_u16 (mp->first_msg_id),
+ mp->plugin_name, clib_net_to_host_u16 (mp->first_msg_id),
rp->first_msg_id);
}
if (rp->last_msg_id != clib_net_to_host_u16 (mp->last_msg_id))
{
clib_warning ("WARNING: traced plugin '%s' last message id %d not %d",
- plugin_name, clib_net_to_host_u16 (mp->last_msg_id),
+ mp->plugin_name, clib_net_to_host_u16 (mp->last_msg_id),
rp->last_msg_id);
}
- vec_free (plugin_name);
}
#define foreach_rpc_api_msg \
static clib_error_t *
rpc_api_hookup (vlib_main_t * vm)
{
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
#define _(N,n) \
vl_msg_api_set_handlers(VL_API_##N, #n, \
vl_api_##n##_t_handler, \