70 const u8 * seg_name,
u32 seg_size)
86 int n_written, bytes, total_copy_bytes;
90 session_fifo_event_t evt;
91 static int serial_number = 0;
93 bytes = e->enqueue_length;
100 tx_fifo = s->server_tx_fifo;
103 total_copy_bytes = (bytes < (tx_fifo->
nitems - tx_fifo->
cursize)) ? bytes :
108 clib_warning (
"no space in tx fifo, event had %d bytes", bytes);
113 _vec_len (bsm->
rx_buf) = total_copy_bytes;
117 ASSERT (n_read == total_copy_bytes);
124 ASSERT (n_written == total_copy_bytes);
129 evt.enqueue_length = total_copy_bytes;
130 evt.event_id = serial_number++;
153 char segment_name[128];
160 memset (a, 0,
sizeof (*a));
161 memset (options, 0,
sizeof (options));
163 a->uri =
"tcp://0.0.0.0/1234";
164 a->api_client_index = ~0;
166 a->options = options;
170 a->segment_name = segment_name;
171 a->segment_name_length =
ARRAY_LEN (segment_name);
184 if (
unformat (input,
"whatever %d", &whatever))
207 .path =
"test server",
208 .short_help =
"test server",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
int svm_fifo_enqueue_nowait(svm_fifo_t *f, int pid, u32 max_bytes, u8 *copy_from_here)
unix_shared_memory_queue_t ** vpp_queue
int vnet_bind_uri(vnet_bind_args_t *a)
static clib_error_t * server_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int builtin_redirect_connect_callback(u32 client_index, void *mp)
int vnet_disconnect_session(u32 session_index, u32 thread_index)
builtin_server_main_t builtin_server_main
struct _stream_session_t stream_session_t
struct _stream_session_cb_vft session_cb_vft_t
#define clib_error_return(e, args...)
void stream_session_cleanup(stream_session_t *s)
Cleanup transport and session state.
int unix_shared_memory_queue_add(unix_shared_memory_queue_t *q, u8 *elem, int nowait)
void builtin_session_disconnect_callback(stream_session_t *s)
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
static int server_create(vlib_main_t *vm)
static unix_shared_memory_queue_t * session_manager_get_vpp_event_queue(u32 thread_index)
int builtin_add_segment_callback(u32 client_index, const u8 *seg_name, u32 seg_size)
#define clib_warning(format, args...)
int builtin_session_accept_callback(stream_session_t *s)
#define VLIB_CLI_COMMAND(x,...)
int builtin_server_rx_callback(stream_session_t *s, session_fifo_event_t *e)
int builtin_session_connected_callback(u32 client_index, stream_session_t *s, u8 is_fail)
void builtin_session_reset_callback(stream_session_t *s)
static session_cb_vft_t builtin_session_cb_vft
static vlib_thread_main_t * vlib_get_thread_main()
int svm_fifo_dequeue_nowait(svm_fifo_t *f, int pid, u32 max_bytes, u8 *copy_here)
struct _vnet_bind_args_t vnet_bind_args_t
struct _unix_shared_memory_queue unix_shared_memory_queue_t