/*
 *------------------------------------------------------------------
 * Copyright (c) 2017 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.
 *------------------------------------------------------------------
 */

/** @file
 *  @defgroup libmemif Example libmemif App
 */

#ifndef _LIBMEMIF_H_
#define _LIBMEMIF_H_

/** Libmemif version. */
#define LIBMEMIF_VERSION "4.0"
/** Default name of application using libmemif. */
#define MEMIF_DEFAULT_APP_NAME "libmemif-app"

#include <inttypes.h>
#include <sys/types.h>
#include <sys/timerfd.h>
#include <sys/types.h>

/*! Error codes */
typedef enum
{
  MEMIF_ERR_SUCCESS = 0,     /*!< success */
			     /* SYSCALL ERRORS */
  MEMIF_ERR_SYSCALL,	     /*!< other syscall error */
  MEMIF_ERR_CONNREFUSED,     /*!< connection refused */
  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 */
			     /* LIBMEMIF ERRORS */
  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 path
			      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 PROTO ERRORS */
  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,	   /*!< disconnect received */
  MEMIF_ERR_DISCONNECTED,  /*!< peer interface disconnected */
  MEMIF_ERR_UNKNOWN_MSG,   /*!< unknown message type */
  MEMIF_ERR_POLL_CANCEL,   /*!< memif_poll_event() was cancelled */
  MEMIF_ERR_MAX_RING,	   /*!< too large ring size */
  MEMIF_ERR_PRIVHDR,	   /*!< private hdrs not supported */
} memif_err_t;

/**
 * @defgroup MEMIF_FD_EVENT Types of events that need to be watched for specific fd.
 * @ingroup libmemif
 * @{
 */

/** \brief Memif fd events
 * User needs to set events that occurred on fd and pass them to
 * memif_control_fd_handler
 */
typedef enum memif_fd_event_type
{
  MEMIF_FD_EVENT_READ = 1,  /* 00001 */
  MEMIF_FD_EVENT_WRITE = 2, /* 00010 */
  /** inform libmemif that error occurred on fd */
  MEMIF_FD_EVENT_ERROR = 4, /* 00100 */
  /** if set, informs that fd is going to be closed (user may want to stop
     watching for events on this fd) */
  MEMIF_FD_EVENT_DEL = 8, /* 01000 */
  /** update events */
  MEMIF_FD_EVENT_MOD = 16 /* 10000 */
} memif_fd_event_type_t;
/** @} */

/** \brief Memif connection handle
    pointer of type void, pointing to internal structure
*/
typedef void *memif_conn_handle_t;

/** \brief Memif socket handle
    pointer of type void, pointing to internal structure
*/
typedef void *memif_socket_handle_t;

/** \brief Memif allocator alloc
    @param size - requested allocation size

    custom memory allocator: alloc function template
*/
typedef void *(memif_alloc_t) (size_t size);


/** \brief Memif realloc
    @param ptr - pointer to memory block
    @param size - requested allocation size

    custom memory reallocation
*/
typedef void *(memif_realloc_t) (void *ptr, size_t size);

/** \brief Memif allocator free
    @param size - requested allocation size

    custom memory allocator: free function template
*/
typedef void (memif_free_t) (void *ptr);

/**
 * @defgroup CALLBACKS Callback functions definitions
 * @ingroup libmemif
 *
 * @{
 */

/** \brief Memif fd event
    @param fd - interrupt file descriptor
    @param type - memif fd event type
    @param private_ctx - private event data
*/
typedef struct memif_fd_event
{
  int fd;
  memif_fd_event_type_t type;
  void *private_ctx;
} memif_fd_event_t;

/** \brief Memif control file descriptor update (callback function)
    @param fde - memif fd event
    @param private_ctx - private context of socket this fd belongs to


    This callback is called when there is new fd to watch for events on
    or if fd is about to be closed (user mey want to stop watching for events
   on this fd). Private context is taken from libmemif_main, 'private_ctx'
   passed to memif_per_thread_init() or NULL in case of memif_init()
*/
typedef int (memif_control_fd_update_t) (memif_fd_event_t fde,
					 void *private_ctx);

/** \brief Memif connection status update (callback function)
    @param conn - memif connection handle
    @param private_ctx - private context

    Informs user about connection status connected/disconnected.
    On connected -> start watching for events on interrupt fd (optional).
*/
typedef int (memif_connection_update_t) (memif_conn_handle_t conn,
					 void *private_ctx);

