aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo_common.h1
-rw-r--r--src/vcl/vcl_bapi.c2
-rw-r--r--src/vnet/session/session.api263
-rw-r--r--src/vnet/session/session_api.c570
4 files changed, 37 insertions, 799 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_common.h b/src/plugins/hs_apps/sapi/vpp_echo_common.h
index f01bb0390f6..16dd4c39ebe 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo_common.h
+++ b/src/plugins/hs_apps/sapi/vpp_echo_common.h
@@ -232,7 +232,6 @@ typedef enum echo_test_evt_
typedef union session_connected_bundled_msg_
{
session_connected_msg_t *mp;
- vl_api_connect_uri_reply_t *bmp;
} session_connected_bundled_msg_t;
typedef struct echo_proto_cb_vft_
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index af2eb035a67..077024ed2cf 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -432,7 +432,7 @@ vppcom_send_application_tls_key_add (vcl_session_t * session, char *key,
u32
vcl_max_nsid_len (void)
{
- vl_api_application_attach_t *mp;
+ vl_api_app_attach_t *mp;
return (sizeof (mp->namespace_id) - 1);
}
diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api
index 905ab5630d9..f95abb92f78 100644
--- a/src/vnet/session/session.api
+++ b/src/vnet/session/session.api
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-option version = "2.0.0";
+option version = "3.0.0";
import "vnet/interface_types.api";
import "vnet/ip/ip_types.api";
@@ -29,49 +29,6 @@ enum transport_proto : u8
TRANSPORT_PROTO_API_QUIC,
};
-/** \brief client->vpp, attach application to session layer
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param initial_segment_size - size of the initial shm segment to be
- allocated
- @param options - segment size, fifo sizes, etc.
- @param namespace_id - string
-*/
- define application_attach {
- u32 client_index;
- u32 context;
- u32 initial_segment_size;
- u64 options[17];
- string namespace_id[];
- };
-
- /** \brief Application attach reply
- ### WILL BE DEPRECATED POST 20.01 ###
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
- @param app_event_queue_address - vpp event queue address or 0 if this
- connection shouldn't send events
- @param n_fds - number of fds exchanged
- @param fd_flags - set of flags that indicate which fds are to be expected
- over the socket (set only if socket transport available)
- @param segment_size - size of first shm segment
- @param app_index - index of the newly created app
- @param segment_handle - handle for segment
- @param segment_name - name of segment client needs to attach to
-*/
-define application_attach_reply {
- u32 context;
- i32 retval;
- u64 app_event_queue_address;
- u8 n_fds;
- u8 fd_flags;
- u32 segment_size;
- u32 app_index;
- u64 segment_handle;
- string segment_name[];
-};
-
/** \brief Application attach to session layer
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -114,6 +71,15 @@ define app_attach_reply {
string segment_name[];
};
+ /** \brief client->vpp, attach application to session layer
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+autoreply define application_detach {
+ u32 client_index;
+ u32 context;
+};
+
/** \brief Add certificate and key
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -182,215 +148,6 @@ autoreply define application_tls_key_add {
u8 key[key_len];
};
- /** \brief client->vpp, attach application to session layer
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
-*/
-autoreply define application_detach {
- u32 client_index;
- u32 context;
- };
-
-/** \brief vpp->client, please map an additional shared memory segment
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param fd_flags - set of flags that indicate which, if any, fds are
- to be expected over the socket. This is set only if
- socket transport available
- @param segment_size - size of the segment to be mapped
- @param segment_name - name of the segment to be mapped
- @param segment_handle - unique identifier for segment
-*/
-autoreply define map_another_segment {
- u32 client_index;
- u32 context;
- u8 fd_flags;
- u32 segment_size;
- string segment_name[128];
- u64 segment_handle;
-};
-
-/** \brief vpp->client unmap shared memory segment
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param segment_name - segment name
- @param segment_handle - handle of the segment to be unmapped
-*/
-autoreply define unmap_segment {
- u32 client_index;
- u32 context;
- u64 segment_handle;
-};
-
- /** \brief Bind to a given URI
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param accept_cookie - sender accept cookie, to identify this bind flavor
- @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
- "tcp://::/0/80" [ipv6] etc.
- @param options - socket options, fifo sizes, etc.
-*/
-autoreply define bind_uri {
- u32 client_index;
- u32 context;
- u32 accept_cookie;
- u8 uri[128];
-};
-
-/** \brief Unbind a given URI
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param uri - a URI, e.g. "tcp://0.0.0.0/0/80" [ipv4]
- "tcp://::/0/80" [ipv6], etc.
- @param options - socket options, fifo sizes, etc.
-*/
-autoreply define unbind_uri {
- u32 client_index;
- u32 context;
- u8 uri[128];
-};
-
-/** \brief Connect to a given URI
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param client_queue_address - binary API client queue address. Used by
- local server when connect was redirected.
- @param options - socket options, fifo sizes, etc. passed by vpp to the
- server when redirecting connects
- @param uri - a URI, e.g. "tcp4://0.0.0.0/0/80"
- "tcp6://::/0/80" [ipv6], etc.
-*/
-autoreply define connect_uri {
- u32 client_index;
- u32 context;
- u64 client_queue_address;
- u64 options[16];
- u8 uri[128];
-};
-
-/** \brief bidirectional disconnect API
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- client to vpp direction only
- @param context - sender context, to match reply w/ request
- @param handle - session handle obtained from accept/connect
-*/
-define disconnect_session {
- u32 client_index;
- u32 context;
- u64 handle;
-};
-
-/** \brief bidirectional disconnect reply API
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- client to vpp direction only
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
- @param handle - session handle
-*/
-define disconnect_session_reply {
- u32 context;
- i32 retval;
- u64 handle;
-};
-
-/** \brief Bind to an ip:port pair for a given transport protocol
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param wrk_index - index of worker requesting the bind
- @param vrf - bind namespace
- @param ip - ip address
- @param port - port
- @param proto - protocol 0 - TCP 1 - UDP
- @param options - socket options, fifo sizes, etc.
-*/
-autoreply define bind_sock {
- u32 client_index;
- u32 context;
- u32 wrk_index;
- u32 vrf;
- vl_api_address_t ip;
- u16 port;
- vl_api_transport_proto_t proto;
- u64 options[16];
-};
-
-/** \brief Unbind
- ### WILL BE DEPRECATED POST 20.01 ###s
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param wrk_index - index of worker requesting the bind
- @param handle - bind handle obtained from bind reply
-*/
-autoreply define unbind_sock {
- u32 client_index;
- u32 context;
- u32 wrk_index;
- u64 handle;
-};
-
-/** \brief Connect to a remote peer
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param wrk_index - worker that requests the connect
- @param client_queue_address - client's API queue address. Non-zero when
- used to perform redirects
- @param options - socket options, fifo sizes, etc. when doing redirects
- @param vrf - connection namespace
- @param ip - ip address
- @param port - port
- @param proto - protocol 0 - TCP 1 - UDP
- @param hostname-len - length of hostname
- @param hostname - destination's hostname. If present, used by protocols
- like tls.
- @param parent_handle - handle of parent session (e.g. for opening quic streams).
-*/
-autoreply define connect_sock {
- u32 client_index;
- u32 context;
- u32 wrk_index;
- u64 client_queue_address;
- u64 options[16];
- u32 vrf;
- vl_api_address_t ip;
- u16 port;
- vl_api_transport_proto_t proto;
- u64 parent_handle;
- string hostname[];
-};
-
-/** \brief ask app to add a new cut-through registration
- ### WILL BE DEPRECATED POST 20.01 ###
- @param client_index - opaque cookie to identify the sender
- client to vpp direction only
- @param context - sender context, to match reply w/ request
- @param evt_q_address - address of the mq in ssvm segment
- @param peer_evt_q_address - address of peer's mq in ssvm segment
- @param wrk_index - index of worker to receive the registration
- @param n_fds - number of fds exchanged
- @param fd_flags - flag indicating the fds that will be exchanged over
- api socket
-*/
-autoreply define app_cut_through_registration_add
-{
- u32 client_index;
- u32 context;
- u64 evt_q_address;
- u64 peer_evt_q_address;
- u32 wrk_index;
- u8 n_fds;
- u8 fd_flags;
-};
-
/** \brief add/del application worker
@param client_index - opaque cookie to identify the sender
client to vpp direction only
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 88deafe13e5..6dcf06bd724 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -43,18 +43,8 @@
#include <vlibapi/api_helper_macros.h>
#define foreach_session_api_msg \
-_(MAP_ANOTHER_SEGMENT_REPLY, map_another_segment_reply) \
-_(APPLICATION_ATTACH, application_attach) \
_(APP_ATTACH, app_attach) \
_(APPLICATION_DETACH, application_detach) \
-_(BIND_URI, bind_uri) \
-_(UNBIND_URI, unbind_uri) \
-_(CONNECT_URI, connect_uri) \
-_(DISCONNECT_SESSION, disconnect_session) \
-_(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \
-_(BIND_SOCK, bind_sock) \
-_(UNBIND_SOCK, unbind_sock) \
-_(CONNECT_SOCK, connect_sock) \
_(SESSION_ENABLE_DISABLE, session_enable_disable) \
_(APP_NAMESPACE_ADD_DEL, app_namespace_add_del) \
_(SESSION_RULE_ADD_DEL, session_rule_add_del) \
@@ -123,79 +113,6 @@ session_send_fds (vl_api_registration_t * reg, int fds[], int n_fds)
return 0;
}
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static int
-send_add_segment_callback (u32 api_client_index, u64 segment_handle)
-{
- int fds[SESSION_N_FD_TYPE], n_fds = 0;
- vl_api_map_another_segment_t *mp;
- vl_api_registration_t *reg;
- fifo_segment_t *fs;
- ssvm_private_t *sp;
- u8 fd_flags = 0;
-
- reg = vl_mem_api_client_index_to_registration (api_client_index);
- if (!reg)
- {
- clib_warning ("no api registration for client: %u", api_client_index);
- return -1;
- }
-
- fs = segment_manager_get_segment_w_handle (segment_handle);
- sp = &fs->ssvm;
- if (ssvm_type (sp) == SSVM_SEGMENT_MEMFD)
- {
- if (vl_api_registration_file_index (reg) == VL_API_INVALID_FI)
- {
- clib_warning ("can't send memfd fd");
- return -1;
- }
-
- fd_flags |= SESSION_FD_F_MEMFD_SEGMENT;
- fds[n_fds] = sp->fd;
- n_fds += 1;
- }
-
- mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
- clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_MAP_ANOTHER_SEGMENT);
- mp->segment_size = sp->ssvm_size;
- mp->fd_flags = fd_flags;
- mp->segment_handle = clib_host_to_net_u64 (segment_handle);
- strncpy ((char *) mp->segment_name, (char *) sp->name,
- sizeof (mp->segment_name) - 1);
-
- vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
-
- if (n_fds)
- return session_send_fds (reg, fds, n_fds);
-
- return 0;
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static int
-send_del_segment_callback (u32 api_client_index, u64 segment_handle)
-{
- vl_api_unmap_segment_t *mp;
- vl_api_registration_t *reg;
-
- reg = vl_mem_api_client_index_to_registration (api_client_index);
- if (!reg)
- {
- clib_warning ("no registration: %u", api_client_index);
- return -1;
- }
-
- mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
- clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_UNMAP_SEGMENT);
- mp->segment_handle = clib_host_to_net_u64 (segment_handle);
- vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
-
- return 0;
-}
-
static int
mq_try_lock_and_alloc_msg (svm_msg_q_t * app_mq, svm_msg_q_msg_t * msg)
{
@@ -660,17 +577,6 @@ mq_send_session_cleanup_cb (session_t * s, session_cleanup_ntf_t ntf)
svm_msg_q_add_and_unlock (app_mq, msg);
}
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static session_cb_vft_t session_mq_cb_vft_old = {
- .session_accept_callback = mq_send_session_accepted_cb,
- .session_disconnect_callback = mq_send_session_disconnected_cb,
- .session_connected_callback = mq_send_session_connected_cb,
- .session_reset_callback = mq_send_session_reset_cb,
- .session_migrate_callback = mq_send_session_migrate_cb,
- .add_segment_callback = send_add_segment_callback,
- .del_segment_callback = send_del_segment_callback,
-};
-
static session_cb_vft_t session_mq_cb_vft = {
.session_accept_callback = mq_send_session_accepted_cb,
.session_disconnect_callback = mq_send_session_disconnected_cb,
@@ -693,89 +599,6 @@ vl_api_session_enable_disable_t_handler (vl_api_session_enable_disable_t * mp)
REPLY_MACRO (VL_API_SESSION_ENABLE_DISABLE_REPLY);
}
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_application_attach_t_handler (vl_api_application_attach_t * mp)
-{
- int rv = 0, fds[SESSION_N_FD_TYPE], n_fds = 0;
- vl_api_application_attach_reply_t *rmp;
- ssvm_private_t *segp, *evt_q_segment;
- vnet_app_attach_args_t _a, *a = &_a;
- vl_api_registration_t *reg;
- u8 fd_flags = 0;
-
- reg = vl_api_client_index_to_registration (mp->client_index);
- if (!reg)
- return;
-
- if (session_main_is_enabled () == 0)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto done;
- }
-
- STATIC_ASSERT (sizeof (u64) * APP_OPTIONS_N_OPTIONS <=
- sizeof (mp->options),
- "Out of options, fix api message definition");
-
- clib_memset (a, 0, sizeof (*a));
- a->api_client_index = mp->client_index;
- a->options = mp->options;
- a->session_cb_vft = &session_mq_cb_vft_old;
- a->namespace_id =
- (u8 *) vl_api_from_api_to_new_c_string (&mp->namespace_id);
-
- if ((rv = vnet_application_attach (a)))
- {
- clib_warning ("attach returned: %d", rv);
- vec_free (a->namespace_id);
- goto done;
- }
- vec_free (a->namespace_id);
-
- /* Send event queues segment */
- if ((evt_q_segment = session_main_get_evt_q_segment ()))
- {
- fd_flags |= SESSION_FD_F_VPP_MQ_SEGMENT;
- fds[n_fds] = evt_q_segment->fd;
- n_fds += 1;
- }
- /* Send fifo segment fd if needed */
- if (ssvm_type (a->segment) == SSVM_SEGMENT_MEMFD)
- {
- fd_flags |= SESSION_FD_F_MEMFD_SEGMENT;
- fds[n_fds] = a->segment->fd;
- n_fds += 1;
- }
- if (a->options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD)
- {
- fd_flags |= SESSION_FD_F_MQ_EVENTFD;
- fds[n_fds] = svm_msg_q_get_producer_eventfd (a->app_evt_q);
- n_fds += 1;
- }
-
-done:
-
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_APPLICATION_ATTACH_REPLY, ({
- if (!rv)
- {
- segp = a->segment;
- rmp->app_index = clib_host_to_net_u32 (a->app_index);
- vl_api_vec_to_api_string (segp->name, &rmp->segment_name);
- rmp->segment_size = segp->ssvm_size;
- rmp->app_event_queue_address = pointer_to_uword (a->app_evt_q);
- rmp->n_fds = n_fds;
- rmp->fd_flags = fd_flags;
- rmp->segment_handle = clib_host_to_net_u64 (a->segment_handle);
- }
- }));
- /* *INDENT-ON* */
-
- if (n_fds)
- session_send_fds (reg, fds, n_fds);
-}
-
static void
vl_api_app_attach_t_handler (vl_api_app_attach_t * mp)
{
@@ -865,363 +688,6 @@ done:
session_send_fds (reg, fds, n_fds);
}
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_application_detach_t_handler (vl_api_application_detach_t * mp)
-{
- vl_api_application_detach_reply_t *rmp;
- int rv = VNET_API_ERROR_INVALID_VALUE_2;
- vnet_app_detach_args_t _a, *a = &_a;
- application_t *app;
-
- if (session_main_is_enabled () == 0)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto done;
- }
-
- app = application_lookup (mp->client_index);
- if (app)
- {
- a->app_index = app->app_index;
- a->api_client_index = mp->client_index;
- rv = vnet_application_detach (a);
- }
-
-done:
- REPLY_MACRO (VL_API_APPLICATION_DETACH_REPLY);
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_bind_uri_t_handler (vl_api_bind_uri_t * mp)
-{
- vl_api_bind_uri_reply_t *rmp;
- vnet_listen_args_t _a, *a = &_a;
- application_t *app = 0;
- app_worker_t *app_wrk;
- int rv;
-
- if (session_main_is_enabled () == 0)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto done;
- }
-
- app = application_lookup (mp->client_index);
- if (app)
- {
- clib_memset (a, 0, sizeof (*a));
- a->uri = (char *) mp->uri;
- a->app_index = app->app_index;
- rv = vnet_bind_uri (a);
- }
- else
- {
- rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
- }
-
-done:
-
- REPLY_MACRO (VL_API_BIND_URI_REPLY);
-
- if (app)
- {
- app_wrk = application_get_worker (app, 0);
- mq_send_session_bound_cb (app_wrk->wrk_index, mp->context, a->handle,
- rv);
- }
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_unbind_uri_t_handler (vl_api_unbind_uri_t * mp)
-{
- vl_api_unbind_uri_reply_t *rmp;
- application_t *app;
- vnet_unlisten_args_t _a, *a = &_a;
- int rv;
-
- if (session_main_is_enabled () == 0)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto done;
- }
-
- app = application_lookup (mp->client_index);
- if (app)
- {
- a->uri = (char *) mp->uri;
- a->app_index = app->app_index;
- a->wrk_map_index = 0;
- rv = vnet_unbind_uri (a);
- }
- else
- {
- rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
- }
-
-done:
- REPLY_MACRO (VL_API_UNBIND_URI_REPLY);
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
-{
- vl_api_connect_uri_reply_t *rmp;
- vnet_connect_args_t _a, *a = &_a;
- application_t *app;
- int rv = 0;
-
- if (session_main_is_enabled () == 0)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto done;
- }
-
- app = application_lookup (mp->client_index);
- if (app)
- {
- clib_memset (a, 0, sizeof (*a));
- a->uri = (char *) mp->uri;
- a->api_context = mp->context;
- a->app_index = app->app_index;
- if ((rv = vnet_connect_uri (a)))
- clib_warning ("connect_uri returned: %d", rv);
- }
- else
- {
- rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
- }
-
- /*
- * Don't reply to stream (tcp) connects. The reply will come once
- * the connection is established. In case of the redirects, the reply
- * will come from the server app.
- */
- if (rv == 0)
- return;
-
-done:
- REPLY_MACRO (VL_API_CONNECT_URI_REPLY);
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_disconnect_session_t_handler (vl_api_disconnect_session_t * mp)
-{
- vl_api_disconnect_session_reply_t *rmp;
- vnet_disconnect_args_t _a, *a = &_a;
- application_t *app;
- int rv = 0;
-
- if (session_main_is_enabled () == 0)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto done;
- }
-
- app = application_lookup (mp->client_index);
- if (app)
- {
- a->handle = mp->handle;
- a->app_index = app->app_index;
- rv = vnet_disconnect_session (a);
- }
- else
- {
- rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
- }
-
-done:
- REPLY_MACRO2 (VL_API_DISCONNECT_SESSION_REPLY, rmp->handle = mp->handle);
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_disconnect_session_reply_t_handler (vl_api_disconnect_session_reply_t *
- mp)
-{
- vnet_disconnect_args_t _a, *a = &_a;
- application_t *app;
-
- /* Client objected to disconnecting the session, log and continue */
- if (mp->retval)
- {
- clib_warning ("client retval %d", mp->retval);
- return;
- }
-
- /* Disconnect has been confirmed. Confirm close to transport */
- app = application_lookup (mp->context);
- if (app)
- {
- a->handle = mp->handle;
- a->app_index = app->app_index;
- vnet_disconnect_session (a);
- }
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_map_another_segment_reply_t_handler (vl_api_map_another_segment_reply_t
- * mp)
-{
- clib_warning ("not implemented");
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_bind_sock_t_handler (vl_api_bind_sock_t * mp)
-{
- vnet_listen_args_t _a, *a = &_a;
- vl_api_bind_sock_reply_t *rmp;
- application_t *app = 0;
- app_worker_t *app_wrk;
- int rv = 0;
-
- if (session_main_is_enabled () == 0)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto done;
- }
-
- app = application_lookup (mp->client_index);
- if (!app)
- {
- rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
- goto done;
- }
-
- clib_memset (a, 0, sizeof (*a));
- ip_address_decode (&mp->ip, &a->sep.ip);
- a->sep.is_ip4 = ip46_address_is_ip4 (&a->sep.ip);
- a->sep.port = mp->port;
- a->sep.fib_index = mp->vrf;
- a->sep.sw_if_index = ENDPOINT_INVALID_INDEX;
- a->sep.transport_proto = api_session_transport_proto_decode (&mp->proto);
- a->app_index = app->app_index;
- a->wrk_map_index = mp->wrk_index;
-
- if ((rv = vnet_listen (a)))
- clib_warning ("listen returned: %d", rv);
-
-done:
- /* Actual reply sent only over mq */
- REPLY_MACRO (VL_API_BIND_SOCK_REPLY);
-
- if (app)
- {
- app_wrk = application_get_worker (app, mp->wrk_index);
- mq_send_session_bound_cb (app_wrk->wrk_index, mp->context, a->handle,
- rv);
- }
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_unbind_sock_t_handler (vl_api_unbind_sock_t * mp)
-{
- vl_api_unbind_sock_reply_t *rmp;
- vnet_unlisten_args_t _a, *a = &_a;
- app_worker_t *app_wrk;
- application_t *app = 0;
- int rv = 0;
-
- if (session_main_is_enabled () == 0)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto done;
- }
-
- app = application_lookup (mp->client_index);
- if (app)
- {
- a->app_index = app->app_index;
- a->handle = mp->handle;
- a->wrk_map_index = mp->wrk_index;
- if ((rv = vnet_unlisten (a)))
- clib_warning ("unlisten returned: %d", rv);
- }
- else
- {
- rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
- }
-
-done:
- REPLY_MACRO (VL_API_UNBIND_SOCK_REPLY);
-
- if (!app)
- return;
-
- app_wrk = application_get_worker (app, a->wrk_map_index);
- if (!app_wrk)
- return;
-
- mq_send_unlisten_reply (app_wrk, mp->handle, mp->context, rv);
-}
-
-/* ### WILL BE DEPRECATED POST 20.01 ### */
-static void
-vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
-{
- vl_api_connect_sock_reply_t *rmp;
- vnet_connect_args_t _a, *a = &_a;
- application_t *app = 0;
- int rv = 0;
-
- if (session_main_is_enabled () == 0)
- {
- rv = VNET_API_ERROR_FEATURE_DISABLED;
- goto done;
- }
-
- app = application_lookup (mp->client_index);
- if (app)
- {
- svm_queue_t *client_q;
-
- clib_memset (a, 0, sizeof (*a));
- client_q = vl_api_client_index_to_input_queue (mp->client_index);
- mp->client_queue_address = pointer_to_uword (client_q);
- ip_address_decode (&mp->ip, &a->sep.ip);
- a->sep.is_ip4 = ip46_address_is_ip4 (&a->sep.ip);
- a->sep.port = mp->port;
- a->sep.transport_proto =
- api_session_transport_proto_decode (&mp->proto);
- a->sep.peer.fib_index = mp->vrf;
- a->sep.peer.sw_if_index = ENDPOINT_INVALID_INDEX;
- a->sep_ext.parent_handle = mp->parent_handle;
- a->sep_ext.hostname =
- (u8 *) vl_api_from_api_to_new_c_string (&mp->hostname);
- a->api_context = mp->context;
- a->app_index = app->app_index;
- a->wrk_map_index = mp->wrk_index;
- if ((rv = vnet_connect (a)))
- clib_warning ("connect returned: %U", format_vnet_api_errno, rv);
- vec_free (a->sep_ext.hostname);
- }
- else
- {
- rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
- }
-
- if (rv == 0)
- return;
-
- /* Got some error, relay it */
-
-done:
- REPLY_MACRO (VL_API_CONNECT_SOCK_REPLY);
-
- if (app)
- {
- app_worker_t *app_wrk = application_get_worker (app, mp->wrk_index);
- mq_send_session_connected_cb (app_wrk->wrk_index, mp->context, 0, 1);
- }
-}
-
static void
vl_api_app_worker_add_del_t_handler (vl_api_app_worker_add_del_t * mp)
{
@@ -1302,6 +768,32 @@ done:
}
static void
+vl_api_application_detach_t_handler (vl_api_application_detach_t * mp)
+{
+ vl_api_application_detach_reply_t *rmp;
+ int rv = VNET_API_ERROR_INVALID_VALUE_2;
+ vnet_app_detach_args_t _a, *a = &_a;
+ application_t *app;
+
+ if (session_main_is_enabled () == 0)
+ {
+ rv = VNET_API_ERROR_FEATURE_DISABLED;
+ goto done;
+ }
+
+ app = application_lookup (mp->client_index);
+ if (app)
+ {
+ a->app_index = app->app_index;
+ a->api_client_index = mp->client_index;
+ rv = vnet_application_detach (a);
+ }
+
+done:
+ REPLY_MACRO (VL_API_APPLICATION_DETACH_REPLY);
+}
+
+static void
vl_api_app_namespace_add_del_t_handler (vl_api_app_namespace_add_del_t * mp)
{
vl_api_app_namespace_add_del_reply_t *rmp;
@@ -1712,16 +1204,6 @@ session_api_hookup (vlib_main_t * vm)
#undef _
/*
- * Messages which bounce off the data-plane to
- * an API client. Simply tells the message handling infra not
- * to free the message.
- *
- * Bounced message handlers MUST NOT block the data plane
- */
- am->message_bounce[VL_API_CONNECT_URI] = 1;
- am->message_bounce[VL_API_CONNECT_SOCK] = 1;
-
- /*
* Set up the (msg_name, crc, message-id) table
*/
setup_message_id_table (am);