40 active_open_session = s;
45 clib_warning (
"proxy session for %s handle %lld (%llx) AWOL",
46 is_active_open ?
"active open" :
"server",
66 clib_warning (
"proxy session for %s handle %lld (%llx) AWOL",
67 is_active_open ?
"active open" :
"server",
77 active_open_session = 0;
84 memset (ps, 0xFE,
sizeof (*ps));
90 if (active_open_session)
144 const u8 * seg_name,
u32 seg_size)
161 int actual_transfer __attribute__ ((unused));
170 session_fifo_event_t evt;
172 ASSERT (s->thread_index == thread_index);
181 active_open_tx_fifo = s->server_rx_fifo;
188 evt.fifo = active_open_tx_fifo;
198 rx_fifo = s->server_rx_fifo;
199 tx_fifo = s->server_tx_fifo;
201 ASSERT (rx_fifo->master_thread_index == thread_index);
202 ASSERT (tx_fifo->master_thread_index == thread_index);
211 bpm->
rx_buf[thread_index]);
215 memset (a, 0,
sizeof (*a));
219 memset (ps, 0,
sizeof (*ps));
231 a->uri =
"tcp://6.0.2.2/23";
232 a->api_context = proxy_index;
258 session_fifo_event_t evt;
281 s->server_tx_fifo->master_session_index = s->session_index;
282 s->server_tx_fifo->master_thread_index = s->thread_index;
289 s->server_tx_fifo->refcnt++;
290 s->server_rx_fifo->refcnt++;
302 evt.fifo = s->server_tx_fifo;
335 session_fifo_event_t evt;
339 server_rx_fifo = s->server_rx_fifo;
346 evt.fifo = server_rx_fifo;
387 u8 segment_name[128];
391 memset (a, 0,
sizeof (*a));
392 memset (options, 0,
sizeof (options));
396 a->options = options;
407 a->segment_name = segment_name;
408 a->segment_name_length =
ARRAY_LEN (segment_name);
425 u8 segment_name[128];
426 u32 segment_name_length;
429 segment_name_length =
ARRAY_LEN (segment_name);
431 memset (a, 0,
sizeof (*a));
432 memset (options, 0,
sizeof (options));
435 a->segment_name = segment_name;
436 a->segment_name_length = segment_name_length;
449 | APP_OPTIONS_FLAGS_IS_PROXY;
451 a->options = options;
466 memset (a, 0,
sizeof (*a));
468 a->uri =
"tcp://0.0.0.0/23";
488 for (i = 0; i < num_threads; i++)
507 for (i = 0; i < num_threads; i++)
542 else if (
unformat (input,
"private-segment-count %d",
545 else if (
unformat (input,
"private-segment-size %U",
548 if (tmp >= 0x100000000ULL)
550 (0,
"private segment size %lld (%llu) too large", tmp, tmp);
575 .path =
"test proxy server",
576 .short_help =
"test proxy server",
u32 private_segment_size
size of private fifo segs
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 server_app_index
server app index
u64 vpp_active_open_handle
#define hash_set(h, key, value)
sll srl srl sll sra u16x4 i
static clib_error_t * proxy_server_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void server_disconnect_callback(stream_session_t *s)
#define hash_unset(h, key)
struct _vnet_connect_args vnet_connect_args_t
static int server_create(vlib_main_t *vm)
int vnet_bind_uri(vnet_bind_args_t *a)
clib_spinlock_t sessions_lock
unix_shared_memory_queue_t * vl_input_queue
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
static int server_rx_callback(stream_session_t *s)
static int active_open_connected_callback(u32 app_index, u32 opaque, stream_session_t *s, u8 is_fail)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
uword * proxy_session_by_server_handle
proxy_session_t * sessions
Session pool, shared.
svm_fifo_t * server_rx_fifo
struct _svm_fifo svm_fifo_t
static void create_api_loopbacks(vlib_main_t *vm)
u32 active_open_client_index
active open API client handle
builtin_proxy_main_t builtin_proxy_main
#define VLIB_INIT_FUNCTION(x)
struct _vnet_disconnect_args_t vnet_disconnect_args_t
static int server_add_segment_callback(u32 client_index, const u8 *seg_name, u32 seg_size)
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
static int active_open_attach(void)
struct _stream_session_cb_vft session_cb_vft_t
#define clib_error_return(e, args...)
static void server_reset_callback(stream_session_t *s)
struct vl_shmem_hdr_ * shmem_hdr
Binary API shared-memory segment header pointer.
struct _stream_session_t stream_session_t
u8 prealloc_fifos
Request fifo preallocation.
struct _vnet_app_attach_args_t vnet_app_attach_args_t
vl_shmem_hdr_t * shmem_hdr
int unix_shared_memory_queue_add(unix_shared_memory_queue_t *q, u8 *elem, int nowait)
unix_shared_memory_queue_t ** server_event_queue
per-thread vectors
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static int server_connected_callback(u32 app_index, u32 api_context, stream_session_t *s, u8 is_fail)
static int server_attach()
#define pool_put(P, E)
Free an object E in pool P.
u32 server_client_index
server API client handle
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
API main structure, used by both vpp and binary API clients.
static int server_redirect_connect_callback(u32 client_index, void *mp)
static u8 svm_fifo_set_event(svm_fifo_t *f)
Sets fifo event flag.
u32 private_segment_count
Number of private fifo segs.
static unix_shared_memory_queue_t * session_manager_get_vpp_event_queue(u32 thread_index)
static_always_inline uword vlib_get_thread_index(void)
static void delete_proxy_session(stream_session_t *s, int is_active_open)
static void active_open_disconnect_callback(stream_session_t *s)
u8 * format_stream_session(u8 *s, va_list *args)
Format stream session as per the following format.
static int active_open_create_callback(stream_session_t *s)
#define clib_warning(format, args...)
clib_error_t * builtin_tcp_proxy_main_init(vlib_main_t *vm)
u32 vl_api_memclnt_create_internal(char *, unix_shared_memory_queue_t *)
int vnet_disconnect_session(vnet_disconnect_args_t *a)
#define VLIB_CLI_COMMAND(x,...)
static int server_accept_callback(stream_session_t *s)
int vnet_application_attach(vnet_app_attach_args_t *a)
Attaches application.
#define hash_create(elts, value_bytes)
uword * proxy_session_by_active_open_handle
static void active_open_reset_callback(stream_session_t *s)
static u64 stream_session_handle(stream_session_t *s)
svm_fifo_t * server_tx_fifo
static int active_open_rx_callback(stream_session_t *s)
unix_shared_memory_queue_t ** active_open_event_queue
u8 ** rx_buf
intermediate rx buffers
static int server_listen()
static vlib_thread_main_t * vlib_get_thread_main()
int vnet_connect_uri(vnet_connect_args_t *a)
int svm_fifo_peek(svm_fifo_t *f, u32 relative_offset, u32 max_bytes, u8 *copy_here)
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
struct _vnet_bind_args_t vnet_bind_args_t
unix_shared_memory_queue_t * vl_input_queue
vpe input queue
static stream_session_t * stream_session_get_from_handle(u64 handle)
u32 active_open_app_index
active open index after attach
static session_cb_vft_t builtin_clients
static session_cb_vft_t builtin_session_cb_vft