/** \brief Memif interrupt occurred (callback function)
    @param conn - memif connection handle
    @param private_ctx - private context
    @param qid - queue id on which interrupt occurred

    Called when event is received on interrupt fd.
*/
typedef int (memif_on_interrupt_t) (memif_conn_handle_t conn,
				    void *private_ctx, uint16_t qid);

/** @} */

/**
 * @defgroup EXTERNAL_REGION External region APIs
 * @ingroup libmemif
 *
 * @{
 */

/** \brief Get external buffer offset (optional)
    @param private_ctx - private context

    Find unallocated external buffer and return its offset.
*/
typedef uint32_t (memif_get_external_buffer_offset_t) (void *private_ctx);

/** \brief Add external region
    @param[out] addr - region address
    @param size - requested region size
    @param fd[out] - file descriptor
    @param private_ctx - private context

    Called by slave. Add external region created by client.
*/
typedef int (memif_add_external_region_t) (void * *addr, uint32_t size,
					   int *fd, void *private_ctx);

/** \brief Get external region address
    @param size - requested region size
    @param fd - file descriptor
    @param private_ctx - private context

    Called by master. Get region address from client.

   \return region address
*/
typedef void *(memif_get_external_region_addr_t) (uint32_t size, int fd,
						  void *private_ctx);

/** \brief Delete external region
    @param addr - region address
    @param size - region size
    @param fd - file descriptor
    @param private_ctx - private context

    Delete external region.
*/
typedef int (memif_del_external_region_t) (void *addr, uint32_t size, int fd,
					   void *private_ctx);

/** \brief Register external region
    @param ar - add external region callback
    @param gr - get external region addr callback
    @param dr - delete external region callback
    @param go - get external buffer offset callback (optional)
*/
void memif_register_external_region (memif_socket_handle_t sock,
				     memif_add_external_region_t *ar,
				     memif_get_external_region_addr_t *gr,
				     memif_del_external_region_t *dr,
				     memif_get_external_buffer_offset_t *go);

/** \brief Register external region
    @param pt_main - per thread main handle
    @param ar - add external region callback
    @param gr - get external region addr callback
    @param dr - delete external region callback
    @param go - get external buffer offset callback (optional)

void memif_per_thread_register_external_region (memif_per_thread_main_handle_t
						pt_main,
						memif_add_external_region_t *
						ar,
						memif_get_external_region_addr_t
						* gr,
						memif_del_external_region_t *
						dr,
						memif_get_external_buffer_offset_t
						* go);

 @} */

/**
 * @defgroup ARGS_N_BUFS Connection arguments and buffers
 * @ingroup libmemif
 *
 * @{
 */

#ifndef _MEMIF_H_
typedef enum
{
  MEMIF_INTERFACE_MODE_ETHERNET = 0,
  MEMIF_INTERFACE_MODE_IP = 1,
  MEMIF_INTERFACE_MODE_PUNT_INJECT = 2,
} memif_interface_mode_t;
#endif /* _MEMIF_H_ */

/** \brief Memif socket arguments
    @param path - UNIX socket path, supports abstract socket (have '\0' or '@'
   as the first char of the path)
    @param app_name - application name
    @param connection_request_timer - automaticaly request connection each time
   this timer expires, must be non-zero to enable this feature
    @param on_control_fd_update - if control fd updates inform user to watch
   new fd
    @param alloc - custom memory allocator, NULL = default
    @param realloc - custom memory reallocation, NULL = default
    @param free - custom memory free, NULL = default

    If param on_control_fd_update is set to NULL,
    libmemif will handle file descriptor event polling
    if a valid callback is set, file descriptor event polling needs to be done
   by user application, all file descriptors and event types will be passed in
    this callback to user application
*/
typedef struct memif_socket_args
{
  char path[108];
  char app_name[32];

  struct itimerspec connection_request_timer;

  memif_control_fd_update_t *on_control_fd_update;
  memif_alloc_t *alloc;
  memif_realloc_t *realloc;
  memif_free_t *free;
} memif_socket_args_t;

