FD.io VPP  v21.01.1
Vector Packet Processing
sock_test_server.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <unistd.h>
17 #include <errno.h>
18 #include <sys/types.h>
19 #include <sys/socket.h>
20 #include <stdio.h>
21 #include <string.h>
22 #include <time.h>
23 #include <ctype.h>
24 #include <hs_apps/vcl/sock_test.h>
25 #include <sys/stat.h>
26 #include <fcntl.h>
27 #include <sys/ioctl.h>
28 #include <sys/epoll.h>
29 #include <sys/un.h>
30 
31 #define SOCK_SERVER_MAX_TEST_CONN 10
32 #define SOCK_SERVER_MAX_EPOLL_EVENTS 10
33 
34 typedef struct
35 {
36  uint8_t is_alloc;
37  int fd;
38  uint8_t *buf;
39  uint32_t buf_size;
43 
44 typedef struct
45 {
46  uint32_t port;
47  uint32_t address_ip6;
48  uint32_t transport_udp;
50 
51 typedef struct
52 {
53  int listen_fd;
55  int epfd;
56  struct epoll_event listen_ev;
57  struct epoll_event wait_events[SOCK_SERVER_MAX_EPOLL_EVENTS];
60  struct epoll_event af_unix_listen_ev;
61  struct sockaddr_un serveraddr;
62  uint32_t af_unix_xacts;
63  size_t num_conn;
66  int nfds;
67  fd_set rd_fdset;
68  fd_set wr_fdset;
69  struct timeval timeout;
71 
73 
74 static inline void
75 conn_pool_expand (size_t expand_size)
76 {
78  sock_server_conn_t *conn_pool;
79  size_t new_size = ssm->conn_pool_size + expand_size;
80  int i;
81 
82  conn_pool = realloc (ssm->conn_pool, new_size * sizeof (*ssm->conn_pool));
83  if (!conn_pool)
84  stfail ("conn_pool_expand()");
85 
86  for (i = ssm->conn_pool_size; i < new_size; i++)
87  {
88  sock_server_conn_t *conn = &conn_pool[i];
89  memset (conn, 0, sizeof (*conn));
90  vcl_test_cfg_init (&conn->cfg);
91  vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ , &conn->buf,
92  &conn->buf_size);
93  conn->cfg.txbuf_size = conn->cfg.rxbuf_size;
94  }
95 
96  ssm->conn_pool = conn_pool;
97  ssm->conn_pool_size = new_size;
98 }
99 
100 static inline sock_server_conn_t *
102 {
104  int i;
105 
106  for (i = 0; i < ssm->conn_pool_size; i++)
107  {
108  if (!ssm->conn_pool[i].is_alloc)
109  {
110  ssm->conn_pool[i].is_alloc = 1;
111  return (&ssm->conn_pool[i]);
112  }
113  }
114 
115  return 0;
116 }
117 
118 static inline void
120 {
121  conn->fd = 0;
122  conn->is_alloc = 0;
123 }
124 
125 static inline void
127 {
128  conn->cfg = *rx_cfg;
129  vcl_test_buf_alloc (&conn->cfg, 1 /* is_rxbuf */ ,
130  &conn->buf, &conn->buf_size);
131  conn->cfg.txbuf_size = conn->cfg.rxbuf_size;
132 
133  if (conn->cfg.verbose)
134  {
135  stinf ("(fd %d): Replying to cfg message!\n", conn->fd);
136  vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
137  }
138  (void) sock_test_write (conn->fd, (uint8_t *) & conn->cfg,
139  sizeof (conn->cfg), NULL, conn->cfg.verbose);
140 }
141 
142 static void
144  vcl_test_cfg_t * rx_cfg)
145 {
147  int client_fd = conn->fd;
148  vcl_test_t test = rx_cfg->test;
149 
150  if (rx_cfg->ctrl_handle == conn->fd)
151  {
152  int i;
153  clock_gettime (CLOCK_REALTIME, &conn->stats.stop);
154 
155  for (i = 0; i < ssm->conn_pool_size; i++)
156  {
157  sock_server_conn_t *tc = &ssm->conn_pool[i];
158 
159  if (tc->cfg.ctrl_handle == conn->fd)
160  {
161  vcl_test_stats_accumulate (&conn->stats, &tc->stats);
162 
163  if (conn->cfg.verbose)
164  {
165  static char buf[64];
166 
167  snprintf (buf, sizeof (buf), "SERVER (fd %d) RESULTS",
168  tc->fd);
169  vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
170  test == VCL_TEST_TYPE_BI
171  /* show tx */ ,
172  conn->cfg.verbose);
173  }
174  }
175  }
176 
177  vcl_test_stats_dump ("SERVER RESULTS", &conn->stats, 1 /* show_rx */ ,
178  (test == VCL_TEST_TYPE_BI) /* show_tx */ ,
179  conn->cfg.verbose);
180  vcl_test_cfg_dump (&conn->cfg, 0 /* is_client */ );
181  if (conn->cfg.verbose)
182  {
183  stinf (" sock server main\n"
185  " buf: %p\n"
186  " buf size: %u (0x%08x)\n"
188  conn->buf, conn->buf_size, conn->buf_size);
189  }
190 
191  sync_config_and_reply (conn, rx_cfg);
192  stinf ("SERVER (fd %d): %s-directional Stream Test Complete!\n"
193  SOCK_TEST_BANNER_STRING "\n", conn->fd,
194  test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
195  }
196  else
197  {
199  "SERVER (fd %d): %s-directional Stream Test!\n"
200  " Sending client the test cfg to start streaming data...\n",
201  client_fd, test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
202 
203  rx_cfg->ctrl_handle = (rx_cfg->ctrl_handle == ~0) ? conn->fd :
204  rx_cfg->ctrl_handle;
205 
206  sync_config_and_reply (conn, rx_cfg);
207 
208  /* read the 1st chunk, record start time */
209  memset (&conn->stats, 0, sizeof (conn->stats));
210  clock_gettime (CLOCK_REALTIME, &conn->stats.start);
211  }
212 }
213 
214 
215 static inline void
217 {
218  int client_fd = conn->fd;
219  vcl_test_t test = conn->cfg.test;
220 
221  if (test == VCL_TEST_TYPE_BI)
222  (void) sock_test_write (client_fd, conn->buf, rx_bytes, &conn->stats,
223  conn->cfg.verbose);
224 
225  if (conn->stats.rx_bytes >= conn->cfg.total_bytes)
226  {
227  clock_gettime (CLOCK_REALTIME, &conn->stats.stop);
228  }
229 }
230 
231 static inline void
233 {
235  int af_unix_client_fd, rv;
236  uint8_t buffer[256];
237  size_t nbytes = strlen (SOCK_TEST_MIXED_EPOLL_DATA) + 1;
238 
239  af_unix_client_fd = accept (ssm->af_unix_listen_fd,
240  (struct sockaddr *) NULL, NULL);
241  if (af_unix_client_fd < 0)
242  stfail ("af_unix_echo accept()");
243 
244  stinf ("Got an AF_UNIX connection -- fd = %d (0x%08x)!",
245  af_unix_client_fd, af_unix_client_fd);
246 
247  memset (buffer, 0, sizeof (buffer));
248 
249  rv = read (af_unix_client_fd, buffer, nbytes);
250  if (rv < 0)
251  stfail ("af_unix_echo read()");
252 
253  /* Make the buffer is NULL-terminated. */
254  buffer[sizeof (buffer) - 1] = 0;
255  stinf ("(AF_UNIX): RX (%d bytes) - '%s'", rv, buffer);
256 
257  if (!strncmp (SOCK_TEST_MIXED_EPOLL_DATA, (const char *) buffer, nbytes))
258  {
259  rv = write (af_unix_client_fd, buffer, nbytes);
260  if (rv < 0)
261  stfail ("af_unix_echo write()");
262  stinf ("(AF_UNIX): TX (%d bytes) - '%s'\n", rv, buffer);
263  ssm->af_unix_xacts++;
264  }
265  close (af_unix_client_fd);
266 }
267 
268 static inline void
270 {
272  int client_fd;
273  sock_server_conn_t *conn;
274 
275  if (ssm->conn_pool_size < (ssm->num_conn + SOCK_SERVER_MAX_TEST_CONN + 1))
277 
278  conn = conn_pool_alloc ();
279  if (!conn)
280  stfail ("No free connections!");
281 
282  client_fd = accept (ssm->listen_fd, (struct sockaddr *) NULL, NULL);
283  if (client_fd < 0)
284  stfail ("new_client accept()");
285 
286  stinf ("Got a connection -- fd = %d (0x%08x)!\n", client_fd, client_fd);
287  if (fcntl (client_fd, F_SETFL, O_NONBLOCK) < 0)
288  stfail ("fcntl()");
289 
290  conn->fd = client_fd;
291 
292  struct epoll_event ev;
293  int rv;
294 
295  ev.events = EPOLLIN;
296  ev.data.u64 = conn - ssm->conn_pool;
297  rv = epoll_ctl (ssm->epfd, EPOLL_CTL_ADD, client_fd, &ev);
298 
299  if (rv < 0)
300  stfail ("new_client epoll_ctl()");
301 
302  ssm->nfds++;
303 }
304 
305 static int
307 {
308  int rv;
309 
310  if (ssm->af_unix_listen_fd > 0)
311  return 0;
312 
313  unlink ((const char *) SOCK_TEST_AF_UNIX_FILENAME);
314  ssm->af_unix_listen_fd = socket (AF_UNIX, SOCK_STREAM, 0);
315  if (ssm->af_unix_listen_fd < 0)
316  stfail ("echo_af_unix_init socket()");
317 
318  memset (&ssm->serveraddr, 0, sizeof (ssm->serveraddr));
319  ssm->serveraddr.sun_family = AF_UNIX;
320  strncpy (ssm->serveraddr.sun_path, SOCK_TEST_AF_UNIX_FILENAME,
321  sizeof (ssm->serveraddr.sun_path));
322 
323  rv = bind (ssm->af_unix_listen_fd, (struct sockaddr *) &ssm->serveraddr,
324  SUN_LEN (&ssm->serveraddr));
325  if (rv < 0)
326  stfail ("echo_af_unix_init bind()");
327 
328  rv = listen (ssm->af_unix_listen_fd, 10);
329  if (rv < 0)
330  stfail ("echo_af_unix_init listen()");
331 
332  ssm->af_unix_listen_ev.events = EPOLLIN;
334  rv = epoll_ctl (ssm->epfd, EPOLL_CTL_ADD, ssm->af_unix_listen_fd,
335  &ssm->af_unix_listen_ev);
336  if (rv < 0)
337  stfail ("echo_af_unix_init epoll_ctl()");
338 
339  return 0;
340 }
341 
342 void
344 {
345  fprintf (stderr,
346  "sock_test_server [OPTIONS] <port>\n"
347  " OPTIONS\n"
348  " -h Print this message and exit.\n"
349  " -6 Use IPv6\n"
350  " -u Use UDP transport layer\n");
351  exit (1);
352 }
353 
354 
355 static void
356 sts_server_echo (sock_server_conn_t * conn, int rx_bytes)
357 {
358  int tx_bytes, nbytes, pos;
359 
360  /* If it looks vaguely like a string make sure it's terminated */
361  pos = rx_bytes < conn->buf_size ? rx_bytes : conn->buf_size - 1;
362  ((char *) conn->buf)[pos] = 0;
363 
364  if (conn->cfg.verbose)
365  stinf ("(fd %d): Echoing back\n", conn->fd);
366 
367  nbytes = strlen ((const char *) conn->buf) + 1;
368 
369  tx_bytes = sock_test_write (conn->fd, conn->buf, nbytes, &conn->stats,
370  conn->cfg.verbose);
371  if (tx_bytes >= 0)
372  stinf ("(fd %d): TX (%d bytes) - '%s'\n", conn->fd, tx_bytes, conn->buf);
373 }
374 
375 static int
377  int rx_bytes)
378 {
380 
381  if (rx_cfg->verbose)
382  {
383  stinf ("(fd %d): Received a cfg message!\n", conn->fd);
384  vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
385  }
386 
387  if (rx_bytes != sizeof (*rx_cfg))
388  {
389  stinf ("(fd %d): Invalid cfg message size (%d) expected %lu!", conn->fd,
390  rx_bytes, sizeof (*rx_cfg));
391  conn->cfg.rxbuf_size = 0;
392  conn->cfg.num_writes = 0;
393  if (conn->cfg.verbose)
394  {
395  stinf ("(fd %d): Replying to cfg message!\n", conn->fd);
396  vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
397  }
398  sock_test_write (conn->fd, (uint8_t *) & conn->cfg, sizeof (conn->cfg),
399  NULL, conn->cfg.verbose);
400  return -1;
401  }
402 
403  switch (rx_cfg->test)
404  {
405  case VCL_TEST_TYPE_NONE:
406  sync_config_and_reply (conn, rx_cfg);
407  break;
408 
409  case VCL_TEST_TYPE_ECHO:
411  goto done;
412 
413  sync_config_and_reply (conn, rx_cfg);
414  break;
415 
416  case VCL_TEST_TYPE_BI:
417  case VCL_TEST_TYPE_UNI:
418  stream_test_server_start_stop (conn, rx_cfg);
419  break;
420 
421  case VCL_TEST_TYPE_EXIT:
422  stinf ("Have a great day connection %d!", conn->fd);
423  close (conn->fd);
424  conn_pool_free (conn);
425  stinf ("Closed client fd %d", conn->fd);
426  ssm->nfds--;
427  break;
428 
429  default:
430  stinf ("ERROR: Unknown test type!\n");
431  vcl_test_cfg_dump (rx_cfg, 0 /* is_client */ );
432  break;
433  }
434 
435 done:
436  return 0;
437 }
438 
439 static int
441 {
442  if (conn->cfg.test == VCL_TEST_TYPE_ECHO)
443  return 1;
444 
445  return (conn->stats.rx_bytes < 128
446  || conn->stats.rx_bytes > conn->cfg.total_bytes);
447 }
448 
449 int
450 main (int argc, char **argv)
451 {
452  int client_fd, rv, main_rv = 0, rx_bytes, c, v, i;
454  sock_server_conn_t *conn;
455  vcl_test_cfg_t *rx_cfg;
456  struct sockaddr_storage servaddr;
457  uint16_t port = VCL_TEST_SERVER_PORT;
458  uint32_t servaddr_size;
459 
460  opterr = 0;
461  while ((c = getopt (argc, argv, "6D")) != -1)
462  switch (c)
463  {
464  case '6':
465  ssm->cfg.address_ip6 = 1;
466  break;
467 
468  case 'D':
469  ssm->cfg.transport_udp = 1;
470  break;
471 
472  case '?':
473  switch (optopt)
474  {
475  default:
476  if (isprint (optopt))
477  stinf ("ERROR: Unknown option `-%c'", optopt);
478  else
479  stinf ("ERROR: Unknown option character `\\x%x'.\n", optopt);
480  }
481  /* fall thru */
482  case 'h':
483  default:
485  }
486 
487  if (argc < (optind + 1))
488  {
489  stinf ("ERROR: Insufficient number of arguments!\n");
491  }
492 
493  if (sscanf (argv[optind], "%d", &v) == 1)
494  port = (uint16_t) v;
495  else
496  {
497  stinf ("ERROR: Invalid port (%s)!\n", argv[optind]);
499  }
500 
502 
503  ssm->listen_fd = socket (ssm->cfg.address_ip6 ? AF_INET6 : AF_INET,
504  ssm->cfg.transport_udp ? SOCK_DGRAM : SOCK_STREAM,
505  0);
506 
507  if (ssm->listen_fd < 0)
508  stfail ("main listen()");
509 
510  memset (&servaddr, 0, sizeof (servaddr));
511 
512  if (ssm->cfg.address_ip6)
513  {
514  struct sockaddr_in6 *server_addr = (struct sockaddr_in6 *) &servaddr;
515  servaddr_size = sizeof (*server_addr);
516  server_addr->sin6_family = AF_INET6;
517  server_addr->sin6_addr = in6addr_any;
518  server_addr->sin6_port = htons (port);
519  }
520  else
521  {
522  struct sockaddr_in *server_addr = (struct sockaddr_in *) &servaddr;
523  servaddr_size = sizeof (*server_addr);
524  server_addr->sin_family = AF_INET;
525  server_addr->sin_addr.s_addr = htonl (INADDR_ANY);
526  server_addr->sin_port = htons (port);
527  }
528 
529  rv = bind (ssm->listen_fd, (struct sockaddr *) &servaddr, servaddr_size);
530  if (rv < 0)
531  stfail ("main bind()");
532 
533  rv = fcntl (ssm->listen_fd, F_SETFL, O_NONBLOCK);
534  if (rv < 0)
535  stfail ("main fcntl()");
536 
537  rv = listen (ssm->listen_fd, 10);
538  if (rv < 0)
539  stfail ("main listen()");
540 
541  ssm->epfd = epoll_create (1);
542  if (ssm->epfd < 0)
543  stfail ("main epoll_create()");
544 
545  ssm->listen_ev.events = EPOLLIN;
546  ssm->listen_ev.data.u32 = ~0;
547 
548  rv = epoll_ctl (ssm->epfd, EPOLL_CTL_ADD, ssm->listen_fd, &ssm->listen_ev);
549  if (rv < 0)
550  stfail ("main epoll_ctl()");
551 
552  stinf ("Waiting for a client to connect on port %d...\n", port);
553 
554  while (1)
555  {
556  int num_ev;
557  num_ev = epoll_wait (ssm->epfd, ssm->wait_events,
559  if (num_ev < 0)
560  stfail ("main epoll_wait()");
561 
562  if (num_ev == 0)
563  {
564  stinf ("epoll_wait() timeout!\n");
565  continue;
566  }
567  for (i = 0; i < num_ev; i++)
568  {
569  conn = &ssm->conn_pool[ssm->wait_events[i].data.u32];
570  if (ssm->wait_events[i].events & (EPOLLHUP | EPOLLRDHUP))
571  {
572  close (conn->fd);
573  continue;
574  }
575  if (ssm->wait_events[i].data.u32 == ~0)
576  {
577  new_client ();
578  continue;
579  }
580  else if (ssm->wait_events[i].data.u32 ==
582  {
583  af_unix_echo ();
584  continue;
585  }
586  client_fd = conn->fd;
587 
588  if (EPOLLIN & ssm->wait_events[i].events)
589  {
590  read_again:
591  rx_bytes = sock_test_read (client_fd, conn->buf,
592  conn->buf_size, &conn->stats);
593 
594  if (rx_bytes <= 0)
595  {
596  if (errno == ECONNRESET)
597  {
598  stinf ("Connection reset by peer\n");
599  main_rv = -1;
600  goto done;
601  }
602  else
603  continue;
604  }
605 
606  if (sts_conn_expect_config (conn))
607  {
608  rx_cfg = (vcl_test_cfg_t *) conn->buf;
609  if (rx_cfg->magic == VCL_TEST_CFG_CTRL_MAGIC)
610  {
611  sts_handle_cfg (rx_cfg, conn, rx_bytes);
612  if (!ssm->nfds)
613  {
614  stinf ("All client connections closed.\n\nSERVER: "
615  "May the force be with you!\n\n");
616  goto done;
617  }
618  continue;
619  }
620  }
621 
622  if ((conn->cfg.test == VCL_TEST_TYPE_UNI)
623  || (conn->cfg.test == VCL_TEST_TYPE_BI))
624  {
625  stream_test_server (conn, rx_bytes);
626  if (ioctl (conn->fd, FIONREAD))
627  goto read_again;
628  continue;
629  }
630  else if (isascii (conn->buf[0]))
631  {
632  sts_server_echo (conn, rx_bytes);
633  }
634  else
635  {
636  stwrn ("FIFO not drained! extra bytes %d", rx_bytes);
637  }
638  }
639  }
640  }
641 
642 done:
643  close (ssm->listen_fd);
644  close (ssm->af_unix_listen_fd);
645  unlink ((const char *) SOCK_TEST_AF_UNIX_FILENAME);
646 
647  if (ssm->conn_pool)
648  free (ssm->conn_pool);
649 
650  return main_rv;
651 }
652 
653 /*
654  * fd.io coding-style-patch-verification: ON
655  *
656  * Local Variables:
657  * eval: (c-set-style "gnu")
658  * End:
659  */
static void new_client(void)
static int sock_test_read(int fd, uint8_t *buf, uint32_t nbytes, vcl_test_stats_t *stats)
Definition: sock_test.h:54
static void conn_pool_expand(size_t expand_size)
static int sts_conn_expect_config(sock_server_conn_t *conn)
struct timespec stop
Definition: vcl_test.h:111
#define SOCK_TEST_AF_UNIX_ACCEPT_DATA
Definition: sock_test.h:27
Optimized string handling code, including c11-compliant "safe C library" variants.
static void sync_config_and_reply(sock_server_conn_t *conn, vcl_test_cfg_t *rx_cfg)
static void conn_pool_free(sock_server_conn_t *conn)
struct sockaddr_un serveraddr
#define VCL_TEST_SERVER_PORT
Definition: vcl_test.h:59
struct timespec start
Definition: vcl_test.h:110
uint64_t num_writes
Definition: vcl_test.h:96
vcl_test_t
Definition: vcl_test.h:73
#define SOCK_TEST_BANNER_STRING
Definition: sock_test.h:29
#define SOCK_TEST_AF_UNIX_FILENAME
Definition: sock_test.h:25
uint64_t txbuf_size
Definition: vcl_test.h:95
static void vcl_test_stats_dump(char *header, vcl_test_stats_t *stats, uint8_t show_rx, uint8_t show_tx, uint8_t verbose)
Definition: vcl_test.h:326
#define stfail(_fn)
Definition: sock_test.h:46
static int sock_test_write(int fd, uint8_t *buf, uint32_t nbytes, vcl_test_stats_t *stats, uint32_t verbose)
Definition: sock_test.h:87
#define SOCK_SERVER_MAX_TEST_CONN
uint32_t verbose
Definition: vcl_test.h:91
#define VCL_TEST_SEPARATOR_STRING
Definition: vcl_test.h:71
static void vcl_test_cfg_dump(vcl_test_cfg_t *cfg, uint8_t is_client)
Definition: vcl_test.h:288
struct epoll_event listen_ev
static void stream_test_server_start_stop(sock_server_conn_t *conn, vcl_test_cfg_t *rx_cfg)
#define VCL_TEST_CFG_CTRL_MAGIC
Definition: vcl_test.h:62
vcl_test_cfg_t cfg
struct epoll_event af_unix_listen_ev
svmdb_client_t * c
sock_server_main_t sock_server_main
static int sts_handle_cfg(vcl_test_cfg_t *rx_cfg, sock_server_conn_t *conn, int rx_bytes)
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
char * buffer
Definition: cJSON.h:163
uint64_t rxbuf_size
Definition: vcl_test.h:94
static void vcl_test_cfg_init(vcl_test_cfg_t *cfg)
Definition: vcl_test.h:200
void free(void *p)
Definition: mem.c:42
#define stwrn(_fmt, _args...)
Definition: sock_test.h:34
vcl_test_stats_t stats
uint32_t magic
Definition: vcl_test.h:84
static void vcl_test_buf_alloc(vcl_test_cfg_t *cfg, uint8_t is_rxbuf, uint8_t **buf, uint32_t *bufsize)
Definition: vcl_test.h:229
uint32_t ctrl_handle
Definition: vcl_test.h:87
#define SOCK_TEST_MIXED_EPOLL_DATA
Definition: sock_test.h:26
static sock_server_conn_t * conn_pool_alloc(void)
void print_usage_and_exit(void)
static void af_unix_echo(void)
void * realloc(void *p, size_t size)
Definition: mem.c:67
sock_server_cfg_t cfg
#define stinf(_fmt, _args...)
Definition: sock_test.h:32
int main(int argc, char **argv)
u16 port
Definition: lb_types.api:73
uint32_t test
Definition: vcl_test.h:86
#define SOCK_SERVER_MAX_EPOLL_EVENTS
static void vcl_test_stats_accumulate(vcl_test_stats_t *accum, vcl_test_stats_t *incr)
Definition: vcl_test.h:187
static void sts_server_echo(sock_server_conn_t *conn, int rx_bytes)
struct epoll_event wait_events[SOCK_SERVER_MAX_EPOLL_EVENTS]
sock_server_conn_t * conn_pool
static int socket_server_echo_af_unix_init(sock_server_main_t *ssm)
uint64_t rx_bytes
Definition: vcl_test.h:103
static void stream_test_server(sock_server_conn_t *conn, int rx_bytes)
uint64_t total_bytes
Definition: vcl_test.h:97