summaryrefslogtreecommitdiffstats
path: root/src/vnet/session-apps
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-02-03 15:26:14 -0800
committerDave Barach <openvpp@barachs.net>2019-02-04 22:00:54 +0000
commit288eaab5964b9211350acad8d742fae4789577fe (patch)
treebdc12155958c6fedf4e976791529fc8a6590d70e /src/vnet/session-apps
parent8d991d923b52a2692370bfa33902d29ff5d2f826 (diff)
session: cleanup part 1
Rename core data structures. This will break compatibility for out of tree builtin apps. - stream_session_t to session_t - server_rx/tx_fifo to rx/tx_fifo - stream_session.h to session_types.h - update copyright Change-Id: I414097c6e28bcbea866fbf13b8773c7db3f49325 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session-apps')
-rw-r--r--src/vnet/session-apps/echo_client.c28
-rw-r--r--src/vnet/session-apps/echo_server.c18
-rw-r--r--src/vnet/session-apps/http_server.c16
-rw-r--r--src/vnet/session-apps/proxy.c52
4 files changed, 56 insertions, 58 deletions
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index d100aae5c2a..c39f787c093 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -263,7 +263,7 @@ echo_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
if (PREDICT_FALSE (delete_session == 1))
{
- stream_session_t *s;
+ session_t *s;
clib_atomic_fetch_add (&ecm->tx_total, sp->bytes_sent);
clib_atomic_fetch_add (&ecm->rx_total, sp->bytes_received);
@@ -356,7 +356,7 @@ echo_clients_init (vlib_main_t * vm)
static int
echo_clients_session_connected_callback (u32 app_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
echo_client_main_t *ecm = &echo_client_main;
eclient_session_t *session;
@@ -393,9 +393,9 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
session_index = session - ecm->sessions;
session->bytes_to_send = ecm->bytes_to_send;
session->bytes_to_receive = ecm->no_return ? 0ULL : ecm->bytes_to_send;
- session->data.rx_fifo = s->server_rx_fifo;
+ session->data.rx_fifo = s->rx_fifo;
session->data.rx_fifo->client_session_index = session_index;
- session->data.tx_fifo = s->server_tx_fifo;
+ session->data.tx_fifo = s->tx_fifo;
session->data.tx_fifo->client_session_index = session_index;
session->data.vpp_evt_q = ecm->vpp_event_queue[thread_index];
session->vpp_session_handle = session_handle (s);
@@ -422,7 +422,7 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
}
static void
-echo_clients_session_reset_callback (stream_session_t * s)
+echo_clients_session_reset_callback (session_t * s)
{
echo_client_main_t *ecm = &echo_client_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -437,13 +437,13 @@ echo_clients_session_reset_callback (stream_session_t * s)
}
static int
-echo_clients_session_create_callback (stream_session_t * s)
+echo_clients_session_create_callback (session_t * s)
{
return 0;
}
static void
-echo_clients_session_disconnect_callback (stream_session_t * s)
+echo_clients_session_disconnect_callback (session_t * s)
{
echo_client_main_t *ecm = &echo_client_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -454,7 +454,7 @@ echo_clients_session_disconnect_callback (stream_session_t * s)
}
void
-echo_clients_session_disconnect (stream_session_t * s)
+echo_clients_session_disconnect (session_t * s)
{
echo_client_main_t *ecm = &echo_client_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -464,7 +464,7 @@ echo_clients_session_disconnect (stream_session_t * s)
}
static int
-echo_clients_rx_callback (stream_session_t * s)
+echo_clients_rx_callback (session_t * s)
{
echo_client_main_t *ecm = &echo_client_main;
eclient_session_t *sp;
@@ -475,15 +475,13 @@ echo_clients_rx_callback (stream_session_t * s)
return -1;
}
- sp = pool_elt_at_index (ecm->sessions,
- s->server_rx_fifo->client_session_index);
+ sp = pool_elt_at_index (ecm->sessions, s->rx_fifo->client_session_index);
receive_data_chunk (ecm, sp);
- if (svm_fifo_max_dequeue (s->server_rx_fifo))
+ if (svm_fifo_max_dequeue (s->rx_fifo))
{
- 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;
}
diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c
index c0fdb131603..0229da35624 100644
--- a/src/vnet/session-apps/echo_server.c
+++ b/src/vnet/session-apps/echo_server.c
@@ -55,7 +55,7 @@ typedef struct
echo_server_main_t echo_server_main;
int
-echo_server_session_accept_callback (stream_session_t * s)
+echo_server_session_accept_callback (session_t * s)
{
echo_server_main_t *esm = &echo_server_main;
@@ -70,7 +70,7 @@ echo_server_session_accept_callback (stream_session_t * s)
}
void
-echo_server_session_disconnect_callback (stream_session_t * s)
+echo_server_session_disconnect_callback (session_t * s)
{
echo_server_main_t *esm = &echo_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -81,7 +81,7 @@ echo_server_session_disconnect_callback (stream_session_t * s)
}
void
-echo_server_session_reset_callback (stream_session_t * s)
+echo_server_session_reset_callback (session_t * s)
{
echo_server_main_t *esm = &echo_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -93,7 +93,7 @@ echo_server_session_reset_callback (stream_session_t * s)
int
echo_server_session_connected_callback (u32 app_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
clib_warning ("called...");
return -1;
@@ -135,15 +135,15 @@ test_bytes (echo_server_main_t * esm, int actual_transfer)
* If no-echo, just drop the data and be done with it.
*/
int
-echo_server_builtin_server_rx_callback_no_echo (stream_session_t * s)
+echo_server_builtin_server_rx_callback_no_echo (session_t * s)
{
- svm_fifo_t *rx_fifo = s->server_rx_fifo;
+ svm_fifo_t *rx_fifo = s->rx_fifo;
svm_fifo_dequeue_drop (rx_fifo, svm_fifo_max_dequeue (rx_fifo));
return 0;
}
int
-echo_server_rx_callback (stream_session_t * s)
+echo_server_rx_callback (session_t * s)
{
u32 n_written, max_dequeue, max_enqueue, max_transfer;
int actual_transfer;
@@ -154,8 +154,8 @@ echo_server_rx_callback (stream_session_t * s)
ASSERT (s->thread_index == thread_index);
- rx_fifo = s->server_rx_fifo;
- tx_fifo = s->server_tx_fifo;
+ rx_fifo = s->rx_fifo;
+ tx_fifo = s->tx_fifo;
ASSERT (rx_fifo->master_thread_index == thread_index);
ASSERT (tx_fifo->master_thread_index == thread_index);
diff --git a/src/vnet/session-apps/http_server.c b/src/vnet/session-apps/http_server.c
index 719608a79d1..25d83214112 100644
--- a/src/vnet/session-apps/http_server.c
+++ b/src/vnet/session-apps/http_server.c
@@ -475,7 +475,7 @@ session_rx_request (http_session_t * hs)
}
static int
-http_server_rx_callback (stream_session_t * s)
+http_server_rx_callback (session_t * s)
{
http_server_args *args;
http_session_t *hs;
@@ -507,7 +507,7 @@ http_server_rx_callback (stream_session_t * s)
}
static int
-http_server_rx_callback_static (stream_session_t * s)
+http_server_rx_callback_static (session_t * s)
{
http_server_main_t *hsm = &http_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -578,7 +578,7 @@ wait_for_data:
}
static int
-http_server_session_accept_callback (stream_session_t * s)
+http_server_session_accept_callback (session_t * s)
{
http_server_main_t *hsm = &http_server_main;
http_session_t *hs;
@@ -592,8 +592,8 @@ http_server_session_accept_callback (stream_session_t * s)
hs = http_server_session_alloc (s->thread_index);
http_server_session_lookup_add (s->thread_index, s->session_index,
hs->session_index);
- hs->rx_fifo = s->server_rx_fifo;
- hs->tx_fifo = s->server_tx_fifo;
+ hs->rx_fifo = s->rx_fifo;
+ hs->tx_fifo = s->tx_fifo;
hs->vpp_session_index = s->session_index;
hs->vpp_session_handle = session_handle (s);
hs->session_state = HTTP_STATE_ESTABLISHED;
@@ -606,7 +606,7 @@ http_server_session_accept_callback (stream_session_t * s)
}
static void
-http_server_session_disconnect_callback (stream_session_t * s)
+http_server_session_disconnect_callback (session_t * s)
{
http_server_main_t *hsm = &http_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -627,7 +627,7 @@ http_server_session_disconnect_callback (stream_session_t * s)
}
static void
-http_server_session_reset_callback (stream_session_t * s)
+http_server_session_reset_callback (session_t * s)
{
http_server_main_t *hsm = &http_server_main;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
@@ -649,7 +649,7 @@ http_server_session_reset_callback (stream_session_t * s)
static int
http_server_session_connected_callback (u32 app_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
clib_warning ("called...");
return -1;
diff --git a/src/vnet/session-apps/proxy.c b/src/vnet/session-apps/proxy.c
index 06c095440bc..063c13cda35 100644
--- a/src/vnet/session-apps/proxy.c
+++ b/src/vnet/session-apps/proxy.c
@@ -59,13 +59,13 @@ proxy_call_main_thread (vnet_connect_args_t * a)
}
static void
-delete_proxy_session (stream_session_t * s, int is_active_open)
+delete_proxy_session (session_t * s, int is_active_open)
{
proxy_main_t *pm = &proxy_main;
proxy_session_t *ps = 0;
vnet_disconnect_args_t _a, *a = &_a;
- stream_session_t *active_open_session = 0;
- stream_session_t *server_session = 0;
+ session_t *active_open_session = 0;
+ session_t *server_session = 0;
uword *p;
u64 handle;
@@ -143,7 +143,7 @@ delete_proxy_session (stream_session_t * s, int is_active_open)
}
static int
-proxy_accept_callback (stream_session_t * s)
+proxy_accept_callback (session_t * s)
{
proxy_main_t *pm = &proxy_main;
@@ -155,13 +155,13 @@ proxy_accept_callback (stream_session_t * s)
}
static void
-proxy_disconnect_callback (stream_session_t * s)
+proxy_disconnect_callback (session_t * s)
{
delete_proxy_session (s, 0 /* is_active_open */ );
}
static void
-proxy_reset_callback (stream_session_t * s)
+proxy_reset_callback (session_t * s)
{
clib_warning ("Reset session %U", format_stream_session, s, 2);
delete_proxy_session (s, 0 /* is_active_open */ );
@@ -169,7 +169,7 @@ proxy_reset_callback (stream_session_t * s)
static int
proxy_connected_callback (u32 app_index, u32 api_context,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
clib_warning ("called...");
return -1;
@@ -183,7 +183,7 @@ proxy_add_segment_callback (u32 client_index, u64 segment_handle)
}
static int
-proxy_rx_callback (stream_session_t * s)
+proxy_rx_callback (session_t * s)
{
u32 max_dequeue;
int actual_transfer __attribute__ ((unused));
@@ -204,7 +204,7 @@ proxy_rx_callback (stream_session_t * s)
if (PREDICT_TRUE (p != 0))
{
clib_spinlock_unlock_if_init (&pm->sessions_lock);
- active_open_tx_fifo = s->server_rx_fifo;
+ active_open_tx_fifo = s->rx_fifo;
/*
* Send event for active open tx fifo
@@ -220,13 +220,13 @@ proxy_rx_callback (stream_session_t * s)
}
else
{
- rx_fifo = s->server_rx_fifo;
- tx_fifo = s->server_tx_fifo;
+ rx_fifo = s->rx_fifo;
+ tx_fifo = s->tx_fifo;
ASSERT (rx_fifo->master_thread_index == thread_index);
ASSERT (tx_fifo->master_thread_index == thread_index);
- max_dequeue = svm_fifo_max_dequeue (s->server_rx_fifo);
+ max_dequeue = svm_fifo_max_dequeue (s->rx_fifo);
if (PREDICT_FALSE (max_dequeue == 0))
return 0;
@@ -272,7 +272,7 @@ static session_cb_vft_t proxy_session_cb_vft = {
static int
active_open_connected_callback (u32 app_index, u32 opaque,
- stream_session_t * s, u8 is_fail)
+ session_t * s, u8 is_fail)
{
proxy_main_t *pm = &proxy_main;
proxy_session_t *ps;
@@ -292,23 +292,23 @@ active_open_connected_callback (u32 app_index, u32 opaque,
ps = pool_elt_at_index (pm->sessions, opaque);
ps->vpp_active_open_handle = session_handle (s);
- s->server_tx_fifo = ps->server_rx_fifo;
- s->server_rx_fifo = ps->server_tx_fifo;
+ s->tx_fifo = ps->server_rx_fifo;
+ s->rx_fifo = ps->server_tx_fifo;
/*
* Reset the active-open tx-fifo master indices so the active-open session
* will receive data, etc.
*/
- s->server_tx_fifo->master_session_index = s->session_index;
- s->server_tx_fifo->master_thread_index = s->thread_index;
+ s->tx_fifo->master_session_index = s->session_index;
+ s->tx_fifo->master_thread_index = s->thread_index;
/*
* Account for the active-open session's use of the fifos
* so they won't disappear until the last session which uses
* them disappears
*/
- s->server_tx_fifo->refcnt++;
- s->server_rx_fifo->refcnt++;
+ s->tx_fifo->refcnt++;
+ s->rx_fifo->refcnt++;
hash_set (pm->proxy_session_by_active_open_handle,
ps->vpp_active_open_handle, opaque);
@@ -319,36 +319,36 @@ active_open_connected_callback (u32 app_index, u32 opaque,
* Send event for active open tx fifo
*/
ASSERT (s->thread_index == thread_index);
- 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;
}
static void
-active_open_reset_callback (stream_session_t * s)
+active_open_reset_callback (session_t * s)
{
delete_proxy_session (s, 1 /* is_active_open */ );
}
static int
-active_open_create_callback (stream_session_t * s)
+active_open_create_callback (session_t * s)
{
return 0;
}
static void
-active_open_disconnect_callback (stream_session_t * s)
+active_open_disconnect_callback (session_t * s)
{
delete_proxy_session (s, 1 /* is_active_open */ );
}
static int
-active_open_rx_callback (stream_session_t * s)
+active_open_rx_callback (session_t * s)
{
svm_fifo_t *proxy_tx_fifo;
- proxy_tx_fifo = s->server_rx_fifo;
+ proxy_tx_fifo = s->rx_fifo;
/*
* Send event for server tx fifo