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>
diff --git a/src/vnet/session-apps/proxy.c b/src/vnet/session-apps/proxy.c
index 06c0954..063c13c 100644
--- a/src/vnet/session-apps/proxy.c
+++ b/src/vnet/session-apps/proxy.c
@@ -59,13 +59,13 @@
}
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 @@
}
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
}
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 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 @@
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 @@
* 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