32 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 39 #define foreach_session_api_msg \ 40 _(MAP_ANOTHER_SEGMENT_REPLY, map_another_segment_reply) \ 41 _(APPLICATION_ATTACH, application_attach) \ 42 _(APPLICATION_DETACH, application_detach) \ 43 _(BIND_URI, bind_uri) \ 44 _(UNBIND_URI, unbind_uri) \ 45 _(CONNECT_URI, connect_uri) \ 46 _(DISCONNECT_SESSION, disconnect_session) \ 47 _(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \ 48 _(ACCEPT_SESSION_REPLY, accept_session_reply) \ 49 _(RESET_SESSION_REPLY, reset_session_reply) \ 50 _(BIND_SOCK, bind_sock) \ 51 _(UNBIND_SOCK, unbind_sock) \ 52 _(CONNECT_SOCK, connect_sock) \ 53 _(SESSION_ENABLE_DISABLE, session_enable_disable) \ 68 memset (mp, 0,
sizeof (*mp));
69 mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_MAP_ANOTHER_SEGMENT);
71 strncpy ((
char *) mp->
segment_name, (
char *) segment_name,
96 memset (mp, 0,
sizeof (*mp));
98 mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_ACCEPT_SESSION);
102 tc = tp_vft->get_connection (s->connection_index, s->thread_index);
108 mp->
port = tc->rmt_port;
129 memset (mp, 0,
sizeof (*mp));
130 mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_DISCONNECT_SESSION);
148 memset (mp, 0,
sizeof (*mp));
149 mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_RESET_SESSION);
170 mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_CONNECT_URI_REPLY);
183 mp->
retval = clib_host_to_net_u32 (VNET_API_ERROR_SESSION_CONNECT_FAIL);
216 rv = VNET_API_ERROR_INVALID_VALUE;
223 rv = VNET_API_ERROR_INVALID_VALUE_2;
260 rv = VNET_API_ERROR_QUEUE_FULL;
282 vl_api_session_enable_disable_reply_t *rmp;
299 rv = VNET_API_ERROR_FEATURE_DISABLED;
305 "Out of options, fix api message definition");
307 memset (a, 0,
sizeof (*a));
324 if (a->segment_name_length)
326 memcpy (rmp->segment_name, a->segment_name,
327 a->segment_name_length);
328 rmp->segment_name_length = a->segment_name_length;
339 vl_api_application_detach_reply_t *rmp;
340 int rv = VNET_API_ERROR_INVALID_VALUE_2;
346 rv = VNET_API_ERROR_FEATURE_DISABLED;
353 a->app_index = app->index;
364 vl_api_bind_uri_reply_t *rmp;
371 rv = VNET_API_ERROR_FEATURE_DISABLED;
378 memset (a, 0,
sizeof (*a));
379 a->uri = (
char *) mp->
uri;
380 a->app_index = app->index;
385 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
395 vl_api_unbind_uri_reply_t *rmp;
402 rv = VNET_API_ERROR_FEATURE_DISABLED;
409 a->uri = (
char *) mp->
uri;
410 a->app_index = app->index;
415 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
432 rv = VNET_API_ERROR_FEATURE_DISABLED;
439 a->uri = (
char *) mp->
uri;
441 a->app_index = app->index;
447 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
471 rv = VNET_API_ERROR_FEATURE_DISABLED;
479 a->app_index = app->index;
484 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
510 a->app_index = app->index;
520 u32 index, thread_index;
528 if (s == 0 || app->index != s->app_index)
550 u32 session_index, thread_index;
569 if (s->app_index != mp->
context)
591 int rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
596 rv = VNET_API_ERROR_FEATURE_DISABLED;
603 memset (a, 0,
sizeof (*a));
607 a->tep.is_ip4 = mp->
is_ip4;
608 a->tep.port = mp->
port;
609 a->tep.vrf = mp->
vrf;
610 a->app_index = app->index;
621 vl_api_unbind_sock_reply_t *rmp;
624 int rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
628 rv = VNET_API_ERROR_FEATURE_DISABLED;
654 rv = VNET_API_ERROR_FEATURE_DISABLED;
662 u8 *ip = mp->
is_ip4 ? (
u8 *) & a->tep.ip.ip4 : (
u8 *) & a->tep.ip;
666 a->tep.is_ip4 = mp->
is_ip4;
667 a->tep.port = mp->
port;
673 a->app_index = app->index;
674 a->proto = mp->
proto;
680 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
699 a->app_index = app->index;
707 #define vl_msg_name_crc_list 709 #undef vl_msg_name_crc_list 714 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 715 foreach_vl_msg_name_crc_session;
732 vl_msg_api_set_handlers(VL_API_##N, #n, \ 733 vl_api_##n##_t_handler, \ 735 vl_api_##n##_t_endian, \ 736 vl_api_##n##_t_print, \ 737 sizeof(vl_api_##n##_t), 1); static void vl_api_disconnect_session_reply_t_handler(vl_api_disconnect_session_reply_t *mp)
static clib_error_t * session_api_hookup(vlib_main_t *vm)
vpp->client reset session API
VL_MSG_API_REAPER_FUNCTION(application_reaper_cb)
struct _transport_connection transport_connection_t
struct _vnet_connect_args vnet_connect_args_t
int vnet_bind_uri(vnet_bind_args_t *a)
#define REPLY_MACRO2(t, body)
static f64 vlib_time_now(vlib_main_t *vm)
static void vl_api_map_another_segment_reply_t_handler(vl_api_map_another_segment_reply_t *mp)
Bind to an ip:port pair for a given transport protocol.
client->vpp, reply to an accept message
application_t * application_lookup(u32 api_client_index)
static void vl_api_unbind_sock_t_handler(vl_api_unbind_sock_t *mp)
#define foreach_session_api_msg
static u8 session_manager_is_enabled()
struct _stream_session_t stream_session_t
#define VNET_CONNECT_REDIRECTED
Server can handle delegated connect requests from local clients.
static void vl_api_connect_uri_t_handler(vl_api_connect_uri_t *mp)
int vnet_unbind_uri(vnet_unbind_args_t *a)
static void vl_api_session_enable_disable_t_handler(vl_api_session_enable_disable_t *mp)
struct _vnet_disconnect_args_t vnet_disconnect_args_t
int vnet_bind(vnet_bind_args_t *a)
static void send_session_reset_callback(stream_session_t *s)
struct _stream_session_cb_vft session_cb_vft_t
struct _vnet_unbind_args_t vnet_unbind_args_t
void stream_session_cleanup(stream_session_t *s)
Cleanup transport and session state.
static uword pointer_to_uword(const void *p)
void * vl_msg_api_alloc(int nbytes)
struct _vnet_app_attach_args_t vnet_app_attach_args_t
struct _transport_proto_vft transport_proto_vft_t
int unix_shared_memory_queue_add(unix_shared_memory_queue_t *q, u8 *elem, int nowait)
static session_cb_vft_t uri_session_cb_vft
static void vl_api_accept_session_reply_t_handler(vl_api_accept_session_reply_t *mp)
client->vpp, attach application to session layer
static void vl_api_disconnect_session_t_handler(vl_api_disconnect_session_t *mp)
void vl_msg_api_free(void *)
static clib_error_t * application_reaper_cb(u32 client_index)
clib_error_t * vnet_session_enable_disable(vlib_main_t *vm, u8 is_en)
u64 vpp_event_queue_address
vpp->client, accept this session
int send_session_connected_callback(u32 app_index, u32 api_context, stream_session_t *s, u8 is_fail)
static int send_session_accept_callback(stream_session_t *s)
static unix_shared_memory_queue_t * session_manager_get_vpp_event_queue(u32 thread_index)
vpp->client, connect reply
#define clib_warning(format, args...)
static int redirect_connect_callback(u32 server_api_client_index, void *mp_arg)
Redirect a connect_uri message to the indicated server.
#define clib_memcpy(a, b, c)
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
struct _application application_t
int vnet_disconnect_session(vnet_disconnect_args_t *a)
static stream_session_t * stream_session_get_if_valid(u64 si, u32 thread_index)
Application attach reply.
int vnet_application_attach(vnet_app_attach_args_t *a)
Attaches application.
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
static void stream_session_parse_handle(u64 handle, u32 *index, u32 *thread_index)
enable/disable session layer
static void vl_api_connect_sock_t_handler(vl_api_connect_sock_t *mp)
u64 app_event_queue_address
client->vpp, attach application to session layer
static void vl_api_bind_sock_t_handler(vl_api_bind_sock_t *mp)
vpp->client, please map an additional shared memory segment
struct _vnet_app_detach_args_t vnet_app_detach_args_t
Connect to a remote peer.
static vlib_main_t * vlib_get_main(void)
static void vl_api_application_attach_t_handler(vl_api_application_attach_t *mp)
transport_proto_vft_t * session_get_transport_vft(u8 type)
static void setup_message_id_table(api_main_t *am)
static u64 stream_session_handle(stream_session_t *s)
bidirectional disconnect API
static stream_session_t * listen_session_get(session_type_t type, u32 index)
#define STATIC_ASSERT(truth,...)
application_t * application_get(u32 index)
int vnet_connect(vnet_connect_args_t *a)
int vnet_unbind(vnet_unbind_args_t *a)
VLIB_API_INIT_FUNCTION(session_api_hookup)
static int send_add_segment_callback(u32 api_client_index, const u8 *segment_name, u32 segment_size)
static void send_session_disconnect_callback(stream_session_t *s)
static void vl_api_application_detach_t_handler(vl_api_application_detach_t *mp)
vpp/server->client, connect reply
client->vpp reset session reply
u64 vpp_event_queue_address
bidirectional disconnect reply API
int vnet_connect_uri(vnet_connect_args_t *a)
int vnet_application_detach(vnet_app_detach_args_t *a)
struct _vnet_bind_args_t vnet_bind_args_t
static u64 listen_session_get_handle(stream_session_t *s)
static void vl_api_bind_uri_t_handler(vl_api_bind_uri_t *mp)
static void vl_api_reset_session_reply_t_handler(vl_api_reset_session_reply_t *mp)
struct _unix_shared_memory_queue unix_shared_memory_queue_t
static void vl_api_unbind_uri_t_handler(vl_api_unbind_uri_t *mp)