aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/hs_apps/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/hs_apps/vcl')
-rw-r--r--src/plugins/hs_apps/vcl/sock_test_client.c160
-rw-r--r--src/plugins/hs_apps/vcl/sock_test_server.c74
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test.h208
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test_client.c167
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test_protos.c6
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test_server.c50
6 files changed, 249 insertions, 416 deletions
diff --git a/src/plugins/hs_apps/vcl/sock_test_client.c b/src/plugins/hs_apps/vcl/sock_test_client.c
index 35252da21bc..c8815692184 100644
--- a/src/plugins/hs_apps/vcl/sock_test_client.c
+++ b/src/plugins/hs_apps/vcl/sock_test_client.c
@@ -46,17 +46,17 @@ sock_test_cfg_sync (vcl_test_session_t * socket)
{
sock_client_main_t *scm = &sock_client_main;
vcl_test_session_t *ctrl = &scm->ctrl_socket;
- vcl_test_cfg_t *rl_cfg = (vcl_test_cfg_t *) socket->rxbuf;
+ hs_test_cfg_t *rl_cfg = (hs_test_cfg_t *) socket->rxbuf;
int rx_bytes, tx_bytes;
if (socket->cfg.verbose)
- vcl_test_cfg_dump (&socket->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&socket->cfg, 1 /* is_client */);
ctrl->cfg.seq_num = ++scm->cfg_seq_num;
if (socket->cfg.verbose)
{
stinf ("(fd %d): Sending config sent to server.\n", socket->fd);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
tx_bytes = sock_test_write (socket->fd, (uint8_t *) & ctrl->cfg,
sizeof (ctrl->cfg), NULL, ctrl->cfg.verbose);
@@ -64,21 +64,21 @@ sock_test_cfg_sync (vcl_test_session_t * socket)
stabrt ("(fd %d): write test cfg failed (%d)!", socket->fd, tx_bytes);
rx_bytes = sock_test_read (socket->fd, (uint8_t *) socket->rxbuf,
- sizeof (vcl_test_cfg_t), NULL);
+ sizeof (hs_test_cfg_t), NULL);
if (rx_bytes < 0)
return rx_bytes;
- if (rl_cfg->magic != VCL_TEST_CFG_CTRL_MAGIC)
+ if (rl_cfg->magic != HS_TEST_CFG_CTRL_MAGIC)
stabrt ("(fd %d): Bad server reply cfg -- aborting!\n", socket->fd);
- if ((rx_bytes != sizeof (vcl_test_cfg_t))
- || !vcl_test_cfg_verify (rl_cfg, &ctrl->cfg))
+ if ((rx_bytes != sizeof (hs_test_cfg_t)) ||
+ !hs_test_cfg_verify (rl_cfg, &ctrl->cfg))
stabrt ("(fd %d): Invalid config received from server!\n", socket->fd);
if (socket->cfg.verbose)
{
stinf ("(fd %d): Got config back from server.", socket->fd);
- vcl_test_cfg_dump (rl_cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (rl_cfg, 1 /* is_client */);
}
ctrl->cfg.ctrl_handle = ((ctrl->cfg.ctrl_handle == ~0) ?
rl_cfg->ctrl_handle : ctrl->cfg.ctrl_handle);
@@ -263,27 +263,25 @@ echo_test_client (void)
vcl_test_stats_dump ("CLIENT RESULTS", &ctrl->stats,
1 /* show_rx */ , 1 /* show tx */ ,
ctrl->cfg.verbose);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
if (ctrl->cfg.verbose > 1)
{
- stinf (" ctrl socket info\n"
- VCL_TEST_SEPARATOR_STRING
+ stinf (" ctrl socket info\n" HS_TEST_SEPARATOR_STRING
" fd: %d (0x%08x)\n"
" rxbuf: %p\n"
" rxbuf size: %u (0x%08x)\n"
" txbuf: %p\n"
- " txbuf size: %u (0x%08x)\n"
- VCL_TEST_SEPARATOR_STRING,
- ctrl->fd, (uint32_t) ctrl->fd,
- ctrl->rxbuf, ctrl->rxbuf_size, ctrl->rxbuf_size,
- ctrl->txbuf, ctrl->txbuf_size, ctrl->txbuf_size);
+ " txbuf size: %u (0x%08x)\n" HS_TEST_SEPARATOR_STRING,
+ ctrl->fd, (uint32_t) ctrl->fd, ctrl->rxbuf, ctrl->rxbuf_size,
+ ctrl->rxbuf_size, ctrl->txbuf, ctrl->txbuf_size,
+ ctrl->txbuf_size);
}
}
}
static void
-stream_test_client (vcl_test_t test)
+stream_test_client (hs_test_t test)
{
sock_client_main_t *scm = &sock_client_main;
vcl_test_session_t *ctrl = &scm->ctrl_socket;
@@ -292,7 +290,7 @@ stream_test_client (vcl_test_t test)
uint32_t i, n;
fd_set wr_fdset, rd_fdset;
fd_set _wfdset, *wfdset = &_wfdset;
- fd_set _rfdset, *rfdset = (test == VCL_TEST_TYPE_BI) ? &_rfdset : 0;
+ fd_set _rfdset, *rfdset = (test == HS_TEST_TYPE_BI) ? &_rfdset : 0;
ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
ctrl->cfg.ctrl_handle = ~0;
@@ -300,7 +298,7 @@ stream_test_client (vcl_test_t test)
stinf ("\n" SOCK_TEST_BANNER_STRING
"CLIENT (fd %d): %s-directional Stream Test!\n\n"
"CLIENT (fd %d): Sending config to server on ctrl socket...\n",
- ctrl->fd, test == VCL_TEST_TYPE_BI ? "Bi" : "Uni", ctrl->fd);
+ ctrl->fd, test == HS_TEST_TYPE_BI ? "Bi" : "Uni", ctrl->fd);
if (sock_test_cfg_sync (ctrl))
stabrt ("test cfg sync failed -- aborting!");
@@ -352,8 +350,7 @@ stream_test_client (vcl_test_t test)
(tsock->stats.stop.tv_nsec == 0)))
continue;
- if ((test == VCL_TEST_TYPE_BI) &&
- FD_ISSET (tsock->fd, rfdset) &&
+ if ((test == HS_TEST_TYPE_BI) && FD_ISSET (tsock->fd, rfdset) &&
(tsock->stats.rx_bytes < ctrl->cfg.total_bytes))
{
(void) sock_test_read (tsock->fd,
@@ -372,9 +369,9 @@ stream_test_client (vcl_test_t test)
tsock->fd);
}
- if (((test == VCL_TEST_TYPE_UNI) &&
+ if (((test == HS_TEST_TYPE_UNI) &&
(tsock->stats.tx_bytes >= ctrl->cfg.total_bytes)) ||
- ((test == VCL_TEST_TYPE_BI) &&
+ ((test == HS_TEST_TYPE_BI) &&
(tsock->stats.rx_bytes >= ctrl->cfg.total_bytes)))
{
clock_gettime (CLOCK_REALTIME, &tsock->stats.stop);
@@ -399,40 +396,39 @@ stream_test_client (vcl_test_t test)
snprintf (buf, sizeof (buf), "CLIENT (fd %d) RESULTS", tsock->fd);
vcl_test_stats_dump (buf, &tsock->stats,
- test == VCL_TEST_TYPE_BI /* show_rx */ ,
- 1 /* show tx */ , ctrl->cfg.verbose);
+ test == HS_TEST_TYPE_BI /* show_rx */,
+ 1 /* show tx */, ctrl->cfg.verbose);
}
vcl_test_stats_accumulate (&ctrl->stats, &tsock->stats);
}
vcl_test_stats_dump ("CLIENT RESULTS", &ctrl->stats,
- test == VCL_TEST_TYPE_BI /* show_rx */ ,
- 1 /* show tx */ , ctrl->cfg.verbose);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ test == HS_TEST_TYPE_BI /* show_rx */, 1 /* show tx */,
+ ctrl->cfg.verbose);
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
if (ctrl->cfg.verbose)
{
- stinf (" ctrl socket info\n"
- VCL_TEST_SEPARATOR_STRING
+ stinf (" ctrl socket info\n" HS_TEST_SEPARATOR_STRING
" fd: %d (0x%08x)\n"
" rxbuf: %p\n"
" rxbuf size: %u (0x%08x)\n"
" txbuf: %p\n"
- " txbuf size: %u (0x%08x)\n"
- VCL_TEST_SEPARATOR_STRING,
- ctrl->fd, (uint32_t) ctrl->fd,
- ctrl->rxbuf, ctrl->rxbuf_size, ctrl->rxbuf_size,
- ctrl->txbuf, ctrl->txbuf_size, ctrl->txbuf_size);
+ " txbuf size: %u (0x%08x)\n" HS_TEST_SEPARATOR_STRING,
+ ctrl->fd, (uint32_t) ctrl->fd, ctrl->rxbuf, ctrl->rxbuf_size,
+ ctrl->rxbuf_size, ctrl->txbuf, ctrl->txbuf_size,
+ ctrl->txbuf_size);
}
- ctrl->cfg.test = VCL_TEST_TYPE_ECHO;
+ ctrl->cfg.test = HS_TEST_TYPE_ECHO;
if (sock_test_cfg_sync (ctrl))
stabrt ("post-test cfg sync failed!");
- stinf ("(fd %d): %s-directional Stream Test Complete!\n"
- SOCK_TEST_BANNER_STRING "\n", ctrl->fd,
- test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
+ stinf (
+ "(fd %d): %s-directional Stream Test Complete!\n" SOCK_TEST_BANNER_STRING
+ "\n",
+ ctrl->fd, test == HS_TEST_TYPE_BI ? "Bi" : "Uni");
}
static void
@@ -448,24 +444,24 @@ exit_client (void)
for (i = 0; i < ctrl->cfg.num_test_sessions; i++)
{
tsock = &scm->test_socket[i];
- tsock->cfg.test = VCL_TEST_TYPE_EXIT;
+ tsock->cfg.test = HS_TEST_TYPE_EXIT;
/* coverity[COPY_PASTE_ERROR] */
if (ctrl->cfg.verbose)
{
stinf ("\(fd %d): Sending exit cfg to server...\n", tsock->fd);
- vcl_test_cfg_dump (&tsock->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&tsock->cfg, 1 /* is_client */);
}
(void) sock_test_write (tsock->fd, (uint8_t *) & tsock->cfg,
sizeof (tsock->cfg), &tsock->stats,
ctrl->cfg.verbose);
}
- ctrl->cfg.test = VCL_TEST_TYPE_EXIT;
+ ctrl->cfg.test = HS_TEST_TYPE_EXIT;
if (ctrl->cfg.verbose)
{
stinf ("\n(fd %d): Sending exit cfg to server...\n", ctrl->fd);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
(void) sock_test_write (ctrl->fd, (uint8_t *) & ctrl->cfg,
sizeof (ctrl->cfg), &ctrl->stats,
@@ -557,7 +553,7 @@ cfg_txbuf_size_set (void)
ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
vcl_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
(uint8_t **) & ctrl->txbuf, &ctrl->txbuf_size);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
else
stabrt ("Invalid txbuf size (%lu) < minimum buf size (%u)!",
@@ -576,7 +572,7 @@ cfg_num_writes_set (void)
{
ctrl->cfg.num_writes = num_writes;
ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
else
stabrt ("Invalid num writes: %u", num_writes);
@@ -596,7 +592,7 @@ cfg_num_test_sockets_set (void)
ctrl->cfg.num_test_sessions = num_test_sockets;
sock_test_connect_test_sockets (num_test_sockets);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
else
stabrt ("Invalid num test sockets: %u, (%d max)\n", num_test_sockets,
@@ -616,7 +612,7 @@ cfg_rxbuf_size_set (void)
ctrl->cfg.rxbuf_size = rxbuf_size;
vcl_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
(uint8_t **) & ctrl->rxbuf, &ctrl->rxbuf_size);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
else
stabrt ("Invalid rxbuf size (%lu) < minimum buf size (%u)!",
@@ -630,19 +626,19 @@ cfg_verbose_toggle (void)
vcl_test_session_t *ctrl = &scm->ctrl_socket;
ctrl->cfg.verbose = ctrl->cfg.verbose ? 0 : 1;
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
-static vcl_test_t
+static hs_test_t
parse_input ()
{
sock_client_main_t *scm = &sock_client_main;
vcl_test_session_t *ctrl = &scm->ctrl_socket;
- vcl_test_t rv = VCL_TEST_TYPE_NONE;
+ hs_test_t rv = HS_TEST_TYPE_NONE;
if (!strncmp (VCL_TEST_TOKEN_EXIT, ctrl->txbuf,
strlen (VCL_TEST_TOKEN_EXIT)))
- rv = VCL_TEST_TYPE_EXIT;
+ rv = HS_TEST_TYPE_EXIT;
else if (!strncmp (VCL_TEST_TOKEN_HELP, ctrl->txbuf,
strlen (VCL_TEST_TOKEN_HELP)))
@@ -672,16 +668,16 @@ parse_input ()
strlen (VCL_TEST_TOKEN_RXBUF_SIZE)))
cfg_rxbuf_size_set ();
- else if (!strncmp (VCL_TEST_TOKEN_RUN_UNI, ctrl->txbuf,
- strlen (VCL_TEST_TOKEN_RUN_UNI)))
- rv = ctrl->cfg.test = VCL_TEST_TYPE_UNI;
+ else if (!strncmp (HS_TEST_TOKEN_RUN_UNI, ctrl->txbuf,
+ strlen (HS_TEST_TOKEN_RUN_UNI)))
+ rv = ctrl->cfg.test = HS_TEST_TYPE_UNI;
- else if (!strncmp (VCL_TEST_TOKEN_RUN_BI, ctrl->txbuf,
- strlen (VCL_TEST_TOKEN_RUN_BI)))
- rv = ctrl->cfg.test = VCL_TEST_TYPE_BI;
+ else if (!strncmp (HS_TEST_TOKEN_RUN_BI, ctrl->txbuf,
+ strlen (HS_TEST_TOKEN_RUN_BI)))
+ rv = ctrl->cfg.test = HS_TEST_TYPE_BI;
else
- rv = VCL_TEST_TYPE_ECHO;
+ rv = HS_TEST_TYPE_ECHO;
return rv;
}
@@ -713,9 +709,9 @@ main (int argc, char **argv)
sock_client_main_t *scm = &sock_client_main;
vcl_test_session_t *ctrl = &scm->ctrl_socket;
int c, rv;
- vcl_test_t post_test = VCL_TEST_TYPE_NONE;
+ hs_test_t post_test = HS_TEST_TYPE_NONE;
- vcl_test_cfg_init (&ctrl->cfg);
+ hs_test_cfg_init (&ctrl->cfg);
vcl_test_session_buf_alloc (ctrl);
opterr = 0;
@@ -749,7 +745,7 @@ main (int argc, char **argv)
break;
case 'X':
- post_test = VCL_TEST_TYPE_EXIT;
+ post_test = HS_TEST_TYPE_EXIT;
break;
case 'E':
@@ -760,7 +756,7 @@ main (int argc, char **argv)
print_usage_and_exit ();
}
strncpy (ctrl->txbuf, optarg, ctrl->txbuf_size);
- ctrl->cfg.test = VCL_TEST_TYPE_ECHO;
+ ctrl->cfg.test = HS_TEST_TYPE_ECHO;
break;
case 'I':
@@ -836,11 +832,11 @@ main (int argc, char **argv)
break;
case 'U':
- ctrl->cfg.test = VCL_TEST_TYPE_UNI;
+ ctrl->cfg.test = HS_TEST_TYPE_UNI;
break;
case 'B':
- ctrl->cfg.test = VCL_TEST_TYPE_BI;
+ ctrl->cfg.test = HS_TEST_TYPE_BI;
break;
case 'V':
@@ -928,54 +924,54 @@ main (int argc, char **argv)
sock_test_connect_test_sockets (ctrl->cfg.num_test_sessions);
- while (ctrl->cfg.test != VCL_TEST_TYPE_EXIT)
+ while (ctrl->cfg.test != HS_TEST_TYPE_EXIT)
{
if (scm->dump_cfg)
{
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
scm->dump_cfg = 0;
}
switch (ctrl->cfg.test)
{
- case VCL_TEST_TYPE_ECHO:
+ case HS_TEST_TYPE_ECHO:
echo_test_client ();
break;
- case VCL_TEST_TYPE_UNI:
- case VCL_TEST_TYPE_BI:
+ case HS_TEST_TYPE_UNI:
+ case HS_TEST_TYPE_BI:
stream_test_client (ctrl->cfg.test);
break;
- case VCL_TEST_TYPE_EXIT:
+ case HS_TEST_TYPE_EXIT:
continue;
- case VCL_TEST_TYPE_NONE:
+ case HS_TEST_TYPE_NONE:
default:
break;
}
switch (post_test)
{
- case VCL_TEST_TYPE_EXIT:
+ case HS_TEST_TYPE_EXIT:
switch (ctrl->cfg.test)
{
- case VCL_TEST_TYPE_EXIT:
- case VCL_TEST_TYPE_UNI:
- case VCL_TEST_TYPE_BI:
- case VCL_TEST_TYPE_ECHO:
- ctrl->cfg.test = VCL_TEST_TYPE_EXIT;
+ case HS_TEST_TYPE_EXIT:
+ case HS_TEST_TYPE_UNI:
+ case HS_TEST_TYPE_BI:
+ case HS_TEST_TYPE_ECHO:
+ ctrl->cfg.test = HS_TEST_TYPE_EXIT;
continue;
- case VCL_TEST_TYPE_NONE:
+ case HS_TEST_TYPE_NONE:
default:
break;
}
break;
- case VCL_TEST_TYPE_NONE:
- case VCL_TEST_TYPE_ECHO:
- case VCL_TEST_TYPE_UNI:
- case VCL_TEST_TYPE_BI:
+ case HS_TEST_TYPE_NONE:
+ case HS_TEST_TYPE_ECHO:
+ case HS_TEST_TYPE_UNI:
+ case HS_TEST_TYPE_BI:
default:
break;
}
diff --git a/src/plugins/hs_apps/vcl/sock_test_server.c b/src/plugins/hs_apps/vcl/sock_test_server.c
index d516c1722db..2356a4eadca 100644
--- a/src/plugins/hs_apps/vcl/sock_test_server.c
+++ b/src/plugins/hs_apps/vcl/sock_test_server.c
@@ -37,7 +37,7 @@ typedef struct
int fd;
uint8_t *buf;
uint32_t buf_size;
- vcl_test_cfg_t cfg;
+ hs_test_cfg_t cfg;
vcl_test_stats_t stats;
} sock_server_conn_t;
@@ -87,7 +87,7 @@ conn_pool_expand (size_t expand_size)
{
sock_server_conn_t *conn = &conn_pool[i];
memset (conn, 0, sizeof (*conn));
- vcl_test_cfg_init (&conn->cfg);
+ hs_test_cfg_init (&conn->cfg);
vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ , &conn->buf,
&conn->buf_size);
conn->cfg.txbuf_size = conn->cfg.rxbuf_size;
@@ -123,7 +123,7 @@ conn_pool_free (sock_server_conn_t * conn)
}
static inline void
-sync_config_and_reply (sock_server_conn_t * conn, vcl_test_cfg_t * rx_cfg)
+sync_config_and_reply (sock_server_conn_t *conn, hs_test_cfg_t *rx_cfg)
{
conn->cfg = *rx_cfg;
vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
@@ -133,19 +133,18 @@ sync_config_and_reply (sock_server_conn_t * conn, vcl_test_cfg_t * rx_cfg)
if (conn->cfg.verbose)
{
stinf ("(fd %d): Replying to cfg message!\n", conn->fd);
- vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (&conn->cfg, 0 /* is_client */);
}
(void) sock_test_write (conn->fd, (uint8_t *) & conn->cfg,
sizeof (conn->cfg), NULL, conn->cfg.verbose);
}
static void
-stream_test_server_start_stop (sock_server_conn_t * conn,
- vcl_test_cfg_t * rx_cfg)
+stream_test_server_start_stop (sock_server_conn_t *conn, hs_test_cfg_t *rx_cfg)
{
sock_server_main_t *ssm = &sock_server_main;
int client_fd = conn->fd;
- vcl_test_t test = rx_cfg->test;
+ hs_test_t test = rx_cfg->test;
if (rx_cfg->ctrl_handle == conn->fd)
{
@@ -166,39 +165,37 @@ stream_test_server_start_stop (sock_server_conn_t * conn,
snprintf (buf, sizeof (buf), "SERVER (fd %d) RESULTS",
tc->fd);
- vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
- test == VCL_TEST_TYPE_BI
- /* show tx */ ,
+ vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */,
+ test == HS_TEST_TYPE_BI
+ /* show tx */,
conn->cfg.verbose);
}
}
}
- vcl_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */ ,
- (test == VCL_TEST_TYPE_BI) /* show_tx */ ,
+ vcl_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */,
+ (test == HS_TEST_TYPE_BI) /* show_tx */,
conn->cfg.verbose);
- vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (&conn->cfg, 0 /* is_client */);
if (conn->cfg.verbose)
{
- stinf (" sock server main\n"
- VCL_TEST_SEPARATOR_STRING
+ stinf (" sock server main\n" HS_TEST_SEPARATOR_STRING
" buf: %p\n"
- " buf size: %u (0x%08x)\n"
- VCL_TEST_SEPARATOR_STRING,
+ " buf size: %u (0x%08x)\n" HS_TEST_SEPARATOR_STRING,
conn->buf, conn->buf_size, conn->buf_size);
}
sync_config_and_reply (conn, rx_cfg);
- stinf ("SERVER (fd %d): %s-directional Stream Test Complete!\n"
- SOCK_TEST_BANNER_STRING "\n", conn->fd,
- test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
+ stinf ("SERVER (fd %d): %s-directional Stream Test "
+ "Complete!\n" SOCK_TEST_BANNER_STRING "\n",
+ conn->fd, test == HS_TEST_TYPE_BI ? "Bi" : "Uni");
}
else
{
stinf (SOCK_TEST_BANNER_STRING
"SERVER (fd %d): %s-directional Stream Test!\n"
" Sending client the test cfg to start streaming data...\n",
- client_fd, test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
+ client_fd, test == HS_TEST_TYPE_BI ? "Bi" : "Uni");
rx_cfg->ctrl_handle = (rx_cfg->ctrl_handle == ~0) ? conn->fd :
rx_cfg->ctrl_handle;
@@ -216,9 +213,9 @@ static inline void
stream_test_server (sock_server_conn_t * conn, int rx_bytes)
{
int client_fd = conn->fd;
- vcl_test_t test = conn->cfg.test;
+ hs_test_t test = conn->cfg.test;
- if (test == VCL_TEST_TYPE_BI)
+ if (test == HS_TEST_TYPE_BI)
(void) sock_test_write (client_fd, conn->buf, rx_bytes, &conn->stats,
conn->cfg.verbose);
@@ -373,15 +370,14 @@ sts_server_echo (sock_server_conn_t * conn, int rx_bytes)
}
static int
-sts_handle_cfg (vcl_test_cfg_t * rx_cfg, sock_server_conn_t * conn,
- int rx_bytes)
+sts_handle_cfg (hs_test_cfg_t *rx_cfg, sock_server_conn_t *conn, int rx_bytes)
{
sock_server_main_t *ssm = &sock_server_main;
if (rx_cfg->verbose)
{
stinf ("(fd %d): Received a cfg message!\n", conn->fd);
- vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
}
if (rx_bytes != sizeof (*rx_cfg))
@@ -393,7 +389,7 @@ sts_handle_cfg (vcl_test_cfg_t * rx_cfg, sock_server_conn_t * conn,
if (conn->cfg.verbose)
{
stinf ("(fd %d): Replying to cfg message!\n", conn->fd);
- vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
}
sock_test_write (conn->fd, (uint8_t *) & conn->cfg, sizeof (conn->cfg),
NULL, conn->cfg.verbose);
@@ -402,23 +398,23 @@ sts_handle_cfg (vcl_test_cfg_t * rx_cfg, sock_server_conn_t * conn,
switch (rx_cfg->test)
{
- case VCL_TEST_TYPE_NONE:
+ case HS_TEST_TYPE_NONE:
sync_config_and_reply (conn, rx_cfg);
break;
- case VCL_TEST_TYPE_ECHO:
+ case HS_TEST_TYPE_ECHO:
if (socket_server_echo_af_unix_init (ssm))
goto done;
sync_config_and_reply (conn, rx_cfg);
break;
- case VCL_TEST_TYPE_BI:
- case VCL_TEST_TYPE_UNI:
+ case HS_TEST_TYPE_BI:
+ case HS_TEST_TYPE_UNI:
stream_test_server_start_stop (conn, rx_cfg);
break;
- case VCL_TEST_TYPE_EXIT:
+ case HS_TEST_TYPE_EXIT:
stinf ("Have a great day connection %d!", conn->fd);
close (conn->fd);
conn_pool_free (conn);
@@ -428,7 +424,7 @@ sts_handle_cfg (vcl_test_cfg_t * rx_cfg, sock_server_conn_t * conn,
default:
stinf ("ERROR: Unknown test type!\n");
- vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
break;
}
@@ -439,7 +435,7 @@ done:
static int
sts_conn_expect_config (sock_server_conn_t * conn)
{
- if (conn->cfg.test == VCL_TEST_TYPE_ECHO)
+ if (conn->cfg.test == HS_TEST_TYPE_ECHO)
return 1;
return (conn->stats.rx_bytes < 128
@@ -452,7 +448,7 @@ main (int argc, char **argv)
int client_fd, rv, main_rv = 0, rx_bytes, c, v, i;
sock_server_main_t *ssm = &sock_server_main;
sock_server_conn_t *conn;
- vcl_test_cfg_t *rx_cfg;
+ hs_test_cfg_t *rx_cfg;
struct sockaddr_storage servaddr;
uint16_t port = VCL_TEST_SERVER_PORT;
uint32_t servaddr_size;
@@ -605,8 +601,8 @@ main (int argc, char **argv)
if (sts_conn_expect_config (conn))
{
- rx_cfg = (vcl_test_cfg_t *) conn->buf;
- if (rx_cfg->magic == VCL_TEST_CFG_CTRL_MAGIC)
+ rx_cfg = (hs_test_cfg_t *) conn->buf;
+ if (rx_cfg->magic == HS_TEST_CFG_CTRL_MAGIC)
{
sts_handle_cfg (rx_cfg, conn, rx_bytes);
if (!ssm->nfds)
@@ -619,8 +615,8 @@ main (int argc, char **argv)
}
}
- if ((conn->cfg.test == VCL_TEST_TYPE_UNI)
- || (conn->cfg.test == VCL_TEST_TYPE_BI))
+ if ((conn->cfg.test == HS_TEST_TYPE_UNI) ||
+ (conn->cfg.test == HS_TEST_TYPE_BI))
{
stream_test_server (conn, rx_bytes);
if (ioctl (conn->fd, FIONREAD))
diff --git a/src/plugins/hs_apps/vcl/vcl_test.h b/src/plugins/hs_apps/vcl/vcl_test.h
index 4c816b80063..0ce27ef84e2 100644
--- a/src/plugins/hs_apps/vcl/vcl_test.h
+++ b/src/plugins/hs_apps/vcl/vcl_test.h
@@ -16,6 +16,7 @@
#ifndef __vcl_test_h__
#define __vcl_test_h__
+#include <hs_apps/hs_test.h>
#include <netdb.h>
#include <errno.h>
#include <stdlib.h>
@@ -46,24 +47,9 @@
#define vt_atomic_add(_ptr, _val) \
__atomic_fetch_add (_ptr, _val, __ATOMIC_RELEASE)
-#define VCL_TEST_TOKEN_HELP "#H"
-#define VCL_TEST_TOKEN_EXIT "#X"
-#define VCL_TEST_TOKEN_VERBOSE "#V"
-#define VCL_TEST_TOKEN_TXBUF_SIZE "#T:"
-#define VCL_TEST_TOKEN_NUM_TEST_SESS "#I:"
-#define VCL_TEST_TOKEN_NUM_WRITES "#N:"
-#define VCL_TEST_TOKEN_RXBUF_SIZE "#R:"
-#define VCL_TEST_TOKEN_SHOW_CFG "#C"
-#define VCL_TEST_TOKEN_RUN_UNI "#U"
-#define VCL_TEST_TOKEN_RUN_BI "#B"
-
#define VCL_TEST_SERVER_PORT 22000
#define VCL_TEST_LOCALHOST_IPADDR "127.0.0.1"
-#define VCL_TEST_CFG_CTRL_MAGIC 0xfeedface
-#define VCL_TEST_CFG_NUM_WRITES_DEF 1000000
-#define VCL_TEST_CFG_TXBUF_SIZE_DEF 8192
-#define VCL_TEST_CFG_RXBUF_SIZE_DEF (64*VCL_TEST_CFG_TXBUF_SIZE_DEF)
#define VCL_TEST_CFG_BUF_SIZE_MIN 128
#define VCL_TEST_CFG_MAX_TEST_SESS ((uint32_t) 1e6)
#define VCL_TEST_CFG_MAX_SELECT_SESS 512
@@ -73,43 +59,6 @@
#define VCL_TEST_CTRL_LISTENER (~0 - 1)
#define VCL_TEST_DATA_LISTENER (~0)
#define VCL_TEST_DELAY_DISCONNECT 1
-#define VCL_TEST_SEPARATOR_STRING \
- " -----------------------------\n"
-typedef enum
-{
- VCL_TEST_TYPE_NONE,
- VCL_TEST_TYPE_ECHO,
- VCL_TEST_TYPE_UNI,
- VCL_TEST_TYPE_BI,
- VCL_TEST_TYPE_EXIT,
- VCL_TEST_TYPE_EXIT_CLIENT,
-} vcl_test_t;
-
-typedef enum
-{
- VCL_TEST_CMD_SYNC,
- VCL_TEST_CMD_START,
- VCL_TEST_CMD_STOP,
-} vcl_test_cmd_t;
-
-typedef struct __attribute__ ((packed))
-{
- uint32_t magic;
- uint32_t seq_num;
- uint32_t test;
- uint32_t cmd;
- uint32_t ctrl_handle;
- uint32_t num_test_sessions;
- uint32_t num_test_sessions_perq;
- uint32_t num_test_qsessions;
- uint32_t verbose;
- uint32_t address_ip6;
- uint32_t transport_udp;
- uint64_t rxbuf_size;
- uint64_t txbuf_size;
- uint64_t num_writes;
- uint64_t total_bytes;
-} vcl_test_cfg_t;
typedef struct
{
@@ -138,7 +87,7 @@ typedef struct vcl_test_session
uint32_t rxbuf_size;
char *txbuf;
char *rxbuf;
- vcl_test_cfg_t cfg;
+ hs_test_cfg_t cfg;
vcl_test_stats_t stats;
vcl_test_stats_t old_stats;
int session_index;
@@ -159,7 +108,7 @@ vcl_test_worker_index (void)
typedef struct
{
- int (*init) (vcl_test_cfg_t *cfg);
+ int (*init) (hs_test_cfg_t *cfg);
int (*open) (vcl_test_session_t *ts, vppcom_endpt_t *endpt);
int (*listen) (vcl_test_session_t *ts, vppcom_endpt_t *endpt);
int (*accept) (int listen_fd, vcl_test_session_t *ts);
@@ -177,7 +126,7 @@ typedef struct
{
const vcl_test_proto_vft_t *protos[VPPCOM_PROTO_SRTP + 1];
uint32_t ckpair_index;
- vcl_test_cfg_t cfg;
+ hs_test_cfg_t cfg;
vcl_test_wrk_t *wrk;
} vcl_test_main_t;
@@ -203,37 +152,8 @@ vcl_test_stats_accumulate (vcl_test_stats_t * accum, vcl_test_stats_t * incr)
}
static inline void
-vcl_test_cfg_init (vcl_test_cfg_t * cfg)
-{
- cfg->magic = VCL_TEST_CFG_CTRL_MAGIC;
- cfg->test = VCL_TEST_TYPE_UNI;
- cfg->ctrl_handle = ~0;
- cfg->num_test_sessions = 1;
- cfg->num_test_sessions_perq = 1;
- cfg->verbose = 0;
- cfg->rxbuf_size = VCL_TEST_CFG_RXBUF_SIZE_DEF;
- cfg->num_writes = VCL_TEST_CFG_NUM_WRITES_DEF;
- cfg->txbuf_size = VCL_TEST_CFG_TXBUF_SIZE_DEF;
- cfg->total_bytes = cfg->num_writes * cfg->txbuf_size;
-}
-
-static inline int
-vcl_test_cfg_verify (vcl_test_cfg_t * cfg, vcl_test_cfg_t * valid_cfg)
-{
- /* Note: txbuf & rxbuf on server are the same buffer,
- * so txbuf_size is not included in this check.
- */
- return ((cfg->magic == valid_cfg->magic)
- && (cfg->test == valid_cfg->test)
- && (cfg->verbose == valid_cfg->verbose)
- && (cfg->rxbuf_size == valid_cfg->rxbuf_size)
- && (cfg->num_writes == valid_cfg->num_writes)
- && (cfg->total_bytes == valid_cfg->total_bytes));
-}
-
-static inline void
-vcl_test_buf_alloc (vcl_test_cfg_t * cfg, uint8_t is_rxbuf, uint8_t ** buf,
- uint32_t * bufsize)
+vcl_test_buf_alloc (hs_test_cfg_t *cfg, uint8_t is_rxbuf, uint8_t **buf,
+ uint32_t *bufsize)
{
uint32_t alloc_size = is_rxbuf ? cfg->rxbuf_size : cfg->txbuf_size;
uint8_t *lb = realloc (*buf, (size_t) alloc_size);
@@ -274,69 +194,6 @@ vcl_test_session_buf_free (vcl_test_session_t *ts)
ts->txbuf = 0;
}
-static inline char *
-vcl_test_type_str (vcl_test_t t)
-{
- switch (t)
- {
- case VCL_TEST_TYPE_NONE:
- return "NONE";
-
- case VCL_TEST_TYPE_ECHO:
- return "ECHO";
-
- case VCL_TEST_TYPE_UNI:
- return "UNI";
-
- case VCL_TEST_TYPE_BI:
- return "BI";
-
- case VCL_TEST_TYPE_EXIT:
- return "EXIT";
-
- default:
- return "Unknown";
- }
-}
-
-static inline void
-vcl_test_cfg_dump (vcl_test_cfg_t * cfg, uint8_t is_client)
-{
- char *spc = " ";
-
- printf (" test config (%p):\n"
- VCL_TEST_SEPARATOR_STRING
- " magic: 0x%08x\n"
- " seq_num: 0x%08x\n"
- "%-5s test: %s (%d)\n"
- " ctrl handle: %d (0x%x)\n"
- "%-5s num test sockets: %u (0x%08x)\n"
- "%-5s verbose: %s (%d)\n"
- "%-5s rxbuf size: %lu (0x%08lx)\n"
- "%-5s txbuf size: %lu (0x%08lx)\n"
- "%-5s num writes: %lu (0x%08lx)\n"
- " client tx bytes: %lu (0x%08lx)\n"
- VCL_TEST_SEPARATOR_STRING,
- (void *) cfg, cfg->magic, cfg->seq_num,
- is_client && (cfg->test == VCL_TEST_TYPE_UNI) ?
- "'" VCL_TEST_TOKEN_RUN_UNI "'" :
- is_client && (cfg->test == VCL_TEST_TYPE_BI) ?
- "'" VCL_TEST_TOKEN_RUN_BI "'" : spc,
- vcl_test_type_str (cfg->test), cfg->test,
- cfg->ctrl_handle, cfg->ctrl_handle,
- is_client ? "'" VCL_TEST_TOKEN_NUM_TEST_SESS "'" : spc,
- cfg->num_test_sessions, cfg->num_test_sessions,
- is_client ? "'" VCL_TEST_TOKEN_VERBOSE "'" : spc,
- cfg->verbose ? "on" : "off", cfg->verbose,
- is_client ? "'" VCL_TEST_TOKEN_RXBUF_SIZE "'" : spc,
- cfg->rxbuf_size, cfg->rxbuf_size,
- is_client ? "'" VCL_TEST_TOKEN_TXBUF_SIZE "'" : spc,
- cfg->txbuf_size, cfg->txbuf_size,
- is_client ? "'" VCL_TEST_TOKEN_NUM_WRITES "'" : spc,
- cfg->num_writes, cfg->num_writes,
- cfg->total_bytes, cfg->total_bytes);
-}
-
static inline void
vcl_test_stats_dump (char *header, vcl_test_stats_t * stats,
uint8_t show_rx, uint8_t show_tx, uint8_t verbose)
@@ -366,31 +223,27 @@ vcl_test_stats_dump (char *header, vcl_test_stats_t * stats,
if (show_tx)
{
- printf (VCL_TEST_SEPARATOR_STRING
- " tx stats (0x%p):\n"
- VCL_TEST_SEPARATOR_STRING
+ printf (HS_TEST_SEPARATOR_STRING
+ " tx stats (0x%p):\n" HS_TEST_SEPARATOR_STRING
" writes: %lu (0x%08lx)\n"
" tx bytes: %lu (0x%08lx)\n"
" tx eagain: %u (0x%08x)\n"
" tx incomplete: %u (0x%08x)\n",
(void *) stats, stats->tx_xacts, stats->tx_xacts,
- stats->tx_bytes, stats->tx_bytes,
- stats->tx_eagain, stats->tx_eagain,
- stats->tx_incomp, stats->tx_incomp);
+ stats->tx_bytes, stats->tx_bytes, stats->tx_eagain,
+ stats->tx_eagain, stats->tx_incomp, stats->tx_incomp);
}
if (show_rx)
{
- printf (VCL_TEST_SEPARATOR_STRING
- " rx stats (0x%p):\n"
- VCL_TEST_SEPARATOR_STRING
+ printf (HS_TEST_SEPARATOR_STRING
+ " rx stats (0x%p):\n" HS_TEST_SEPARATOR_STRING
" reads: %lu (0x%08lx)\n"
" rx bytes: %lu (0x%08lx)\n"
" rx eagain: %u (0x%08x)\n"
" rx incomplete: %u (0x%08x)\n",
(void *) stats, stats->rx_xacts, stats->rx_xacts,
- stats->rx_bytes, stats->rx_bytes,
- stats->rx_eagain, stats->rx_eagain,
- stats->rx_incomp, stats->rx_incomp);
+ stats->rx_bytes, stats->rx_bytes, stats->rx_eagain,
+ stats->rx_eagain, stats->rx_incomp, stats->rx_incomp);
}
if (verbose)
printf (" start.tv_sec: %ld\n"
@@ -400,7 +253,7 @@ vcl_test_stats_dump (char *header, vcl_test_stats_t * stats,
stats->start.tv_sec, stats->start.tv_nsec,
stats->stop.tv_sec, stats->stop.tv_nsec);
- printf (VCL_TEST_SEPARATOR_STRING);
+ printf (HS_TEST_SEPARATOR_STRING);
}
static inline double
@@ -572,25 +425,18 @@ dump_help (void)
{
#define INDENT "\n "
- printf ("CLIENT: Test configuration commands:"
- INDENT VCL_TEST_TOKEN_HELP
- "\t\t\tDisplay help."
- INDENT VCL_TEST_TOKEN_EXIT
- "\t\t\tExit test client & server."
- INDENT VCL_TEST_TOKEN_SHOW_CFG
- "\t\t\tShow the current test cfg."
- INDENT VCL_TEST_TOKEN_RUN_UNI
- "\t\t\tRun the Uni-directional test."
- INDENT VCL_TEST_TOKEN_RUN_BI
- "\t\t\tRun the Bi-directional test."
- INDENT VCL_TEST_TOKEN_VERBOSE
- "\t\t\tToggle verbose setting."
- INDENT VCL_TEST_TOKEN_RXBUF_SIZE
- "<rxbuf size>\tRx buffer size (bytes)."
- INDENT VCL_TEST_TOKEN_TXBUF_SIZE
- "<txbuf size>\tTx buffer size (bytes)."
- INDENT VCL_TEST_TOKEN_NUM_WRITES
- "<# of writes>\tNumber of txbuf writes to server." "\n");
+ printf (
+ "CLIENT: Test configuration commands:" INDENT VCL_TEST_TOKEN_HELP
+ "\t\t\tDisplay help." INDENT VCL_TEST_TOKEN_EXIT
+ "\t\t\tExit test client & server." INDENT VCL_TEST_TOKEN_SHOW_CFG
+ "\t\t\tShow the current test cfg." INDENT HS_TEST_TOKEN_RUN_UNI
+ "\t\t\tRun the Uni-directional test." INDENT HS_TEST_TOKEN_RUN_BI
+ "\t\t\tRun the Bi-directional test." INDENT VCL_TEST_TOKEN_VERBOSE
+ "\t\t\tToggle verbose setting." INDENT VCL_TEST_TOKEN_RXBUF_SIZE
+ "<rxbuf size>\tRx buffer size (bytes)." INDENT VCL_TEST_TOKEN_TXBUF_SIZE
+ "<txbuf size>\tTx buffer size (bytes)." INDENT VCL_TEST_TOKEN_NUM_WRITES
+ "<# of writes>\tNumber of txbuf writes to server."
+ "\n");
}
#endif /* __vcl_test_h__ */
diff --git a/src/plugins/hs_apps/vcl/vcl_test_client.c b/src/plugins/hs_apps/vcl/vcl_test_client.c
index 1962e810fce..a4a10b562ff 100644
--- a/src/plugins/hs_apps/vcl/vcl_test_client.c
+++ b/src/plugins/hs_apps/vcl/vcl_test_client.c
@@ -52,7 +52,7 @@ struct vtc_worker_
};
pthread_t thread_handle;
vtc_worker_run_fn *wrk_run_fn;
- vcl_test_cfg_t cfg;
+ hs_test_cfg_t cfg;
};
typedef struct
@@ -62,7 +62,7 @@ typedef struct
vppcom_endpt_t server_endpt;
uint32_t cfg_seq_num;
uint8_t dump_cfg;
- vcl_test_t post_test;
+ hs_test_t post_test;
uint8_t proto;
uint8_t incremental_stats;
uint32_t n_workers;
@@ -85,14 +85,14 @@ vcl_test_main_t vcl_test_main;
static int
vtc_cfg_sync (vcl_test_session_t * ts)
{
- vcl_test_cfg_t *rx_cfg = (vcl_test_cfg_t *) ts->rxbuf;
+ hs_test_cfg_t *rx_cfg = (hs_test_cfg_t *) ts->rxbuf;
int rx_bytes, tx_bytes;
vt_atomic_add (&ts->cfg.seq_num, 1);
if (ts->cfg.verbose)
{
vtinf ("(fd %d): Sending config to server.", ts->fd);
- vcl_test_cfg_dump (&ts->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ts->cfg, 1 /* is_client */);
}
tx_bytes = ts->write (ts, &ts->cfg, sizeof (ts->cfg));
if (tx_bytes < 0)
@@ -101,36 +101,36 @@ vtc_cfg_sync (vcl_test_session_t * ts)
return tx_bytes;
}
- rx_bytes = ts->read (ts, ts->rxbuf, sizeof (vcl_test_cfg_t));
+ rx_bytes = ts->read (ts, ts->rxbuf, sizeof (hs_test_cfg_t));
if (rx_bytes < 0)
return rx_bytes;
- if (rx_cfg->magic != VCL_TEST_CFG_CTRL_MAGIC)
+ if (rx_cfg->magic != HS_TEST_CFG_CTRL_MAGIC)
{
vtwrn ("(fd %d): Bad server reply cfg -- aborting!", ts->fd);
return -1;
}
- if ((rx_bytes != sizeof (vcl_test_cfg_t))
- || !vcl_test_cfg_verify (rx_cfg, &ts->cfg))
+ if ((rx_bytes != sizeof (hs_test_cfg_t)) ||
+ !hs_test_cfg_verify (rx_cfg, &ts->cfg))
{
vtwrn ("(fd %d): Invalid config received from server!", ts->fd);
- if (rx_bytes != sizeof (vcl_test_cfg_t))
+ if (rx_bytes != sizeof (hs_test_cfg_t))
{
vtinf ("\tRx bytes %d != cfg size %lu", rx_bytes,
- sizeof (vcl_test_cfg_t));
+ sizeof (hs_test_cfg_t));
}
else
{
- vcl_test_cfg_dump (rx_cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (rx_cfg, 1 /* is_client */);
vtinf ("(fd %d): Valid config sent to server.", ts->fd);
- vcl_test_cfg_dump (&ts->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ts->cfg, 1 /* is_client */);
}
return -1;
}
if (ts->cfg.verbose)
{
vtinf ("(fd %d): Got config back from server.", ts->fd);
- vcl_test_cfg_dump (rx_cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (rx_cfg, 1 /* is_client */);
}
return 0;
@@ -179,8 +179,8 @@ vtc_worker_alloc_sessions (vcl_test_client_worker_t *wrk)
switch (ts->cfg.test)
{
- case VCL_TEST_TYPE_UNI:
- case VCL_TEST_TYPE_BI:
+ case HS_TEST_TYPE_UNI:
+ case HS_TEST_TYPE_BI:
for (j = 0; j < ts->txbuf_size; j++)
ts->txbuf[j] = j & 0xff;
break;
@@ -239,8 +239,7 @@ vtc_accumulate_stats (vcl_test_client_worker_t * wrk,
while (__sync_lock_test_and_set (&stats_lock, 1))
;
- if (ctrl->cfg.test == VCL_TEST_TYPE_BI
- || ctrl->cfg.test == VCL_TEST_TYPE_ECHO)
+ if (ctrl->cfg.test == HS_TEST_TYPE_BI || ctrl->cfg.test == HS_TEST_TYPE_ECHO)
show_rx = 1;
for (i = 0; i < wrk->cfg.num_test_sessions; i++)
@@ -373,7 +372,7 @@ vtc_worker_run_select (vcl_test_client_worker_t *wrk)
return rv;
}
- check_rx = wrk->cfg.test != VCL_TEST_TYPE_UNI;
+ check_rx = wrk->cfg.test != HS_TEST_TYPE_UNI;
n_active_sessions = wrk->cfg.num_test_sessions;
vtc_worker_start_transfer (wrk);
@@ -593,7 +592,7 @@ vtc_worker_run_epoll (vcl_test_client_worker_t *wrk)
}
n_active_sessions = rv;
- check_rx = wrk->cfg.test != VCL_TEST_TYPE_UNI;
+ check_rx = wrk->cfg.test != HS_TEST_TYPE_UNI;
vtc_worker_start_transfer (wrk);
ts = wrk->next_to_send;
@@ -729,46 +728,43 @@ done:
static void
vtc_print_stats (vcl_test_session_t * ctrl)
{
- int is_echo = ctrl->cfg.test == VCL_TEST_TYPE_ECHO;
+ int is_echo = ctrl->cfg.test == HS_TEST_TYPE_ECHO;
int show_rx = 0;
char buf[64];
- if (ctrl->cfg.test == VCL_TEST_TYPE_BI
- || ctrl->cfg.test == VCL_TEST_TYPE_ECHO)
+ if (ctrl->cfg.test == HS_TEST_TYPE_BI || ctrl->cfg.test == HS_TEST_TYPE_ECHO)
show_rx = 1;
vcl_test_stats_dump ("CLIENT RESULTS", &ctrl->stats,
show_rx, 1 /* show tx */ ,
ctrl->cfg.verbose);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
if (ctrl->cfg.verbose)
{
- vtinf (" ctrl session info\n"
- VCL_TEST_SEPARATOR_STRING
+ vtinf (" ctrl session info\n" HS_TEST_SEPARATOR_STRING
" fd: %d (0x%08x)\n"
" rxbuf: %p\n"
" rxbuf size: %u (0x%08x)\n"
" txbuf: %p\n"
- " txbuf size: %u (0x%08x)\n"
- VCL_TEST_SEPARATOR_STRING,
- ctrl->fd, (uint32_t) ctrl->fd,
- ctrl->rxbuf, ctrl->rxbuf_size, ctrl->rxbuf_size,
- ctrl->txbuf, ctrl->txbuf_size, ctrl->txbuf_size);
+ " txbuf size: %u (0x%08x)\n" HS_TEST_SEPARATOR_STRING,
+ ctrl->fd, (uint32_t) ctrl->fd, ctrl->rxbuf, ctrl->rxbuf_size,
+ ctrl->rxbuf_size, ctrl->txbuf, ctrl->txbuf_size,
+ ctrl->txbuf_size);
}
if (is_echo)
snprintf (buf, sizeof (buf), "Echo");
else
snprintf (buf, sizeof (buf), "%s-directional Stream",
- ctrl->cfg.test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
+ ctrl->cfg.test == HS_TEST_TYPE_BI ? "Bi" : "Uni");
}
static void
vtc_echo_client (vcl_test_client_main_t * vcm)
{
vcl_test_session_t *ctrl = &vcm->ctrl_session;
- vcl_test_cfg_t *cfg = &ctrl->cfg;
+ hs_test_cfg_t *cfg = &ctrl->cfg;
int rv;
cfg->total_bytes = strlen (ctrl->txbuf) + 1;
@@ -788,12 +784,12 @@ static void
vtc_stream_client (vcl_test_client_main_t * vcm)
{
vcl_test_session_t *ctrl = &vcm->ctrl_session;
- vcl_test_cfg_t *cfg = &ctrl->cfg;
+ hs_test_cfg_t *cfg = &ctrl->cfg;
vcl_test_client_worker_t *wrk;
uint32_t i, n_conn, n_conn_per_wrk;
vtinf ("%s-directional Stream Test Starting!",
- ctrl->cfg.test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
+ ctrl->cfg.test == HS_TEST_TYPE_BI ? "Bi" : "Uni");
memset (&ctrl->stats, 0, sizeof (vcl_test_stats_t));
cfg->total_bytes = cfg->num_writes * cfg->txbuf_size;
@@ -811,7 +807,7 @@ vtc_stream_client (vcl_test_client_main_t * vcm)
}
vcm->test_running = 1;
- ctrl->cfg.cmd = VCL_TEST_CMD_START;
+ ctrl->cfg.cmd = HS_TEST_CMD_START;
if (vtc_cfg_sync (ctrl))
{
vtwrn ("test cfg sync failed -- aborting!");
@@ -834,7 +830,7 @@ vtc_stream_client (vcl_test_client_main_t * vcm)
;
vtinf ("Sending config on ctrl session (fd %d) for stats...", ctrl->fd);
- ctrl->cfg.cmd = VCL_TEST_CMD_STOP;
+ ctrl->cfg.cmd = HS_TEST_CMD_STOP;
if (vtc_cfg_sync (ctrl))
{
vtwrn ("test cfg sync failed -- aborting!");
@@ -843,8 +839,8 @@ vtc_stream_client (vcl_test_client_main_t * vcm)
vtc_print_stats (ctrl);
- ctrl->cfg.cmd = VCL_TEST_CMD_SYNC;
- ctrl->cfg.test = VCL_TEST_TYPE_ECHO;
+ ctrl->cfg.cmd = HS_TEST_CMD_SYNC;
+ ctrl->cfg.test = HS_TEST_TYPE_ECHO;
ctrl->cfg.total_bytes = 0;
if (vtc_cfg_sync (ctrl))
vtwrn ("post-test cfg sync failed!");
@@ -864,7 +860,7 @@ cfg_txbuf_size_set (void)
ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
vcl_test_buf_alloc (&ctrl->cfg, 0 /* is_rxbuf */ ,
(uint8_t **) & ctrl->txbuf, &ctrl->txbuf_size);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
else
vtwrn ("Invalid txbuf size (%lu) < minimum buf size (%u)!",
@@ -883,7 +879,7 @@ cfg_num_writes_set (void)
{
ctrl->cfg.num_writes = num_writes;
ctrl->cfg.total_bytes = ctrl->cfg.num_writes * ctrl->cfg.txbuf_size;
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
else
{
@@ -903,7 +899,7 @@ cfg_num_test_sessions_set (void)
(num_test_sessions <= VCL_TEST_CFG_MAX_TEST_SESS))
{
ctrl->cfg.num_test_sessions = num_test_sessions;
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
else
{
@@ -925,7 +921,7 @@ cfg_rxbuf_size_set (void)
ctrl->cfg.rxbuf_size = rxbuf_size;
vcl_test_buf_alloc (&ctrl->cfg, 1 /* is_rxbuf */ ,
(uint8_t **) & ctrl->rxbuf, &ctrl->rxbuf_size);
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
else
vtwrn ("Invalid rxbuf size (%lu) < minimum buf size (%u)!",
@@ -939,20 +935,19 @@ cfg_verbose_toggle (void)
vcl_test_session_t *ctrl = &vcm->ctrl_session;
ctrl->cfg.verbose = ctrl->cfg.verbose ? 0 : 1;
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
-
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
}
-static vcl_test_t
+static hs_test_t
parse_input ()
{
vcl_test_client_main_t *vcm = &vcl_client_main;
vcl_test_session_t *ctrl = &vcm->ctrl_session;
- vcl_test_t rv = VCL_TEST_TYPE_NONE;
+ hs_test_t rv = HS_TEST_TYPE_NONE;
if (!strncmp (VCL_TEST_TOKEN_EXIT, ctrl->txbuf,
strlen (VCL_TEST_TOKEN_EXIT)))
- rv = VCL_TEST_TYPE_EXIT;
+ rv = HS_TEST_TYPE_EXIT;
else if (!strncmp (VCL_TEST_TOKEN_HELP, ctrl->txbuf,
strlen (VCL_TEST_TOKEN_HELP)))
@@ -982,16 +977,16 @@ parse_input ()
strlen (VCL_TEST_TOKEN_RXBUF_SIZE)))
cfg_rxbuf_size_set ();
- else if (!strncmp (VCL_TEST_TOKEN_RUN_UNI, ctrl->txbuf,
- strlen (VCL_TEST_TOKEN_RUN_UNI)))
- rv = ctrl->cfg.test = VCL_TEST_TYPE_UNI;
+ else if (!strncmp (HS_TEST_TOKEN_RUN_UNI, ctrl->txbuf,
+ strlen (HS_TEST_TOKEN_RUN_UNI)))
+ rv = ctrl->cfg.test = HS_TEST_TYPE_UNI;
- else if (!strncmp (VCL_TEST_TOKEN_RUN_BI, ctrl->txbuf,
- strlen (VCL_TEST_TOKEN_RUN_BI)))
- rv = ctrl->cfg.test = VCL_TEST_TYPE_BI;
+ else if (!strncmp (HS_TEST_TOKEN_RUN_BI, ctrl->txbuf,
+ strlen (HS_TEST_TOKEN_RUN_BI)))
+ rv = ctrl->cfg.test = HS_TEST_TYPE_BI;
else
- rv = VCL_TEST_TYPE_ECHO;
+ rv = HS_TEST_TYPE_ECHO;
return rv;
}
@@ -1088,11 +1083,11 @@ vtc_process_opts (vcl_test_client_main_t * vcm, int argc, char **argv)
break;
case 'X':
- vcm->post_test = VCL_TEST_TYPE_EXIT;
+ vcm->post_test = HS_TEST_TYPE_EXIT;
break;
case 'x':
- vcm->post_test = VCL_TEST_TYPE_NONE;
+ vcm->post_test = HS_TEST_TYPE_NONE;
break;
case 'E':
@@ -1103,7 +1098,7 @@ vtc_process_opts (vcl_test_client_main_t * vcm, int argc, char **argv)
print_usage_and_exit ();
}
strncpy (ctrl->txbuf, optarg, ctrl->txbuf_size);
- ctrl->cfg.test = VCL_TEST_TYPE_ECHO;
+ ctrl->cfg.test = HS_TEST_TYPE_ECHO;
break;
case 'N':
@@ -1179,11 +1174,11 @@ vtc_process_opts (vcl_test_client_main_t * vcm, int argc, char **argv)
break;
case 'U':
- ctrl->cfg.test = VCL_TEST_TYPE_UNI;
+ ctrl->cfg.test = HS_TEST_TYPE_UNI;
break;
case 'B':
- ctrl->cfg.test = VCL_TEST_TYPE_BI;
+ ctrl->cfg.test = HS_TEST_TYPE_BI;
break;
case 'V':
@@ -1299,13 +1294,13 @@ vtc_ctrl_session_exit (void)
int verbose = ctrl->cfg.verbose;
/* Only clients exits, server can accept new connections */
- if (vcm->post_test == VCL_TEST_TYPE_EXIT_CLIENT)
+ if (vcm->post_test == HS_TEST_TYPE_EXIT_CLIENT)
return;
- ctrl->cfg.test = VCL_TEST_TYPE_EXIT;
+ ctrl->cfg.test = HS_TEST_TYPE_EXIT;
vtinf ("(fd %d): Sending exit cfg to server...", ctrl->fd);
if (verbose)
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
(void) vcl_test_write (ctrl, (uint8_t *) &ctrl->cfg, sizeof (ctrl->cfg));
sleep (1);
}
@@ -1334,7 +1329,7 @@ vtc_ctrl_session_init (vcl_test_client_main_t *vcm, vcl_test_session_t *ctrl)
ctrl->read = vcl_test_read;
ctrl->write = vcl_test_write;
- ctrl->cfg.cmd = VCL_TEST_CMD_SYNC;
+ ctrl->cfg.cmd = HS_TEST_CMD_SYNC;
rv = vtc_cfg_sync (ctrl);
if (rv)
{
@@ -1342,7 +1337,7 @@ vtc_ctrl_session_init (vcl_test_client_main_t *vcm, vcl_test_session_t *ctrl)
return rv;
}
- ctrl->cfg.ctrl_handle = ((vcl_test_cfg_t *) ctrl->rxbuf)->ctrl_handle;
+ ctrl->cfg.ctrl_handle = ((hs_test_cfg_t *) ctrl->rxbuf)->ctrl_handle;
memset (&ctrl->stats, 0, sizeof (ctrl->stats));
return 0;
@@ -1400,9 +1395,9 @@ main (int argc, char **argv)
int rv;
vcm->n_workers = 1;
- vcm->post_test = VCL_TEST_TYPE_EXIT_CLIENT;
+ vcm->post_test = HS_TEST_TYPE_EXIT_CLIENT;
- vcl_test_cfg_init (&ctrl->cfg);
+ hs_test_cfg_init (&ctrl->cfg);
vt_incercept_sigs ();
vcl_test_session_buf_alloc (ctrl);
vtc_process_opts (vcm, argc, argv);
@@ -1425,57 +1420,57 @@ main (int argc, char **argv)
vtfail ("vppcom_session_create() ctrl session", rv);
/* Update ctrl port to data port */
- vcm->server_endpt.port += 1;
+ vcm->server_endpt.port = hs_make_data_port (vcm->server_endpt.port);
- while (ctrl->cfg.test != VCL_TEST_TYPE_EXIT)
+ while (ctrl->cfg.test != HS_TEST_TYPE_EXIT)
{
if (vcm->dump_cfg)
{
- vcl_test_cfg_dump (&ctrl->cfg, 1 /* is_client */ );
+ hs_test_cfg_dump (&ctrl->cfg, 1 /* is_client */);
vcm->dump_cfg = 0;
}
switch (ctrl->cfg.test)
{
- case VCL_TEST_TYPE_ECHO:
+ case HS_TEST_TYPE_ECHO:
vtc_echo_client (vcm);
break;
- case VCL_TEST_TYPE_UNI:
- case VCL_TEST_TYPE_BI:
+ case HS_TEST_TYPE_UNI:
+ case HS_TEST_TYPE_BI:
vtc_stream_client (vcm);
break;
- case VCL_TEST_TYPE_EXIT:
+ case HS_TEST_TYPE_EXIT:
continue;
- case VCL_TEST_TYPE_NONE:
+ case HS_TEST_TYPE_NONE:
default:
break;
}
switch (vcm->post_test)
{
- case VCL_TEST_TYPE_EXIT:
- case VCL_TEST_TYPE_EXIT_CLIENT:
+ case HS_TEST_TYPE_EXIT:
+ case HS_TEST_TYPE_EXIT_CLIENT:
switch (ctrl->cfg.test)
{
- case VCL_TEST_TYPE_EXIT:
- case VCL_TEST_TYPE_UNI:
- case VCL_TEST_TYPE_BI:
- case VCL_TEST_TYPE_ECHO:
- ctrl->cfg.test = VCL_TEST_TYPE_EXIT;
+ case HS_TEST_TYPE_EXIT:
+ case HS_TEST_TYPE_UNI:
+ case HS_TEST_TYPE_BI:
+ case HS_TEST_TYPE_ECHO:
+ ctrl->cfg.test = HS_TEST_TYPE_EXIT;
continue;
- case VCL_TEST_TYPE_NONE:
+ case HS_TEST_TYPE_NONE:
default:
break;
}
break;
- case VCL_TEST_TYPE_NONE:
- case VCL_TEST_TYPE_ECHO:
- case VCL_TEST_TYPE_UNI:
- case VCL_TEST_TYPE_BI:
+ case HS_TEST_TYPE_NONE:
+ case HS_TEST_TYPE_ECHO:
+ case HS_TEST_TYPE_UNI:
+ case HS_TEST_TYPE_BI:
default:
break;
}
diff --git a/src/plugins/hs_apps/vcl/vcl_test_protos.c b/src/plugins/hs_apps/vcl/vcl_test_protos.c
index 97d64b5f10d..cd1ac2b24f4 100644
--- a/src/plugins/hs_apps/vcl/vcl_test_protos.c
+++ b/src/plugins/hs_apps/vcl/vcl_test_protos.c
@@ -276,7 +276,7 @@ vt_add_cert_key_pair ()
}
static int
-vt_tls_init (vcl_test_cfg_t *cfg)
+vt_tls_init (hs_test_cfg_t *cfg)
{
return vt_add_cert_key_pair ();
}
@@ -384,7 +384,7 @@ static const vcl_test_proto_vft_t vcl_test_tls = {
VCL_TEST_REGISTER_PROTO (VPPCOM_PROTO_TLS, vcl_test_tls);
static int
-vt_dtls_init (vcl_test_cfg_t *cfg)
+vt_dtls_init (hs_test_cfg_t *cfg)
{
return vt_add_cert_key_pair ();
}
@@ -492,7 +492,7 @@ static const vcl_test_proto_vft_t vcl_test_dtls = {
VCL_TEST_REGISTER_PROTO (VPPCOM_PROTO_DTLS, vcl_test_dtls);
static int
-vt_quic_init (vcl_test_cfg_t *cfg)
+vt_quic_init (hs_test_cfg_t *cfg)
{
vcl_test_main_t *vt = &vcl_test_main;
diff --git a/src/plugins/hs_apps/vcl/vcl_test_server.c b/src/plugins/hs_apps/vcl/vcl_test_server.c
index b7731d365d0..6ce91301419 100644
--- a/src/plugins/hs_apps/vcl/vcl_test_server.c
+++ b/src/plugins/hs_apps/vcl/vcl_test_server.c
@@ -106,7 +106,7 @@ again:
conn->endpt.ip = wrk->conn_pool[i].ip;
conn->is_alloc = 1;
conn->session_index = i;
- vcl_test_cfg_init (&conn->cfg);
+ hs_test_cfg_init (&conn->cfg);
return (&wrk->conn_pool[i]);
}
}
@@ -130,7 +130,7 @@ conn_pool_free (vcl_test_session_t *ts)
}
static inline void
-sync_config_and_reply (vcl_test_session_t *conn, vcl_test_cfg_t *rx_cfg)
+sync_config_and_reply (vcl_test_session_t *conn, hs_test_cfg_t *rx_cfg)
{
conn->cfg = *rx_cfg;
vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */, (uint8_t **) &conn->rxbuf,
@@ -140,7 +140,7 @@ sync_config_and_reply (vcl_test_session_t *conn, vcl_test_cfg_t *rx_cfg)
if (conn->cfg.verbose)
{
vtinf ("(fd %d): Replying to cfg message!\n", conn->fd);
- vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (&conn->cfg, 0 /* is_client */);
}
(void) vcl_test_write (conn, &conn->cfg, sizeof (conn->cfg));
}
@@ -185,14 +185,14 @@ vts_wrk_cleanup_all (vcl_test_server_worker_t *wrk)
static void
vts_test_cmd (vcl_test_server_worker_t *wrk, vcl_test_session_t *conn,
- vcl_test_cfg_t *rx_cfg)
+ hs_test_cfg_t *rx_cfg)
{
- u8 is_bi = rx_cfg->test == VCL_TEST_TYPE_BI;
+ u8 is_bi = rx_cfg->test == HS_TEST_TYPE_BI;
vcl_test_session_t *tc;
char buf[64];
int i;
- if (rx_cfg->cmd == VCL_TEST_CMD_STOP)
+ if (rx_cfg->cmd == HS_TEST_CMD_STOP)
{
struct timespec stop;
clock_gettime (CLOCK_REALTIME, &stop);
@@ -232,25 +232,25 @@ vts_test_cmd (vcl_test_server_worker_t *wrk, vcl_test_session_t *conn,
vcl_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */ ,
is_bi /* show_tx */ , conn->cfg.verbose);
- vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (&conn->cfg, 0 /* is_client */);
if (conn->cfg.verbose)
{
- vtinf (" vcl server main\n" VCL_TEST_SEPARATOR_STRING
+ vtinf (" vcl server main\n" HS_TEST_SEPARATOR_STRING
" buf: %p\n"
- " buf size: %u (0x%08x)\n" VCL_TEST_SEPARATOR_STRING,
+ " buf size: %u (0x%08x)\n" HS_TEST_SEPARATOR_STRING,
conn->rxbuf, conn->rxbuf_size, conn->rxbuf_size);
}
sync_config_and_reply (conn, rx_cfg);
memset (&conn->stats, 0, sizeof (conn->stats));
}
- else if (rx_cfg->cmd == VCL_TEST_CMD_SYNC)
+ else if (rx_cfg->cmd == HS_TEST_CMD_SYNC)
{
rx_cfg->ctrl_handle = conn->fd;
vtinf ("Set control fd %d for test!", conn->fd);
sync_config_and_reply (conn, rx_cfg);
}
- else if (rx_cfg->cmd == VCL_TEST_CMD_START)
+ else if (rx_cfg->cmd == HS_TEST_CMD_START)
{
vtinf ("Starting %s-directional Stream Test (fd %d)!",
is_bi ? "Bi" : "Uni", conn->fd);
@@ -268,7 +268,7 @@ vts_server_process_rx (vcl_test_session_t *conn, int rx_bytes)
{
vcl_test_server_main_t *vsm = &vcl_server_main;
- if (conn->cfg.test == VCL_TEST_TYPE_BI)
+ if (conn->cfg.test == HS_TEST_TYPE_BI)
{
if (vsm->use_ds)
{
@@ -523,13 +523,13 @@ vcl_test_server_process_opts (vcl_test_server_main_t * vsm, int argc,
}
int
-vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, vcl_test_cfg_t *rx_cfg,
+vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, hs_test_cfg_t *rx_cfg,
vcl_test_session_t *conn, int rx_bytes)
{
if (rx_cfg->verbose)
{
vtinf ("(fd %d): Received a cfg msg!", conn->fd);
- vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
}
if (rx_bytes != sizeof (*rx_cfg))
@@ -541,7 +541,7 @@ vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, vcl_test_cfg_t *rx_cfg,
if (conn->cfg.verbose)
{
vtinf ("(fd %d): Replying to cfg msg", conn->fd);
- vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
}
conn->write (conn, &conn->cfg, sizeof (conn->cfg));
return -1;
@@ -549,17 +549,17 @@ vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, vcl_test_cfg_t *rx_cfg,
switch (rx_cfg->test)
{
- case VCL_TEST_TYPE_NONE:
- case VCL_TEST_TYPE_ECHO:
+ case HS_TEST_TYPE_NONE:
+ case HS_TEST_TYPE_ECHO:
sync_config_and_reply (conn, rx_cfg);
break;
- case VCL_TEST_TYPE_BI:
- case VCL_TEST_TYPE_UNI:
+ case HS_TEST_TYPE_BI:
+ case HS_TEST_TYPE_UNI:
vts_test_cmd (wrk, conn, rx_cfg);
break;
- case VCL_TEST_TYPE_EXIT:
+ case HS_TEST_TYPE_EXIT:
vtinf ("Ctrl session fd %d closing!", conn->fd);
vts_session_cleanup (conn);
wrk->nfds--;
@@ -570,7 +570,7 @@ vts_handle_ctrl_cfg (vcl_test_server_worker_t *wrk, vcl_test_cfg_t *rx_cfg,
default:
vtwrn ("Unknown test type %d", rx_cfg->test);
- vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
+ hs_test_cfg_dump (rx_cfg, 0 /* is_client */);
break;
}
@@ -652,7 +652,7 @@ vts_worker_loop (void *arg)
vcl_test_server_worker_t *wrk = arg;
vcl_test_session_t *conn;
int i, rx_bytes, num_ev;
- vcl_test_cfg_t *rx_cfg;
+ hs_test_cfg_t *rx_cfg;
if (wrk->wrk_index)
vts_worker_init (wrk);
@@ -726,8 +726,8 @@ vts_worker_loop (void *arg)
if (!wrk->wrk_index && conn->fd == vsm->ctrl->fd)
{
rx_bytes = conn->read (conn, conn->rxbuf, conn->rxbuf_size);
- rx_cfg = (vcl_test_cfg_t *) conn->rxbuf;
- if (rx_cfg->magic == VCL_TEST_CFG_CTRL_MAGIC)
+ rx_cfg = (hs_test_cfg_t *) conn->rxbuf;
+ if (rx_cfg->magic == HS_TEST_CFG_CTRL_MAGIC)
{
vts_handle_ctrl_cfg (wrk, rx_cfg, conn, rx_bytes);
if (!wrk->nfds)
@@ -855,7 +855,7 @@ main (int argc, char **argv)
vts_ctrl_session_init (&vsm->workers[0]);
/* Update ctrl port to data port */
- vsm->server_cfg.endpt.port += 1;
+ vsm->server_cfg.endpt.port = hs_make_data_port (vsm->server_cfg.endpt.port);
vts_worker_init (&vsm->workers[0]);
for (i = 1; i < vsm->server_cfg.workers; i++)
{