/*
 *------------------------------------------------------------------
 * Copyright (c) 2020 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 _COMMON_H_
#define _COMMON_H_

#include <libmemif.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>

#ifdef ICMP_DBG
#define DBG(...)                                                              \
  do                                                                          \
    {                                                                         \
      printf (APP_NAME ":%s:%d: ", __func__, __LINE__);                       \
      printf (__VA_ARGS__);                                                   \
      printf ("\n");                                                          \
    }                                                                         \
  while (0)
#else
#define DBG(...)
#endif

#define INFO(...)                                                             \
  do                                                                          \
    {                                                                         \
      printf ("INFO: " __VA_ARGS__);                                          \
      printf ("\n");                                                          \
    }                                                                         \
  while (0)

/* maximum tx/rx memif buffers */
#define MAX_MEMIF_BUFS 1024

struct memif_connection;

typedef int (memif_packet_handler_t) (struct memif_connection *conn);

typedef int (packet_generator_t) (struct memif_connection *c,
				  uint16_t num_pkts);

typedef struct memif_connection
{
  uint16_t index;
  /* memif conenction handle */
  memif_conn_handle_t conn;
  uint8_t is_connected;
  /* transmit queue id */
  uint16_t tx_qid;
  /* tx buffers */
  memif_buffer_t *tx_bufs;
  /* allocated tx buffers counter */
  /* number of tx buffers pointing to shared memory */
  uint16_t tx_buf_num;
  /* rx buffers */
  memif_buffer_t *rx_bufs;
  /* allcoated rx buffers counter */
  /* number of rx buffers pointing to shared memory */
  uint16_t rx_buf_num;
  memif_packet_handler_t *packet_handler;
  /* interface ip address */
  uint8_t ip_addr[4];
  /* interface hw address */
  uint8_t hw_addr[6];
  /* buffer size */
  uint16_t buffer_size;
  /* headroom size */
  uint16_t headroom_size;
} memif_connection_t;

void print_version ();

int parse_ip4 (const char *input, uint8_t out[4]);

int parse_mac (const char *input, uint8_t out[6]);

void alloc_memif_buffers (memif_connection_t *c);

void free_memif_buffers (memif_connection_t *c);

void print_memif_details (memif_connection_t *c);

void print_memif_rx_ring_details (memif_connection_t *c, uint16_t qid);

void print_memif_tx_ring_details (memif_connection_t *c, uint16_t qid);

int send_packets (memif_connection_t *conn, uint16_t qid,
		  packet_generator_t *gen, uint32_t num_pkts,
		  uint16_t max_pkt_size);

/* Expect packets smaller than 2048b */
int responder (memif_conn_handle_t conn, void *private_ctx, uint16_t qid);

/* Expect packets smaller than 2048b */
int responder_zero_copy (memif_conn_handle_t conn, void *private_ctx,
			 uint16_t qid);

/* reply with the same data */
int basic_packet_handler (memif_connection_t *conn);

/* ICMPv4 and ARP handler */
int icmp_packet_handler (memif_connection_t *conn);

#endif /* COMMON_H */
