16 #ifndef SRC_VNET_SESSION_APPLICATION_H_ 17 #define SRC_VNET_SESSION_APPLICATION_H_ 26 #define APP_DBG(_fmt, _args...) clib_warning (_fmt, ##_args) 28 #define APP_DBG(_fmt, _args...) 31 typedef struct _stream_session_cb_vft
34 int (*add_segment_callback) (
u32 api_client_index,
u64 segment_handle);
37 int (*del_segment_callback) (
u32 api_client_index,
u64 segment_handle);
43 int (*session_connected_callback) (
u32 app_wrk_index,
u32 opaque,
193 #define foreach_app_init_args \ 194 _(u32, api_client_index) \ 197 _(u8 *, namespace_id) \ 198 _(session_cb_vft_t *, session_cb_vft) \ 203 #define _(_type, _name) _type _name; 208 typedef struct _vnet_app_worker_add_del_args
212 u32 api_client_index;
219 #define APP_INVALID_INDEX ((u32)~0) 220 #define APP_NS_INVALID_INDEX ((u32)~0) 221 #define APP_INVALID_SEGMENT_MANAGER_INDEX ((u32) ~0) 318 u32 app_or_wrk_index;
337 *app_or_wrk = ls_id >> 16;
338 *session_index = ls_id & 0xFF;
347 bottom = (handle & 0xFFFFFFFF);
367 u32 server_index, session_index;
app_worker_t * application_listener_select_worker(stream_session_t *ls, u8 is_local)
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.
void application_free(application_t *app)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
static session_handle_t application_local_session_handle(local_session_t *ls)
int app_worker_lock_and_send_event(app_worker_t *app, stream_session_t *s, u8 evt_type)
Send event to application.
u32 ns_index
Namespace the application belongs to.
u8 application_use_mq_for_ctrl(application_t *app)
struct _segment_manager_properties segment_manager_properties_t
application_t * application_lookup_name(const u8 *name)
application_t * application_get_if_valid(u32 index)
void application_remove_proxy(application_t *app)
segment_manager_t * app_worker_get_or_alloc_connect_segment_manager(app_worker_t *)
local_session_t * local_listen_sessions
Pool of local listen sessions.
app_listener_t * listeners
Pool of listeners for the app.
u32 wrk_map_index
Worker index in app's map pool.
#define SESSION_LOCAL_HANDLE_PREFIX
local_session_t * application_get_local_session_from_handle(session_handle_t handle)
uword * listeners_table
Lookup tables for listeners.
application_t * application_lookup(u32 api_client_index)
struct app_listener_ app_listener_t
u32 connects_seg_manager
Segment manager used for outgoing connects issued by the app.
segment_manager_properties_t * application_get_segment_manager_properties(u32 app_index)
uword unformat_application_proto(unformat_input_t *input, va_list *args)
int app_worker_alloc_and_init(application_t *app, app_worker_t **wrk)
u32 first_segment_manager
First segment manager has in the the first segment the application's event fifo.
int app_worker_open_session(app_worker_t *app, session_endpoint_t *tep, u32 api_context)
struct _stream_session_cb_vft session_cb_vft_t
app_listener_t * local_listeners
Pool of local listeners for app.
segment_manager_t * app_worker_get_listen_segment_manager(app_worker_t *, stream_session_t *)
static local_session_t * application_get_local_listen_session(application_t *app, u32 session_index)
struct _stream_session_t stream_session_t
int application_local_session_disconnect_w_index(u32 app_or_wrk, u32 ls_index)
u8 tls_engine
Preferred tls engine.
clib_error_t * vnet_app_worker_add_del(vnet_app_worker_add_del_args_t *a)
struct _session_endpoint_cfg session_endpoint_cfg_t
int application_local_session_connect(app_worker_t *client, app_worker_t *server, local_session_t *ls, u32 opaque)
struct app_worker_ app_worker_t
void application_local_session_free(app_worker_t *app, local_session_t *ls)
app_worker_t * workers
Pool of workers associated to apps.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
struct _session_endpoint session_endpoint_t
int application_is_builtin(application_t *app)
int application_start_listen(application_t *app, session_endpoint_cfg_t *tep, session_handle_t *handle)
Start listening local transport endpoint for requested transport.
static void local_session_parse_id(u32 ls_id, u32 *app_or_wrk, u32 *session_index)
segment_manager_t * app_worker_get_connect_segment_manager(app_worker_t *)
static u8 application_local_session_listener_has_transport(local_session_t *ls)
int application_start_local_listen(application_t *server, session_endpoint_cfg_t *sep, session_handle_t *handle)
u32 wrk_index
Worker index in global worker pool.
app_worker_t * app_worker_get_if_valid(u32 wrk_index)
app_worker_t * app_worker_alloc(application_t *app)
volatile u8 session_state
State.
void application_detach_process(application_t *app, u32 api_client_index)
app_worker_map_t * worker_maps
Pool of mappings that keep track of workers associated to this app.
uword * app_by_name
Hash table of builtin apps by name.
static transport_proto_t session_type_transport_proto(session_type_t st)
struct app_init_args_ app_init_args_t
int app_worker_send_event(app_worker_t *app, stream_session_t *s, u8 evt)
Send event to application.
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.
u32 app_wrk_index
Server index.
int app_worker_add_segment_notify(u32 app_or_wrk, u64 segment_handle)
Send an API message to the external app, to map new segment.
const u8 * application_name_from_index(u32 app_or_wrk)
Returns app name for app-index.
int application_stop_local_listen(u32 app_index, u32 app_or_wrk, session_handle_t lh)
Clean up local session table.
u8 application_has_global_scope(application_t *app)
application_t * application_get(u32 index)
static local_session_t * application_get_local_listener_w_handle(session_handle_t handle)
int application_is_proxy(application_t *app)
uword * app_by_api_client_index
Hash table of apps by api client index.
void app_worker_local_sessions_free(app_worker_t *app)
session_cb_vft_t cb_fns
Callbacks: shoulder-taps for the server/client.
u32 app_worker_n_listeners(app_worker_t *app)
u8 * tls_key
PEM encoded key.
u32 application_session_table(application_t *app, u8 fib_proto)
stream_session_t * app_worker_first_listener(app_worker_t *app, u8 fib_proto, u8 transport_proto)
int application_alloc_and_init(app_init_args_t *args)
u32 accept_rotor
last worker to accept a connection
local_session_t * application_get_local_session(app_worker_t *app, u32 session_index)
struct app_main_ app_main_t
u32 app_index
App index in app pool.
struct app_worker_map_ app_worker_map_t
u32 application_local_session_table(application_t *app)
application_t * application_alloc(void)
local_session_t * application_local_session_alloc(app_worker_t *app)
struct application_ application_t
int application_local_session_disconnect(u32 app_or_wrk, local_session_t *ls)
app_worker_t * app_worker_get(u32 wrk_index)
application_t * app_pool
Pool from which we allocate all applications.
enum _transport_proto transport_proto_t
segment_manager_properties_t * application_segment_manager_properties(application_t *app)
static u32 local_session_id(local_session_t *ls)
u8 * name
Name registered by builtin apps.
application_t * app_worker_get_app(u32 wrk_index)
u32 session_index
Session index.
int app_worker_alloc_connects_segment_manager(app_worker_t *app)
struct _segment_manager segment_manager_t
u8 app_worker_application_is_builtin(app_worker_t *app_wrk)
u8 application_has_local_scope(application_t *app)
int application_stop_listen(u32 app_index, u32 app_or_wrk, session_handle_t handle)
Stop listening on session associated to handle.
u32 app_index
Index of owning app.
int application_is_builtin_proxy(application_t *app)
uword * local_connects
Hash table of the app's local connects.
local_session_t * local_sessions
Pool of local sessions the app owns (as a server)
void app_worker_free(app_worker_t *app_wrk)
app_worker_t * application_get_default_worker(application_t *app)
u8 * tls_cert
Certificate to be used for listen sessions.
local_session_t * application_get_local_listen_session_from_handle(session_handle_t lh)
int application_local_session_connect_notify(local_session_t *ls)
#define foreach_app_init_args
u32 api_client_index
API index for the worker.
int app_worker_own_session(app_worker_t *app_wrk, stream_session_t *s)
svm_msg_q_t * event_queue
Application listens for events on this svm queue.
void application_setup_proxy(application_t *app)
app_worker_t * application_get_worker(application_t *app, u32 wrk_index)
u8 first_segment_manager_in_use
static void local_session_parse_handle(session_handle_t handle, u32 *app_or_wrk_index, u32 *session_index)
void mq_send_local_session_disconnected_cb(u32 app_or_wrk, local_session_t *ls)