FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
main.c File Reference
+ Include dependency graph for main.c:

Go to the source code of this file.

Data Structures

struct  memif_connection_t
 
struct  icmpr_thread_data_t
 

Macros

#define TIME_UTC   1
 
#define APP_NAME   "ICMP_Responder"
 
#define IF_NAME   "memif_connection"
 
#define DBG(...)
 
#define INFO(...)
 
#define MAX_MEMIF_BUFS   256
 
#define MAX_CONNS   50
 
#define F_LINUX_SPECIFIC_BASE   1024
 
#define MFD_ALLOW_SEALING   0x0002U
 
#define F_ADD_SEALS   (F_LINUX_SPECIFIC_BASE + 9)
 
#define F_GET_SEALS   (F_LINUX_SPECIFIC_BASE + 10)
 
#define F_SEAL_SEAL   0x0001 /* prevent further seals from being set */
 
#define F_SEAL_SHRINK   0x0002 /* prevent file from shrinking */
 
#define F_SEAL_GROW   0x0004 /* prevent file from growing */
 
#define F_SEAL_WRITE   0x0008 /* prevent writes */
 

Functions

static int memfd_create (const char *name, unsigned int flags)
 
static void print_help ()
 
static void print_memif_details ()
 
void icmpr_print_counters ()
 
void icmpr_reset_counters ()
 
int add_epoll_fd (int fd, uint32_t events)
 
int mod_epoll_fd (int fd, uint32_t events)
 
int del_epoll_fd (int fd)
 
int on_connect (memif_conn_handle_t conn, void *private_ctx)
 
int on_disconnect (memif_conn_handle_t conn, void *private_ctx)
 
int control_fd_update (int fd, uint8_t events, void *ctx)
 
int icmpr_memif_delete (long index)
 
int icmpr_free ()
 
int icmpr_add_external_region (void **addr, uint32_t size, int *fd, void *private_ctx)
 
void * icmpr_get_external_region_addr (uint32_t size, int fd, void *private_ctx)
 
int icmpr_del_external_region (void *addr, uint32_t size, int fd, void *private_ctx)
 