/** \brief Memif connection arguments
    @param socket - Memif socket handle, if NULL default socket will be used.
		    Default socket is only supported in global database (see memif_init).
		    Custom database does not create a default socket
		    (see memif_per_thread_init).
		    Memif connection is stored in the same database as the socket.
    @param secret - optional parameter used as interface authentication
    @param num_s2m_rings - number of slave to master rings
    @param num_m2s_rings - number of master to slave rings
    @param buffer_size - size of buffer in shared memory
    @param log2_ring_size - logarithm base 2 of ring size
    @param is_master - 0 == master, 1 == slave
    @param interface_id - id used to identify peer connection
    @param interface_name - interface name
    @param mode - 0 == ethernet, 1 == ip , 2 == punt/inject
*/
typedef struct
{
  memif_socket_handle_t socket;	/*!< default = /run/vpp/memif.sock */
  uint8_t secret[24];		/*!< optional (interface authentication) */

  uint8_t num_s2m_rings;	/*!< default = 1 */
  uint8_t num_m2s_rings;	/*!< default = 1 */
  uint16_t buffer_size;		/*!< default = 2048 */
  uint8_t log2_ring_size;	/*!< default = 10 (1024) */
  uint8_t is_master;

  uint32_t interface_id;
  uint8_t interface_name[32];
  memif_interface_mode_t mode:8;
} memif_conn_args_t;

/*! memif receive mode */
typedef enum
{
  MEMIF_RX_MODE_INTERRUPT = 0,	/*!< interrupt mode */
  MEMIF_RX_MODE_POLLING		/*!< polling mode */
} memif_rx_mode_t;

/** \brief Memif buffer
    @param desc_index - ring descriptor index
    @param ring - pointer to ring containing descriptor for this buffer
    @param len - available length
    @param flags - memif buffer flags
    @param data - pointer to shared memory data
*/
typedef struct
{
  uint16_t desc_index;
  void *queue;
  uint32_t len;
/** next buffer present (chained buffers) */
#define MEMIF_BUFFER_FLAG_NEXT (1 << 0)
  uint8_t flags;
  void *data;
} memif_buffer_t;
/** @} */

/**
 * @defgroup MEMIF_DETAILS Memif details structs
 * @ingroup libmemif
 *
 * @{
 */

/** \brief Memif queue details
    @param region - region index
    @param qid - queue id
    @param ring_size - size of ring buffer in shared memory
    @param flags - ring flags
    @param head - ring head pointer
    @param tail - ring tail pointer
    @param buffer_size - buffer size on shared memory
*/
typedef struct
{
  uint8_t region;
  uint16_t qid;
  uint32_t ring_size;
/** if set queue is in polling mode, else in interrupt mode */
#define MEMIF_QUEUE_FLAG_POLLING 1
  uint16_t flags;
  uint16_t head;
  uint16_t tail;
  uint16_t buffer_size;
} memif_queue_details_t;

/** \brief Memif region details
    @param index - region index
    @param addr - region address
    @param size - region size
    @param fd - file descriptor
    @param is_external - if not zero then region is defined by client
*/
typedef struct
{
  uint8_t index;
  void *addr;
  uint32_t size;
  int fd;
  uint8_t is_external;
} memif_region_details_t;

/** \brief Memif details
    @param if_name - interface name
    @param inst_name - application name
    @param remote_if_name - peer interface name
    @param remote_inst_name - peer application name
    @param id - connection id
    @param secret - secret
    @param role - 0 = master, 1 = slave
    @param mode - 0 = ethernet, 1 = ip , 2 = punt/inject
    @param socket_path - socket path
    @param regions_num - number of regions
    @param regions - struct containing region details
    @param rx_queues_num - number of receive queues
    @param tx_queues_num - number of transmit queues
    @param rx_queues - struct containing receive queue details
    @param tx_queues - struct containing transmit queue details
    @param error - error string
    @param link_up_down - 1 = up (connected), 2 = down (disconnected)
*/
typedef struct
{
  uint8_t *if_name;
  uint8_t *inst_name;
  uint8_t *remote_if_name;
  uint8_t *remote_inst_name;

  uint32_t id;
  uint8_t *secret;		/* optional */
  uint8_t role;			/* 0 = master, 1 = slave */
  uint8_t mode;			/* 0 = ethernet, 1 = ip, 2 = punt/inject */
  uint8_t *socket_path;
  uint8_t regions_num;
  memif_region_details_t *regions;
  uint8_t rx_queues_num;
  uint8_t tx_queues_num;
  memif_queue_details_t *rx_queues;
  memif_queue_details_t *tx_queues;

  uint8_t *error;
  uint8_t link_up_down;		/* 1 = up, 0 = down */
} memif_details_t;
/** @} */

/**
 * @defgroup API_CALLS Api calls
 * @ingroup libmemif
 *
 * @{
 */

/** \brief Memif get version

    \return ((MEMIF_VERSION_MAJOR << 8) | MEMIF_VERSION_MINOR)
*/
uint16_t memif_get_version ();

