/*
- * Copyright (c) 2018 Cisco and/or its affiliates.
+ * Copyright (c) 2018-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:
}
int
-tls_add_vpp_q_rx_evt (stream_session_t * s)
+tls_add_vpp_q_rx_evt (session_t * s)
{
- if (svm_fifo_set_event (s->server_rx_fifo))
- session_send_io_evt_to_thread (s->server_rx_fifo, FIFO_EVENT_APP_RX);
+ if (svm_fifo_set_event (s->rx_fifo))
+ session_send_io_evt_to_thread (s->rx_fifo, FIFO_EVENT_APP_RX);
return 0;
}
int
-tls_add_vpp_q_builtin_rx_evt (stream_session_t * s)
+tls_add_vpp_q_builtin_rx_evt (session_t * s)
{
- if (svm_fifo_set_event (s->server_rx_fifo))
- session_send_io_evt_to_thread (s->server_rx_fifo, FIFO_EVENT_BUILTIN_RX);
+ if (svm_fifo_set_event (s->rx_fifo))
+ session_send_io_evt_to_thread (s->rx_fifo, FIFO_EVENT_BUILTIN_RX);
return 0;
}
int
-tls_add_vpp_q_tx_evt (stream_session_t * s)
+tls_add_vpp_q_tx_evt (session_t * s)
{
- if (svm_fifo_set_event (s->server_tx_fifo))
- session_send_io_evt_to_thread (s->server_tx_fifo, FIFO_EVENT_APP_TX);
+ if (svm_fifo_set_event (s->tx_fifo))
+ session_send_io_evt_to_thread (s->tx_fifo, FIFO_EVENT_APP_TX);
return 0;
}
int
-tls_add_vpp_q_builtin_tx_evt (stream_session_t * s)
+tls_add_vpp_q_builtin_tx_evt (session_t * s)
{
- if (svm_fifo_set_event (s->server_tx_fifo))
+ if (svm_fifo_set_event (s->tx_fifo))
session_send_io_evt_to_thread_custom (s, s->thread_index,
FIFO_EVENT_BUILTIN_TX);
return 0;
}
static inline int
-tls_add_app_q_evt (app_worker_t * app, stream_session_t * app_session)
+tls_add_app_q_evt (app_worker_t * app, session_t * app_session)
{
return app_worker_lock_and_send_event (app, app_session, FIFO_EVENT_APP_RX);
}
}
void
-tls_notify_app_enqueue (tls_ctx_t * ctx, stream_session_t * app_session)
+tls_notify_app_enqueue (tls_ctx_t * ctx, session_t * app_session)
{
app_worker_t *app;
app = app_worker_get_if_valid (app_session->app_wrk_index);
int
tls_notify_app_accept (tls_ctx_t * ctx)
{
- stream_session_t *app_listener, *app_session;
+ session_t *app_listener, *app_session;
segment_manager_t *sm;
app_worker_t *app_wrk;
application_t *app;
int
tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed)
{
- int (*cb_fn) (u32, u32, stream_session_t *, u8);
- stream_session_t *app_session;
+ int (*cb_fn) (u32, u32, session_t *, u8);
+ session_t *app_session;
segment_manager_t *sm;
app_worker_t *app_wrk;
application_t *app;
}
static inline int
-tls_ctx_write (tls_ctx_t * ctx, stream_session_t * app_session)
+tls_ctx_write (tls_ctx_t * ctx, session_t * app_session)
{
return tls_vfts[ctx->tls_ctx_engine].ctx_write (ctx, app_session);
}
static inline int
-tls_ctx_read (tls_ctx_t * ctx, stream_session_t * tls_session)
+tls_ctx_read (tls_ctx_t * ctx, session_t * tls_session)
{
return tls_vfts[ctx->tls_ctx_engine].ctx_read (ctx, tls_session);
}
}
void
-tls_session_reset_callback (stream_session_t * s)
+tls_session_reset_callback (session_t * s)
{
clib_warning ("called...");
}
}
void
-tls_session_disconnect_callback (stream_session_t * tls_session)
+tls_session_disconnect_callback (session_t * tls_session)
{
- stream_session_t *app_session;
+ session_t *app_session;
tls_ctx_t *ctx;
app_worker_t *app_wrk;
application_t *app;
}
int
-tls_session_accept_callback (stream_session_t * tls_session)
+tls_session_accept_callback (session_t * tls_session)
{
- stream_session_t *tls_listener, *app_session;
+ session_t *tls_listener, *app_session;
tls_ctx_t *lctx, *ctx;
u32 ctx_handle;
}
int
-tls_app_tx_callback (stream_session_t * app_session)
+tls_app_tx_callback (session_t * app_session)
{
tls_ctx_t *ctx;
if (PREDICT_FALSE (app_session->session_state == SESSION_STATE_CLOSED))
}
int
-tls_app_rx_callback (stream_session_t * tls_session)
+tls_app_rx_callback (session_t * tls_session)
{
tls_ctx_t *ctx;
int
tls_session_connected_callback (u32 tls_app_index, u32 ho_ctx_index,
- stream_session_t * tls_session, u8 is_fail)
+ session_t * tls_session, u8 is_fail)
{
- stream_session_t *app_session;
+ session_t *app_session;
tls_ctx_t *ho_ctx, *ctx;
u32 ctx_handle;
if (is_fail)
{
- int (*cb_fn) (u32, u32, stream_session_t *, u8), rv = 0;
+ int (*cb_fn) (u32, u32, session_t *, u8), rv = 0;
u32 wrk_index, api_context;
app_worker_t *app_wrk;
application_t *app;
tls_engine_type_t engine_type;
tls_main_t *tm = &tls_main;
app_worker_t *app_wrk;
- clib_error_t *error;
application_t *app;
tls_ctx_t *ctx;
u32 ctx_index;
+ int rv;
sep = (session_endpoint_cfg_t *) tep;
app_wrk = app_worker_get (sep->app_wrk_index);
cargs->sep.transport_proto = TRANSPORT_PROTO_TCP;
cargs->app_index = tm->app_index;
cargs->api_context = ctx_index;
- if ((error = vnet_connect (cargs)))
- return clib_error_get_code (error);
+ if ((rv = vnet_connect (cargs)))
+ return rv;
TLS_DBG (1, "New connect request %u engine %d", ctx_index, engine_type);
return 0;
u32
tls_start_listen (u32 app_listener_index, transport_endpoint_t * tep)
{
- vnet_bind_args_t _bargs, *args = &_bargs;
+ vnet_listen_args_t _bargs, *args = &_bargs;
app_worker_t *app_wrk;
tls_main_t *tm = &tls_main;
session_handle_t tls_handle;
session_endpoint_cfg_t *sep;
- stream_session_t *tls_listener;
- stream_session_t *app_listener;
+ session_t *tls_listener;
+ session_t *app_listener;
tls_engine_type_t engine_type;
application_t *app;
tls_ctx_t *lctx;
clib_memset (args, 0, sizeof (*args));
args->app_index = tm->app_index;
args->sep_ext = *sep;
- if (vnet_bind (args))
+ if (vnet_listen (args))
return -1;
tls_handle = args->handle;
{
tls_engine_type_t engine_type;
tls_ctx_t *lctx;
+ int rv;
lctx = tls_listener_ctx_get (lctx_index);
- vnet_unbind_args_t a = {
+ vnet_unlisten_args_t a = {
.handle = lctx->tls_session_handle,
.app_index = tls_main.app_index,
.wrk_map_index = 0 /* default wrk */
};
- if (vnet_unbind (&a))
- clib_warning ("unbind returned");
+ if ((rv = vnet_unlisten (&a)))
+ clib_warning ("unlisten returned %d", rv);
engine_type = lctx->tls_ctx_engine;
tls_vfts[engine_type].ctx_stop_listen (lctx);
s = format (s, "%-50U", format_tls_ctx, ctx, thread_index);
if (verbose)
{
- stream_session_t *ts;
+ session_t *ts;
ts = session_get_from_handle (ctx->app_session_handle);
s = format (s, "state: %-7u", ts->session_state);
if (verbose > 1)
/* *INDENT-OFF* */
const static transport_proto_vft_t tls_proto = {
- .open = tls_connect,
+ .connect = tls_connect,
.close = tls_disconnect,
- .bind = tls_start_listen,
+ .start_listen = tls_start_listen,
+ .stop_listen = tls_stop_listen,
.get_connection = tls_connection_get,
.get_listener = tls_listener_get,
- .unbind = tls_stop_listen,
.tx_type = TRANSPORT_TX_INTERNAL,
.service_type = TRANSPORT_SERVICE_APP,
.format_connection = format_tls_connection,