/*
 * Copyright (c) 2018 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:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __sock_test_common_h__
#define __sock_test_common_h__

#include <netdb.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>

#define SOCK_TEST_TOKEN_HELP           "#H"
#define SOCK_TEST_TOKEN_EXIT           "#X"
#define SOCK_TEST_TOKEN_VERBOSE        "#V"
#define SOCK_TEST_TOKEN_TXBUF_SIZE     "#T:"
#define SOCK_TEST_TOKEN_NUM_TEST_SCKTS "#I:"
#define SOCK_TEST_TOKEN_NUM_WRITES     "#N:"
#define SOCK_TEST_TOKEN_RXBUF_SIZE     "#R:"
#define SOCK_TEST_TOKEN_SHOW_CFG       "#C"
#define SOCK_TEST_TOKEN_RUN_UNI        "#U"
#define SOCK_TEST_TOKEN_RUN_BI         "#B"

#define SOCK_TEST_BANNER_STRING \
  "============================================\n"
#define SOCK_TEST_SEPARATOR_STRING \
  "  -----------------------------\n"

#define ONE_GIG                       (1024*1024*1024)
#define SOCK_TEST_SERVER_PORT         22000
#define SOCK_TEST_LOCALHOST_IPADDR    "127.0.0.1"

#define SOCK_TEST_CFG_CTRL_MAGIC      0xfeedface
#define SOCK_TEST_CFG_NUM_WRITES_DEF  1000000
#define SOCK_TEST_CFG_TXBUF_SIZE_DEF  8192
#define SOCK_TEST_CFG_RXBUF_SIZE_DEF  (64*SOCK_TEST_CFG_TXBUF_SIZE_DEF)
#define SOCK_TEST_CFG_BUF_SIZE_MIN    128
#define SOCK_TEST_CFG_MAX_TEST_SCKTS  5

typedef enum
{
  SOCK_TEST_TYPE_NONE,
  SOCK_TEST_TYPE_ECHO,
  SOCK_TEST_TYPE_UNI,
  SOCK_TEST_TYPE_BI,
  SOCK_TEST_TYPE_EXIT,
} sock_test_t;

typedef struct  __attribute__ ((packed))
{
  uint32_t magic;
  uint32_t seq_num;
  uint32_t test;
  uint32_t ctrl_handle;
  uint32_t num_test_sockets;
  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;
} sock_test_cfg_t;

typedef struct
{
  uint64_t rx_xacts;
  uint64_t rx_bytes;
  uint32_t rx_eagain;
  uint32_t rx_incomp;
  uint64_t tx_xacts;
  uint64_t tx_bytes;
  uint32_t tx_eagain;
  uint32_t tx_incomp;
  struct timespec start;
  struct timespec stop;
} sock_test_stats_t;

typedef struct
{
  int fd;
  uint32_t txbuf_size;
  char *txbuf;
  uint32_t rxbuf_size;
  char *rxbuf;
  sock_test_cfg_t cfg;
  sock_test_stats_t stats;
} sock_test_socket_t;

static inline void
sock_test_stats_accumulate (sock_test_stats_t * accum,
                            sock_test_stats_t * incr)
{
  accum->rx_xacts += incr->rx_xacts;
  accum->rx_bytes += incr->rx_bytes;
  accum->rx_eagain += incr->rx_eagain;
  accum->rx_incomp += incr->rx_incomp;
  accum->tx_xacts += incr->tx_xacts;
  accum->tx_bytes += incr->tx_bytes;
  accum->tx_eagain += incr->tx_eagain;
  accum->tx_incomp += incr->tx_incomp;
}

static inline void
sock_test_cfg_init (sock_test_cfg_t *cfg)
{
  cfg->magic = SOCK_TEST_CFG_CTRL_MAGIC;
  cfg->test = SOCK_TEST_TYPE_NONE;
  cfg->ctrl_handle = ~0;
  cfg->num_test_sockets = 1;
  cfg->verbose = 0;
  cfg->rxbuf_size = SOCK_TEST_CFG_RXBUF_SIZE_DEF;
  cfg->num_writes = SOCK_TEST_CFG_NUM_WRITES_DEF;
  cfg->txbuf_size = SOCK_TEST_CFG_TXBUF_SIZE_DEF;
  cfg->total_bytes = cfg->num_writes * cfg->txbuf_size;
}

static inline int
sock_test_cfg_verify (sock_test_cfg_t *cfg, sock_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
sock_test_buf_alloc (sock_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);

  if (lb)
    {
      if (is_rxbuf)
        cfg->rxbuf_size = *bufsize = alloc_size;
      else
        cfg->txbuf_size = *bufsize = alloc_size;
      
      *buf = lb;
    }
  else
    {
      int errno_val = errno;
      perror ("ERROR in sock_test_buf_alloc()");
      fprintf (stderr, "SOCK_TEST: ERROR: Buffer allocation "
               "failed (errno = %d)!\n"
               "       Using buffer size %d instead of desired"
               " size (%d)\n", errno_val, *bufsize, alloc_size);
    }
}

static inline void
sock_test_socket_buf_alloc (sock_test_socket_t *socket)
{
  socket->rxbuf_size = socket->cfg.rxbuf_size;
  socket->txbuf_size = socket->cfg.txbuf_size;
  sock_test_buf_alloc (&socket->cfg, 0 /* is_rxbuf */ ,
		       (uint8_t **) &socket->txbuf, &socket->txbuf_size);
  sock_test_buf_alloc (&socket->cfg, 1 /* is_rxbuf */ ,
		       (uint8_t **) &socket->rxbuf, &socket->rxbuf_size);
}

