28 memset (app_listener, 0,
sizeof (*app_listener));
45 memset (app_listener, 0xfa,
sizeof (*app_listener));
53 memset (app_listener, 0,
sizeof (*app_listener));
70 memset (app_listener, 0xfa,
sizeof (*app_listener));
78 memset (map, 0,
sizeof (*map));
132 app_ns->ip4_fib_index);
135 app_ns->ip6_fib_index);
145 return app_ns->local_table_index;
152 sep->transport_proto =
154 sep->port = ll->
port;
171 if (q->cursize == q->maxsize)
237 memset (app, 0,
sizeof (*app));
268 if (cb_fns->session_accept_callback == 0)
270 if (cb_fns->session_connected_callback == 0)
271 clib_warning (
"No session connected callback function provided");
272 if (cb_fns->session_disconnect_callback == 0)
273 clib_warning (
"No session disconnect callback function provided");
274 if (cb_fns->session_reset_callback == 0)
275 clib_warning (
"No session reset callback function provided");
291 clib_warning (
"memfd seg: vpp's event qs IN binary api svm region");
298 clib_warning (
"shm seg: vpp's event qs NOT IN binary api svm region");
315 options = a->options;
323 return VNET_API_ERROR_APP_UNSUPPORTED_CFG;
331 clib_warning (
"mq eventfds can only be used if socket transport is " 333 return VNET_API_ERROR_APP_UNSUPPORTED_CFG;
339 return VNET_API_ERROR_APP_UNSUPPORTED_CFG;
346 app->
cb_fns = *a->session_cb_vft;
354 app->
flags |= APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
363 props->add_segment = 1;
372 props->use_mq_eventfd = 1;
375 props->segment_type = seg_type;
381 APP_DBG (
"New app name: %v api index: %u index %u", app->
name,
400 APP_DBG (
"Delete app name %v api index: %d index: %d", app->
name,
412 app_wrk = app_worker_get (wrk_map->wrk_index);
413 app_worker_free (app_wrk);
427 application_local_listener_session_endpoint (ll, &sep);
428 session_lookup_del_session_endpoint (table_index, &sep);
472 wrk_index = clib_bitmap_next_set (app_listener->
workers,
487 memset (app_wrk, 0,
sizeof (*app_wrk));
517 u64 handle, *handles = 0;
529 vec_add1 (handles, handle);
530 sm = segment_manager_get (sm_index);
531 sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
535 for (i = 0; i <
vec_len (handles); i++)
539 a->handle = handles[
i];
560 sm->first_is_protected = 0;
575 memset (app_wrk, 0xfe,
sizeof (*app_wrk));
603 sm->first_is_protected = 1;
671 if (!ls->server_rx_fifo
689 clib_warning (
"listener handle was removed %llu!", handle);
722 u32 table_index, fib_proto;
740 return VNET_API_ERROR_ADDRESS_IN_USE;
743 if (ls->app_wrk_index == app_wrk->
wrk_index)
744 return VNET_API_ERROR_ADDRESS_IN_USE;
771 ls->listener_db_index = app_listener->
al_index;
818 clib_warning (
"worker not listening on handle %lu", handle);
896 "App %u does not exist", a->app_index);
904 a->segment = &fs->
ssvm;
914 "App %u does not have worker %u",
920 "No worker %u", a->wrk_index);
948 return (app->
flags & APP_OPTIONS_FLAGS_IS_PROXY);
954 return (app->
flags & APP_OPTIONS_FLAGS_IS_BUILTIN);
966 return app->
flags & APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE;
972 return app->
flags & APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
978 return app->
flags & APP_OPTIONS_FLAGS_USE_MQ_FOR_CTRL_MSGS;
1012 listener = listen_session_get_from_handle (handle);
1013 if (listener->session_type == sst
1014 && listener->enqueue_epoch != SESSION_PROXY_LISTENER_INDEX)
1042 listener = listen_session_get_from_handle (handle);
1043 if (listener->session_type == sst
1044 && listener->enqueue_epoch == SESSION_PROXY_LISTENER_INDEX)
1054 u8 transport_proto,
u8 is_start)
1071 sep.is_ip4 = is_ip4;
1073 sep.sw_if_index = app_ns->sw_if_index;
1074 sep.transport_proto = transport_proto;
1092 sep.is_ip4 = is_ip4;
1094 sep.transport_proto = transport_proto;
1111 u8 transport_proto,
u8 is_start)
1117 sep.transport_proto = transport_proto;
1146 transport_proto, is_start);
1148 transport_proto, is_start);
1162 if (transports & (1 << tp))
1178 if (transports & (1 << tp))
1227 session_event_t *evt;
1243 return app->
cb_fns.builtin_app_rx_callback (s);
1266 evt->fifo = s->server_rx_fifo;
1280 session_event_t *evt;
1303 evt->fifo = s->server_tx_fifo;
1350 memset (s, 0,
sizeof (*s));
1362 memset (s, 0xfc,
sizeof (*s));
1377 u32 session_index, server_wrk_index;
1390 memset (ll, 0,
sizeof (*ll));
1406 memset (ll, 0xfb,
sizeof (*ll));
1431 return VNET_API_ERROR_ADDRESS_IN_USE;
1434 return VNET_API_ERROR_ADDRESS_IN_USE;
1447 ll->
port = sep_ext->port;
1476 u32 table_index, ll_index, server_index;
1505 clib_warning (
"app %u does not own local handle 0x%lx", app_index, lh);
1519 clib_warning (
"app wrk %u not listening on handle %lu", wrk_map_index,
1527 if (ls->listener_index == ll->session_index)
1528 application_local_session_disconnect (server_wrk->app_index, ls);
1566 u32 seg_size, evt_q_sz, evt_q_elts, margin = 16 << 10;
1568 u32 round_rx_fifo_sz, round_tx_fifo_sz;
1569 int rv, has_transport, seg_index;
1582 evt_q_elts = props->evt_q_size + cprops->evt_q_size;
1584 round_rx_fifo_sz = 1 <<
max_log2 (props->rx_fifo_size);
1585 round_tx_fifo_sz = 1 <<
max_log2 (props->tx_fifo_size);
1586 seg_size = round_rx_fifo_sz + round_tx_fifo_sz + evt_q_sz + margin;
1600 ls->
port = tc->lcl_port;
1607 clib_warning (
"failed to add new cut-through segment");
1614 if (props->use_mq_eventfd)
1620 props->tx_fifo_size,
1625 clib_warning (
"failed to add fifos in cut-through segment");
1641 clib_warning (
"failed to notify server of new segment");
1648 clib_warning (
"failed to send accept cut-through notify to server");
1651 if (server->
flags & APP_OPTIONS_FLAGS_IS_BUILTIN)
1670 u32 * session_index)
1672 *app_wrk_index = key >> 32;
1673 *session_index = key & 0xFFFFFFFF;
1683 int rv, is_fail = 0;
1695 clib_warning (
"failed to notify client %u of new segment",
1768 u8 is_server = 0, is_client = 0;
1780 else if (client_wrk && client_wrk->
app_index == app_index)
1783 if (!is_server && !is_client)
1785 clib_warning (
"app %u is neither client nor server for session 0x%lx",
1787 return VNET_API_ERROR_INVALID_VALUE;
1839 u32 index, server_wrk_index, session_index;
1840 u64 handle, *handles = 0;
1853 application_local_session_disconnect (app_wrk->wrk_index, ls);
1864 vec_add1 (handles, handle);
1868 for (i = 0; i <
vec_len (handles); i++)
1893 0,
"app %u doesn't exist", a->app_index);
1905 0,
"app %u doesn't exist", a->app_index);
1914 u64 handle = va_arg (*args,
u64);
1915 u32 sm_index = va_arg (*args,
u32);
1916 int verbose = va_arg (*args,
int);
1924 s =
format (s,
"%-40s%-25s%=10s%-15s%-15s%-10s",
"Connection",
"App",
1925 "Wrk",
"API Client",
"ListenerID",
"SegManager");
1927 s =
format (s,
"%-40s%-25s%=10s",
"Connection",
"App",
"Wrk");
1941 s =
format (s,
"%-40s%-25s%=10s%-15u%-15u%-10u", str, app_name,
1969 app_wrk = app_worker_get (wrk_map->wrk_index);
1970 if (hash_elts (app_wrk->listeners_table) == 0)
1972 hash_foreach (handle, sm_index, app_wrk->listeners_table, ({
1973 vlib_cli_output (vm,
"%U", format_app_worker_listener, app_wrk,
1974 handle, sm_index, verbose);
1986 u8 *app_name, *s = 0;
1994 "API Client",
"SegManager");
2017 u32 session_index, thread_index;
2020 session_index = fifo->master_session_index;
2021 thread_index = fifo->master_thread_index;
2023 session =
session_get (session_index, thread_index);
2027 s =
format (s,
"%-40s%-20s%-15u%-10u", str, app_name,
2030 s =
format (s,
"%-40s%-20s", str, app_name);
2059 app_wrk = app_worker_get (wrk_map->wrk_index);
2060 app_worker_format_connects (app_wrk, verbose);
2087 tp = session_type_transport_proto(ls->listener_session_type);
2088 conn = format (0,
"[L][%U] *:%u", format_transport_proto_short, tp,
2090 vlib_cli_output (vm,
"%-40v%-15u%-20u", conn, ls->app_wrk_index,
2091 ls->client_wrk_index);
2092 vec_reset_length (conn);
2121 tp = session_type_transport_proto (ls->listener_session_type);
2122 conn = format (0,
"[L][%U] *:%u", format_transport_proto_short, tp,
2124 vlib_cli_output (vm,
"%-40v%-15u%-20s", conn, ls->app_wrk_index,
"*");
2125 vec_reset_length (conn);
2134 app_wrk = app_worker_get (wrk_map->wrk_index);
2135 app_worker_format_local_sessions (app_wrk, verbose);
2144 u32 app_wrk_index, session_index;
2155 "Peer App",
"SegManager");
2167 application_client_local_connect_key_parse (client_key, &app_wrk_index,
2169 server_wrk = app_worker_get (app_wrk_index);
2170 ls = application_get_local_session (server_wrk, session_index);
2171 vlib_cli_output (vm,
"%-40s%-15s%-20s",
"TODO", ls->app_wrk_index,
2172 ls->client_wrk_index);
2191 app_wrk = app_worker_get (wrk_map->wrk_index);
2192 app_worker_format_local_connects (app_wrk, verbose);
2203 const u8 *app_ns_name;
2209 s =
format (s,
"%-10s%-20s%-15s%-15s%-15s%-15s%-15s",
"Index",
"Name",
2210 "API Client",
"Namespace",
"Add seg size",
"Rx-f size",
2213 s =
format (s,
"%-10s%-20s%-15s%-40s",
"Index",
"Name",
"API Client",
2226 props->tx_fifo_size);
2249 application_format_local_sessions (app, verbose);
2259 application_format_listeners (app, verbose);
2282 application_format_local_connects (app, verbose);
2292 application_format_connects (app, verbose);
2302 int do_server = 0, do_client = 0, do_local = 0;
2312 else if (
unformat (input,
"client"))
2314 else if (
unformat (input,
"local"))
2316 else if (
unformat (input,
"verbose"))
2329 if (!do_server && !do_client)
2334 vlib_cli_output (vm,
"%U", format_application, app, verbose);
2346 .short_help =
"show app [server|client] [verbose]",
static void application_table_add(application_t *app)
static app_listener_t * app_local_listener_alloc(application_t *app)
int application_stop_listen(u32 app_index, u32 app_wrk_index, session_handle_t handle)
Stop listening on session associated to handle.
struct _vnet_app_worker_add_del_args vnet_app_worker_add_del_args_t
session_type_t listener_session_type
Has transport embedded when listener not purely local.
app_worker_t * app_worker_get(u32 wrk_index)
static int app_send_io_evt_rx(app_worker_t *app_wrk, stream_session_t *s, u8 lock)
static u8 svm_msg_q_msg_is_invalid(svm_msg_q_msg_t *msg)
Check if message is invalid.
int application_local_session_disconnect_w_index(u32 app_wrk_index, u32 ls_index)
#define hash_set(h, key, value)
void segment_manager_segment_reader_unlock(segment_manager_t *sm)
void * svm_msg_q_msg_data(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Get data for message in queue.
static u8 svm_msg_q_ring_is_full(svm_msg_q_t *mq, u32 ring_index)
application_t * app_worker_get_app(u32 wrk_index)
int session_open(u32 app_wrk_index, session_endpoint_t *rmt, u32 opaque)
Ask transport to open connection to remote transport endpoint.
static session_handle_t application_local_session_handle(local_session_t *ls)
int app_worker_alloc_and_init(application_t *app, app_worker_t **wrk)
#define hash_unset(h, key)
u64 session_lookup_endpoint_listener(u32 table_index, session_endpoint_t *sep, u8 use_rules)
Lookup listener for session endpoint in table.
u32 ns_index
Namespace the application belongs to.
u8 application_has_global_scope(application_t *app)
u8 app_worker_application_is_builtin(app_worker_t *app_wrk)
struct _transport_connection transport_connection_t
struct _segment_manager_properties segment_manager_properties_t
int app_worker_stop_listen(app_worker_t *app_wrk, session_handle_t handle)
app_worker_t * app_worker_alloc(application_t *app)
void app_worker_free(app_worker_t *app_wrk)
#define session_cli_return_if_not_enabled()
segment_manager_properties_t * application_get_segment_manager_properties(u32 app_index)
static clib_error_t * show_app_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * vnet_unbind(vnet_unbind_args_t *a)
svm_msg_q_t * segment_manager_alloc_queue(svm_fifo_segment_private_t *segment, segment_manager_properties_t *props)
Allocates shm queue in the first segment.
app_worker_t * application_listener_select_worker(stream_session_t *ls, u8 is_local)
#define SESSION_PROXY_LISTENER_INDEX
static app_listener_t * app_listener_get(application_t *app, u32 app_listener_index)
application_t * application_lookup_name(const u8 *name)
u32 session_lookup_get_index_for_fib(u32 fib_proto, u32 fib_index)
local_session_t * local_listen_sessions
Pool of local listen sessions.
local_session_t * application_get_local_session_from_handle(session_handle_t handle)
int application_local_session_connect(app_worker_t *client_wrk, app_worker_t *server_wrk, local_session_t *ll, u32 opaque)
static int svm_msg_q_get_producer_eventfd(svm_msg_q_t *mq)
static void application_client_local_connect_key_parse(uword key, u32 *app_wrk_index, u32 *session_index)
application_t * application_lookup(u32 api_client_index)
void application_free(application_t *app)
app_listener_t * listeners
Pool of listeners for the app.
u32 wrk_map_index
Worker index in app's map pool.
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
#define hash_set_mem(h, key, value)
static app_send_evt_handler_fn *const app_send_evt_handler_fns[3]
void svm_fifo_dequeue_drop_all(svm_fifo_t *f)
svm_fifo_t * server_tx_fifo
void app_worker_local_sessions_free(app_worker_t *app_wrk)
segment_manager_properties_t * segment_manager_properties_init(segment_manager_properties_t *props)
uword * listeners_table
Lookup tables for listeners.
#define segment_manager_foreach_segment_w_lock(VAR, SM, BODY)
struct _vnet_application_add_tls_cert_args_t vnet_app_add_tls_cert_args_t
int app_worker_start_listen(app_worker_t *app_wrk, stream_session_t *ls)
#define SESSION_ENDPOINT_EXT_NULL
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
u32 connects_seg_manager
Segment manager used for outgoing connects issued by the app.
u8 application_use_mq_for_ctrl(application_t *app)
u32 segment_manager_evt_q_expected_size(u32 q_len)
clib_error_t * vnet_app_add_tls_cert(vnet_app_add_tls_cert_args_t *a)
static stream_session_t * listen_session_get_from_handle(session_handle_t handle)
app_worker_t * application_get_worker(application_t *app, u32 wrk_map_index)
void application_local_session_free(app_worker_t *app, local_session_t *s)
int segment_manager_init(segment_manager_t *sm, u32 first_seg_size, u32 prealloc_fifo_pairs)
Initializes segment manager based on options provided.
application_t * application_get_if_valid(u32 app_index)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
#define SESSION_ENDPOINT_NULL
struct _svm_fifo svm_fifo_t
static uword clib_bitmap_set_no_check(uword *a, uword i, uword new_value)
Sets the ith bit of a bitmap to new_value.
segment_manager_t * app_worker_get_listen_segment_manager(app_worker_t *app, stream_session_t *listener)
int session_stop_listen(stream_session_t *s)
Ask transport to stop listening on local transport endpoint.
int application_is_proxy(application_t *app)
static int svm_fifo_is_empty(svm_fifo_t *f)
enum ssvm_segment_type_ ssvm_segment_type_t
memset(h->entries, 0, sizeof(h->entries[0])*entries)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
u32 first_segment_manager
First segment manager has in the the first segment the application's event fifo.
static void application_table_del(application_t *app)
static uword clib_bitmap_is_zero(uword *ai)
predicate function; is an entire bitmap empty?
int application_local_session_connect_notify(local_session_t *ls)
u32 transport_listener_index
Transport listener index.
struct _stream_session_cb_vft session_cb_vft_t
struct _vnet_unbind_args_t vnet_unbind_args_t
svm_fifo_segment_private_t * segment_manager_get_segment_w_lock(segment_manager_t *sm, u32 segment_index)
Reads a segment from the segment manager's pool and acquires reader lock.
app_listener_t * local_listeners
Pool of local listeners for app.
#define hash_foreach(key_var, value_var, h, body)
session_type_t session_type
Type.
static stream_session_t * listen_session_get(u32 index)
#define transport_proto_foreach(VAR, BODY)
static u8 * app_get_name_from_reg_index(application_t *app)
u32 application_index(application_t *app)
static local_session_t * application_get_local_listen_session(application_t *app, u32 session_index)
struct _stream_session_t stream_session_t
u8 tls_engine
Preferred tls engine.
segment_manager_t * segment_manager_new()
#define pool_flush(VAR, POOL, BODY)
Remove all elements from a pool in a safe way.
static app_main_t app_main
static void application_verify_cb_fns(session_cb_vft_t *cb_fns)
clib_error_t * vnet_app_add_tls_key(vnet_app_add_tls_key_args_t *a)
app_worker_t * workers
Pool of workers associated to apps.
static void listen_session_del(stream_session_t *s)
static int app_enqueue_evt(svm_msg_q_t *mq, svm_msg_q_msg_t *msg, u8 lock)
int application_is_builtin(application_t *app)
u32 app_namespace_get_fib_index(app_namespace_t *app_ns, u8 fib_proto)
static svm_fifo_t * svm_fifo_segment_get_fifo_list(svm_fifo_segment_private_t *fifo_segment)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define hash_unset_mem(h, key)
#define VL_API_INVALID_FI
struct _session_endpoint session_endpoint_t
static uword clib_bitmap_first_set(uword *ai)
Return the lowest numbered set bit in a bitmap.
static u8 * app_get_name(application_t *app)
int application_start_listen(application_t *app, session_endpoint_extended_t *sep_ext, session_handle_t *res)
Start listening local transport endpoint for requested transport.
stream_session_t * application_proxy_listener(app_worker_t *app, u8 fib_proto, u8 transport_proto)
svm_fifo_t * server_rx_fifo
fifo pointers.
app_worker_t * app_worker_get_if_valid(u32 wrk_index)
static u8 session_handle_is_local(session_handle_t handle)
static u32 app_worker_map_index(application_t *app, app_worker_map_t *map)
#define pool_put(P, E)
Free an object E in pool P.
#define APP_INVALID_INDEX
local_session_t * application_local_listen_session_alloc(application_t *app)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
u32 application_local_listener_index(application_t *app, local_session_t *ll)
svm_fifo_segment_private_t * segment_manager_get_segment(segment_manager_t *sm, u32 segment_index)
Reads a segment from the segment manager's pool without lock.
u8 segment_manager_has_fifos(segment_manager_t *sm)
u32 svm_segment_index
Segment index where fifos were allocated.
static u8 application_local_session_listener_has_transport(local_session_t *ls)
app_namespace_t * app_namespace_get(u32 index)
u32 wrk_index
Worker index in global worker pool.
u32 application_session_table(application_t *app, u8 fib_proto)
static void application_local_session_fix_eventds(svm_msg_q_t *sq, svm_msg_q_t *cq)
stream_session_t * app_worker_first_listener(app_worker_t *app, u8 fib_proto, u8 transport_proto)
void segment_manager_del_segment(segment_manager_t *sm, svm_fifo_segment_private_t *fs)
Remove segment without lock.
u8 * application_name_from_index(u32 app_index)
Returns app name.
int segment_manager_add_segment(segment_manager_t *sm, u32 segment_size)
Adds segment to segment manager's pool.
volatile u8 session_state
State.
static stream_session_t * session_get(u32 si, u32 thread_index)
app_worker_map_t * worker_maps
Pool of mappings that keep track of workers associated to this app.
int session_alloc_fifos(segment_manager_t *sm, stream_session_t *s)
#define SEGMENT_MANAGER_INVALID_APP_INDEX
#define pool_free(p)
Free a pool.
static u8 svm_fifo_set_event(svm_fifo_t *f)
Sets fifo event flag.
An API client registration, only in vpp/vlib.
u32 application_local_session_table(application_t *app)
static int app_send_io_evt_tx(app_worker_t *app_wrk, stream_session_t *s, u8 lock)
uword * app_by_name
Hash table of builtin apps by name.
static session_type_t session_type_from_proto_and_ip(transport_proto_t proto, u8 is_ip4)
static void svm_msg_q_unlock(svm_msg_q_t *mq)
Unlock message queue.
static void app_listener_free(application_t *app, app_listener_t *app_listener)
static transport_proto_t session_type_transport_proto(session_type_t st)
static segment_manager_t * app_worker_alloc_segment_manager(app_worker_t *app_wrk)
int session_listen(stream_session_t *ls, session_endpoint_extended_t *sep)
Ask transport to listen on session endpoint.
svm_queue_t * vl_api_client_index_to_input_queue(u32 index)
u8 * format_stream_session(u8 *s, va_list *args)
Format stream session as per the following format.
#define vec_free(V)
Free vector's memory (no header).
transport_service_type_t session_transport_service_type(stream_session_t *s)
int session_lookup_del_session_endpoint(u32 table_index, session_endpoint_t *sep)
#define clib_warning(format, args...)
#define SESSION_INVALID_HANDLE
int svm_msg_q_add(svm_msg_q_t *mq, svm_msg_q_msg_t *msg, int nowait)
Producer enqueue one message to queue.
u32 local_segment_manager
Segment manager used for incoming "cut through" connects.
clib_bitmap_t * workers
workers accepting connections
segment_manager_properties_t sm_properties
Segment manager properties.
u16 port
Port for connection.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
const u8 * app_namespace_id_from_index(u32 index)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
blocking call - best used in combination with condvars, for eventfds we don't yield the cpu ...
void application_local_listen_session_free(application_t *app, local_session_t *ll)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
int session_lookup_add_session_endpoint(u32 table_index, session_endpoint_t *sep, u64 value)
u32 app_wrk_index
Server index.
static u32 vl_api_registration_file_index(vl_api_registration_t *reg)
static u8 session_has_transport(stream_session_t *s)
int segment_manager_try_alloc_fifos(svm_fifo_segment_private_t *fifo_segment, u32 rx_fifo_size, u32 tx_fifo_size, svm_fifo_t **rx_fifo, svm_fifo_t **tx_fifo)
struct _app_namespace app_namespace_t
application_t * application_get(u32 app_index)
application_t * application_alloc(void)
static u32 segment_manager_index(segment_manager_t *sm)
int app_worker_lock_and_send_event(app_worker_t *app, stream_session_t *s, u8 evt_type)
Send event to application.
#define VLIB_CLI_COMMAND(x,...)
#define hash_create(elts, value_bytes)
ssvm_private_t * session_manager_get_evt_q_segment(void)
void segment_manager_init_del(segment_manager_t *sm)
local_session_t * application_local_session_alloc(app_worker_t *app_wrk)
static void app_local_listener_free(application_t *app, app_listener_t *app_listener)
static uword hash_elts(void *v)
u32 client_wrk_index
Client data.
void svm_msg_q_add_and_unlock(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Producer enqueue one message to queue with mutex held.
static local_session_t * application_get_local_listener_w_handle(session_handle_t handle)
static void application_format_local_connects(application_t *app, int verbose)
static u8 session_endpoint_fib_proto(session_endpoint_t *sep)
int application_start_local_listen(application_t *app, session_endpoint_extended_t *sep_ext, session_handle_t *handle)
uword * app_by_api_client_index
Hash table of apps by api client index.
static app_listener_t * app_local_listener_get(application_t *app, u32 app_listener_index)
void application_remove_proxy(application_t *app)
session_cb_vft_t cb_fns
Callbacks: shoulder-taps for the server/client.
struct _vnet_application_add_tls_key_args_t vnet_app_add_tls_key_args_t
int app_worker_alloc_connects_segment_manager(app_worker_t *app_wrk)
int listen_session_get_local_session_endpoint(stream_session_t *listener, session_endpoint_t *sep)
u8 * tls_key
PEM encoded key.
#define clib_bitmap_free(v)
Free a bitmap.
int application_local_session_disconnect(u32 app_index, local_session_t *ls)
void application_format_all_listeners(vlib_main_t *vm, int do_local, int verbose)
segment_manager_t * application_get_local_segment_manager(app_worker_t *app)
u32 accept_rotor
last worker to accept a connection
u32 api_client_index
Binary API connection index, ~0 if internal.
static svm_msg_q_t * segment_manager_event_queue(segment_manager_t *sm)
static uword pointer_to_uword(const void *p)
int application_alloc_and_init(app_init_args_t *a)
void svm_msg_q_set_consumer_eventfd(svm_msg_q_t *mq, int fd)
Set event fd for queue consumer.
static vlib_main_t * vlib_get_main(void)
u8 * format_app_worker_listener(u8 *s, va_list *args)
static void app_worker_format_connects(app_worker_t *app_wrk, int verbose)
static void app_worker_format_local_sessions(app_worker_t *app_wrk, int verbose)
u8 ip_is_zero(ip46_address_t *ip46_address, u8 is_ip4)
u32 application_n_listeners(app_worker_t *app)
u32 app_index
App index in app pool.
void segment_manager_del(segment_manager_t *sm)
Removes segment manager.
int application_local_session_cleanup(app_worker_t *client_wrk, app_worker_t *server_wrk, local_session_t *ls)
local_session_t * application_get_local_session(app_worker_t *app_wrk, u32 session_index)
application_t * app_pool
Pool from which we allocate all applications.
void svm_msg_q_free_msg(svm_msg_q_t *mq, svm_msg_q_msg_t *msg)
Free message buffer.
enum _transport_proto transport_proto_t
transport_connection_t * listen_session_get_transport(stream_session_t *s)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u8 * format_application(u8 *s, va_list *args)
u8 * name
Name registered by builtin apps.
static uword max_log2(uword x)
static stream_session_t * listen_session_new(u8 thread_index, session_type_t type)
u32 session_index
Session index.
void segment_manager_del_sessions(segment_manager_t *sm)
Initiate disconnects for all sessions 'owned' by a segment manager.
static app_worker_map_t * app_worker_map_alloc(application_t *app)
int app_worker_open_session(app_worker_t *app, session_endpoint_t *sep, u32 api_context)
app_worker_t * application_get_default_worker(application_t *app)
struct _segment_manager segment_manager_t
struct _svm_queue svm_queue_t
static void application_format_listeners(application_t *app, int verbose)
static clib_error_t * application_start_stop_proxy_fib_proto(application_t *app, u8 fib_proto, u8 transport_proto, u8 is_start)
#define hash_get_mem(h, key)
static void application_format_local_sessions(application_t *app, int verbose)
static uword application_client_local_connect_key(local_session_t *ls)
u32 app_index
Index of owning app.
int( app_send_evt_handler_fn)(app_worker_t *app, stream_session_t *s, u8 lock)
static void application_start_stop_proxy_local_scope(application_t *app, u8 transport_proto, u8 is_start)
uword * local_connects
Hash table of the app's local connects.
int application_stop_local_listen(u32 app_index, u32 wrk_map_index, session_handle_t lh)
Clean up local session table.
local_session_t * local_sessions
Pool of local sessions the app owns (as a server)
segment_manager_t * application_get_local_segment_manager_w_session(app_worker_t *app, local_session_t *ls)
int app_worker_add_segment_notify(u32 app_wrk_index, ssvm_private_t *fs)
Send an API message to the external app, to map new segment.
#define clib_error_return_code(e, code, flags, args...)
u8 * tls_cert
Certificate to be used for listen sessions.
static app_worker_map_t * app_worker_map_get(application_t *app, u32 map_index)
static int svm_fifo_has_event(svm_fifo_t *f)
void application_setup_proxy(application_t *app)
static u8 application_verify_cfg(ssvm_segment_type_t st)
Check app config for given segment type.
static void application_format_connects(application_t *app, int verbose)
int application_is_builtin_proxy(application_t *app)
segment_manager_t * app_worker_get_connect_segment_manager(app_worker_t *app)
static void app_worker_map_free(application_t *app, app_worker_map_t *map)
int app_worker_send_event(app_worker_t *app, stream_session_t *s, u8 evt_type)
Send event to application.
void application_start_stop_proxy(application_t *app, transport_proto_t transport_proto, u8 is_start)
int application_api_queue_is_full(application_t *app)
static int svm_msg_q_lock(svm_msg_q_t *mq)
Lock, or block trying, the message queue.
segment_manager_properties_t * application_segment_manager_properties(application_t *app)
svm_msg_q_t * event_queue
Application listens for events on this svm queue.
static void application_local_listener_session_endpoint(local_session_t *ll, session_endpoint_t *sep)
#define APP_INVALID_SEGMENT_MANAGER_INDEX
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static u8 svm_msg_q_is_full(svm_msg_q_t *mq)
Check if message queue is full.
#define APP_DBG(_fmt, _args...)
static segment_manager_t * segment_manager_get(u32 index)
svm_msg_q_msg_t svm_msg_q_alloc_msg_w_ring(svm_msg_q_t *mq, u32 ring_index)
Allocate message buffer on ring.
static u64 listen_session_get_handle(stream_session_t *s)
struct _session_endpoint_extended session_endpoint_extended_t
u8 first_segment_manager_in_use
static void local_session_parse_handle(session_handle_t handle, u32 *app_or_wrk_index, u32 *session_index)
clib_error_t * vnet_app_worker_add_del(vnet_app_worker_add_del_args_t *a)
void application_format_all_clients(vlib_main_t *vm, int do_local, int verbose)
void mq_send_local_session_disconnected_cb(u32 app_or_wrk, local_session_t *ls)
static void app_worker_format_local_connects(app_worker_t *app, int verbose)
static app_listener_t * app_listener_alloc(application_t *app)
u8 application_has_local_scope(application_t *app)
static uword pool_elts(void *v)
Number of active elements in a pool.