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_SESSION_REPLY);
183 mp->
retval = clib_host_to_net_u32 (VNET_API_ERROR_SESSION_CONNECT_FAIL);
209 rv = VNET_API_ERROR_INVALID_VALUE;
216 rv = VNET_API_ERROR_INVALID_VALUE_2;
253 rv = VNET_API_ERROR_QUEUE_FULL;
275 vl_api_session_enable_disable_reply_t *rmp;
292 rv = VNET_API_ERROR_FEATURE_DISABLED;
298 "Out of options, fix api message definition");
300 memset (a, 0,
sizeof (*a));
317 if (a->segment_name_length)
319 memcpy (rmp->segment_name, a->segment_name,
320 a->segment_name_length);
321 rmp->segment_name_length = a->segment_name_length;
332 vl_api_application_detach_reply_t *rmp;
333 int rv = VNET_API_ERROR_INVALID_VALUE_2;
339 rv = VNET_API_ERROR_FEATURE_DISABLED;
346 a->app_index = app->index;
357 vl_api_bind_uri_reply_t *rmp;
364 rv = VNET_API_ERROR_FEATURE_DISABLED;
371 memset (a, 0,
sizeof (*a));
372 a->uri = (
char *) mp->
uri;
373 a->app_index = app->index;
378 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
388 vl_api_unbind_uri_reply_t *rmp;
395 rv = VNET_API_ERROR_FEATURE_DISABLED;
402 a->uri = (
char *) mp->
uri;
403 a->app_index = app->index;
408 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
425 rv = VNET_API_ERROR_FEATURE_DISABLED;
432 a->uri = (
char *) mp->
uri;
434 a->app_index = app->index;
440 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
464 rv = VNET_API_ERROR_FEATURE_DISABLED;
472 a->app_index = app->index;
477 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
503 a->app_index = app->index;
513 u32 index, thread_index;
521 if (s == 0 || app->index != s->app_index)
543 u32 session_index, thread_index;
562 if (s->app_index != mp->
context)
584 int rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
589 rv = VNET_API_ERROR_FEATURE_DISABLED;
596 ip46_address_t *ip46 = (ip46_address_t *) mp->
ip;
598 memset (a, 0,
sizeof (*a));
599 a->tep.is_ip4 = mp->
is_ip4;
601 a->tep.port = mp->
port;
602 a->tep.vrf = mp->
vrf;
603 a->app_index = app->index;
619 vl_api_unbind_sock_reply_t *rmp;
622 int rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
626 rv = VNET_API_ERROR_FEATURE_DISABLED;
652 rv = VNET_API_ERROR_FEATURE_DISABLED;
660 ip46_address_t *ip46 = (ip46_address_t *) mp->
ip;
664 a->tep.is_ip4 = mp->
is_ip4;
666 a->tep.port = mp->
port;
667 a->tep.vrf = mp->
vrf;
669 a->app_index = app->index;
670 a->proto = mp->
proto;
676 rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
695 a->app_index = app->index;
703 #define vl_msg_name_crc_list 705 #undef vl_msg_name_crc_list 710 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 711 foreach_vl_msg_name_crc_session;
728 vl_msg_api_set_handlers(VL_API_##N, #n, \ 729 vl_api_##n##_t_handler, \ 731 vl_api_##n##_t_endian, \ 732 vl_api_##n##_t_print, \ 733 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
u64 vpp_event_queue_address
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)
u8 * message_bounce
Don't automatically free message buffer vetor.
static void vl_api_map_another_segment_reply_t_handler(vl_api_map_another_segment_reply_t *mp)
struct _transport_proto_vft transport_proto_vft_t
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()
#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
vpp/server->client, connect reply – used for all connect_* messages
void stream_session_cleanup(stream_session_t *s)
Cleanup transport and session state.
struct _stream_session_t stream_session_t
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
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)
API main structure, used by both vpp and binary API clients.
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)
#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)
static void setup_message_id_table(api_main_t *am)
static u64 stream_session_handle(stream_session_t *s)
bidirectional disconnect API
transport_proto_vft_t * session_get_transport_vft(u8 session_type)
Get transport virtual function table.
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)
client->vpp reset session reply
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)