static inline char *
sock_test_type_str (sock_test_t t)
{
  switch (t)
    {
    case SOCK_TEST_TYPE_NONE:
      return "NONE";

    case SOCK_TEST_TYPE_ECHO:
      return "ECHO";

    case SOCK_TEST_TYPE_UNI:
      return "UNI";

    case SOCK_TEST_TYPE_BI:
      return "BI";

    case SOCK_TEST_TYPE_EXIT:
      return "EXIT";

    default:
      return "Unknown";
    }
}

static inline void
sock_test_cfg_dump (sock_test_cfg_t * cfg, uint8_t is_client)
{
  char *spc = "     ";
  
  printf ("  test config (%p):\n"
          SOCK_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"
          SOCK_TEST_SEPARATOR_STRING,
	  (void *) cfg, cfg->magic, cfg->seq_num,
          is_client && (cfg->test == SOCK_TEST_TYPE_UNI) ?
          "'"SOCK_TEST_TOKEN_RUN_UNI"'" :
          is_client && (cfg->test == SOCK_TEST_TYPE_BI) ?
           "'"SOCK_TEST_TOKEN_RUN_BI"'" : spc,
          sock_test_type_str (cfg->test), cfg->test,
          cfg->ctrl_handle, cfg->ctrl_handle,
          is_client ? "'"SOCK_TEST_TOKEN_NUM_TEST_SCKTS"'" : spc,
          cfg->num_test_sockets, cfg->num_test_sockets,
          is_client ? "'"SOCK_TEST_TOKEN_VERBOSE"'" : spc,
          cfg->verbose ? "on" : "off", cfg->verbose,
          is_client ? "'"SOCK_TEST_TOKEN_RXBUF_SIZE"'" : spc,
          cfg->rxbuf_size, cfg->rxbuf_size,
          is_client ? "'"SOCK_TEST_TOKEN_TXBUF_SIZE"'" : spc,
          cfg->txbuf_size, cfg->txbuf_size,
          is_client ? "'"SOCK_TEST_TOKEN_NUM_WRITES"'" : spc,
          cfg->num_writes, cfg->num_writes,
          cfg->total_bytes, cfg->total_bytes);
}

static inline void
sock_test_stats_dump (char * header, sock_test_stats_t * stats,
                      uint8_t show_rx, uint8_t show_tx,
                      uint8_t verbose)
{
  struct timespec diff;
  double duration, rate;
  uint64_t total_bytes;
  
  if ((stats->stop.tv_nsec - stats->start.tv_nsec) < 0)
    {
      diff.tv_sec = stats->stop.tv_sec - stats->start.tv_sec - 1;
      diff.tv_nsec = stats->stop.tv_nsec - stats->start.tv_nsec + 1000000000;
    }
  else
    {
      diff.tv_sec = stats->stop.tv_sec - stats->start.tv_sec;
      diff.tv_nsec = stats->stop.tv_nsec - stats->start.tv_nsec;
    }
  duration = (double) diff.tv_sec + (1e-9 * diff.tv_nsec);

  total_bytes = stats->tx_bytes + stats->rx_bytes;
  rate = (double) total_bytes * 8 / duration / ONE_GIG;
  printf ("\n%s: Streamed %lu bytes\n"
          "  in %lf seconds (%lf Gbps %s-duplex)!\n",
              header, total_bytes, duration, rate,
          (show_rx && show_tx) ? "full" : "half");

  if (show_tx)
    {
      printf (SOCK_TEST_SEPARATOR_STRING
              "  tx stats (0x%p):\n"
              SOCK_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);
    }
  if (show_rx)
    {
      printf (SOCK_TEST_SEPARATOR_STRING
              "  rx stats (0x%p):\n"
              SOCK_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);
    }
  if (verbose)
    printf ("   start.tv_sec:  %ld\n"
            "  start.tv_nsec:  %ld\n"
            "    stop.tv_sec:  %ld\n"
            "   stop.tv_nsec:  %ld\n",
            stats->start.tv_sec, stats->start.tv_nsec,
            stats->stop.tv_sec, stats->stop.tv_nsec);
            
  printf (SOCK_TEST_SEPARATOR_STRING);
}

#endif /* __sock_test_common_h__ */
