summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/application_local.c10
-rwxr-xr-xsrc/vnet/session/session_api.c9
-rw-r--r--src/vnet/session/session_node.c4
-rw-r--r--src/vnet/session/transport.h7
-rw-r--r--src/vnet/tls/tls.c25
5 files changed, 31 insertions, 24 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index 745b202f580..5a3f738dd82 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -464,6 +464,15 @@ format_ct_connection_id (u8 * s, va_list * args)
return s;
}
+static int
+ct_custom_tx (void *session)
+{
+ session_t *s = (session_t *) session;
+ if (session_has_transport (s))
+ return 0;
+ return ct_session_tx (s);
+}
+
static u8 *
format_ct_listener (u8 * s, va_list * args)
{
@@ -523,6 +532,7 @@ const static transport_proto_vft_t cut_thru_proto = {
.connect = ct_session_connect,
.close = ct_session_close,
.get_connection = ct_session_get,
+ .custom_tx = ct_custom_tx,
.tx_type = TRANSPORT_TX_INTERNAL,
.service_type = TRANSPORT_SERVICE_APP,
.format_listener = format_ct_listener,
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 525f63799be..780c765cca5 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -445,20 +445,11 @@ done:
return 0;
}
-static int
-mq_app_tx_callback (session_t * s)
-{
- if (session_has_transport (s))
- return 0;
- return ct_session_tx (s);
-}
-
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,
.session_connected_callback = mq_send_session_connected_cb,
.session_reset_callback = mq_send_session_reset_cb,
- .builtin_app_tx_callback = mq_app_tx_callback,
.add_segment_callback = send_add_segment_callback,
.del_segment_callback = send_del_segment_callback,
};
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 7cbd0d9ab04..fb53846afdc 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -819,13 +819,11 @@ session_tx_fifo_dequeue_internal (vlib_main_t * vm,
session_event_t * e, int *n_tx_pkts)
{
session_t *s = wrk->ctx.s;
- application_t *app;
if (PREDICT_FALSE (s->session_state >= SESSION_STATE_TRANSPORT_CLOSED))
return 0;
- app = application_get (s->t_app_index);
svm_fifo_unset_event (s->tx_fifo);
- return app->cb_fns.builtin_app_tx_callback (s);
+ return transport_custom_tx (session_get_transport_proto (s), s);
}
always_inline session_t *
diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h
index 8500e9d2445..e446a3934d1 100644
--- a/src/vnet/session/transport.h
+++ b/src/vnet/session/transport.h
@@ -45,6 +45,7 @@ typedef struct _transport_proto_vft
u32 (*tx_fifo_offset) (transport_connection_t * tc);
void (*update_time) (f64 time_now, u8 thread_index);
void (*flush_data) (transport_connection_t *tconn);
+ int (*custom_tx) (void *session);
/*
* Connection retrieval
@@ -104,6 +105,12 @@ transport_get_half_open (transport_proto_t tp, u32 conn_index)
return tp_vfts[tp].get_half_open (conn_index);
}
+static inline int
+transport_custom_tx (transport_proto_t tp, void *s)
+{
+ return tp_vfts[tp].custom_tx (s);
+}
+
void transport_register_protocol (transport_proto_t transport_proto,
const transport_proto_vft_t * vft,
fib_protocol_t fib_proto, u32 output_node);
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index df5a0686715..ce62765b7aa 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -415,17 +415,6 @@ tls_session_accept_callback (session_t * tls_session)
}
int
-tls_app_tx_callback (session_t * app_session)
-{
- tls_ctx_t *ctx;
- if (PREDICT_FALSE (app_session->session_state == SESSION_STATE_CLOSED))
- return 0;
- ctx = tls_ctx_get (app_session->connection_index);
- tls_ctx_write (ctx, app_session);
- return 0;
-}
-
-int
tls_app_rx_callback (session_t * tls_session)
{
tls_ctx_t *ctx;
@@ -501,7 +490,6 @@ static session_cb_vft_t tls_app_cb_vft = {
.add_segment_callback = tls_add_segment_callback,
.del_segment_callback = tls_del_segment_callback,
.builtin_app_rx_callback = tls_app_rx_callback,
- .builtin_app_tx_callback = tls_app_tx_callback,
};
/* *INDENT-ON* */
@@ -663,6 +651,18 @@ tls_listener_get (u32 listener_index)
return &ctx->connection;
}
+int
+tls_custom_tx_callback (void *session)
+{
+ session_t *app_session = (session_t *) session;
+ tls_ctx_t *ctx;
+ if (PREDICT_FALSE (app_session->session_state == SESSION_STATE_CLOSED))
+ return 0;
+ ctx = tls_ctx_get (app_session->connection_index);
+ tls_ctx_write (ctx, app_session);
+ return 0;
+}
+
u8 *
format_tls_ctx (u8 * s, va_list * args)
{
@@ -735,6 +735,7 @@ const static transport_proto_vft_t tls_proto = {
.stop_listen = tls_stop_listen,
.get_connection = tls_connection_get,
.get_listener = tls_listener_get,
+ .custom_tx = tls_custom_tx_callback,
.tx_type = TRANSPORT_TX_INTERNAL,
.service_type = TRANSPORT_SERVICE_APP,
.format_connection = format_tls_connection,