aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-04-02 11:38:51 -0700
committerDave Barach <openvpp@barachs.net>2019-04-02 21:12:56 +0000
commit69b68ef1a98ab45becb585f8906acc19b9665e6d (patch)
tree1b4d22c5baeea4e2ff9bee64bf39d1b282d45c2e /src/vnet
parentf6adf1f8dbbdfb2822c391d7d1b132d2846bf004 (diff)
session: use app cb function wrappers
Change-Id: I77ad9eb4d4c7699397aa4be6a973ef37c60db4c5 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/application.h1
-rw-r--r--src/vnet/session/application_worker.c13
-rw-r--r--src/vnet/session/session.c7
-rwxr-xr-xsrc/vnet/session/session_cli.c3
-rw-r--r--src/vnet/session/session_node.c5
-rw-r--r--src/vnet/tls/tls.c10
6 files changed, 19 insertions, 20 deletions
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index 3d601cecfc9..0cf97a75742 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -225,6 +225,7 @@ int app_worker_init_connected (app_worker_t * app_wrk, session_t * s);
int app_worker_connect_notify (app_worker_t * app_wrk, session_t * s,
u32 opaque);
int app_worker_close_notify (app_worker_t * app_wrk, session_t * s);
+int app_worker_reset_notify (app_worker_t * app_wrk, session_t * s);
int app_worker_builtin_rx (app_worker_t * app_wrk, session_t * s);
segment_manager_t *app_worker_get_listen_segment_manager (app_worker_t *,
session_t *);
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 08b42f38f16..6f504dafa43 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -330,6 +330,14 @@ app_worker_close_notify (app_worker_t * app_wrk, session_t * s)
}
int
+app_worker_reset_notify (app_worker_t * app_wrk, session_t * s)
+{
+ application_t *app = application_get (app_wrk->app_index);
+ app->cb_fns.session_reset_callback (s);
+ return 0;
+}
+
+int
app_worker_builtin_rx (app_worker_t * app_wrk, session_t * s)
{
application_t *app = application_get (app_wrk->app_index);
@@ -553,10 +561,7 @@ app_send_io_evt_rx (app_worker_t * app_wrk, session_t * s, u8 lock)
}
if (app_worker_application_is_builtin (app_wrk))
- {
- application_t *app = application_get (app_wrk->app_index);
- return app->cb_fns.builtin_app_rx_callback (s);
- }
+ return app_worker_builtin_rx (app_wrk, s);
if (svm_fifo_has_event (s->rx_fifo))
return 0;
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 7769f1faace..f637d625616 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -825,17 +825,16 @@ session_transport_closed_notify (transport_connection_t * tc)
void
session_transport_reset_notify (transport_connection_t * tc)
{
- session_t *s;
app_worker_t *app_wrk;
- application_t *app;
+ session_t *s;
+
s = session_get (tc->s_index, tc->thread_index);
svm_fifo_dequeue_drop_all (s->tx_fifo);
if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSING)
return;
s->session_state = SESSION_STATE_TRANSPORT_CLOSING;
app_wrk = app_worker_get (s->app_wrk_index);
- app = application_get (app_wrk->app_index);
- app->cb_fns.session_reset_callback (s);
+ app_worker_reset_notify (app_wrk, s);
}
int
diff --git a/src/vnet/session/session_cli.c b/src/vnet/session/session_cli.c
index d8e504e5fb3..5179322049d 100755
--- a/src/vnet/session/session_cli.c
+++ b/src/vnet/session/session_cli.c
@@ -362,8 +362,7 @@ static int
clear_session (session_t * s)
{
app_worker_t *server_wrk = app_worker_get (s->app_wrk_index);
- application_t *server = application_get (server_wrk->app_index);
- server->cb_fns.session_disconnect_callback (s);
+ app_worker_close_notify (server_wrk, s);
return 0;
}
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 81679477472..2eac5152e16 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -88,8 +88,7 @@ session_mq_accepted_reply_handler (void *data)
/* Closed while waiting for app to reply. Resend disconnect */
if (old_state >= SESSION_STATE_TRANSPORT_CLOSING)
{
- application_t *app = application_get (app_wrk->app_index);
- app->cb_fns.session_disconnect_callback (s);
+ app_worker_close_notify (app_wrk, s);
s->session_state = old_state;
return;
}
@@ -289,7 +288,7 @@ session_mq_worker_update_handler (void *data)
app_worker_lock_and_send_event (app_wrk, s, SESSION_IO_EVT_RX);
if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSING)
- app->cb_fns.session_disconnect_callback (s);
+ app_worker_close_notify (app_wrk, s);
}
vlib_node_registration_t session_queue_node;
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index a5e08721fdd..81b51f5dcc8 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -431,19 +431,15 @@ tls_session_connected_callback (u32 tls_app_index, u32 ho_ctx_index,
if (is_fail)
{
- int (*cb_fn) (u32, u32, session_t *, u8), rv = 0;
- u32 wrk_index, api_context;
app_worker_t *app_wrk;
- application_t *app;
+ u32 api_context;
+ int rv = 0;
- wrk_index = ho_ctx->parent_app_wrk_index;
app_wrk = app_worker_get_if_valid (ho_ctx->parent_app_wrk_index);
if (app_wrk)
{
api_context = ho_ctx->c_s_index;
- app = application_get (app_wrk->app_index);
- cb_fn = app->cb_fns.session_connected_callback;
- rv = cb_fn (wrk_index, api_context, 0, 1 /* failed */ );
+ app_worker_connect_notify (app_wrk, 0, api_context);
}
tls_ctx_half_open_reader_unlock ();
tls_ctx_half_open_free (ho_ctx_index);