/** \brief Get memif version as string
    \return major.minor
*/
const char *memif_get_version_str ();

/** \brief Memif get queue event file descriptor
    @param conn - memif connection handle
    @param qid - queue id
    @param[out] fd - returns event file descriptor

    \return memif_err_t
*/

int memif_get_queue_efd (memif_conn_handle_t conn, uint16_t qid, int *fd);

/** \brief Memif set rx mode
    @param conn - memif connection handle
    @param rx_mode - receive mode
    @param qid - queue id

    \return memif_err_t
*/
int memif_set_rx_mode (memif_conn_handle_t conn, memif_rx_mode_t rx_mode,
		       uint16_t qid);

/** \brief Memif strerror
    @param err_code - error code

    Converts error code to error message.

    \return Error string
*/
char *memif_strerror (int err_code);

/** \brief Memif get details
    @param conn - memif connection handle
    @param md - pointer to memif details struct
    @param buf - buffer containing details strings
    @param buflen - length of buffer

    \return memif_err_t
*/
int memif_get_details (memif_conn_handle_t conn, memif_details_t * md,
		       char *buf, ssize_t buflen);

/** \brief Memory interface create function
    @param conn - connection handle for client app
    @param args - memory interface connection arguments
    @param on_connect - inform user about connected status
    @param on_disconnect - inform user about disconnected status
    @param on_interrupt - informs user about interrupt, if set to null user will not be notified about interrupt, user can use memif_get_queue_efd call to get interrupt fd to poll for events
    @param private_ctx - private context passed back to user with callback

    Creates memory interface.

    SLAVE-MODE -
        Start timer that will send events to timerfd. If this fd is passed to memif_control_fd_handler
        every disconnected memif in slave mode will send connection request.
        On success new fd is passed to user with memif_control_fd_update_t.

    MASTER-MODE -
        Create listener socket and pass fd to user with memif_control_fd_update_t.
        If this fd is passed to memif_control_fd_handler accept will be called and
        new fd will be passed to user with memif_control_fd_update_t.


    \return memif_err_t
*/
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_on_interrupt_t *on_interrupt, void *private_ctx);

/** \brief Memif control file descriptor handler
    @param ptr - pointer to event data
    @param events - event type(s) that occurred

    \return memif_err_t

*/
int memif_control_fd_handler (void *ptr, memif_fd_event_type_t events);

/** \brief Memif delete
    @param conn - pointer to memif connection handle


    disconnect session (free queues and regions, close file descriptors, unmap shared memory)
    set connection handle to NULL, to avoid possible double free

    \return memif_err_t
*/
int memif_delete (memif_conn_handle_t * conn);

/** \brief Memif buffer enq tx
    @param conn - memif connection handle
    @param qid - number identifying queue
    @param bufs - memif buffers
    @param count - number of memif buffers to enqueue
    @param count_out - returns number of allocated buffers

    Enqueue buffers to specified tx queue. Can only be used by slave.
    Updates desc_index field for each memif buffer.
    If connection handle points to master returns MEMIF_ERR_INVAL_ARG.

    \return memif_err_t
*/
int memif_buffer_enq_tx (memif_conn_handle_t conn, uint16_t qid,
			 memif_buffer_t * bufs, uint16_t count,
			 uint16_t * count_out);

/** \brief Memif buffer enq tx at idx
    @param conn - memif connection handle
    @param buf_a - memif buffer
    @param buf_b - memif buffer

    Swap descriptors for provided buffers and update the buffers
*/
int memif_buffer_requeue (memif_conn_handle_t conn, memif_buffer_t *buf_a,
			  memif_buffer_t *buf_b);

/** \brief Memif buffer alloc
    @param conn - memif connection handle
    @param qid - number identifying queue
    @param bufs - memif buffers
    @param count - number of memif buffers to allocate
    @param count_out - returns number of allocated buffers
    @param size - buffer size, may return chained buffers if size > buffer_size

    \return memif_err_t
*/
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);

/** \brief Memif set next free buffer
    @param conn - memif connection handle
    @param qid - number identifying queue
    @param buf - next free buffer

    Sets next free descriptor pointer for specified tx queue.
    The next allocation will happen at this buffer.
*/
int memif_set_next_free_buffer (memif_conn_handle_t conn, uint16_t qid,
				memif_buffer_t *buf);

