libosmocore  1.9.0.20-4ca0f.202310312026
Osmocom core library
osmo_io.h File Reference

io(_uring) abstraction osmo fd compatibility More...

Go to the source code of this file.

Data Structures

struct  osmo_io_ops
 

Macros

#define LOGPIO(iofd, level, fmt, args...)    LOGP(DLIO, level, "iofd(%s)" fmt, iofd->name, ## args)
 

Enumerations

enum  osmo_io_fd_mode {
  OSMO_IO_FD_MODE_READ_WRITE ,
  OSMO_IO_FD_MODE_RECVFROM_SENDTO ,
  OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG
}
 
enum  osmo_io_backend {
  OSMO_IO_BACKEND_POLL ,
  OSMO_IO_BACKEND_IO_URING
}
 

Functions

static const char * osmo_io_backend_name (enum osmo_io_backend val)
 
void osmo_iofd_init (void)
 
struct osmo_io_fdosmo_iofd_setup (const void *ctx, int fd, const char *name, enum osmo_io_fd_mode mode, const struct osmo_io_ops *ioops, void *data)
 
int osmo_iofd_register (struct osmo_io_fd *iofd, int fd)
 
int osmo_iofd_unregister (struct osmo_io_fd *iofd)
 
unsigned int osmo_iofd_txqueue_len (struct osmo_io_fd *iofd)
 
void osmo_iofd_txqueue_clear (struct osmo_io_fd *iofd)
 
int osmo_iofd_close (struct osmo_io_fd *iofd)
 
void osmo_iofd_free (struct osmo_io_fd *iofd)
 
void osmo_iofd_notify_connected (struct osmo_io_fd *iofd)
 
int osmo_iofd_write_msgb (struct osmo_io_fd *iofd, struct msgb *msg)
 
int osmo_iofd_sendto_msgb (struct osmo_io_fd *iofd, struct msgb *msg, int sendto_flags, const struct osmo_sockaddr *dest)
 
void osmo_iofd_set_alloc_info (struct osmo_io_fd *iofd, unsigned int size, unsigned int headroom)
 
void osmo_iofd_set_txqueue_max_length (struct osmo_io_fd *iofd, unsigned int size)
 
void * osmo_iofd_get_data (const struct osmo_io_fd *iofd)
 
void osmo_iofd_set_data (struct osmo_io_fd *iofd, void *data)
 
unsigned int osmo_iofd_get_priv_nr (const struct osmo_io_fd *iofd)
 
void osmo_iofd_set_priv_nr (struct osmo_io_fd *iofd, unsigned int priv_nr)
 
int osmo_iofd_get_fd (const struct osmo_io_fd *iofd)
 
const char * osmo_iofd_get_name (const struct osmo_io_fd *iofd)
 
void osmo_iofd_set_name (struct osmo_io_fd *iofd, const char *name)
 
void osmo_iofd_set_ioops (struct osmo_io_fd *iofd, const struct osmo_io_ops *ioops)
 

Variables

const struct value_string osmo_io_backend_names []
 

Detailed Description

io(_uring) abstraction osmo fd compatibility

Macro Definition Documentation

◆ LOGPIO

#define LOGPIO (   iofd,
  level,
  fmt,
  args... 
)     LOGP(DLIO, level, "iofd(%s)" fmt, iofd->name, ## args)

Enumeration Type Documentation

◆ osmo_io_backend

Enumerator
OSMO_IO_BACKEND_POLL 
OSMO_IO_BACKEND_IO_URING 

◆ osmo_io_fd_mode

Enumerator
OSMO_IO_FD_MODE_READ_WRITE 

use read() / write() calls

OSMO_IO_FD_MODE_RECVFROM_SENDTO 

use recvfrom() / sendto() calls

OSMO_IO_FD_MODE_SCTP_RECVMSG_SENDMSG 

emulate sctp_recvmsg() and sctp_sendmsg()

Function Documentation

◆ osmo_io_backend_name()

static const char* osmo_io_backend_name ( enum osmo_io_backend  val)
inlinestatic

◆ osmo_iofd_close()

int osmo_iofd_close ( struct osmo_io_fd iofd)

◆ osmo_iofd_free()

void osmo_iofd_free ( struct osmo_io_fd iofd)

◆ osmo_iofd_get_data()

void* osmo_iofd_get_data ( const struct osmo_io_fd iofd)

◆ osmo_iofd_get_fd()

int osmo_iofd_get_fd ( const struct osmo_io_fd iofd)

◆ osmo_iofd_get_name()

const char* osmo_iofd_get_name ( const struct osmo_io_fd iofd)

◆ osmo_iofd_get_priv_nr()

unsigned int osmo_iofd_get_priv_nr ( const struct osmo_io_fd iofd)

◆ osmo_iofd_init()

void osmo_iofd_init ( void  )

◆ osmo_iofd_notify_connected()

void osmo_iofd_notify_connected ( struct osmo_io_fd iofd)

◆ osmo_iofd_register()

int osmo_iofd_register ( struct osmo_io_fd iofd,
int  fd 
)

◆ osmo_iofd_sendto_msgb()

int osmo_iofd_sendto_msgb ( struct osmo_io_fd iofd,
struct msgb msg,
int  sendto_flags,
const struct osmo_sockaddr dest 
)

◆ osmo_iofd_set_alloc_info()

void osmo_iofd_set_alloc_info ( struct osmo_io_fd iofd,
unsigned int  size,
unsigned int  headroom 
)

◆ osmo_iofd_set_data()

void osmo_iofd_set_data ( struct osmo_io_fd iofd,
void *  data 
)

◆ osmo_iofd_set_ioops()

void osmo_iofd_set_ioops ( struct osmo_io_fd iofd,
const struct osmo_io_ops ioops 
)

◆ osmo_iofd_set_name()

void osmo_iofd_set_name ( struct osmo_io_fd iofd,
const char *  name 
)

◆ osmo_iofd_set_priv_nr()

void osmo_iofd_set_priv_nr ( struct osmo_io_fd iofd,
unsigned int  priv_nr 
)

◆ osmo_iofd_set_txqueue_max_length()

void osmo_iofd_set_txqueue_max_length ( struct osmo_io_fd iofd,
unsigned int  size 
)

◆ osmo_iofd_setup()

struct osmo_io_fd* osmo_iofd_setup ( const void *  ctx,
int  fd,
const char *  name,
enum osmo_io_fd_mode  mode,
const struct osmo_io_ops ioops,
void *  data 
)

◆ osmo_iofd_txqueue_clear()

void osmo_iofd_txqueue_clear ( struct osmo_io_fd iofd)

◆ osmo_iofd_txqueue_len()

unsigned int osmo_iofd_txqueue_len ( struct osmo_io_fd iofd)

◆ osmo_iofd_unregister()

int osmo_iofd_unregister ( struct osmo_io_fd iofd)

◆ osmo_iofd_write_msgb()

int osmo_iofd_write_msgb ( struct osmo_io_fd iofd,
struct msgb msg 
)

Variable Documentation

◆ osmo_io_backend_names

const struct value_string osmo_io_backend_names[]
extern

Referenced by osmo_io_backend_name().