int on_interrupt (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
 
int on_interrupt1 (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
 
int icmpr_memif_create (long index, long mode, char *s)
 
void * icmpr_send_proc (void *data)
 
int icmpr_send (long index, long packet_num, char *hw, char *ip)
 
int user_input_handler ()
 
int poll_event (int timeout)
 
int main ()
 

Variables

icmpr_thread_data_t icmpr_thread_data [MAX_CONNS]
 
pthread_t thread [MAX_CONNS]
 
int epfd
 
long ctx [MAX_CONNS]
 
memif_connection_t memif_connection [MAX_CONNS]
 

Macro Definition Documentation

◆ APP_NAME

#define APP_NAME   "ICMP_Responder"

Definition at line 57 of file main.c.

◆ DBG

#define DBG (   ...)

Definition at line 67 of file main.c.

◆ F_ADD_SEALS

#define F_ADD_SEALS   (F_LINUX_SPECIFIC_BASE + 9)

Definition at line 108 of file main.c.

◆ F_GET_SEALS

#define F_GET_SEALS   (F_LINUX_SPECIFIC_BASE + 10)

Definition at line 109 of file main.c.

◆ F_LINUX_SPECIFIC_BASE

#define F_LINUX_SPECIFIC_BASE   1024

Definition at line 100 of file main.c.

◆ F_SEAL_GROW

#define F_SEAL_GROW   0x0004 /* prevent file from growing */

Definition at line 113 of file main.c.

◆ F_SEAL_SEAL

#define F_SEAL_SEAL   0x0001 /* prevent further seals from being set */

Definition at line 111 of file main.c.

◆ F_SEAL_SHRINK

#define F_SEAL_SHRINK   0x0002 /* prevent file from shrinking */

Definition at line 112 of file main.c.

◆ F_SEAL_WRITE

#define F_SEAL_WRITE   0x0008 /* prevent writes */

Definition at line 114 of file main.c.

◆ IF_NAME

#define IF_NAME   "memif_connection"

Definition at line 58 of file main.c.

◆ INFO

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

Definition at line 70 of file main.c.

◆ MAX_CONNS

#define MAX_CONNS   50

Definition at line 76 of file main.c.

◆ MAX_MEMIF_BUFS

#define MAX_MEMIF_BUFS   256

Definition at line 75 of file main.c.

◆ MFD_ALLOW_SEALING

#define MFD_ALLOW_SEALING   0x0002U

Definition at line 104 of file main.c.

◆ TIME_UTC

#define TIME_UTC   1

Definition at line 51 of file main.c.

Function Documentation

◆ add_epoll_fd()

int add_epoll_fd ( int  fd,
uint32_t  events 
)

Definition at line 302 of file main.c.

+ Here is the caller graph for this function:

◆ control_fd_update()

int control_fd_update ( int  fd,
uint8_t  events,
void *  ctx 
)

Definition at line 378 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ del_epoll_fd()

int del_epoll_fd ( int  fd)

Definition at line 344 of file main.c.

+ Here is the caller graph for this function:

◆ icmpr_add_external_region()

int icmpr_add_external_region ( void **  addr,
uint32_t  size,
int *  fd,
void *  private_ctx 
)

Definition at line 451 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icmpr_del_external_region()

int icmpr_del_external_region ( void *  addr,
uint32_t  size,
int  fd,
void *  private_ctx 
)

Definition at line 483 of file main.c.

+ Here is the caller graph for this function:

◆ icmpr_free()

int icmpr_free ( )

Definition at line 431 of file main.c.

+ Here is the call graph for this function:

◆ icmpr_get_external_region_addr()

void* icmpr_get_external_region_addr ( uint32_t  size,
int  fd,
void *  private_ctx 
)

Definition at line 477 of file main.c.

+ Here is the caller graph for this function:

◆ icmpr_memif_create()

int icmpr_memif_create ( long  index,
long  mode,
char *  s 
)

Definition at line 645 of file main.c.

+ Here is the call graph for this function:

◆ icmpr_memif_delete()

int icmpr_memif_delete ( long  index)

Definition at line 397 of file main.c.

+ Here is the call graph for this function:

◆ icmpr_print_counters()

void icmpr_print_counters ( )

Definition at line 272 of file main.c.

+ Here is the caller graph for this function:

◆ icmpr_reset_counters()

void icmpr_reset_counters ( )

Definition at line 289 of file main.c.

+ Here is the caller graph for this function:

◆ icmpr_send()

int icmpr_send ( long  index,
long  packet_num,
char *  hw,
char *  ip 
)

Definition at line 817 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ icmpr_send_proc()

void* icmpr_send_proc ( void *  data)

Definition at line 720 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main()

int main ( )

Definition at line 1031 of file main.c.

+ Here is the call graph for this function:

◆ memfd_create()

static int memfd_create ( const char *  name,
unsigned int  flags 
)
inlinestatic

Definition at line 93 of file main.c.

+ Here is the caller graph for this function:

◆ mod_epoll_fd()

int mod_epoll_fd ( int  fd,
uint32_t  events 
)

Definition at line 323 of file main.c.

+ Here is the caller graph for this function:

◆ on_connect()

int on_connect ( memif_conn_handle_t  conn,
void *  private_ctx 
)

Definition at line 363 of file main.c.

+ Here is the call graph for this function:

◆ on_disconnect()

int on_disconnect ( memif_conn_handle_t  conn,
void *  private_ctx 
)

Definition at line 371 of file main.c.

◆ on_interrupt()

int on_interrupt ( memif_conn_handle_t  conn,
void *  private_ctx,
uint16_t  qid 
)

Definition at line 494 of file main.c.

+ Here is the call graph for this function:

◆ on_interrupt1()

int on_interrupt1 ( memif_conn_handle_t  conn,
void *  private_ctx,
uint16_t  qid 
)

Definition at line 571 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ poll_event()

int poll_event ( int  timeout)

Definition at line 975 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_help()

static void print_help ( )
static

Definition at line 148 of file main.c.

+ Here is the call graph for this function:

◆ print_memif_details()

static void print_memif_details ( )
static

Definition at line 173 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ user_input_handler()

int user_input_handler ( )

Definition at line 894 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ ctx

long ctx[MAX_CONNS]

Definition at line 144 of file main.c.

◆ epfd

int epfd

Definition at line 143 of file main.c.

◆ icmpr_thread_data

icmpr_thread_data_t icmpr_thread_data[MAX_CONNS]

Definition at line 141 of file main.c.

◆ memif_connection

Definition at line 145 of file main.c.

◆ thread

pthread_t thread[MAX_CONNS]

Definition at line 142 of file main.c.