/** \brief Memif refill queue
    @param conn - memif connection handle
    @param qid - number identifying queue
    @param count - number of buffers to be placed on ring
    @param headroom - offset the buffer by headroom

    \return memif_err_t
*/
int memif_refill_queue (memif_conn_handle_t conn, uint16_t qid,
			uint16_t count, uint16_t headroom);

/** \brief Memif transmit buffer burst
    @param conn - memif connection handle
    @param qid - number identifying queue
    @param bufs - memif buffers
    @param count - number of memif buffers to transmit
    @param tx - returns number of transmitted buffers

    \return memif_err_t
*/
int memif_tx_burst (memif_conn_handle_t conn, uint16_t qid,
		    memif_buffer_t * bufs, uint16_t count, uint16_t * tx);

/** \brief Memif receive buffer burst
    @param conn - memif connection handle
    @param qid - number identifying queue
    @param bufs - memif buffers
    @param count - number of memif buffers to receive
    @param rx - returns number of received buffers

    Consume interrupt event for receive queue.
    The event is not consumed, if memif_rx_burst fails.

    \return memif_err_t
*/
int memif_rx_burst (memif_conn_handle_t conn, uint16_t qid,
		    memif_buffer_t * bufs, uint16_t count, uint16_t * rx);

/** \brief Memif poll event
    @param sock - socket to poll events on
    @param timeout - timeout in seconds

    Passive event polling -
    timeout = 0 - dont wait for event, check event queue if there is an event
   and return. timeout = -1 - wait until event

    \return memif_err_t
*/
int memif_poll_event (memif_socket_handle_t sock, int timeout);

/** \brief Send signal to stop concurrently running memif_poll_event().
    @param sock - stop polling on this socket

    The function, however, does not wait for memif_poll_event() to stop.
    memif_poll_event() may still return simply because an event has occurred
    or the timeout has elapsed, but if called repeatedly in an infinite loop,
    a canceled memif_poll_event() is guaranteed to return MEMIF_ERR_POLL_CANCEL
    in the shortest possible time.
    This feature was not available in the first release.
    Use macro MEMIF_HAVE_CANCEL_POLL_EVENT to check if the feature is present.

    \return memif_err_t
*/
#define MEMIF_HAVE_CANCEL_POLL_EVENT 1
int memif_cancel_poll_event (memif_socket_handle_t sock);

/** \brief Send connection request
    @param conn - memif connection handle

    Only slave interface can request connection.

    \return memif_err_t
*/
int memif_request_connection (memif_conn_handle_t conn);

/** \brief Create memif socket
    @param sock - socket handle for client app
    @param args - memif socket arguments
    @param private_ctx - private context

    The first time an interface is assigned a socket, its type is determined.
    For master role it's 'listener', for slave role it's 'client'. Each
   interface requires socket of its respective type. Default socket is created
   if no socket handle is passed to memif_create(). It's private context is
   NULL. If all interfaces using this socket are deleted, the socket returns to
   its default state.

    \return memif_err_t
*/
int memif_create_socket (memif_socket_handle_t *sock,
			 memif_socket_args_t *args, void *private_ctx);

/** \brief Get memif socket handle from connection
    @param conn - memif connection handle

    \return memif_socket_handle_t
*/
memif_socket_handle_t memif_get_socket_handle (memif_conn_handle_t conn);

/** \brief Delete memif socket
    @param sock - socket handle for client app

    When trying to free socket in use, socket will not be freed and
    MEMIF_ERR_INVAL_ARG is returned.

    \return memif_err_t
*/
int memif_delete_socket (memif_socket_handle_t * sock);

/** \brief Get socket path
    @param sock - socket handle for client app

    Return constant pointer to socket path.

    \return const char *
*/
const char *memif_get_socket_path (memif_socket_handle_t sock);

/** \brief Get listener file descriptor
    @param sock - memif socket handle

    \return listener fd
*/
int memif_get_listener_fd (memif_socket_handle_t sock);

/** \brief Set listener file descriptor
    @param sock - memif socket handle
    @param if - file descriptor

    \return memif_err_t
*/
int memif_set_listener_fd (memif_socket_handle_t sock, int fd);

/** \brief Set connection request timer value
    @param sock - memif socket handle
    @param timer - new timer value

    Timer on which all disconnected slaves request connection.
    If the timer doesn't exist (timerspec is 0) create new timer.
    See system call 'timer_settime' man-page.
    \return memif_err_t
*/
int memif_set_connection_request_timer (memif_socket_handle_t sock,
					struct itimerspec timer);

/** @} */

#endif /* _LIBMEMIF_H_ */