#endif
socket_main_t *sm = &socket_main;
u16 msg_id = ntohs (*(u16 *) elem);
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
msgbuf_t *mb = (msgbuf_t *) (elem - offsetof (msgbuf_t, data));
vl_api_registration_t *sock_rp;
clib_file_main_t *fm = &file_main;
}
void
-vl_socket_process_api_msg (clib_file_t * uf, vl_api_registration_t * rp,
- i8 * input_v)
+vl_socket_process_api_msg (vl_api_registration_t * rp, i8 * input_v)
{
msgbuf_t *mbp = (msgbuf_t *) input_v;
u8 *the_msg = (u8 *) (mbp->data);
- socket_main.current_uf = uf;
socket_main.current_rp = rp;
vl_msg_api_socket_handler (the_msg);
- socket_main.current_uf = 0;
socket_main.current_rp = 0;
}
u32 msgbuf_len;
u32 save_input_buffer_length = vec_len (socket_main.input_buffer);
vl_socket_args_for_process_t *a;
+ u32 reg_index = uf->private_data;
- rp = pool_elt_at_index (socket_main.registration_pool, uf->private_data);
+ rp = vl_socket_get_registration (reg_index);
/* Ignore unprocessed_input for now, n describes input_buffer for now. */
n = read (uf->file_descriptor, socket_main.input_buffer,
{
/* Severe error, close the file. */
clib_file_del (fm, uf);
-
- if (!pool_is_free (socket_main.registration_pool, rp))
- {
- u32 index = rp - socket_main.registration_pool;
- vl_socket_free_registration_index (index);
- }
- else
- {
- clib_warning ("client index %d already free?",
- rp->vl_api_registration_pool_index);
- }
+ vl_socket_free_registration_index (reg_index);
}
/* EAGAIN means we do not close the file, but no data to process anyway. */
return 0;
_vec_len (data_for_process) = msgbuf_len;
/* Everything is ready to signal the SOCKET_READ_EVENT. */
pool_get (socket_main.process_args, a);
- a->clib_file = uf;
- a->regp = rp;
+ a->reg_index = reg_index;
a->data = data_for_process;
vlib_process_signal_event (vm, vl_api_clnt_node.index,
{
vl_api_registration_t *regp;
vl_api_sockclnt_create_reply_t *rp;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
hash_pair_t *hp;
int rv = 0;
u32 nmsg = hash_elts (am->msg_index_by_name_and_crc);
hash_foreach_pair (hp, am->msg_index_by_name_and_crc,
({
rp->message_table[i].index = htons(hp->value[0]);
- strncpy_s((char *)rp->message_table[i].name, 64 /* bytes of space at dst */,
- (char *)hp->key, 64-1 /* chars to copy, without zero byte. */);
+ (void) strncpy_s((char *)rp->message_table[i].name,
+ 64 /* bytes of space at dst */,
+ (char *)hp->key,
+ 64-1 /* chars to copy, without zero byte. */);
i++;
}));
/* *INDENT-ON* */
ssvm_private_t _memfd_private, *memfd = &_memfd_private;
svm_map_region_args_t _args, *a = &_args;
vl_api_registration_t *regp;
- api_main_t *am = &api_main;
+ api_main_t *am = vlibapi_get_main ();
svm_region_t *vlib_rp;
clib_file_t *cf;
vl_api_shm_elem_config_t *config = 0;