FD.io VPP  v17.10-9-gd594711
Vector Packet Processing
libmemif.h File Reference
+ Include dependency graph for libmemif.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  memif_conn_args_t
 Memif connection arguments. More...
 
struct  memif_buffer_t
 Memif buffer. More...
 
struct  memif_queue_details_t
 Memif queue details. More...
 
struct  memif_details_t
 Memif details. More...
 

Macros

#define LIBMEMIF_VERSION   "1.0"
 Libmemif version. More...
 
#define MEMIF_DEFAULT_APP_NAME   "libmemif-app"
 Default name of application using libmemif. More...
 
#define MEMIF_FD_EVENT_READ   (1 << 0)
 user needs to set events that occured on fd and pass them to memif_control_fd_handler More...
 
#define MEMIF_FD_EVENT_WRITE   (1 << 1)
 
#define MEMIF_FD_EVENT_ERROR   (1 << 2)
 inform libmemif that error occured on fd More...
 
#define MEMIF_FD_EVENT_DEL   (1 << 3)
 if set, informs that fd is going to be closed (user may want to stop watching for events on this fd) More...
 
#define MEMIF_FD_EVENT_MOD   (1 << 4)
 update events More...
 

Typedefs

typedef void * memif_conn_handle_t
 *brief Memif connection handle pointer of type void, pointing to internal structure More...
 
typedef int( memif_control_fd_update_t) (int fd, uint8_t events)
 Memif control file descriptor update (callback function) More...
 
typedef int( memif_connection_update_t) (memif_conn_handle_t conn, void *private_ctx)
 Memif connection status update (callback function) More...
 
typedef int( memif_interrupt_t) (memif_conn_handle_t conn, void *private_ctx, uint16_t qid)
 Memif interrupt occured (callback function) More...
 

Enumerations

enum  memif_err_t {
  MEMIF_ERR_SUCCESS = 0, MEMIF_ERR_SYSCALL, MEMIF_ERR_ACCES, MEMIF_ERR_NO_FILE,
  MEMIF_ERR_FILE_LIMIT, MEMIF_ERR_PROC_FILE_LIMIT, MEMIF_ERR_ALREADY, MEMIF_ERR_AGAIN,
  MEMIF_ERR_BAD_FD, MEMIF_ERR_NOMEM, MEMIF_ERR_INVAL_ARG, MEMIF_ERR_NOCONN,
  MEMIF_ERR_CONN, MEMIF_ERR_CB_FDUPDATE, MEMIF_ERR_FILE_NOT_SOCK, MEMIF_ERR_NO_SHMFD,
  MEMIF_ERR_COOKIE, MEMIF_ERR_NOBUF_RING, MEMIF_ERR_NOBUF, MEMIF_ERR_NOBUF_DET,
  MEMIF_ERR_INT_WRITE, MEMIF_ERR_MFMSG, MEMIF_ERR_QID, MEMIF_ERR_PROTO,
  MEMIF_ERR_ID, MEMIF_ERR_ACCSLAVE, MEMIF_ERR_ALRCONN, MEMIF_ERR_MODE,
  MEMIF_ERR_SECRET, MEMIF_ERR_NOSECRET, MEMIF_ERR_MAXREG, MEMIF_ERR_MAXRING,
  MEMIF_ERR_NO_INTFD, MEMIF_ERR_DISCONNECT, MEMIF_ERR_DISCONNECTED, MEMIF_ERR_UNKNOWN_MSG
}
 
enum  memif_rx_mode_t { MEMIF_RX_MODE_INTERRUPT = 0, MEMIF_RX_MODE_POLLING }
 

Functions

int memif_get_queue_efd (memif_conn_handle_t conn, uint16_t qid, int *fd)
 Memif get queue event file descriptor More...
 
int memif_set_rx_mode (memif_conn_handle_t conn, memif_rx_mode_t rx_mode, uint16_t qid)
 Memif set rx mode. More...
 
char * memif_strerror (int err_code)
 Memif strerror. More...
 
int memif_get_details (memif_conn_handle_t conn, memif_details_t *md, char *buf, ssize_t buflen)
 Memif get details. More...
 
int memif_init (memif_control_fd_update_t *on_control_fd_update, char *app_name)
 Memif initialization. More...
 
