35 if (app->api_client_index == ~0)
42 if (q->cursize == q->maxsize)
98 if (type ==
APP_SERVER && cb_fns->session_accept_callback == 0)
100 if (type ==
APP_CLIENT && cb_fns->session_connected_callback == 0)
101 clib_warning (
"No session connected callback function provided");
102 if (cb_fns->session_disconnect_callback == 0)
103 clib_warning (
"No session disconnect callback function provided");
104 if (cb_fns->session_reset_callback == 0)
105 clib_warning (
"No session reset callback function provided");
119 memset (app, 0,
sizeof (*app));
127 sizeof (session_fifo_event_t),
138 pool_get (smm->session_managers, sm);
139 memset (sm, 0,
sizeof (*sm));
141 app->session_manager_index = sm - smm->session_managers;
148 app->session_manager_index = smm->connect_manager_index[sst];
153 app->session_type = sst;
154 app->api_client_index = api_client_index;
156 app->cb_fns = *cb_fns;
190 u32 add_segment_size,
u32 rx_fifo_size,
191 u32 tx_fifo_size,
u8 ** segment_name)
207 sm->add_segment_size = add_segment_size;
208 sm->rx_fifo_size = rx_fifo_size;
209 sm->tx_fifo_size = tx_fifo_size;
210 sm->add_segment = sm->add_segment_size != 0;
218 int verbose = va_arg (*args,
int);
221 u8 *server_name, *str, *seg_name;
227 s =
format (s,
"%-40s%-20s%-15s%-15s%-10s",
"Connection",
"Server",
228 "Segment",
"API Client",
"Cookie");
230 s =
format (s,
"%-40s%-20s",
"Connection",
"Server");
237 server_name =
format (0,
"builtin-%d%c", srv->index, 0);
239 server_name = regp->
name;
249 s =
format (s,
"%-40s%-20s%-20s%-10d%-10d", str, server_name,
250 seg_name, srv->api_client_index, srv->accept_cookie);
253 s =
format (s,
"%-40s%-20s", str, server_name);
261 int verbose = va_arg (*args,
int);
270 format (s,
"%-40s%-20s%-10s",
"Connection",
"Segment",
273 s =
format (s,
"%-40s",
"Connection");
285 s =
format (s,
"%-40s%-20s%-10d%", str, seg_name,
286 client->api_client_index);
289 s =
format (s,
"%-40s", str);
303 if (!smm->is_enabled)
312 else if (
unformat (input,
"client"))
314 else if (
unformat (input,
"verbose"))
367 .short_help =
"show app [server|client] [verbose]",
static void application_table_add(application_t *app)
#define hash_set(h, key, value)
static void svm_pop_heap(void *oldheap)
#define hash_unset(h, key)
static clib_error_t * show_app_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void unix_shared_memory_queue_free(unix_shared_memory_queue_t *q)
session_manager_main_t session_manager_main
void session_manager_del(session_manager_main_t *smm, session_manager_t *sm)
application_t * application_lookup(u32 api_client_index)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
u8 * format_application_client(u8 *s, va_list *args)
int session_manager_add_first_segment(session_manager_main_t *smm, session_manager_t *sm, u32 segment_size, u8 **segment_name)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
struct _stream_session_t stream_session_t
static stream_session_t * stream_session_get(u64 si, u32 thread_index)
void session_manager_get_segment_info(u32 index, u8 **name, u32 *size)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
static void application_table_del(application_t *app)
static void * svm_push_data_heap(svm_region_t *rp)
struct _stream_session_cb_vft session_cb_vft_t
static void application_verify_cb_fns(application_type_t type, session_cb_vft_t *cb_fns)
#define clib_error_return(e, args...)
static session_manager_t * session_manager_get(u32 index)
vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static session_manager_main_t * vnet_get_session_manager_main()
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static application_t * app_pool
#define pool_put(P, E)
Free an object E in pool P.
application_t * application_new(application_type_t type, session_type_t sst, u32 api_client_index, u32 flags, session_cb_vft_t *cb_fns)
struct _session_manager_main session_manager_main_t
void connects_session_manager_init(session_manager_main_t *smm, u8 session_type)
u8 * format_stream_session(u8 *s, va_list *args)
Format stream session as per the following format.
#define clib_warning(format, args...)
struct _session_manager session_manager_t
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
struct _application application_t
static uword * app_by_api_client_index
u8 * format_application_server(u8 *s, va_list *args)
#define VLIB_CLI_COMMAND(x,...)
static stream_session_t * stream_session_listener_get(u8 sst, u64 si)
unix_shared_memory_queue_t * unix_shared_memory_queue_init(int nels, int elsize, int consumer_pid, int signal_when_queue_non_empty)
void application_del(application_t *app)
u32 application_get_index(application_t *app)
application_t * application_get(u32 index)
int application_server_init(application_t *server, u32 segment_size, u32 add_segment_size, u32 rx_fifo_size, u32 tx_fifo_size, u8 **segment_name)
int application_api_queue_is_full(application_t *app)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
application_t * application_get_if_valid(u32 index)
struct _unix_shared_memory_queue unix_shared_memory_queue_t
static uword pool_elts(void *v)
Number of active elements in a pool.