aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-03-02 10:47:47 -0800
committerFlorin Coras <fcoras@cisco.com>2019-03-02 15:44:50 -0800
commit6442401c21f880dbfd25d36859f79ddf54b49178 (patch)
tree93912b5311f92999e921509af76af8d2ea4fe78c /src
parenta0dbf9e02871a1a4e985f52d23908f9427a2d83a (diff)
session: remove deprecated binary apis
Change-Id: Ia1a628498fa3b639b6b1508f65c6aea1806f73ec Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/tests/vnet/session/tcp_echo.c1
-rw-r--r--src/tests/vnet/session/udp_echo.c37
-rw-r--r--src/vcl/vcl_bapi.c18
-rw-r--r--src/vnet/session/application.c6
-rw-r--r--src/vnet/session/application.h1
-rw-r--r--src/vnet/session/application_interface.h1
-rw-r--r--src/vnet/session/session.api198
-rwxr-xr-xsrc/vnet/session/session_api.c345
8 files changed, 40 insertions, 567 deletions
diff --git a/src/tests/vnet/session/tcp_echo.c b/src/tests/vnet/session/tcp_echo.c
index 5249b8d6076..435a414d097 100644
--- a/src/tests/vnet/session/tcp_echo.c
+++ b/src/tests/vnet/session/tcp_echo.c
@@ -233,7 +233,6 @@ application_send_attach (echo_main_t * em)
bmp->context = ntohl (0xfeedface);
bmp->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_ACCEPT_REDIRECT;
bmp->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_ADD_SEGMENT;
- bmp->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_MQ_FOR_CTRL_MSGS;
bmp->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] = 16;
bmp->options[APP_OPTIONS_RX_FIFO_SIZE] = em->fifo_size;
bmp->options[APP_OPTIONS_TX_FIFO_SIZE] = em->fifo_size;
diff --git a/src/tests/vnet/session/udp_echo.c b/src/tests/vnet/session/udp_echo.c
index 813aee22264..462e113dbbd 100644
--- a/src/tests/vnet/session/udp_echo.c
+++ b/src/tests/vnet/session/udp_echo.c
@@ -308,7 +308,6 @@ application_send_attach (udp_echo_main_t * utm)
bmp->options[APP_OPTIONS_FLAGS] = APP_OPTIONS_FLAGS_ADD_SEGMENT;
bmp->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
bmp->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE;
- bmp->options[APP_OPTIONS_FLAGS] |= APP_OPTIONS_FLAGS_USE_MQ_FOR_CTRL_MSGS;
bmp->options[APP_OPTIONS_PREALLOC_FIFO_PAIRS] = 2;
bmp->options[APP_OPTIONS_RX_FIFO_SIZE] = utm->fifo_size;
bmp->options[APP_OPTIONS_TX_FIFO_SIZE] = utm->fifo_size;
@@ -875,41 +874,6 @@ client_test (udp_echo_main_t * utm)
}
static void
-vl_api_bind_uri_reply_t_handler (vl_api_bind_uri_reply_t * mp)
-{
- udp_echo_main_t *utm = &udp_echo_main;
- svm_fifo_t *rx_fifo, *tx_fifo;
- app_session_t *session;
- u32 session_index;
-
- if (mp->retval)
- {
- clib_warning ("bind failed: %d", mp->retval);
- utm->state = STATE_FAILED;
- return;
- }
-
- rx_fifo = uword_to_pointer (mp->rx_fifo, svm_fifo_t *);
- tx_fifo = uword_to_pointer (mp->tx_fifo, svm_fifo_t *);
-
- pool_get (utm->sessions, session);
- clib_memset (session, 0, sizeof (*session));
- session_index = session - utm->sessions;
-
- rx_fifo->client_session_index = session_index;
- tx_fifo->client_session_index = session_index;
- session->rx_fifo = rx_fifo;
- session->tx_fifo = tx_fifo;
- clib_memcpy_fast (&session->transport.lcl_ip, mp->lcl_ip,
- sizeof (ip46_address_t));
- session->transport.is_ip4 = mp->lcl_is_ip4;
- session->transport.lcl_port = mp->lcl_port;
- session->vpp_evt_q = uword_to_pointer (mp->vpp_evt_q, svm_msg_q_t *);
-
- utm->state = utm->is_connected ? STATE_BOUND : STATE_READY;
-}
-
-static void
vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
{
svm_fifo_segment_create_args_t _a, *a = &_a;
@@ -977,7 +941,6 @@ static void
}
#define foreach_tcp_echo_msg \
-_(BIND_URI_REPLY, bind_uri_reply) \
_(UNBIND_URI_REPLY, unbind_uri_reply) \
_(MAP_ANOTHER_SEGMENT, map_another_segment) \
_(UNMAP_SEGMENT, unmap_segment) \
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index 95efe00c8f1..b06081fce65 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -332,8 +332,7 @@ static void
vl_api_bind_sock_reply_t_handler (vl_api_bind_sock_reply_t * mp)
{
/* Expecting a similar message on mq. So ignore this */
- VDBG (0, "bapi msg vpp handle 0x%llx, sid %u: bind retval: %u!",
- mp->handle, mp->context, mp->retval);
+ VDBG (0, "bapi bind retval: %u!", mp->retval);
}
static void
@@ -352,18 +351,16 @@ vl_api_disconnect_session_reply_t_handler (vl_api_disconnect_session_reply_t *
mp)
{
if (mp->retval)
- clib_warning ("VCL<%d>: ERROR: sid %u: disconnect failed: %U",
- getpid (), mp->context, format_api_error,
- ntohl (mp->retval));
+ VDBG (0, "ERROR: sid %u: disconnect failed: %U", mp->context,
+ format_api_error, ntohl (mp->retval));
}
static void
-vl_api_connect_session_reply_t_handler (vl_api_connect_sock_reply_t * mp)
+vl_api_connect_sock_reply_t_handler (vl_api_connect_sock_reply_t * mp)
{
if (mp->retval)
- clib_warning ("VCL<%d>: ERROR: sid %u: connect failed: %U",
- getpid (), mp->context, format_api_error,
- ntohl (mp->retval));
+ VDBG (0, "ERROR: connect failed: %U", format_api_error,
+ ntohl (mp->retval));
}
static void
@@ -395,7 +392,7 @@ static void
_(SESSION_ENABLE_DISABLE_REPLY, session_enable_disable_reply) \
_(BIND_SOCK_REPLY, bind_sock_reply) \
_(UNBIND_SOCK_REPLY, unbind_sock_reply) \
-_(CONNECT_SESSION_REPLY, connect_session_reply) \
+_(CONNECT_SOCK_REPLY, connect_sock_reply) \
_(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \
_(APPLICATION_ATTACH_REPLY, application_attach_reply) \
_(APPLICATION_DETACH_REPLY, application_detach_reply) \
@@ -458,7 +455,6 @@ vppcom_app_send_attach (void)
(vcm->cfg.app_scope_local ? APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE : 0) |
(vcm->cfg.app_scope_global ? APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE : 0) |
(app_is_proxy ? APP_OPTIONS_FLAGS_IS_PROXY : 0) |
- APP_OPTIONS_FLAGS_USE_MQ_FOR_CTRL_MSGS |
(vcm->cfg.use_mq_eventfd ? APP_OPTIONS_FLAGS_EVT_MQ_USE_EVENTFD : 0);
bmp->options[APP_OPTIONS_PROXY_TRANSPORT] =
(u64) ((vcm->cfg.app_proxy_transport_tcp ? 1 << TRANSPORT_PROTO_TCP : 0) |
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 052a3e4f79c..03e1eae3a85 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -1171,12 +1171,6 @@ application_has_global_scope (application_t * app)
return app->flags & APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
}
-u8
-application_use_mq_for_ctrl (application_t * app)
-{
- return app->flags & APP_OPTIONS_FLAGS_USE_MQ_FOR_CTRL_MSGS;
-}
-
static clib_error_t *
application_start_stop_proxy_fib_proto (application_t * app, u8 fib_proto,
u8 transport_proto, u8 is_start)
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index d96ae117332..f23737c8499 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -193,7 +193,6 @@ u32 application_local_session_table (application_t * app);
const u8 *application_name_from_index (u32 app_or_wrk);
u8 application_has_local_scope (application_t * app);
u8 application_has_global_scope (application_t * app);
-u8 application_use_mq_for_ctrl (application_t * app);
void application_setup_proxy (application_t * app);
void application_remove_proxy (application_t * app);
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index 66037a56e34..935a352a436 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -174,7 +174,6 @@ typedef enum
_(IS_PROXY, "Application is proxying") \
_(USE_GLOBAL_SCOPE, "App can use global session scope") \
_(USE_LOCAL_SCOPE, "App can use local session scope") \
- _(USE_MQ_FOR_CTRL_MSGS, "Use message queue for ctr msgs") \
_(EVT_MQ_USE_EVENTFD, "Use eventfds for signaling") \
typedef enum _app_options
diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api
index 084678f2518..c22c18fe3cf 100644
--- a/src/vnet/session/session.api
+++ b/src/vnet/session/session.api
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016 Cisco and/or its affiliates.
+ * Copyright (c) 2015-2019 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-option version = "1.5.0";
+option version = "1.6.0";
/** \brief client->vpp, attach application to session layer
@param client_index - opaque cookie to identify the sender
@@ -136,24 +136,12 @@ autoreply define unmap_segment {
"tcp://::/0/80" [ipv6] etc.
@param options - socket options, fifo sizes, etc.
*/
-define bind_uri {
+autoreply define bind_uri {
u32 client_index;
u32 context;
u32 accept_cookie;
u8 uri[128];
};
-/** *** Will be DEPRECATED. Use message queue instead. *** */
-define bind_uri_reply {
- u32 context;
- u64 handle;
- i32 retval;
- u64 rx_fifo;
- u64 tx_fifo;
- u8 lcl_is_ip4;
- u8 lcl_ip[16];
- u16 lcl_port;
- u64 vpp_evt_q;
-};
/** \brief Unbind a given URI
@param client_index - opaque cookie to identify the sender
@@ -186,49 +174,6 @@ autoreply define connect_uri {
u8 uri[128];
};
-/** \brief vpp->client, accept this session
- *** Will be DEPRECATED. Use message queue instead. ***
- @param context - sender context, to match reply w/ request
- @param listener_handle - tells client which listener this pertains to
- @param handle - unique session identifier
- @param rx_fifo_address - rx (vpp -> vpp-client) fifo address
- @param tx_fifo_address - tx (vpp-client -> vpp) fifo address
- @param vpp_event_queue_address - vpp's event queue address or client's
- event queue for cut through
- @param server_event_queue_address - server's event queue address for
- cut through sessions
- @param port - remote port
- @param is_ip4 - 1 if the ip is ip4
- @param ip - remote ip
-*/
-define accept_session {
- u32 client_index;
- u32 context;
- u64 listener_handle;
- u64 handle;
- u64 server_rx_fifo;
- u64 server_tx_fifo;
- u64 vpp_event_queue_address;
- u64 server_event_queue_address;
- u16 port;
- u8 is_ip4;
- u8 ip[16];
-};
-
-/** \brief client->vpp, reply to an accept message
- *** Will be DEPRECATED. Use message queue instead. ***
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
- @param session_index - session index from accept_session / connect_reply
- @param session_thread_index - thread index from accept_session /
- connect_reply
-*/
-define accept_session_reply {
- u32 context;
- i32 retval;
- u64 handle;
-};
-
/** \brief bidirectional disconnect API
@param client_index - opaque cookie to identify the sender
client to vpp direction only
@@ -242,7 +187,6 @@ define disconnect_session {
};
/** \brief bidirectional disconnect reply API
- *** Will be DEPRECATED. Use message queue instead. ***
@param client_index - opaque cookie to identify the sender
client to vpp direction only
@param context - sender context, to match reply w/ request
@@ -255,31 +199,6 @@ define disconnect_session_reply {
u64 handle;
};
-/** \brief vpp->client reset session API
- *** Will be DEPRECATED. Use message queue instead. ***
- @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 via accept/connects
-*/
-define reset_session {
- u32 client_index;
- u32 context;
- u64 handle;
-};
-
-/** \brief client->vpp reset session reply
- *** Will be DEPRECATED. Use message queue instead. ***
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
- @param handle - session handle obtained via accept/connect
-*/
-define reset_session_reply {
- u32 context;
- i32 retval;
- u64 handle;
-};
-
/** \brief Bind to an ip:port pair for a given transport protocol
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -291,7 +210,7 @@ define reset_session_reply {
@param proto - protocol 0 - TCP 1 - UDP
@param options - socket options, fifo sizes, etc.
*/
-define bind_sock {
+autoreply define bind_sock {
u32 client_index;
u32 context;
u32 wrk_index;
@@ -347,77 +266,6 @@ autoreply define connect_sock {
u8 hostname[hostname_len];
};
-/** \brief Bind reply
- *** Will be DEPRECATED. Use message queue instead. ***
- @param context - sender context, to match reply w/ request
- @param handle - bind handle
- @param retval - return code for the request
- @param lcl_is_ip4 - local ip address type
- @param lcl_ip6 - local ip address
- @param lcl_port - local port
- @param rx_fifo - rx fifo address if allocated (connectionless)
- @param tx_fifo - tx fifo address if allocated (connectionless)
- @param vpp_evt_q - vpp event queue address (connectionless)
- @param segment_name_length - length of segment name
- @param segment_name - name of segment client needs to attach to
-*/
-define bind_sock_reply {
- u32 context;
- u64 handle;
- i32 retval;
- u8 lcl_is_ip4;
- u8 lcl_ip[16];
- u16 lcl_port;
- u64 rx_fifo;
- u64 tx_fifo;
- u64 vpp_evt_q;
- u32 segment_size;
- u8 segment_name_length;
- u8 segment_name[128];
-};
-
-/* Dummy connect message -- needed to satisfy api generators
-*
-* NEVER USED, doxygen tags elided on purpose.
-*/
-define connect_session {
- u32 client_index;
- u32 context;
-};
-
-/** \brief vpp/server->client, connect reply -- used for all connect_* messages
- *** Will be DEPRECATED. Use message queue instead. ***
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
- @param handle - connection handle
- @param server_rx_fifo - rx (vpp -> vpp-client) fifo address
- @param server_tx_fifo - tx (vpp-client -> vpp) fifo address
- @param vpp_event_queue_address - vpp's event queue address
- @param client_event_queue_address - client's event queue address
- @param segment_size - size of segment to be attached. Only for redirects.
- @param segment_name_length - non-zero if the client needs to attach to
- the fifo segment
- @param segment_name - set if the client needs to attach to the segment
- @param lcl_ip - local ip for connection
- @param is_ip4 - flag to indicate if ip is v4 or v6
- @param lcl_port - local port
-*/
-define connect_session_reply {
- u32 context;
- i32 retval;
- u64 handle;
- u64 server_rx_fifo;
- u64 server_tx_fifo;
- u64 vpp_event_queue_address;
- u64 client_event_queue_address;
- u32 segment_size;
- u8 segment_name_length;
- u8 segment_name[128];
- u8 lcl_ip[16];
- u8 is_ip4;
- u16 lcl_port;
-};
-
/** \brief ask app to add a new cut-through registration
@param client_index - opaque cookie to identify the sender
client to vpp direction only
@@ -499,13 +347,13 @@ autoreply define session_enable_disable {
@param client_index - opaque cookie to identify the sender
client to vpp direction only
@param context - sender context, to match reply w/ request
- @param secret - secret shared between app and vpp
+ @param secret - secret shared between app and vpp
@param sw_if_index - local interface that "supports" namespace. Set to
- ~0 if no preference
- @param ip4_fib_id - id of ip4 fib that "supports" the namespace. Ignored
- if sw_if_index set.
- @param ip6_fib_id - id of ip6 fib that "supports" the namespace. Ignored
- if sw_if_index set.
+ ~0 if no preference
+ @param ip4_fib_id - id of ip4 fib that "supports" the namespace. Ignored
+ if sw_if_index set.
+ @param ip6_fib_id - id of ip6 fib that "supports" the namespace. Ignored
+ if sw_if_index set.
@param namespace_id_len - length of namespace id lower
@param namespace_id - namespace id
*/
@@ -544,14 +392,12 @@ define app_namespace_add_del_reply
@param rmt_ple - remote prefix length
@param lcl_port - local port
@param rmt_port - remote port
- @param action_index - the only action defined now is forward to
- application with index action_index
- @param is_add - flag to indicate if add or del
- @param appns_index - application namespace where rule is to be applied
- to
- @param scope - flag that indicates scope of the rule: global or local.
- If 0, default is global, 1 is global 2 is local, 3 is
- both
+ @param action_index - the only action defined now is forward to
+ application with index action_index
+ @param is_add - flag to indicate if add or del
+ @param appns_index - application namespace where rule is to be applied to
+ @param scope - flag that indicates scope of the rule: global or local.
+ If 0, default is global, 1 is global 2 is local, 3 is both
*/
autoreply define session_rule_add_del {
u32 client_index;
@@ -582,7 +428,7 @@ define session_rules_dump
};
/** \brief Session rules details
- @param context - sender context, to match reply w/ request
+ @param context - sender context, to match reply w/ request
@param transport_proto - transport protocol (0 - tcp 1 - udp)
@param is_ip4 - flag to indicate if ip addresses are ip4 or 6
@param lcl_ip - local ip
@@ -592,12 +438,10 @@ define session_rules_dump
@param lcl_port - local port
@param rmt_port - remote port
@param action_index - the only action defined now is forward to
- application with index action_index
- @param appns_index - application namespace where rule is to be applied
- to
- @param scope - flag that indicates scope of the rule: global or local.
- If 0, default is global, 1 is global 2 is local, 3 is
- both
+ application with index action_index
+ @param appns_index - application namespace where rule is to be applied to
+ @param scope - flag that indicates scope of the rule: global or local.
+ If 0, default is global, 1 is global 2 is local, 3 is both
*/
define session_rules_details
{
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index c4be556f637..8ee25a9a2ce 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -49,8 +49,6 @@ _(UNBIND_URI, unbind_uri) \
_(CONNECT_URI, connect_uri) \
_(DISCONNECT_SESSION, disconnect_session) \
_(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \
-_(ACCEPT_SESSION_REPLY, accept_session_reply) \
-_(RESET_SESSION_REPLY, reset_session_reply) \
_(BIND_SOCK, bind_sock) \
_(UNBIND_SOCK, unbind_sock) \
_(CONNECT_SOCK, connect_sock) \
@@ -200,189 +198,6 @@ send_app_cut_through_registration_add (u32 api_client_index,
}
static int
-send_session_accept_callback (session_t * s)
-{
- app_worker_t *server_wrk = app_worker_get (s->app_wrk_index);
- vl_api_accept_session_t *mp;
- vl_api_registration_t *reg;
- transport_connection_t *tc;
- session_t *listener;
- svm_msg_q_t *vpp_queue;
- application_t *server;
- app_listener_t *al;
-
- server = application_get (server_wrk->app_index);
- reg =
- vl_mem_api_client_index_to_registration (server_wrk->api_client_index);
- if (!reg)
- {
- clib_warning ("no registration: %u", server_wrk->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_ACCEPT_SESSION);
- mp->context = server_wrk->wrk_index;
- mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
-
- if (session_has_transport (s))
- {
- listener = listen_session_get (s->listener_index);
- al = app_listener_get (server, listener->al_index);
- mp->listener_handle = app_listener_handle (al);
- if (application_is_proxy (server))
- {
- listener =
- app_worker_first_listener (server_wrk, session_get_fib_proto (s),
- session_get_transport_proto (s));
- if (listener)
- mp->listener_handle = listen_session_get_handle (listener);
- }
- vpp_queue = session_main_get_vpp_event_queue (s->thread_index);
- mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
- mp->handle = session_handle (s);
- tc = transport_get_connection (session_get_transport_proto (s),
- s->connection_index, s->thread_index);
- mp->port = tc->rmt_port;
- mp->is_ip4 = tc->is_ip4;
- clib_memcpy_fast (&mp->ip, &tc->rmt_ip, sizeof (tc->rmt_ip));
- }
- else
- {
- ct_connection_t *ct;
- ct = (ct_connection_t *) session_get_transport (s);
- listener = listen_session_get (s->listener_index);
- al = app_listener_get (server, listener->al_index);
- mp->listener_handle = app_listener_handle (al);
- mp->is_ip4 = session_type_is_ip4 (listener->session_type);
- mp->handle = session_handle (s);
- mp->port = ct->c_rmt_port;
- mp->vpp_event_queue_address = ct->client_evt_q;
- mp->server_event_queue_address = ct->server_evt_q;
- }
- vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
-
- return 0;
-}
-
-static void
-send_session_disconnect_callback (session_t * s)
-{
- app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
- vl_api_disconnect_session_t *mp;
- vl_api_registration_t *reg;
-
- reg = vl_mem_api_client_index_to_registration (app_wrk->api_client_index);
- if (!reg)
- {
- clib_warning ("no registration: %u", app_wrk->api_client_index);
- return;
- }
-
- 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_DISCONNECT_SESSION);
- mp->handle = session_handle (s);
- mp->context = app_wrk->api_client_index;
- vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
-}
-
-static void
-send_session_reset_callback (session_t * s)
-{
- app_worker_t *app_wrk = app_worker_get (s->app_wrk_index);
- vl_api_registration_t *reg;
- vl_api_reset_session_t *mp;
-
- reg = vl_mem_api_client_index_to_registration (app_wrk->api_client_index);
- if (!reg)
- {
- clib_warning ("no registration: %u", app_wrk->api_client_index);
- return;
- }
-
- 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_RESET_SESSION);
- mp->handle = session_handle (s);
- vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
-}
-
-int
-send_session_connected_callback (u32 app_wrk_index, u32 api_context,
- session_t * s, u8 is_fail)
-{
- vl_api_connect_session_reply_t *mp;
- transport_connection_t *tc;
- vl_api_registration_t *reg;
- svm_msg_q_t *vpp_queue;
- app_worker_t *app_wrk;
-
- app_wrk = app_worker_get (app_wrk_index);
- reg = vl_mem_api_client_index_to_registration (app_wrk->api_client_index);
- if (!reg)
- {
- clib_warning ("no registration: %u", app_wrk->api_client_index);
- return -1;
- }
-
- mp = vl_mem_api_alloc_as_if_client_w_reg (reg, sizeof (*mp));
- mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_CONNECT_SESSION_REPLY);
- mp->context = api_context;
-
- if (is_fail)
- goto done;
-
- if (session_has_transport (s))
- {
- tc = session_get_transport (s);
- if (!tc)
- {
- is_fail = 1;
- goto done;
- }
-
- vpp_queue = session_main_get_vpp_event_queue (s->thread_index);
- mp->handle = session_handle (s);
- mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
- clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
- mp->is_ip4 = tc->is_ip4;
- mp->lcl_port = tc->lcl_port;
- mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
- }
- else
- {
- ct_connection_t *ct;
- ct = (ct_connection_t *) session_get_transport (s);
- mp->handle = session_handle (s);
- mp->lcl_port = ct->c_lcl_port;
- mp->vpp_event_queue_address = ct->server_evt_q;
- mp->client_event_queue_address = ct->client_evt_q;
- mp->server_rx_fifo = pointer_to_uword (s->tx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->rx_fifo);
- }
-
-done:
- mp->retval = is_fail ?
- clib_host_to_net_u32 (VNET_API_ERROR_SESSION_CONNECT) : 0;
- vl_msg_api_send_shmem (reg->vl_input_queue, (u8 *) & mp);
- return 0;
-}
-
-static session_cb_vft_t session_cb_vft = {
- .session_accept_callback = send_session_accept_callback,
- .session_disconnect_callback = send_session_disconnect_callback,
- .session_connected_callback = send_session_connected_callback,
- .session_reset_callback = send_session_reset_callback,
- .add_segment_callback = send_add_segment_callback,
- .del_segment_callback = send_del_segment_callback,
-};
-
-static int
mq_try_lock_and_alloc_msg (svm_msg_q_t * app_mq, svm_msg_q_msg_t * msg)
{
int rv;
@@ -737,12 +552,7 @@ vl_api_application_attach_t_handler (vl_api_application_attach_t * mp)
clib_memset (a, 0, sizeof (*a));
a->api_client_index = mp->client_index;
a->options = mp->options;
-
- if (a->options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_USE_MQ_FOR_CTRL_MSGS)
- a->session_cb_vft = &session_mq_cb_vft;
- else
- a->session_cb_vft = &session_cb_vft;
-
+ a->session_cb_vft = &session_mq_cb_vft;
if (mp->namespace_id_len > 64)
{
rv = VNET_API_ERROR_INVALID_VALUE;
@@ -841,12 +651,9 @@ done:
static void
vl_api_bind_uri_t_handler (vl_api_bind_uri_t * mp)
{
- transport_connection_t *tc = 0;
- vnet_listen_args_t _a, *a = &_a;
vl_api_bind_uri_reply_t *rmp;
- session_t *s;
+ vnet_listen_args_t _a, *a = &_a;
application_t *app = 0;
- svm_msg_q_t *vpp_evt_q;
app_worker_t *app_wrk;
int rv;
@@ -871,33 +678,9 @@ vl_api_bind_uri_t_handler (vl_api_bind_uri_t * mp)
done:
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_BIND_URI_REPLY, ({
- if (!rv)
- {
- rmp->handle = a->handle;
- if (app && application_has_global_scope (app))
- {
- app_listener_t* al = app_listener_get_w_handle(a->handle);
- s = app_listener_get_session(al);
- tc = listen_session_get_transport (s);
- rmp->lcl_is_ip4 = tc->is_ip4;
- rmp->lcl_port = tc->lcl_port;
- clib_memcpy_fast (rmp->lcl_ip, &tc->lcl_ip, sizeof(tc->lcl_ip));
- if (session_transport_service_type (s) == TRANSPORT_SERVICE_CL)
- {
- rmp->rx_fifo = pointer_to_uword (s->rx_fifo);
- rmp->tx_fifo = pointer_to_uword (s->tx_fifo);
- vpp_evt_q = session_main_get_vpp_event_queue (0);
- rmp->vpp_evt_q = pointer_to_uword (vpp_evt_q);
- }
- }
- }
- }));
- /* *INDENT-ON* */
+ REPLY_MACRO (VL_API_BIND_URI_REPLY);
- /* If app uses mq for control messages, send an mq message as well */
- if (app && application_use_mq_for_ctrl (app))
+ if (app)
{
app_wrk = application_get_worker (app, 0);
mq_send_session_bound_cb (app_wrk->wrk_index, mp->context, a->handle,
@@ -938,7 +721,7 @@ done:
static void
vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
{
- vl_api_connect_session_reply_t *rmp;
+ vl_api_connect_uri_reply_t *rmp;
vnet_connect_args_t _a, *a = &_a;
application_t *app;
int rv = 0;
@@ -973,9 +756,7 @@ vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
return;
done:
- /* *INDENT-OFF* */
- REPLY_MACRO (VL_API_CONNECT_SESSION_REPLY);
- /* *INDENT-ON* */
+ REPLY_MACRO (VL_API_CONNECT_URI_REPLY);
}
static void
@@ -1033,81 +814,6 @@ vl_api_disconnect_session_reply_t_handler (vl_api_disconnect_session_reply_t *
}
static void
-vl_api_reset_session_reply_t_handler (vl_api_reset_session_reply_t * mp)
-{
- vnet_disconnect_args_t _a = { 0 }, *a = &_a;
- app_worker_t *app_wrk;
- application_t *app;
- session_t *s;
- u32 index, thread_index;
-
- app = application_lookup (mp->context);
- if (!app)
- return;
-
- session_parse_handle (mp->handle, &index, &thread_index);
- s = session_get_if_valid (index, thread_index);
- if (!s)
- {
- clib_warning ("Invalid session!");
- return;
- }
-
- app_wrk = app_worker_get (s->app_wrk_index);
- if (app_wrk->app_index != app->app_index)
- {
- clib_warning ("app %u does not own handle 0x%lx", app->app_index,
- mp->handle);
- return;
- }
-
- /* Client objected to resetting the session, log and continue */
- if (mp->retval)
- {
- clib_warning ("client retval %d", mp->retval);
- return;
- }
-
- /* This comes as a response to a reset, transport only waiting for
- * confirmation to remove connection state, no need to disconnect */
- a->handle = mp->handle;
- a->app_index = app->app_index;
- vnet_disconnect_session (a);
-}
-
-static void
-vl_api_accept_session_reply_t_handler (vl_api_accept_session_reply_t * mp)
-{
- vnet_disconnect_args_t _a = { 0 }, *a = &_a;
- session_t *s;
-
- /* Server isn't interested, kill the session */
- if (mp->retval)
- {
- a->app_index = mp->context;
- a->handle = mp->handle;
- vnet_disconnect_session (a);
- return;
- }
-
- s = session_get_from_handle_if_valid (mp->handle);
- if (!s)
- {
- clib_warning ("session doesn't exist");
- return;
- }
- if (s->app_wrk_index != mp->context)
- {
- clib_warning ("app doesn't own session");
- return;
- }
- s->session_state = SESSION_STATE_READY;
-
- if (!session_has_transport (s))
- ct_session_connect_notify (s);
-}
-
-static void
vl_api_map_another_segment_reply_t_handler (vl_api_map_another_segment_reply_t
* mp)
{
@@ -1118,14 +824,10 @@ static void
vl_api_bind_sock_t_handler (vl_api_bind_sock_t * mp)
{
vnet_listen_args_t _a, *a = &_a;
- transport_connection_t *tc = 0;
vl_api_bind_sock_reply_t *rmp;
- svm_msg_q_t *vpp_evt_q;
application_t *app = 0;
app_worker_t *app_wrk;
ip46_address_t *ip46;
- app_listener_t *al;
- session_t *s;
int rv = 0;
if (session_main_is_enabled () == 0)
@@ -1156,33 +858,10 @@ vl_api_bind_sock_t_handler (vl_api_bind_sock_t * mp)
clib_warning ("listen returned: %d", rv);
done:
- /* *INDENT-OFF* */
- REPLY_MACRO2 (VL_API_BIND_SOCK_REPLY,({
- if (!rv)
- {
- rmp->handle = a->handle;
- rmp->lcl_port = mp->port;
- rmp->lcl_is_ip4 = mp->is_ip4;
- if (app && application_has_global_scope (app))
- {
- al = app_listener_get_w_handle (a->handle);
- s = app_listener_get_session (al);
- tc = listen_session_get_transport (s);
- clib_memcpy_fast (rmp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
- if (session_transport_service_type (s) == TRANSPORT_SERVICE_CL)
- {
- rmp->rx_fifo = pointer_to_uword (s->rx_fifo);
- rmp->tx_fifo = pointer_to_uword (s->tx_fifo);
- vpp_evt_q = session_main_get_vpp_event_queue (0);
- rmp->vpp_evt_q = pointer_to_uword (vpp_evt_q);
- }
- }
- }
- }));
- /* *INDENT-ON* */
+ /* Actual reply sent only over mq */
+ REPLY_MACRO (VL_API_BIND_SOCK_REPLY);
- /* If app uses mq for control messages, send an mq message as well */
- if (app && application_use_mq_for_ctrl (app))
+ if (app)
{
app_wrk = application_get_worker (app, mp->wrk_index);
mq_send_session_bound_cb (app_wrk->wrk_index, mp->context, a->handle,
@@ -1250,7 +929,7 @@ done:
static void
vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
{
- vl_api_connect_session_reply_t *rmp;
+ vl_api_connect_sock_reply_t *rmp;
vnet_connect_args_t _a, *a = &_a;
application_t *app = 0;
int rv = 0;
@@ -1300,9 +979,9 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
/* Got some error, relay it */
done:
- REPLY_MACRO (VL_API_CONNECT_SESSION_REPLY);
+ REPLY_MACRO (VL_API_CONNECT_SOCK_REPLY);
- if (app && application_use_mq_for_ctrl (app))
+ 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);