int memif_cleanup ()
 Memif cleanup. More...
 
int memif_create (memif_conn_handle_t *conn, memif_conn_args_t *args, memif_connection_update_t *on_connect, memif_connection_update_t *on_disconnect, memif_interrupt_t *on_interrupt, void *private_ctx)
 Memory interface create function. More...
 
int memif_control_fd_handler (int fd, uint8_t events)
 Memif control file descriptor handler. More...
 
int memif_delete (memif_conn_handle_t *conn)
 Memif delete. More...
 
int memif_buffer_alloc (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t *bufs, uint16_t count, uint16_t *count_out, uint16_t size)
 Memif buffer alloc. More...
 
int memif_buffer_free (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t *bufs, uint16_t count, uint16_t *count_out)
 Memif buffer free. More...
 
int memif_tx_burst (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t *bufs, uint16_t count, uint16_t *tx)
 Memif transmit buffer burst. More...
 
int memif_rx_burst (memif_conn_handle_t conn, uint16_t qid, memif_buffer_t *bufs, uint16_t count, uint16_t *rx)
 Memif receive buffer burst. More...
 
int memif_poll_event (int timeout)
 Memif poll event. More...
 

Macro Definition Documentation

#define LIBMEMIF_VERSION   "1.0"

Libmemif version.

Definition at line 24 of file libmemif.h.

#define MEMIF_DEFAULT_APP_NAME   "libmemif-app"

Default name of application using libmemif.

Definition at line 26 of file libmemif.h.

Typedef Documentation

typedef void* memif_conn_handle_t

*brief Memif connection handle pointer of type void, pointing to internal structure

Definition at line 97 of file libmemif.h.

Enumeration Type Documentation

Error codes

Enumerator
MEMIF_ERR_SUCCESS 

success

MEMIF_ERR_SYSCALL 

other syscall error

MEMIF_ERR_ACCES 

permission denied

MEMIF_ERR_NO_FILE 

file does not exist

MEMIF_ERR_FILE_LIMIT 

system open file limit

MEMIF_ERR_PROC_FILE_LIMIT 

process open file limit

MEMIF_ERR_ALREADY 

connection already requested

MEMIF_ERR_AGAIN 

fd is not socket, or operation would block

MEMIF_ERR_BAD_FD 

invalid fd

MEMIF_ERR_NOMEM 

out of memory

MEMIF_ERR_INVAL_ARG 

invalid argument

MEMIF_ERR_NOCONN 

handle points to no connection

MEMIF_ERR_CONN 

handle points to existing connection

MEMIF_ERR_CB_FDUPDATE 

user defined callback memif_control_fd_update_t error

MEMIF_ERR_FILE_NOT_SOCK 

file specified by socket filename exists, but it's not socket

MEMIF_ERR_NO_SHMFD 

missing shm fd

MEMIF_ERR_COOKIE 

wrong cookie on ring

MEMIF_ERR_NOBUF_RING 

ring buffer full

MEMIF_ERR_NOBUF 

not enough memif buffers

MEMIF_ERR_NOBUF_DET 

memif details needs larger buffer

MEMIF_ERR_INT_WRITE 

send interrupt error

MEMIF_ERR_MFMSG 

malformed msg received

MEMIF_ERR_QID 

invalid queue id

MEMIF_ERR_PROTO 

incompatible protocol version

MEMIF_ERR_ID 

unmatched interface id

MEMIF_ERR_ACCSLAVE 

slave cannot accept connection requests

MEMIF_ERR_ALRCONN 

memif is already connected

MEMIF_ERR_MODE 

mode mismatch

MEMIF_ERR_SECRET 

secret mismatch

MEMIF_ERR_NOSECRET 

secret required

MEMIF_ERR_MAXREG 

max region limit reached

MEMIF_ERR_MAXRING 

max ring limit reached

MEMIF_ERR_NO_INTFD 

missing interrupt fd

MEMIF_ERR_DISCONNECT 

disconenct received

MEMIF_ERR_DISCONNECTED 

peer interface disconnected

MEMIF_ERR_UNKNOWN_MSG 

unknown message type

Definition at line 33 of file libmemif.h.