\doxysection{Osmocom I/O interface}
\label{group__osmo__io}\index{Osmocom I/O interface@{Osmocom I/O interface}}


osmo\+\_\+io is the new (2023) interface for performing asynchronous I/O.  


\doxysubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ osmo\+\_\+io.\+h}
\begin{DoxyCompactList}\small\item\em io(\+\_\+uring) abstraction osmo fd compatibility \end{DoxyCompactList}\item 
file \textbf{ osmo\+\_\+io.\+c}
\end{DoxyCompactItemize}
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+io\+\_\+ops}
\begin{DoxyCompactList}\small\item\em I/O operations (call-\/back functions) related to an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ LOGPIO}(iofd,  \textbf{ level},  fmt,  args...)~ \textbf{ LOGP}(\textbf{ DLIO}, \textbf{ level}, \char`\"{}iofd(\%s) \char`\"{} fmt, iofd-\/$>$\textbf{ name}, \#\# args)
\begin{DoxyCompactList}\small\item\em log macro used for logging information related to the \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
\#define \textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+ENV}~\char`\"{}LIBOSMO\+\_\+\+IO\+\_\+\+BACKEND\char`\"{}
\begin{DoxyCompactList}\small\item\em This environment variable can be set to manually set the backend used in osmo\+\_\+io. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ osmo\+\_\+io\+\_\+fd\+\_\+mode} \{ \newline
\textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}
, \newline
\textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVFROM\+\_\+\+SENDTO}
, \newline
\textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG}
 \}
\begin{DoxyCompactList}\small\item\em The {\itshape mode} of an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} determines if read/write, recvfrom/sendmsg or recvmsg/sendmsg semantics are used. \end{DoxyCompactList}\item 
enum \textbf{ osmo\+\_\+io\+\_\+op} \{ \newline
\textbf{ OSMO\+\_\+\+IO\+\_\+\+OP\+\_\+\+READ}
, \newline
\textbf{ OSMO\+\_\+\+IO\+\_\+\+OP\+\_\+\+WRITE}
 \}
\begin{DoxyCompactList}\small\item\em The {\itshape operation} of an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} determines if read or write operation are to be configured used. \end{DoxyCompactList}\item 
enum \textbf{ osmo\+\_\+io\+\_\+backend} \{ \newline
\textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+POLL}
, \newline
\textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+IO\+\_\+\+URING}
 \}
\begin{DoxyCompactList}\small\item\em The back-\/end used by osmo\+\_\+io. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ osmo\+\_\+io\+\_\+backend} \textbf{ osmo\+\_\+io\+\_\+get\+\_\+backend} (void)
\begin{DoxyCompactList}\small\item\em Obtain the osmo\+\_\+io\+\_\+backend in use by the process. \end{DoxyCompactList}\item 
static const char $\ast$ \textbf{ osmo\+\_\+io\+\_\+backend\+\_\+name} (enum \textbf{ osmo\+\_\+io\+\_\+backend} val)
\begin{DoxyCompactList}\small\item\em return the string name of an osmo\+\_\+io\+\_\+backend \end{DoxyCompactList}\item 
static const char $\ast$ \textbf{ osmo\+\_\+iofd\+\_\+mode\+\_\+name} (enum \textbf{ osmo\+\_\+io\+\_\+fd\+\_\+mode} val)
\begin{DoxyCompactList}\small\item\em return the string name of an osmo\+\_\+io\+\_\+mode \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+init} (void)
\begin{DoxyCompactList}\small\item\em initialize osmo\+\_\+io for the current thread \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$ \textbf{ osmo\+\_\+iofd\+\_\+setup} (const void $\ast$ctx, int fd, const char $\ast$\textbf{ name}, enum \textbf{ osmo\+\_\+io\+\_\+fd\+\_\+mode} \textbf{ mode}, const struct \textbf{ osmo\+\_\+io\+\_\+ops} $\ast$ioops, void $\ast$\textbf{ data})
\begin{DoxyCompactList}\small\item\em Allocate and setup a new iofd. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+cmsg\+\_\+size} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, size\+\_\+t cmsg\+\_\+size)
\begin{DoxyCompactList}\small\item\em Set the size of the control message buffer allocated when submitting recvmsg. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+io\+\_\+buffers} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, enum \textbf{ osmo\+\_\+io\+\_\+op} op, uint8\+\_\+t buffers)
\begin{DoxyCompactList}\small\item\em Set the number of buffers that can be used in a single read or write operation. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+sqes} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, enum \textbf{ osmo\+\_\+io\+\_\+op} op, uint8\+\_\+t sqes)
\begin{DoxyCompactList}\small\item\em Set the number of SQEs that are submitted to an io\+\_\+unring before completion is received. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+register} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, int fd)
\begin{DoxyCompactList}\small\item\em Register the \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} for active I/O. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+unregister} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Unregister the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} from osmo\+\_\+io. \end{DoxyCompactList}\item 
unsigned int \textbf{ osmo\+\_\+iofd\+\_\+txqueue\+\_\+len} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Retrieve the number of messages pending in the transmit queue. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+txqueue\+\_\+clear} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Clear the transmit queue of the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+close} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Close the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+free} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Free the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+notify\+\_\+connected} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Request notification of the user if/when a client socket is connected. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+write\+\_\+msgb} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em Write a message to a file descriptor / connected socket. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+sendto\+\_\+msgb} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, struct \textbf{ msgb} $\ast$\textbf{ msg}, int sendto\+\_\+flags, const struct \textbf{ osmo\+\_\+sockaddr} $\ast$dest)
\begin{DoxyCompactList}\small\item\em Send a message through an unconnected socket. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+sendmsg\+\_\+msgb} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, struct \textbf{ msgb} $\ast$\textbf{ msg}, int sendmsg\+\_\+flags, const struct msghdr $\ast$msgh)
\begin{DoxyCompactList}\small\item\em osmo\+\_\+io equivalent of the sendmsg(2) socket API call. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+alloc\+\_\+info} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, unsigned int size, unsigned int headroom)
\begin{DoxyCompactList}\small\item\em Set the size and headroom of the msgb allocated when receiving messages. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+txqueue\+\_\+max\+\_\+length} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, unsigned int max\+\_\+length)
\begin{DoxyCompactList}\small\item\em Set the maximum number of messages enqueued for sending. \end{DoxyCompactList}\item 
unsigned int \textbf{ osmo\+\_\+iofd\+\_\+get\+\_\+txqueue\+\_\+max\+\_\+length} (const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Get the maximum number of messages enqueued for sending. \end{DoxyCompactList}\item 
void $\ast$ \textbf{ osmo\+\_\+iofd\+\_\+get\+\_\+data} (const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Retrieve the associated user-\/data from an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+data} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, void $\ast$\textbf{ data})
\begin{DoxyCompactList}\small\item\em Set the associated user-\/data from an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
unsigned int \textbf{ osmo\+\_\+iofd\+\_\+get\+\_\+priv\+\_\+nr} (const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Retrieve the private number from an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+priv\+\_\+nr} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, unsigned int priv\+\_\+nr)
\begin{DoxyCompactList}\small\item\em Set the private number of an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+get\+\_\+fd} (const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Retrieve the underlying file descriptor from an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+iofd\+\_\+get\+\_\+name} (const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Retrieve the human-\/readable name of the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+name} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Set the human-\/readable name of the file descriptor. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+name\+\_\+f} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, const char $\ast$fmt,...)
\begin{DoxyCompactList}\small\item\em Set the human-\/readable name of the file descriptor using arguments like printf() \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+ioops} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, const struct \textbf{ osmo\+\_\+io\+\_\+ops} $\ast$ioops)
\begin{DoxyCompactList}\small\item\em Set the \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops} calbacks for an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+iofd\+\_\+get\+\_\+ioops} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, struct \textbf{ osmo\+\_\+io\+\_\+ops} $\ast$ioops)
\begin{DoxyCompactList}\small\item\em Retrieve the \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops} for an iofd. \end{DoxyCompactList}\item 
static \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+} ((constructor(103)))
\item 
struct \textbf{ iofd\+\_\+msghdr} $\ast$ \textbf{ iofd\+\_\+msghdr\+\_\+alloc} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, enum \textbf{ iofd\+\_\+msg\+\_\+action} action, struct \textbf{ msgb} $\ast$\textbf{ msg}, size\+\_\+t cmsg\+\_\+size)
\begin{DoxyCompactList}\small\item\em Allocate the msghdr. \end{DoxyCompactList}\item 
void \textbf{ iofd\+\_\+msghdr\+\_\+free} (struct \textbf{ iofd\+\_\+msghdr} $\ast$msghdr)
\begin{DoxyCompactList}\small\item\em Free the msghdr. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ iofd\+\_\+msgb\+\_\+alloc2} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em convenience wrapper to call msgb\+\_\+alloc with parameters from \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} (of given size) \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ iofd\+\_\+msgb\+\_\+alloc} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em convenience wrapper to call msgb\+\_\+alloc with parameters from \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} \end{DoxyCompactList}\item 
int \textbf{ iofd\+\_\+txqueue\+\_\+enqueue} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, struct \textbf{ iofd\+\_\+msghdr} $\ast$msghdr)
\begin{DoxyCompactList}\small\item\em Enqueue a message to be sent. \end{DoxyCompactList}\item 
void \textbf{ iofd\+\_\+txqueue\+\_\+enqueue\+\_\+front} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, struct \textbf{ iofd\+\_\+msghdr} $\ast$msghdr)
\begin{DoxyCompactList}\small\item\em Enqueue a message at the front. \end{DoxyCompactList}\item 
struct \textbf{ iofd\+\_\+msghdr} $\ast$ \textbf{ iofd\+\_\+txqueue\+\_\+dequeue} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\begin{DoxyCompactList}\small\item\em Dequeue a message from the front. \end{DoxyCompactList}\item 
static enum \textbf{ iofd\+\_\+seg\+\_\+act} \textbf{ iofd\+\_\+handle\+\_\+segmentation} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, struct \textbf{ msgb} $\ast$\textbf{ msg}, struct \textbf{ msgb} $\ast$$\ast$pending\+\_\+out)
\begin{DoxyCompactList}\small\item\em Handle segmentation of the msg. \end{DoxyCompactList}\item 
static void \textbf{ \+\_\+call\+\_\+read\+\_\+cb} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, int rc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\item 
static uint16\+\_\+t \textbf{ iofd\+\_\+msgb\+\_\+length\+\_\+max} (const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd)
\item 
static struct \textbf{ msgb} $\ast$ \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, struct \textbf{ msgb} $\ast$in\+\_\+msg)
\item 
static void \textbf{ iofd\+\_\+handle\+\_\+segmented\+\_\+read} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, int rc, struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em Restore message boundaries on read() and pass individual messages to the read callback. \end{DoxyCompactList}\item 
void \textbf{ iofd\+\_\+handle\+\_\+recv} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, struct \textbf{ msgb} $\ast$\textbf{ msg}, int rc, struct \textbf{ iofd\+\_\+msghdr} $\ast$\textbf{ hdr})
\begin{DoxyCompactList}\small\item\em completion handler\+: Internal function called by osmo\+\_\+io\+\_\+backend after a given I/O operation has completed \end{DoxyCompactList}\item 
void \textbf{ iofd\+\_\+handle\+\_\+send\+\_\+completion} (struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$iofd, int rc, struct \textbf{ iofd\+\_\+msghdr} $\ast$msghdr)
\begin{DoxyCompactList}\small\item\em completion handler\+: Internal function called by osmo\+\_\+io\+\_\+backend after a given I/O operation has completed \end{DoxyCompactList}\item 
static int \textbf{ check\+\_\+mode\+\_\+callback\+\_\+compat} (enum \textbf{ osmo\+\_\+io\+\_\+fd\+\_\+mode} \textbf{ mode}, const struct \textbf{ osmo\+\_\+io\+\_\+ops} $\ast$ops)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
const struct \textbf{ value\+\_\+string} \textbf{ osmo\+\_\+io\+\_\+backend\+\_\+names} [$\,$]
\item 
const struct \textbf{ value\+\_\+string} \textbf{ osmo\+\_\+iofd\+\_\+mode\+\_\+names} [$\,$]
\item 
const struct \textbf{ value\+\_\+string} \textbf{ osmo\+\_\+io\+\_\+backend\+\_\+names} [$\,$]
\item 
const struct \textbf{ value\+\_\+string} \textbf{ osmo\+\_\+iofd\+\_\+mode\+\_\+names} [$\,$]
\item 
static enum \textbf{ osmo\+\_\+io\+\_\+backend} \textbf{ g\+\_\+io\+\_\+backend}
\item 
struct \textbf{ iofd\+\_\+backend\+\_\+ops} \textbf{ osmo\+\_\+iofd\+\_\+ops}
\item 
static \+\_\+\+\_\+thread bool \textbf{ g\+\_\+thread\+\_\+initialized} = false
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
osmo\+\_\+io is the new (2023) interface for performing asynchronous I/O. 

osmo\+\_\+io encapsulates asynchronous, non-\/blocking I/O to sockets or other file descriptors with a submission/completion model.

For writes, the API user submits write requests, and receives completion call-\/backs once the write completes.

For reads, the API user specifies the size (and headroom) for message buffers, and osmo\+\_\+io internally allocates msgb\textquotesingle{}s accordingly. Whenever data arrives at the socket/file descriptor, osmo\+\_\+io reads the data into such a msgb and hands it to a read-\/completion call-\/back provided by the API user.

A given socket/file descriptor is represented by struct \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} are named, i.\+e. the API user can provide a meaningful name describing the purpose (such as protocol/interface or the name of the remote peer). This allows osmo\+\_\+io to log any related [error] messages using this name as context.

When implementing some SOCK\+\_\+\+STREAM / SOCK\+\_\+\+SEQPACKET based client/server transports (such as those on top of TCP or SCTP), you are most likely better off using the osmo\+\_\+stream\+\_\+cli / osmo\+\_\+stream\+\_\+srv abstractions provided by libosmo-\/netif. They in turn can be used in an osmo\+\_\+io mode, see the respective documentation.

If you use \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} directly, the life-\/cycle usually will look as follows\+:


\begin{DoxyEnumerate}
\item open some socket and bind and/or connect it
\item Allocate an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} using \doxyref{osmo\+\_\+iofd\+\_\+setup()}{p.}{group__osmo__io_gaa51acb50932f9ca44bfe0fe8a7005c93}, configuring the mode and specifying the call-\/backs
\item Registering it with \doxyref{osmo\+\_\+iofd\+\_\+register()}{p.}{group__osmo__io_gaa53e1057f56ac19ab23f35eecf4ed95a}, which enables reading
\item Handle inbound data via \{read,recvfrom,recvmsg\} call-\/backs; write to it using osmo\+\_\+iofd\+\_\+\{write,sendto\+\_\+sendmsg\}\+\_\+msg()
\item Eventually un-\/register it using \doxyref{osmo\+\_\+iofd\+\_\+unregister()}{p.}{group__osmo__io_ga3ea9d5e4466d3cf56d922e25106fe8ff}. Afterwards, you can re-\/cycle the iofd by calling \doxyref{osmo\+\_\+iofd\+\_\+register()}{p.}{group__osmo__io_gaa53e1057f56ac19ab23f35eecf4ed95a} with a new file-\/descriptor, or free it using \doxyref{osmo\+\_\+iofd\+\_\+free()}{p.}{group__osmo__io_ga8a10e120fd35fcf7f0fd8b43f5b8d5aa}. 
\end{DoxyEnumerate}

\doxysubsection{Macro Definition Documentation}
\mbox{\label{group__osmo__io_gad79a233373abd11aa1e78ba00a03fba4}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!LOGPIO@{LOGPIO}}
\index{LOGPIO@{LOGPIO}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{LOGPIO}
{\footnotesize\ttfamily \#define LOGPIO(\begin{DoxyParamCaption}\item[{}]{iofd,  }\item[{}]{\textbf{ level},  }\item[{}]{fmt,  }\item[{}]{args... }\end{DoxyParamCaption})~ \textbf{ LOGP}(\textbf{ DLIO}, \textbf{ level}, \char`\"{}iofd(\%s) \char`\"{} fmt, iofd-\/$>$\textbf{ name}, \#\# args)}



log macro used for logging information related to the \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} about which we\textquotesingle{}re logging \\
\hline
\mbox{\texttt{ in}}  & {\em level} & log-\/level (LOGL\+\_\+\+DEBUG, LOGL\+\_\+\+INFO, LOGL\+\_\+\+NOTICE, LOGL\+\_\+\+ERROR, LOGL\+\_\+\+FATAL) \\
\hline
\mbox{\texttt{ in}}  & {\em fmt} & printf-\/style format string \\
\hline
\mbox{\texttt{ in}}  & {\em args} & arguments to the format string \\
\hline
\end{DoxyParams}
\mbox{\label{group__osmo__io_ga39780b6efe5513635fe389b5a1e15851}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!OSMO\_IO\_BACKEND\_ENV@{OSMO\_IO\_BACKEND\_ENV}}
\index{OSMO\_IO\_BACKEND\_ENV@{OSMO\_IO\_BACKEND\_ENV}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{OSMO\_IO\_BACKEND\_ENV}
{\footnotesize\ttfamily \#define OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+ENV~\char`\"{}LIBOSMO\+\_\+\+IO\+\_\+\+BACKEND\char`\"{}}



This environment variable can be set to manually set the backend used in osmo\+\_\+io. 



\doxysubsection{Enumeration Type Documentation}
\mbox{\label{group__osmo__io_ga5cd6c55e1c52afb526fe99154a8c1037}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_io\_backend@{osmo\_io\_backend}}
\index{osmo\_io\_backend@{osmo\_io\_backend}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_io\_backend}
{\footnotesize\ttfamily enum \textbf{ osmo\+\_\+io\+\_\+backend}}



The back-\/end used by osmo\+\_\+io. 

There can be multiple different back-\/ends available on a given system; only one of it is used for all I/O performed via osmo\+\_\+io in one given process. \begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_IO\_BACKEND\_POLL@{OSMO\_IO\_BACKEND\_POLL}!Osmocom I/O interface@{Osmocom I/O interface}}\index{Osmocom I/O interface@{Osmocom I/O interface}!OSMO\_IO\_BACKEND\_POLL@{OSMO\_IO\_BACKEND\_POLL}}}\mbox{\label{group__osmo__io_gga5cd6c55e1c52afb526fe99154a8c1037ae373cd88f847a3dca2f27161c18a3854}} 
OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+POLL&classic back-\/end using poll(2) and direct read/write/recvfrom/sendto/recvmsg/sendmsg syscalls \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_IO\_BACKEND\_IO\_URING@{OSMO\_IO\_BACKEND\_IO\_URING}!Osmocom I/O interface@{Osmocom I/O interface}}\index{Osmocom I/O interface@{Osmocom I/O interface}!OSMO\_IO\_BACKEND\_IO\_URING@{OSMO\_IO\_BACKEND\_IO\_URING}}}\mbox{\label{group__osmo__io_gga5cd6c55e1c52afb526fe99154a8c1037af670c1a37d43d6a4c954371727a1ec30}} 
OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+IO\+\_\+\+URING&back-\/end using io\+\_\+uring to perform efficient I/O and reduce syscall overhead \\
\hline

\end{DoxyEnumFields}
\mbox{\label{group__osmo__io_ga196eee1d3f903df0c1bf84fb7c3179a4}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_io\_fd\_mode@{osmo\_io\_fd\_mode}}
\index{osmo\_io\_fd\_mode@{osmo\_io\_fd\_mode}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_io\_fd\_mode}
{\footnotesize\ttfamily enum \textbf{ osmo\+\_\+io\+\_\+fd\+\_\+mode}}



The {\itshape mode} of an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} determines if read/write, recvfrom/sendmsg or recvmsg/sendmsg semantics are used. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_IO\_FD\_MODE\_READ\_WRITE@{OSMO\_IO\_FD\_MODE\_READ\_WRITE}!Osmocom I/O interface@{Osmocom I/O interface}}\index{Osmocom I/O interface@{Osmocom I/O interface}!OSMO\_IO\_FD\_MODE\_READ\_WRITE@{OSMO\_IO\_FD\_MODE\_READ\_WRITE}}}\mbox{\label{group__osmo__io_gga196eee1d3f903df0c1bf84fb7c3179a4af6e3729d49ac9f56c26a8af14172fc14}} 
OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE&use read() / write() semantics with read\+\_\+cb/write\+\_\+cb in \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops} \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_IO\_FD\_MODE\_RECVFROM\_SENDTO@{OSMO\_IO\_FD\_MODE\_RECVFROM\_SENDTO}!Osmocom I/O interface@{Osmocom I/O interface}}\index{Osmocom I/O interface@{Osmocom I/O interface}!OSMO\_IO\_FD\_MODE\_RECVFROM\_SENDTO@{OSMO\_IO\_FD\_MODE\_RECVFROM\_SENDTO}}}\mbox{\label{group__osmo__io_gga196eee1d3f903df0c1bf84fb7c3179a4a13ea1b4f62c4f0d1aa4c31be31dd26d5}} 
OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVFROM\+\_\+\+SENDTO&use recvfrom() / sendto() semantics with recvfrom\+\_\+cb/sendto\+\_\+cb in \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops} \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_IO\_FD\_MODE\_RECVMSG\_SENDMSG@{OSMO\_IO\_FD\_MODE\_RECVMSG\_SENDMSG}!Osmocom I/O interface@{Osmocom I/O interface}}\index{Osmocom I/O interface@{Osmocom I/O interface}!OSMO\_IO\_FD\_MODE\_RECVMSG\_SENDMSG@{OSMO\_IO\_FD\_MODE\_RECVMSG\_SENDMSG}}}\mbox{\label{group__osmo__io_gga196eee1d3f903df0c1bf84fb7c3179a4aaec6a07945b508eb06fa7b53e4fba4b8}} 
OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG&emulate recvmsg() / sendmsg() semantics with recvmsg\+\_\+cb/sendto\+\_\+cb in \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops} \\
\hline

\end{DoxyEnumFields}
\mbox{\label{group__osmo__io_gaf24a0d74fe0528130dd79e91e8b47217}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_io\_op@{osmo\_io\_op}}
\index{osmo\_io\_op@{osmo\_io\_op}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_io\_op}
{\footnotesize\ttfamily enum \textbf{ osmo\+\_\+io\+\_\+op}}



The {\itshape operation} of an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} determines if read or write operation are to be configured used. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_IO\_OP\_READ@{OSMO\_IO\_OP\_READ}!Osmocom I/O interface@{Osmocom I/O interface}}\index{Osmocom I/O interface@{Osmocom I/O interface}!OSMO\_IO\_OP\_READ@{OSMO\_IO\_OP\_READ}}}\mbox{\label{group__osmo__io_ggaf24a0d74fe0528130dd79e91e8b47217aa3b4583e49116c2a5edcaadc3015dcdc}} 
OSMO\+\_\+\+IO\+\_\+\+OP\+\_\+\+READ&change parameters for read() \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{OSMO\_IO\_OP\_WRITE@{OSMO\_IO\_OP\_WRITE}!Osmocom I/O interface@{Osmocom I/O interface}}\index{Osmocom I/O interface@{Osmocom I/O interface}!OSMO\_IO\_OP\_WRITE@{OSMO\_IO\_OP\_WRITE}}}\mbox{\label{group__osmo__io_ggaf24a0d74fe0528130dd79e91e8b47217ac3f2db3a8b7590008f949c88f0d4515f}} 
OSMO\+\_\+\+IO\+\_\+\+OP\+\_\+\+WRITE&change parameters for write() \\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\label{group__osmo__io_gaa811d40f7e27f5bf851308f829f85506}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!\_\_attribute\_\_@{\_\_attribute\_\_}}
\index{\_\_attribute\_\_@{\_\_attribute\_\_}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{\_\_attribute\_\_()}
{\footnotesize\ttfamily static \+\_\+\+\_\+attribute\+\_\+\+\_\+ (\begin{DoxyParamCaption}\item[{(constructor(103))}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ iofd\+\_\+backend\+\_\+ops\+::close}, \textbf{ g\+\_\+io\+\_\+backend}, \textbf{ iofd\+\_\+poll\+\_\+ops}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::notify\+\_\+connected}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+DEFAULT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+ENV}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+IO\+\_\+\+URING}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+POLL}, \textbf{ osmo\+\_\+iofd\+\_\+init()}, \textbf{ osmo\+\_\+iofd\+\_\+ops}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::read\+\_\+disable}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::read\+\_\+enable}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::register\+\_\+fd}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::unregister\+\_\+fd}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::write\+\_\+disable}, and \textbf{ iofd\+\_\+backend\+\_\+ops\+::write\+\_\+enable}.

\mbox{\label{group__osmo__io_ga0941375a74d6713f536cff8c48e3364b}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!\_call\_read\_cb@{\_call\_read\_cb}}
\index{\_call\_read\_cb@{\_call\_read\_cb}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{\_call\_read\_cb()}
{\footnotesize\ttfamily static void \+\_\+call\+\_\+read\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{int}]{rc,  }\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ osmo\+\_\+io\+\_\+fd\+::ctx}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+ops}, \textbf{ msg}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msgb\+\_\+alloc}, and \textbf{ osmo\+\_\+io\+\_\+ops\+::read\+\_\+cb}.



Referenced by \textbf{ iofd\+\_\+handle\+\_\+segmented\+\_\+read()}.

\mbox{\label{group__osmo__io_gaca9d1219150743bf70dc3eee15466efe}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!check\_mode\_callback\_compat@{check\_mode\_callback\_compat}}
\index{check\_mode\_callback\_compat@{check\_mode\_callback\_compat}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{check\_mode\_callback\_compat()}
{\footnotesize\ttfamily static int check\+\_\+mode\+\_\+callback\+\_\+compat (\begin{DoxyParamCaption}\item[{enum \textbf{ osmo\+\_\+io\+\_\+fd\+\_\+mode}}]{mode,  }\item[{const struct \textbf{ osmo\+\_\+io\+\_\+ops} $\ast$}]{ops }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ mode}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVFROM\+\_\+\+SENDTO}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG}, \textbf{ osmo\+\_\+io\+\_\+ops\+::read\+\_\+cb}, \textbf{ osmo\+\_\+io\+\_\+ops\+::recvfrom\+\_\+cb}, \textbf{ osmo\+\_\+io\+\_\+ops\+::recvmsg\+\_\+cb}, \textbf{ osmo\+\_\+io\+\_\+ops\+::segmentation\+\_\+cb}, \textbf{ osmo\+\_\+io\+\_\+ops\+::segmentation\+\_\+cb2}, \textbf{ osmo\+\_\+io\+\_\+ops\+::sendmsg\+\_\+cb}, \textbf{ osmo\+\_\+io\+\_\+ops\+::sendto\+\_\+cb}, and \textbf{ osmo\+\_\+io\+\_\+ops\+::write\+\_\+cb}.



Referenced by \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+ioops()}, and \textbf{ osmo\+\_\+iofd\+\_\+setup()}.

\mbox{\label{group__osmo__io_gad7e46038ace42362fd2ad67d20260da9}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_handle\_recv@{iofd\_handle\_recv}}
\index{iofd\_handle\_recv@{iofd\_handle\_recv}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_handle\_recv()}
{\footnotesize\ttfamily void iofd\+\_\+handle\+\_\+recv (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{int}]{rc,  }\item[{struct \textbf{ iofd\+\_\+msghdr} $\ast$}]{hdr }\end{DoxyParamCaption})}



completion handler\+: Internal function called by osmo\+\_\+io\+\_\+backend after a given I/O operation has completed 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & I/O file-\/descriptor on which I/O has completed \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer containing data related to completed I/O \\
\hline
\mbox{\texttt{ in}}  & {\em rc} & result code with read size or error (-\/errno) \\
\hline
\mbox{\texttt{ in}}  & {\em hdr} & serialized msghdr containing state of completed I/O \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::ctx}, \textbf{ hdr}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+ops}, \textbf{ iofd\+\_\+handle\+\_\+segmented\+\_\+read()}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ msg}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msgb\+\_\+alloc}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVFROM\+\_\+\+SENDTO}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG}, \textbf{ osmo\+\_\+io\+\_\+ops\+::recvfrom\+\_\+cb}, and \textbf{ osmo\+\_\+io\+\_\+ops\+::recvmsg\+\_\+cb}.



Referenced by \textbf{ iofd\+\_\+poll\+\_\+handle\+\_\+recv()}.

\mbox{\label{group__osmo__io_ga6f1e706e4d7ad59bfd240c9567002713}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_handle\_segmentation@{iofd\_handle\_segmentation}}
\index{iofd\_handle\_segmentation@{iofd\_handle\_segmentation}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_handle\_segmentation()}
{\footnotesize\ttfamily static enum \textbf{ iofd\+\_\+seg\+\_\+act} iofd\+\_\+handle\+\_\+segmentation (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{struct \textbf{ msgb} $\ast$$\ast$}]{pending\+\_\+out }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Handle segmentation of the msg. 

If this function returns $\ast$\+\_\+\+HANDLE\+\_\+\+ONE or MORE then the data in msg will contain one complete message. If there are bytes left over, $\ast$pending\+\_\+out will point to a msgb with the remaining data. Upon IOFD\+\_\+\+SEG\+\_\+\+ACT\+\_\+\+DEFER is returned, errno is set to error value providing reason\+: EAGAIN is returned when data is still missing to fill the segment; other error codes are propagated through read\+\_\+cb(). 

References \textbf{ data}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+ops}, \textbf{ iofd\+\_\+msgb\+\_\+alloc()}, \textbf{ IOFD\+\_\+\+SEG\+\_\+\+ACT\+\_\+\+DEFER}, \textbf{ IOFD\+\_\+\+SEG\+\_\+\+ACT\+\_\+\+HANDLE\+\_\+\+MORE}, \textbf{ IOFD\+\_\+\+SEG\+\_\+\+ACT\+\_\+\+HANDLE\+\_\+\+ONE}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGPIO}, \textbf{ msg}, \textbf{ msgb\+\_\+data()}, \textbf{ msgb\+\_\+length()}, \textbf{ msgb\+\_\+put()}, \textbf{ osmo\+\_\+io\+\_\+ops\+::segmentation\+\_\+cb}, and \textbf{ osmo\+\_\+io\+\_\+ops\+::segmentation\+\_\+cb2}.



Referenced by \textbf{ iofd\+\_\+handle\+\_\+segmented\+\_\+read()}.

\mbox{\label{group__osmo__io_ga91d182e9430d8fbe2a4bca5fa7cf4fa6}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_handle\_segmented\_read@{iofd\_handle\_segmented\_read}}
\index{iofd\_handle\_segmented\_read@{iofd\_handle\_segmented\_read}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_handle\_segmented\_read()}
{\footnotesize\ttfamily static void iofd\+\_\+handle\+\_\+segmented\+\_\+read (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{int}]{rc,  }\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Restore message boundaries on read() and pass individual messages to the read callback. 



References \textbf{ \+\_\+call\+\_\+read\+\_\+cb()}, \textbf{ osmo\+\_\+io\+\_\+fd\+::headroom}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+FD\+\_\+\+REGISTERED}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+ISSET}, \textbf{ iofd\+\_\+handle\+\_\+segmentation()}, \textbf{ iofd\+\_\+msgb\+\_\+length\+\_\+max()}, \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation()}, \textbf{ IOFD\+\_\+\+SEG\+\_\+\+ACT\+\_\+\+DEFER}, \textbf{ IOFD\+\_\+\+SEG\+\_\+\+ACT\+\_\+\+HANDLE\+\_\+\+MORE}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGPIO}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ msg}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msgb\+\_\+alloc}, \textbf{ msgb\+\_\+length()}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+UNLIKELY}, \textbf{ osmo\+\_\+io\+\_\+fd\+::pending}, and \textbf{ res}.



Referenced by \textbf{ iofd\+\_\+handle\+\_\+recv()}.

\mbox{\label{group__osmo__io_ga58b7e5d35ed02d28dab9b31004087a3d}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_handle\_send\_completion@{iofd\_handle\_send\_completion}}
\index{iofd\_handle\_send\_completion@{iofd\_handle\_send\_completion}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_handle\_send\_completion()}
{\footnotesize\ttfamily void iofd\+\_\+handle\+\_\+send\+\_\+completion (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{int}]{rc,  }\item[{struct \textbf{ iofd\+\_\+msghdr} $\ast$}]{msghdr }\end{DoxyParamCaption})}



completion handler\+: Internal function called by osmo\+\_\+io\+\_\+backend after a given I/O operation has completed 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & I/O file-\/descriptor on which I/O has completed \\
\hline
\mbox{\texttt{ in}}  & {\em rc} & return value of the I/O operation \\
\hline
\mbox{\texttt{ in}}  & {\em msghdr} & serialized msghdr containing state of completed I/O \\
\hline
\end{DoxyParams}


References \textbf{ iofd\+\_\+msghdr\+::action}, \textbf{ iofd\+\_\+msghdr\+::hdr}, \textbf{ iofd\+\_\+msghdr\+::io\+\_\+len}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+ops}, \textbf{ IOFD\+\_\+\+ACT\+\_\+\+SENDMSG}, \textbf{ IOFD\+\_\+\+ACT\+\_\+\+SENDTO}, \textbf{ IOFD\+\_\+\+ACT\+\_\+\+WRITE}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+FD\+\_\+\+REGISTERED}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+ISSET}, \textbf{ iofd\+\_\+msghdr\+\_\+free()}, \textbf{ iofd\+\_\+txqueue\+\_\+enqueue\+\_\+front()}, \textbf{ iofd\+\_\+msghdr\+::iov}, \textbf{ msg}, \textbf{ iofd\+\_\+msghdr\+::msg}, \textbf{ msgb\+\_\+free()}, \textbf{ msgb\+\_\+length()}, \textbf{ msgb\+\_\+pull()}, \textbf{ iofd\+\_\+msghdr\+::osa}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ osmo\+\_\+io\+\_\+ops\+::sendmsg\+\_\+cb}, \textbf{ osmo\+\_\+io\+\_\+ops\+::sendto\+\_\+cb}, and \textbf{ osmo\+\_\+io\+\_\+ops\+::write\+\_\+cb}.



Referenced by \textbf{ iofd\+\_\+poll\+\_\+ofd\+\_\+cb\+\_\+recvmsg\+\_\+sendmsg()}.

\mbox{\label{group__osmo__io_gaa76da55f64623829b922e3320d3a35a1}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_msgb\_alloc@{iofd\_msgb\_alloc}}
\index{iofd\_msgb\_alloc@{iofd\_msgb\_alloc}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_msgb\_alloc()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ iofd\+\_\+msgb\+\_\+alloc (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



convenience wrapper to call msgb\+\_\+alloc with parameters from \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} 



References \textbf{ iofd\+\_\+msgb\+\_\+alloc2()}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msgb\+\_\+alloc}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::size}.



Referenced by \textbf{ iofd\+\_\+handle\+\_\+segmentation()}, and \textbf{ iofd\+\_\+msghdr\+\_\+alloc()}.

\mbox{\label{group__osmo__io_ga9040b62bfc7b213a941e92bda5000eec}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_msgb\_alloc2@{iofd\_msgb\_alloc2}}
\index{iofd\_msgb\_alloc2@{iofd\_msgb\_alloc2}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_msgb\_alloc2()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ iofd\+\_\+msgb\+\_\+alloc2 (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}



convenience wrapper to call msgb\+\_\+alloc with parameters from \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} (of given size) 



References \textbf{ osmo\+\_\+io\+\_\+fd\+::headroom}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msgb\+\_\+alloc}, \textbf{ msgb\+\_\+alloc\+\_\+headroom\+\_\+c()}, and \textbf{ OSMO\+\_\+\+ASSERT}.



Referenced by \textbf{ iofd\+\_\+msgb\+\_\+alloc()}, and \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation()}.

\mbox{\label{group__osmo__io_ga170eaa88a44190ad3e73795bf4567451}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_msgb\_length\_max@{iofd\_msgb\_length\_max}}
\index{iofd\_msgb\_length\_max@{iofd\_msgb\_length\_max}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_msgb\_length\_max()}
{\footnotesize\ttfamily static uint16\+\_\+t iofd\+\_\+msgb\+\_\+length\+\_\+max (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ osmo\+\_\+io\+\_\+fd\+::headroom}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::msgb\+\_\+alloc}.



Referenced by \textbf{ iofd\+\_\+handle\+\_\+segmented\+\_\+read()}, and \textbf{ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation()}.

\mbox{\label{group__osmo__io_ga85597f790f142e4d7d49ca104a771d52}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_msghdr\_alloc@{iofd\_msghdr\_alloc}}
\index{iofd\_msghdr\_alloc@{iofd\_msghdr\_alloc}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_msghdr\_alloc()}
{\footnotesize\ttfamily struct \textbf{ iofd\+\_\+msghdr} $\ast$ iofd\+\_\+msghdr\+\_\+alloc (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{enum \textbf{ iofd\+\_\+msg\+\_\+action}}]{action,  }\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{size\+\_\+t}]{cmsg\+\_\+size }\end{DoxyParamCaption})}



Allocate the msghdr. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the osmo\+\_\+io file structure \\
\hline
\mbox{\texttt{ in}}  & {\em action} & the action this msg(hdr) is for (read, write, ..) \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & the msg buffer to use. Will allocate a new one if NULL \\
\hline
\mbox{\texttt{ in}}  & {\em cmsg\+\_\+size} & size (in bytes) of iofd\+\_\+msghdr.\+cmsg buffer. Can be 0 if cmsg is not used. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the newly allocated msghdr or NULL in case of error 
\end{DoxyReturn}


References \textbf{ iofd\+\_\+msghdr\+::action}, \textbf{ for()}, \textbf{ iofd\+\_\+msghdr\+::hdr}, \textbf{ iofd\+\_\+msghdr\+::io\+\_\+len}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+read\+\_\+buffers}, \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ IOFD\+\_\+\+ACT\+\_\+\+READ}, \textbf{ iofd\+\_\+msgb\+\_\+alloc()}, and \textbf{ iofd\+\_\+msghdr\+::msg}.



Referenced by \textbf{ iofd\+\_\+poll\+\_\+ofd\+\_\+cb\+\_\+recvmsg\+\_\+sendmsg()}, \textbf{ osmo\+\_\+iofd\+\_\+sendmsg\+\_\+msgb()}, \textbf{ osmo\+\_\+iofd\+\_\+sendto\+\_\+msgb()}, and \textbf{ osmo\+\_\+iofd\+\_\+write\+\_\+msgb()}.

\mbox{\label{group__osmo__io_ga25fcd917fe6e149b762c689c4c6648d4}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_msghdr\_free@{iofd\_msghdr\_free}}
\index{iofd\_msghdr\_free@{iofd\_msghdr\_free}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_msghdr\_free()}
{\footnotesize\ttfamily void iofd\+\_\+msghdr\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ iofd\+\_\+msghdr} $\ast$}]{msghdr }\end{DoxyParamCaption})}



Free the msghdr. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em msghdr} & the msghdr to free \\
\hline
\end{DoxyParams}


Referenced by \textbf{ iofd\+\_\+handle\+\_\+send\+\_\+completion()}, \textbf{ iofd\+\_\+poll\+\_\+handle\+\_\+recv()}, \textbf{ iofd\+\_\+txqueue\+\_\+dequeue()}, \textbf{ osmo\+\_\+iofd\+\_\+sendmsg\+\_\+msgb()}, \textbf{ osmo\+\_\+iofd\+\_\+sendto\+\_\+msgb()}, \textbf{ osmo\+\_\+iofd\+\_\+txqueue\+\_\+clear()}, and \textbf{ osmo\+\_\+iofd\+\_\+write\+\_\+msgb()}.

\mbox{\label{group__osmo__io_ga41c2117b9e58768fbbdf26490ea3ed6a}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_prepare\_handle\_segmentation@{iofd\_prepare\_handle\_segmentation}}
\index{iofd\_prepare\_handle\_segmentation@{iofd\_prepare\_handle\_segmentation}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_prepare\_handle\_segmentation()}
{\footnotesize\ttfamily static struct \textbf{ msgb} $\ast$ iofd\+\_\+prepare\+\_\+handle\+\_\+segmentation (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{struct \textbf{ msgb} $\ast$}]{in\+\_\+msg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



References \textbf{ iofd\+\_\+msgb\+\_\+alloc2()}, \textbf{ iofd\+\_\+msgb\+\_\+length\+\_\+max()}, \textbf{ msgb\+\_\+data()}, \textbf{ msgb\+\_\+free()}, \textbf{ msgb\+\_\+length()}, \textbf{ msgb\+\_\+pull()}, \textbf{ msgb\+\_\+put()}, \textbf{ msgb\+\_\+tailroom()}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+LIKELY}, \textbf{ OSMO\+\_\+\+MIN}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::pending}.



Referenced by \textbf{ iofd\+\_\+handle\+\_\+segmented\+\_\+read()}.

\mbox{\label{group__osmo__io_gacba5cc1993b3e9512a1a9ef53f5f0539}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_txqueue\_dequeue@{iofd\_txqueue\_dequeue}}
\index{iofd\_txqueue\_dequeue@{iofd\_txqueue\_dequeue}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_txqueue\_dequeue()}
{\footnotesize\ttfamily struct \textbf{ iofd\+\_\+msghdr} $\ast$ iofd\+\_\+txqueue\+\_\+dequeue (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Dequeue a message from the front. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the msghdr from the front of the queue or NULL if the queue is empty 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::current\+\_\+length}, \textbf{ iofd\+\_\+msghdr\+::hdr}, \textbf{ iofd\+\_\+msghdr\+::io\+\_\+len}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+write\+\_\+buffers}, \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ iofd\+\_\+msghdr\+\_\+free()}, \textbf{ iofd\+\_\+msghdr\+::iov}, \textbf{ list}, \textbf{ iofd\+\_\+msghdr\+::list}, \textbf{ llist\+\_\+del()}, \textbf{ llist\+\_\+first\+\_\+entry\+\_\+or\+\_\+null}, \textbf{ iofd\+\_\+msghdr\+::msg}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msg\+\_\+queue}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ osmo\+\_\+iofd\+\_\+ops}, \textbf{ OSMO\+\_\+\+UNLIKELY}, \textbf{ osmo\+\_\+io\+\_\+fd\+::tx\+\_\+queue}, and \textbf{ iofd\+\_\+backend\+\_\+ops\+::write\+\_\+disable}.



Referenced by \textbf{ iofd\+\_\+poll\+\_\+ofd\+\_\+cb\+\_\+recvmsg\+\_\+sendmsg()}, and \textbf{ osmo\+\_\+iofd\+\_\+txqueue\+\_\+clear()}.

\mbox{\label{group__osmo__io_gac93ff2c863e5b878ae7b35bb059454ab}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_txqueue\_enqueue@{iofd\_txqueue\_enqueue}}
\index{iofd\_txqueue\_enqueue@{iofd\_txqueue\_enqueue}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_txqueue\_enqueue()}
{\footnotesize\ttfamily int iofd\+\_\+txqueue\+\_\+enqueue (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{struct \textbf{ iofd\+\_\+msghdr} $\ast$}]{msghdr }\end{DoxyParamCaption})}



Enqueue a message to be sent. 

Enqueues the message at the back of the queue provided there is enough space. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em msghdr} & the message to enqueue \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if the message was enqueued succcessfully, -\/ENOSPC if the queue already contains the maximum number of messages 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::current\+\_\+length}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+CLOSED}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+ISSET}, \textbf{ iofd\+\_\+msghdr\+::list}, \textbf{ llist\+\_\+add\+\_\+tail()}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGPIO}, \textbf{ osmo\+\_\+io\+\_\+fd\+::max\+\_\+length}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msg\+\_\+queue}, \textbf{ osmo\+\_\+iofd\+\_\+ops}, \textbf{ osmo\+\_\+io\+\_\+fd\+::tx\+\_\+queue}, and \textbf{ iofd\+\_\+backend\+\_\+ops\+::write\+\_\+enable}.



Referenced by \textbf{ osmo\+\_\+iofd\+\_\+sendmsg\+\_\+msgb()}, \textbf{ osmo\+\_\+iofd\+\_\+sendto\+\_\+msgb()}, and \textbf{ osmo\+\_\+iofd\+\_\+write\+\_\+msgb()}.

\mbox{\label{group__osmo__io_ga0a3e46bdd7713605f681e993b2d3f84f}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!iofd\_txqueue\_enqueue\_front@{iofd\_txqueue\_enqueue\_front}}
\index{iofd\_txqueue\_enqueue\_front@{iofd\_txqueue\_enqueue\_front}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{iofd\_txqueue\_enqueue\_front()}
{\footnotesize\ttfamily void iofd\+\_\+txqueue\+\_\+enqueue\+\_\+front (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{struct \textbf{ iofd\+\_\+msghdr} $\ast$}]{msghdr }\end{DoxyParamCaption})}



Enqueue a message at the front. 

Used to enqueue a msgb from a partial send again. This function will always enqueue the message, even if the maximum number of messages is reached. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em msghdr} & the message to enqueue \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::current\+\_\+length}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+CLOSED}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+ISSET}, \textbf{ iofd\+\_\+msghdr\+::list}, \textbf{ llist\+\_\+add()}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msg\+\_\+queue}, \textbf{ osmo\+\_\+iofd\+\_\+ops}, \textbf{ osmo\+\_\+io\+\_\+fd\+::tx\+\_\+queue}, and \textbf{ iofd\+\_\+backend\+\_\+ops\+::write\+\_\+enable}.



Referenced by \textbf{ iofd\+\_\+handle\+\_\+send\+\_\+completion()}.

\mbox{\label{group__osmo__io_ga48f0337026e1c0df61db86255a1268a1}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_io\_backend\_name@{osmo\_io\_backend\_name}}
\index{osmo\_io\_backend\_name@{osmo\_io\_backend\_name}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_io\_backend\_name()}
{\footnotesize\ttfamily static const char $\ast$ osmo\+\_\+io\+\_\+backend\+\_\+name (\begin{DoxyParamCaption}\item[{enum \textbf{ osmo\+\_\+io\+\_\+backend}}]{val }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



return the string name of an osmo\+\_\+io\+\_\+backend 



References \textbf{ get\+\_\+value\+\_\+string()}, and \textbf{ osmo\+\_\+io\+\_\+backend\+\_\+names}.

\mbox{\label{group__osmo__io_ga9a5ee69f272cd017639951f2ed9dd350}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_io\_get\_backend@{osmo\_io\_get\_backend}}
\index{osmo\_io\_get\_backend@{osmo\_io\_get\_backend}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_io\_get\_backend()}
{\footnotesize\ttfamily enum \textbf{ osmo\+\_\+io\+\_\+backend} osmo\+\_\+io\+\_\+get\+\_\+backend (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Obtain the osmo\+\_\+io\+\_\+backend in use by the process. 

\begin{DoxyReturn}{Returns}
The osmo\+\_\+io backend which was configured at startup time 
\end{DoxyReturn}


References \textbf{ g\+\_\+io\+\_\+backend}.

\mbox{\label{group__osmo__io_gae87caba238946a9c9b29f248bb588f9a}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_close@{osmo\_iofd\_close}}
\index{osmo\_iofd\_close@{osmo\_iofd\_close}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_close()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+close (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Close the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 

This function closes the underlying fd, unregisters it from osmo\+\_\+io and clears any messages in the tx queue. The iofd itself is not freed and can be assigned a new file descriptor with \doxyref{osmo\+\_\+iofd\+\_\+register()}{p.}{group__osmo__io_gaa53e1057f56ac19ab23f35eecf4ed95a} 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, a negative value otherwise 
\end{DoxyReturn}


References \textbf{ iofd\+\_\+backend\+\_\+ops\+::close}, \textbf{ osmo\+\_\+io\+\_\+fd\+::fd}, \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+CLOSED}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+ISSET}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+SET}, \textbf{ msgb\+\_\+free()}, \textbf{ osmo\+\_\+iofd\+\_\+ops}, \textbf{ osmo\+\_\+iofd\+\_\+txqueue\+\_\+clear()}, \textbf{ osmo\+\_\+iofd\+\_\+unregister()}, \textbf{ osmo\+\_\+io\+\_\+fd\+::pending}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::read\+\_\+disable}, and \textbf{ iofd\+\_\+backend\+\_\+ops\+::write\+\_\+disable}.



Referenced by \textbf{ log\+\_\+target\+\_\+file\+\_\+reopen()}, and \textbf{ osmo\+\_\+iofd\+\_\+free()}.

\mbox{\label{group__osmo__io_ga8a10e120fd35fcf7f0fd8b43f5b8d5aa}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_free@{osmo\_iofd\_free}}
\index{osmo\_iofd\_free@{osmo\_iofd\_free}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_free()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+free (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Free the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 

The iofd will be automatically closed before via \doxyref{osmo\+\_\+iofd\+\_\+close()}{p.}{group__osmo__io_gae87caba238946a9c9b29f248bb588f9a} [which in turn will unregister it and clear any pending transmit queue items]. You must not reference the iofd after calling this function. However, it is safe to call this function from any of osmo\+\_\+io call-\/backs; in this case, actual free will be internally delayed until that call-\/back completes.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}


References \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+IN\+\_\+\+CALLBACK}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+ISSET}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+SET}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+TO\+\_\+\+FREE}, and \textbf{ osmo\+\_\+iofd\+\_\+close()}.



Referenced by \textbf{ \+\_\+log\+\_\+target\+\_\+file\+\_\+setup\+\_\+iofd()}, \textbf{ log\+\_\+target\+\_\+file\+\_\+destroy()}, \textbf{ log\+\_\+target\+\_\+file\+\_\+reopen()}, \textbf{ log\+\_\+target\+\_\+file\+\_\+switch\+\_\+to\+\_\+stream()}, and \textbf{ osmo\+\_\+iofd\+\_\+setup()}.

\mbox{\label{group__osmo__io_gaddf0cc4e28ce123e52d0b62cc947d7ac}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_get\_data@{osmo\_iofd\_get\_data}}
\index{osmo\_iofd\_get\_data@{osmo\_iofd\_get\_data}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_get\_data()}
{\footnotesize\ttfamily void $\ast$ osmo\+\_\+iofd\+\_\+get\+\_\+data (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Retrieve the associated user-\/data from an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 

A call to this function will return the opaque user data pointer which was specified previously via \doxyref{osmo\+\_\+iofd\+\_\+setup()}{p.}{group__osmo__io_gaa51acb50932f9ca44bfe0fe8a7005c93} or via \doxyref{osmo\+\_\+iofd\+\_\+set\+\_\+data()}{p.}{group__osmo__io_ga090693c9f45a01e5c39b7c4fbebb9079}.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the data that was previously set with \doxyref{osmo\+\_\+iofd\+\_\+setup()}{p.}{group__osmo__io_gaa51acb50932f9ca44bfe0fe8a7005c93} 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::data}, and \textbf{ iofd\+\_\+msghdr\+::iofd}.



Referenced by \textbf{ \+\_\+file\+\_\+raw\+\_\+output()}, and \textbf{ \+\_\+log\+\_\+target\+\_\+file\+\_\+setup\+\_\+talloc\+\_\+pool()}.

\mbox{\label{group__osmo__io_ga8747c5e4274bd97c7faf968a5a6b1fd1}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_get\_fd@{osmo\_iofd\_get\_fd}}
\index{osmo\_iofd\_get\_fd@{osmo\_iofd\_get\_fd}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_get\_fd()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+get\+\_\+fd (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Retrieve the underlying file descriptor from an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the underlying file descriptor number 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::fd}, and \textbf{ iofd\+\_\+msghdr\+::iofd}.

\mbox{\label{group__osmo__io_ga2acd36a67ea289bc3b043d9125c6e2c4}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_get\_ioops@{osmo\_iofd\_get\_ioops}}
\index{osmo\_iofd\_get\_ioops@{osmo\_iofd\_get\_ioops}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_get\_ioops()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+get\+\_\+ioops (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{struct \textbf{ osmo\+\_\+io\+\_\+ops} $\ast$}]{ioops }\end{DoxyParamCaption})}



Retrieve the \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops} for an iofd. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & Target iofd file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em ioops} & caller-\/allocated \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops} structure to be filled \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+ops}, and \textbf{ iofd\+\_\+msghdr\+::iofd}.

\mbox{\label{group__osmo__io_gacaf7cf012bdf07bc8325deb929485a9d}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_get\_name@{osmo\_iofd\_get\_name}}
\index{osmo\_iofd\_get\_name@{osmo\_iofd\_get\_name}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_get\_name()}
{\footnotesize\ttfamily const char $\ast$ osmo\+\_\+iofd\+\_\+get\+\_\+name (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Retrieve the human-\/readable name of the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the name of the iofd as given in \doxyref{osmo\+\_\+iofd\+\_\+setup()}{p.}{group__osmo__io_gaa51acb50932f9ca44bfe0fe8a7005c93} 
\end{DoxyReturn}


References \textbf{ iofd\+\_\+msghdr\+::iofd}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::name}.

\mbox{\label{group__osmo__io_gade3d061edf87b81213cbaf62eaa9da2e}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_get\_priv\_nr@{osmo\_iofd\_get\_priv\_nr}}
\index{osmo\_iofd\_get\_priv\_nr@{osmo\_iofd\_get\_priv\_nr}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_get\_priv\_nr()}
{\footnotesize\ttfamily unsigned int osmo\+\_\+iofd\+\_\+get\+\_\+priv\+\_\+nr (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Retrieve the private number from an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 

Calling this function will retrieve the private user number previously set via \doxyref{osmo\+\_\+iofd\+\_\+set\+\_\+priv\+\_\+nr()}{p.}{group__osmo__io_ga52cab17b19fa5dd62f80b6a3bd020d7b}. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the private number that was previously set with \doxyref{osmo\+\_\+iofd\+\_\+set\+\_\+priv\+\_\+nr()}{p.}{group__osmo__io_ga52cab17b19fa5dd62f80b6a3bd020d7b} 
\end{DoxyReturn}


References \textbf{ iofd\+\_\+msghdr\+::iofd}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::priv\+\_\+nr}.

\mbox{\label{group__osmo__io_ga930572437897f5a8b1beaa3e9fa9af8d}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_get\_txqueue\_max\_length@{osmo\_iofd\_get\_txqueue\_max\_length}}
\index{osmo\_iofd\_get\_txqueue\_max\_length@{osmo\_iofd\_get\_txqueue\_max\_length}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_get\_txqueue\_max\_length()}
{\footnotesize\ttfamily unsigned int osmo\+\_\+iofd\+\_\+get\+\_\+txqueue\+\_\+max\+\_\+length (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Get the maximum number of messages enqueued for sending. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the maximum size of the transmit queue 
\end{DoxyReturn}


References \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ osmo\+\_\+io\+\_\+fd\+::max\+\_\+length}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::tx\+\_\+queue}.



Referenced by \textbf{ \+\_\+log\+\_\+target\+\_\+file\+\_\+setup\+\_\+iofd()}.

\mbox{\label{group__osmo__io_gac2aa95b43d279379692c700a982c1b36}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_init@{osmo\_iofd\_init}}
\index{osmo\_iofd\_init@{osmo\_iofd\_init}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_init()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+init (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



initialize osmo\+\_\+io for the current thread 



References \textbf{ g\+\_\+io\+\_\+backend}, \textbf{ g\+\_\+thread\+\_\+initialized}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+IO\+\_\+\+URING}, and \textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+POLL}.



Referenced by \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+()}, and \textbf{ osmo\+\_\+iofd\+\_\+setup()}.

\mbox{\label{group__osmo__io_ga3d1d70e2518dce3fcb19ceadac1a6072}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_mode\_name@{osmo\_iofd\_mode\_name}}
\index{osmo\_iofd\_mode\_name@{osmo\_iofd\_mode\_name}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_mode\_name()}
{\footnotesize\ttfamily static const char $\ast$ osmo\+\_\+iofd\+\_\+mode\+\_\+name (\begin{DoxyParamCaption}\item[{enum \textbf{ osmo\+\_\+io\+\_\+fd\+\_\+mode}}]{val }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



return the string name of an osmo\+\_\+io\+\_\+mode 



References \textbf{ get\+\_\+value\+\_\+string()}, and \textbf{ osmo\+\_\+iofd\+\_\+mode\+\_\+names}.



Referenced by \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+ioops()}, and \textbf{ osmo\+\_\+iofd\+\_\+setup()}.

\mbox{\label{group__osmo__io_ga51608c4401dcbc99a7ad91a2746f8e90}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_notify\_connected@{osmo\_iofd\_notify\_connected}}
\index{osmo\_iofd\_notify\_connected@{osmo\_iofd\_notify\_connected}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_notify\_connected()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+notify\+\_\+connected (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Request notification of the user if/when a client socket is connected. 

Calling this function will request osmo\+\_\+io to notify the user (via write call-\/back with res=0 and msgb=NULL) once a non-\/blocking outbound connect() of the socket completes.

This only works for connection oriented sockets in either OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE or OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG mode.

The fact that the write call-\/back is called with msgb=NULL can be used to distinguish before this \char`\"{}connected\char`\"{} notification and a socket write failure.

If the server transmits data quick enough after accepting the connection, it may happen that a read call-\/back is triggered towards the user before this special write-\/callback, since both events may come together from the kernel. Hence under those scenarios where server starts the communication, it is important not to assume or require that the write-\/callback(res=0, msgb=NULL) will be the first one triggered.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}


References \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::notify\+\_\+connected}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG}, and \textbf{ osmo\+\_\+iofd\+\_\+ops}.

\mbox{\label{group__osmo__io_gaa53e1057f56ac19ab23f35eecf4ed95a}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_register@{osmo\_iofd\_register}}
\index{osmo\_iofd\_register@{osmo\_iofd\_register}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_register()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+register (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{int}]{fd }\end{DoxyParamCaption})}



Register the \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} for active I/O. 

Calling this function will register a previously initialized \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} for performing I/O.

If the osmo\+\_\+iofd has a read\+\_\+cb/recvfrom\+\_\+cb\+\_\+recvmsg\+\_\+cb set in its \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops}, read/receive will be automatically enabled and the respective call-\/back is called at any time data becomes available.

If there is to-\/be-\/transmitted data in the transmit queue, write will be automatically enabled, allowing the transmit queue to be drained as soon as the fd/socket becomes writable.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the iofd file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em fd} & the system fd number that will be registered. If you did not yet specify the file descriptor number during \doxyref{osmo\+\_\+fd\+\_\+setup()}{p.}{group__select_ga2f14f77e5e71c5bd3461d5936f8c8725}, or if it has changed since then, you can state the [new] file descriptor number as argument. If you wish to proceed with the previously specified file descriptor number, pass -\/1. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, a negative value on error 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::current\+\_\+length}, \textbf{ ENOTSUP}, \textbf{ osmo\+\_\+io\+\_\+fd\+::fd}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+ops}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+CLOSED}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+FD\+\_\+\+REGISTERED}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+ISSET}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+SET}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+UNSET}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGPIO}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVFROM\+\_\+\+SENDTO}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG}, \textbf{ osmo\+\_\+iofd\+\_\+ops}, \textbf{ osmo\+\_\+io\+\_\+ops\+::read\+\_\+cb}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::read\+\_\+enable}, \textbf{ osmo\+\_\+io\+\_\+ops\+::recvfrom\+\_\+cb}, \textbf{ osmo\+\_\+io\+\_\+ops\+::recvmsg\+\_\+cb}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::register\+\_\+fd}, \textbf{ osmo\+\_\+io\+\_\+fd\+::tx\+\_\+queue}, and \textbf{ iofd\+\_\+backend\+\_\+ops\+::write\+\_\+enable}.



Referenced by \textbf{ \+\_\+log\+\_\+target\+\_\+file\+\_\+setup\+\_\+iofd()}, and \textbf{ log\+\_\+target\+\_\+file\+\_\+reopen()}.

\mbox{\label{group__osmo__io_gabab40e7a5478bf4195dd8b79752bc1b2}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_sendmsg\_msgb@{osmo\_iofd\_sendmsg\_msgb}}
\index{osmo\_iofd\_sendmsg\_msgb@{osmo\_iofd\_sendmsg\_msgb}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_sendmsg\_msgb()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+sendmsg\+\_\+msgb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{int}]{sendmsg\+\_\+flags,  }\item[{const struct msghdr $\ast$}]{msgh }\end{DoxyParamCaption})}



osmo\+\_\+io equivalent of the sendmsg(2) socket API call. 

The \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} must be using OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG.

Appends the message to the internal transmit queue for eventual non-\/blocking sendmsg on the underlying socket/file descriptor.

If the function returns success (0), it will take ownership of the msgb and internally call \doxyref{msgb\+\_\+free()}{p.}{group__msgb_gae48b55f6f4529aafb069eaa3fa1998f0} after the sendmsg request completes. In case of an error the msgb needs to be freed by the caller.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & file descriptor to write to \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer to send; is used to fill msgh-\/$>$iov[] \\
\hline
\mbox{\texttt{ in}}  & {\em sendmsg\+\_\+flags} & Flags to pass to the send call \\
\hline
\mbox{\texttt{ in}}  & {\em msgh} & \textquotesingle{}struct msghdr\textquotesingle{} for name/control/flags. iov must be empty! \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 in case of success; a negative value in case of error 
\end{DoxyReturn}


References \textbf{ iofd\+\_\+msghdr\+::hdr}, \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ IOFD\+\_\+\+ACT\+\_\+\+SENDMSG}, \textbf{ iofd\+\_\+msghdr\+\_\+alloc()}, \textbf{ iofd\+\_\+msghdr\+\_\+free()}, \textbf{ iofd\+\_\+txqueue\+\_\+enqueue()}, \textbf{ iofd\+\_\+msghdr\+::iov}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGPIO}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ iofd\+\_\+msghdr\+::msg}, \textbf{ msgb\+\_\+data()}, \textbf{ msgb\+\_\+length()}, \textbf{ iofd\+\_\+msghdr\+::osa}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG}, \textbf{ OSMO\+\_\+\+UNLIKELY}, \textbf{ osmo\+\_\+sockaddr\+::sa}, and \textbf{ osmo\+\_\+sockaddr\+::u}.

\mbox{\label{group__osmo__io_gaefb2721bf4d1f6fb443214d989a90e8c}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_sendto\_msgb@{osmo\_iofd\_sendto\_msgb}}
\index{osmo\_iofd\_sendto\_msgb@{osmo\_iofd\_sendto\_msgb}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_sendto\_msgb()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+sendto\+\_\+msgb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{int}]{sendto\+\_\+flags,  }\item[{const struct \textbf{ osmo\+\_\+sockaddr} $\ast$}]{dest }\end{DoxyParamCaption})}



Send a message through an unconnected socket. 

The \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} must be using OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVFROM\+\_\+\+SENDTO.

Appends the message to the internal transmit queue for eventual non-\/blocking sendto on the underlying socket/file descriptor.

If the function returns success (0), it will take ownership of the msgb and internally call \doxyref{msgb\+\_\+free()}{p.}{group__msgb_gae48b55f6f4529aafb069eaa3fa1998f0} after the sendto request completes. In case of an error the msgb needs to be freed by the caller.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & file descriptor to write to \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer to send \\
\hline
\mbox{\texttt{ in}}  & {\em sendto\+\_\+flags} & Flags to pass to the send call \\
\hline
\mbox{\texttt{ in}}  & {\em dest} & destination address to send the message to \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 in case of success; a negative value in case of error 
\end{DoxyReturn}


References \textbf{ iofd\+\_\+msghdr\+::flags}, \textbf{ iofd\+\_\+msghdr\+::hdr}, \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ IOFD\+\_\+\+ACT\+\_\+\+SENDTO}, \textbf{ iofd\+\_\+msghdr\+\_\+alloc()}, \textbf{ iofd\+\_\+msghdr\+\_\+free()}, \textbf{ iofd\+\_\+txqueue\+\_\+enqueue()}, \textbf{ iofd\+\_\+msghdr\+::iov}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGPIO}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ iofd\+\_\+msghdr\+::msg}, \textbf{ msgb\+\_\+data()}, \textbf{ msgb\+\_\+length()}, \textbf{ iofd\+\_\+msghdr\+::osa}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVFROM\+\_\+\+SENDTO}, \textbf{ osmo\+\_\+sockaddr\+\_\+size()}, \textbf{ OSMO\+\_\+\+UNLIKELY}, \textbf{ osmo\+\_\+sockaddr\+::sa}, and \textbf{ osmo\+\_\+sockaddr\+::u}.

\mbox{\label{group__osmo__io_gadc4115972306e4f5614432119fefc386}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_alloc\_info@{osmo\_iofd\_set\_alloc\_info}}
\index{osmo\_iofd\_set\_alloc\_info@{osmo\_iofd\_set\_alloc\_info}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_alloc\_info()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+set\+\_\+alloc\+\_\+info (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{unsigned int}]{size,  }\item[{unsigned int}]{headroom }\end{DoxyParamCaption})}



Set the size and headroom of the msgb allocated when receiving messages. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em size} & the size of the msgb when receiving data \\
\hline
\mbox{\texttt{ in}}  & {\em headroom} & the headroom of the msgb when receiving data \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::headroom}, \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msgb\+\_\+alloc}, \textbf{ OSMO\+\_\+\+ASSERT}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::size}.

\mbox{\label{group__osmo__io_gaf275c59b5ddcb21ae83652ecb5756f31}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_cmsg\_size@{osmo\_iofd\_set\_cmsg\_size}}
\index{osmo\_iofd\_set\_cmsg\_size@{osmo\_iofd\_set\_cmsg\_size}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_cmsg\_size()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+set\+\_\+cmsg\+\_\+size (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{size\+\_\+t}]{cmsg\+\_\+size }\end{DoxyParamCaption})}



Set the size of the control message buffer allocated when submitting recvmsg. 

If your \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} is in OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG mode, this API function can be used to tell the osmo\+\_\+io code how much memory should be allocated for the cmsg (control message) buffer when performing recvmsg(). 

References \textbf{ osmo\+\_\+io\+\_\+fd\+::cmsg\+\_\+size}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, and \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG}.

\mbox{\label{group__osmo__io_ga090693c9f45a01e5c39b7c4fbebb9079}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_data@{osmo\_iofd\_set\_data}}
\index{osmo\_iofd\_set\_data@{osmo\_iofd\_set\_data}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_data()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+set\+\_\+data (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Set the associated user-\/data from an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 

Calling this function will set/overwrite the opaque user data pointer, which can later be retrieved using \doxyref{osmo\+\_\+iofd\+\_\+get\+\_\+data()}{p.}{group__osmo__io_gaddf0cc4e28ce123e52d0b62cc947d7ac}.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em data} & the data to set \\
\hline
\end{DoxyParams}


References \textbf{ data}, \textbf{ osmo\+\_\+io\+\_\+fd\+::data}, and \textbf{ iofd\+\_\+msghdr\+::iofd}.



Referenced by \textbf{ \+\_\+log\+\_\+target\+\_\+file\+\_\+setup\+\_\+talloc\+\_\+pool()}.

\mbox{\label{group__osmo__io_ga28891e57c72de4603b6460d0c84b5978}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_io\_buffers@{osmo\_iofd\_set\_io\_buffers}}
\index{osmo\_iofd\_set\_io\_buffers@{osmo\_iofd\_set\_io\_buffers}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_io\_buffers()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+set\+\_\+io\+\_\+buffers (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{enum \textbf{ osmo\+\_\+io\+\_\+op}}]{op,  }\item[{uint8\+\_\+t}]{buffers }\end{DoxyParamCaption})}



Set the number of buffers that can be used in a single read or write operation. 

If the \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} is in OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE mode, this API function can be used to tell the osmo\+\_\+io proecess how many buffers should be read or written with a single read or write operation.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the iofd file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em op} & the osmo\+\_\+io\+\_\+op (read or write) to set the number of IO buffers for \\
\hline
\mbox{\texttt{ in}}  & {\em buffers} & the number of IO buffer for each specified operation \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, a negative value on error
\end{DoxyReturn}
The minimum valid buffers to set is always 1. The maximum valid buffers is implementation defined, and trying to set a value greater than the maximum will return an error. Passing buffers with a value of 0 can be used to fetch the maximum value allowed. 

References \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+read\+\_\+buffers}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+write\+\_\+buffers}, \textbf{ IOFD\+\_\+\+MSGHDR\+\_\+\+IO\+\_\+\+BUFFERS}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+OP\+\_\+\+READ}, and \textbf{ OSMO\+\_\+\+IO\+\_\+\+OP\+\_\+\+WRITE}.



Referenced by \textbf{ \+\_\+log\+\_\+target\+\_\+file\+\_\+setup\+\_\+iofd()}.

\mbox{\label{group__osmo__io_ga365266d41cdc7dc76fd0073c77084580}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_ioops@{osmo\_iofd\_set\_ioops}}
\index{osmo\_iofd\_set\_ioops@{osmo\_iofd\_set\_ioops}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_ioops()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+set\+\_\+ioops (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{const struct \textbf{ osmo\+\_\+io\+\_\+ops} $\ast$}]{ioops }\end{DoxyParamCaption})}



Set the \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops} calbacks for an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 

This function can be used to update/overwrite the call-\/back functions for the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}; it replaces the currently-\/set call-\/back function pointers from a previous call to \doxyref{osmo\+\_\+iofd\+\_\+set\+\_\+ioops()}{p.}{group__osmo__io_ga365266d41cdc7dc76fd0073c77084580} or the original \doxyref{osmo\+\_\+iofd\+\_\+setup()}{p.}{group__osmo__io_gaa51acb50932f9ca44bfe0fe8a7005c93}. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & Target iofd file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em ioops} & \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops} structure to be copied to the \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, negative on error 
\end{DoxyReturn}


References \textbf{ check\+\_\+mode\+\_\+callback\+\_\+compat()}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+ops}, \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGPIO}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVFROM\+\_\+\+SENDTO}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG}, \textbf{ osmo\+\_\+iofd\+\_\+mode\+\_\+name()}, \textbf{ osmo\+\_\+iofd\+\_\+ops}, \textbf{ osmo\+\_\+io\+\_\+ops\+::read\+\_\+cb}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::read\+\_\+disable}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::read\+\_\+enable}, \textbf{ osmo\+\_\+io\+\_\+ops\+::recvfrom\+\_\+cb}, and \textbf{ osmo\+\_\+io\+\_\+ops\+::recvmsg\+\_\+cb}.

\mbox{\label{group__osmo__io_ga7f7bbf44f3a5308f510ccaab21b89cfe}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_name@{osmo\_iofd\_set\_name}}
\index{osmo\_iofd\_set\_name@{osmo\_iofd\_set\_name}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_name()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+set\+\_\+name (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Set the human-\/readable name of the file descriptor. 

The given name will be used as context by all related logging and future calls to \doxyref{osmo\+\_\+iofd\+\_\+get\+\_\+name()}{p.}{group__osmo__io_gacaf7cf012bdf07bc8325deb929485a9d}. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em name} & the name to set on the file descriptor \\
\hline
\end{DoxyParams}


References \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ name}, \textbf{ osmo\+\_\+io\+\_\+fd\+::name}, and \textbf{ osmo\+\_\+talloc\+\_\+replace\+\_\+string()}.

\mbox{\label{group__osmo__io_gadd605353d540e3107aa9075cdc24c23f}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_name\_f@{osmo\_iofd\_set\_name\_f}}
\index{osmo\_iofd\_set\_name\_f@{osmo\_iofd\_set\_name\_f}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_name\_f()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+set\+\_\+name\+\_\+f (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{const char $\ast$}]{fmt,  }\item[{}]{... }\end{DoxyParamCaption})}



Set the human-\/readable name of the file descriptor using arguments like printf() 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em fmt} & the fmt to set on the file descriptor \\
\hline
\end{DoxyParams}


References \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ name}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::name}.

\mbox{\label{group__osmo__io_ga52cab17b19fa5dd62f80b6a3bd020d7b}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_priv\_nr@{osmo\_iofd\_set\_priv\_nr}}
\index{osmo\_iofd\_set\_priv\_nr@{osmo\_iofd\_set\_priv\_nr}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_priv\_nr()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+set\+\_\+priv\+\_\+nr (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{unsigned int}]{priv\+\_\+nr }\end{DoxyParamCaption})}



Set the private number of an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 

The priv\+\_\+nr passed in via this call can later be retrieved via \doxyref{osmo\+\_\+iofd\+\_\+get\+\_\+priv\+\_\+nr()}{p.}{group__osmo__io_gade3d061edf87b81213cbaf62eaa9da2e}. It provides a way how additional context can be stored in the \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} beyond the opaque \textquotesingle{}data\textquotesingle{} pointer. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em priv\+\_\+nr} & the private number to set \\
\hline
\end{DoxyParams}


References \textbf{ iofd\+\_\+msghdr\+::iofd}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::priv\+\_\+nr}.

\mbox{\label{group__osmo__io_ga14a5a4c9dd90939a2beab07a843a630f}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_sqes@{osmo\_iofd\_set\_sqes}}
\index{osmo\_iofd\_set\_sqes@{osmo\_iofd\_set\_sqes}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_sqes()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+set\+\_\+sqes (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{enum \textbf{ osmo\+\_\+io\+\_\+op}}]{op,  }\item[{uint8\+\_\+t}]{sqes }\end{DoxyParamCaption})}



Set the number of SQEs that are submitted to an io\+\_\+unring before completion is received. 

If the io\+\_\+using backend is selected, this API function can be used to tell the osmo\+\_\+io process how many SQE are scheduled in advance. The feature is currently supports scheduling read SQEs only.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the iofd file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em op} & the osmo\+\_\+io\+\_\+op (read) to set the number of IO buffers for \\
\hline
\mbox{\texttt{ in}}  & {\em number} & of scheduled SQEs \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, a negative value on error 
\end{DoxyReturn}


References \textbf{ g\+\_\+io\+\_\+backend}, \textbf{ IOFD\+\_\+\+MSGHDR\+\_\+\+MAX\+\_\+\+READ\+\_\+\+SQES}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ osmo\+\_\+io\+\_\+fd\+::num\+\_\+sqes}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+BACKEND\+\_\+\+IO\+\_\+\+URING}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+OP\+\_\+\+READ}, \textbf{ osmo\+\_\+io\+\_\+fd\+::read}, \textbf{ osmo\+\_\+io\+\_\+fd\+::u}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::uring}.

\mbox{\label{group__osmo__io_ga62d298658dac2770d55e766fbcfc4fcb}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_set\_txqueue\_max\_length@{osmo\_iofd\_set\_txqueue\_max\_length}}
\index{osmo\_iofd\_set\_txqueue\_max\_length@{osmo\_iofd\_set\_txqueue\_max\_length}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_set\_txqueue\_max\_length()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+set\+\_\+txqueue\+\_\+max\+\_\+length (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{unsigned int}]{max\+\_\+length }\end{DoxyParamCaption})}



Set the maximum number of messages enqueued for sending. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\mbox{\texttt{ in}}  & {\em size} & the maximum size of the transmit queue \\
\hline
\end{DoxyParams}


References \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ osmo\+\_\+io\+\_\+fd\+::max\+\_\+length}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::tx\+\_\+queue}.



Referenced by \textbf{ \+\_\+log\+\_\+target\+\_\+file\+\_\+setup\+\_\+iofd()}.

\mbox{\label{group__osmo__io_gaa51acb50932f9ca44bfe0fe8a7005c93}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_setup@{osmo\_iofd\_setup}}
\index{osmo\_iofd\_setup@{osmo\_iofd\_setup}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_setup()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$ osmo\+\_\+iofd\+\_\+setup (\begin{DoxyParamCaption}\item[{const void $\ast$}]{ctx,  }\item[{int}]{fd,  }\item[{const char $\ast$}]{name,  }\item[{enum \textbf{ osmo\+\_\+io\+\_\+fd\+\_\+mode}}]{mode,  }\item[{const struct \textbf{ osmo\+\_\+io\+\_\+ops} $\ast$}]{ioops,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Allocate and setup a new iofd. 

Use this to create a new \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}, specifying the osmo\+\_\+io\+\_\+fd\+\_\+mode and \doxyref{osmo\+\_\+io\+\_\+ops}{p.}{structosmo__io__ops}, as well as optionally the file-\/descriptor number and a human-\/readable name. This is the first function you call for any \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}.

The created \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} is not yet registered, and hence can not be used for any I/O until a subsequent call to \doxyref{osmo\+\_\+iofd\+\_\+register()}{p.}{group__osmo__io_gaa53e1057f56ac19ab23f35eecf4ed95a}.

The created \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} is initialized with some default settings\+:
\begin{DoxyItemize}
\item msgb allocations size\+: OSMO\+\_\+\+IO\+\_\+\+DEFAULT\+\_\+\+MSGB\+\_\+\+SIZE (1024)
\item msgb headroom\+: OSMO\+\_\+\+IO\+\_\+\+DEFAULT\+\_\+\+MSGB\+\_\+\+HEADROOM (128)
\item tx\+\_\+queue depth\+: 1024
\end{DoxyItemize}

Those values may be adjusted from their defaults by using \doxyref{osmo\+\_\+iofd\+\_\+set\+\_\+alloc\+\_\+info()}{p.}{group__osmo__io_gadc4115972306e4f5614432119fefc386} and \doxyref{osmo\+\_\+iofd\+\_\+set\+\_\+txqueue\+\_\+max\+\_\+length()}{p.}{group__osmo__io_ga62d298658dac2770d55e766fbcfc4fcb} on the \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & the parent context from which to allocate \\
\hline
\mbox{\texttt{ in}}  & {\em fd} & the underlying system file descriptor. May be -\/1 if not known yet; must then be specified at subsequent \doxyref{osmo\+\_\+iofd\+\_\+register()}{p.}{group__osmo__io_gaa53e1057f56ac19ab23f35eecf4ed95a} time. \\
\hline
\mbox{\texttt{ in}}  & {\em name} & the optional human-\/readable name of the iofd; may be NULL \\
\hline
\mbox{\texttt{ in}}  & {\em mode} & the osmo\+\_\+io\+\_\+fd\+\_\+mode of the iofd, whether it should use read()/write(), sendto()/recvfrom() semantics. \\
\hline
\mbox{\texttt{ in}}  & {\em ioops} & structure specifying the read/write/send/recv callbacks. Will be copied to the iofd, so the caller does not have to keep it around after issuing the osmo\+\_\+iofd\+\_\+setup call. \\
\hline
\mbox{\texttt{ in}}  & {\em data} & opaque user data pointer accessible by the ioops callbacks \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The newly allocated \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} struct or NULL on failure 
\end{DoxyReturn}


References \textbf{ check\+\_\+mode\+\_\+callback\+\_\+compat()}, \textbf{ osmo\+\_\+io\+\_\+fd\+::ctx}, \textbf{ data}, \textbf{ osmo\+\_\+io\+\_\+fd\+::data}, \textbf{ DLIO}, \textbf{ osmo\+\_\+io\+\_\+fd\+::fd}, \textbf{ osmo\+\_\+io\+\_\+fd\+::headroom}, \textbf{ INIT\+\_\+\+LLIST\+\_\+\+HEAD}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+ops}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+read\+\_\+buffers}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+write\+\_\+buffers}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+CLOSED}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+SET}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGP}, \textbf{ osmo\+\_\+io\+\_\+fd\+::max\+\_\+length}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msg\+\_\+queue}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msgb\+\_\+alloc}, \textbf{ name}, \textbf{ osmo\+\_\+io\+\_\+fd\+::name}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+DEFAULT\+\_\+\+MSGB\+\_\+\+HEADROOM}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+DEFAULT\+\_\+\+MSGB\+\_\+\+SIZE}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVFROM\+\_\+\+SENDTO}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+RECVMSG\+\_\+\+SENDMSG}, \textbf{ osmo\+\_\+iofd\+\_\+free()}, \textbf{ osmo\+\_\+iofd\+\_\+init()}, \textbf{ osmo\+\_\+iofd\+\_\+mode\+\_\+name()}, \textbf{ osmo\+\_\+iofd\+\_\+ops}, \textbf{ osmo\+\_\+io\+\_\+fd\+::pending}, \textbf{ iofd\+\_\+backend\+\_\+ops\+::setup}, \textbf{ osmo\+\_\+io\+\_\+fd\+::size}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::tx\+\_\+queue}.



Referenced by \textbf{ \+\_\+log\+\_\+target\+\_\+file\+\_\+setup\+\_\+iofd()}.

\mbox{\label{group__osmo__io_ga71bccce92a62bd5e5e50b840a0596890}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_txqueue\_clear@{osmo\_iofd\_txqueue\_clear}}
\index{osmo\_iofd\_txqueue\_clear@{osmo\_iofd\_txqueue\_clear}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_txqueue\_clear()}
{\footnotesize\ttfamily void osmo\+\_\+iofd\+\_\+txqueue\+\_\+clear (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Clear the transmit queue of the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd}. 

This function frees all messages currently pending in the transmit queue 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}


References \textbf{ iofd\+\_\+msghdr\+::hdr}, \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ iofd\+\_\+msghdr\+\_\+free()}, \textbf{ iofd\+\_\+txqueue\+\_\+dequeue()}, and \textbf{ msgb\+\_\+free()}.



Referenced by \textbf{ osmo\+\_\+iofd\+\_\+close()}.

\mbox{\label{group__osmo__io_gac2a28e90c8d6d9ed17a6a69593443eb5}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_txqueue\_len@{osmo\_iofd\_txqueue\_len}}
\index{osmo\_iofd\_txqueue\_len@{osmo\_iofd\_txqueue\_len}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_txqueue\_len()}
{\footnotesize\ttfamily unsigned int osmo\+\_\+iofd\+\_\+txqueue\+\_\+len (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Retrieve the number of messages pending in the transmit queue. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+io\+\_\+fd\+::current\+\_\+length}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::tx\+\_\+queue}.



Referenced by \textbf{ iofd\+\_\+poll\+\_\+ofd\+\_\+cb\+\_\+recvmsg\+\_\+sendmsg()}, and \textbf{ log\+\_\+target\+\_\+file\+\_\+switch\+\_\+to\+\_\+stream()}.

\mbox{\label{group__osmo__io_ga3ea9d5e4466d3cf56d922e25106fe8ff}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_unregister@{osmo\_iofd\_unregister}}
\index{osmo\_iofd\_unregister@{osmo\_iofd\_unregister}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_unregister()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+unregister (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd }\end{DoxyParamCaption})}



Unregister the given \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} from osmo\+\_\+io. 

After an \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} has been successfully unregistered, it can no longer perform any I/O via osmo\+\_\+io. However, it can be subsequently re-\/registered using \doxyref{osmo\+\_\+iofd\+\_\+register()}{p.}{group__osmo__io_gaa53e1057f56ac19ab23f35eecf4ed95a}.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, a negative value on error 
\end{DoxyReturn}


References \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+FD\+\_\+\+REGISTERED}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+ISSET}, \textbf{ IOFD\+\_\+\+FLAG\+\_\+\+UNSET}, \textbf{ osmo\+\_\+iofd\+\_\+ops}, and \textbf{ iofd\+\_\+backend\+\_\+ops\+::unregister\+\_\+fd}.



Referenced by \textbf{ osmo\+\_\+iofd\+\_\+close()}.

\mbox{\label{group__osmo__io_ga0c3ca8f15e1c3382902c226e001e98ad}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_write\_msgb@{osmo\_iofd\_write\_msgb}}
\index{osmo\_iofd\_write\_msgb@{osmo\_iofd\_write\_msgb}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_write\_msgb()}
{\footnotesize\ttfamily int osmo\+\_\+iofd\+\_\+write\+\_\+msgb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+io\+\_\+fd} $\ast$}]{iofd,  }\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



Write a message to a file descriptor / connected socket. 

The \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} must be using OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE.

Appends the message to the internal transmit queue for eventual non-\/blocking write to the underlying socket/file descriptor.

If the function returns success (0) it will take ownership of the msgb and internally call \doxyref{msgb\+\_\+free()}{p.}{group__msgb_gae48b55f6f4529aafb069eaa3fa1998f0} after the write request completes. In case of an error, the msgb needs to be freed by the caller.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em iofd} & \doxyref{osmo\+\_\+io\+\_\+fd}{p.}{structosmo__io__fd} file descriptor to write data to \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer containing the data to write \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 in case of success; a negative value in case of error 
\end{DoxyReturn}


References \textbf{ iofd\+\_\+msghdr\+::flags}, \textbf{ iofd\+\_\+msghdr\+::hdr}, \textbf{ iofd\+\_\+msghdr\+::io\+\_\+len}, \textbf{ osmo\+\_\+io\+\_\+fd\+::io\+\_\+write\+\_\+buffers}, \textbf{ iofd\+\_\+msghdr\+::iofd}, \textbf{ IOFD\+\_\+\+ACT\+\_\+\+WRITE}, \textbf{ iofd\+\_\+msghdr\+\_\+alloc()}, \textbf{ iofd\+\_\+msghdr\+\_\+free()}, \textbf{ iofd\+\_\+txqueue\+\_\+enqueue()}, \textbf{ iofd\+\_\+msghdr\+::iov}, \textbf{ list}, \textbf{ llist\+\_\+last\+\_\+entry\+\_\+or\+\_\+null}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGPIO}, \textbf{ osmo\+\_\+io\+\_\+fd\+::mode}, \textbf{ iofd\+\_\+msghdr\+::msg}, \textbf{ osmo\+\_\+io\+\_\+fd\+::msg\+\_\+queue}, \textbf{ msgb\+\_\+data()}, \textbf{ msgb\+\_\+length()}, \textbf{ OSMO\+\_\+\+ASSERT}, \textbf{ OSMO\+\_\+\+IO\+\_\+\+FD\+\_\+\+MODE\+\_\+\+READ\+\_\+\+WRITE}, \textbf{ OSMO\+\_\+\+UNLIKELY}, and \textbf{ osmo\+\_\+io\+\_\+fd\+::tx\+\_\+queue}.



Referenced by \textbf{ \+\_\+file\+\_\+raw\+\_\+output()}.



\doxysubsection{Variable Documentation}
\mbox{\label{group__osmo__io_gae8d889e5c9ea71b5099d26954f1f5914}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!g\_io\_backend@{g\_io\_backend}}
\index{g\_io\_backend@{g\_io\_backend}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{g\_io\_backend}
{\footnotesize\ttfamily enum \textbf{ osmo\+\_\+io\+\_\+backend} g\+\_\+io\+\_\+backend\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+()}, \textbf{ osmo\+\_\+io\+\_\+get\+\_\+backend()}, \textbf{ osmo\+\_\+iofd\+\_\+init()}, and \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+sqes()}.

\mbox{\label{group__osmo__io_ga6085c489092d3fb995087e67bee1eb3b}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!g\_thread\_initialized@{g\_thread\_initialized}}
\index{g\_thread\_initialized@{g\_thread\_initialized}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{g\_thread\_initialized}
{\footnotesize\ttfamily \+\_\+\+\_\+thread bool g\+\_\+thread\+\_\+initialized = false\hspace{0.3cm}{\ttfamily [static]}}



Referenced by \textbf{ osmo\+\_\+iofd\+\_\+init()}.

\mbox{\label{group__osmo__io_ga8f5cb2143224530f5cf0c0e84e4ade1b}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_io\_backend\_names@{osmo\_io\_backend\_names}}
\index{osmo\_io\_backend\_names@{osmo\_io\_backend\_names}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_io\_backend\_names\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily const struct \textbf{ value\+\_\+string} osmo\+\_\+io\+\_\+backend\+\_\+names[$\,$]\hspace{0.3cm}{\ttfamily [extern]}}



Referenced by \textbf{ osmo\+\_\+io\+\_\+backend\+\_\+name()}.

\mbox{\label{group__osmo__io_ga8f5cb2143224530f5cf0c0e84e4ade1b}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_io\_backend\_names@{osmo\_io\_backend\_names}}
\index{osmo\_io\_backend\_names@{osmo\_io\_backend\_names}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_io\_backend\_names\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily const struct \textbf{ value\+\_\+string} osmo\+\_\+io\+\_\+backend\+\_\+names[$\,$]}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        \{ OSMO\_IO\_BACKEND\_POLL, \textcolor{stringliteral}{"{}poll"{}} \},}
\DoxyCodeLine{        \{ OSMO\_IO\_BACKEND\_IO\_URING, \textcolor{stringliteral}{"{}io\_uring"{}} \},}
\DoxyCodeLine{        \{ 0, NULL \}}
\DoxyCodeLine{\}}

\end{DoxyCode}


Referenced by \textbf{ osmo\+\_\+io\+\_\+backend\+\_\+name()}.

\mbox{\label{group__osmo__io_gac9c7fc1e9c6e8219afd43e9e19a96b61}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_mode\_names@{osmo\_iofd\_mode\_names}}
\index{osmo\_iofd\_mode\_names@{osmo\_iofd\_mode\_names}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_mode\_names\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily const struct \textbf{ value\+\_\+string} osmo\+\_\+iofd\+\_\+mode\+\_\+names[$\,$]\hspace{0.3cm}{\ttfamily [extern]}}



Referenced by \textbf{ osmo\+\_\+iofd\+\_\+mode\+\_\+name()}.

\mbox{\label{group__osmo__io_gac9c7fc1e9c6e8219afd43e9e19a96b61}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_mode\_names@{osmo\_iofd\_mode\_names}}
\index{osmo\_iofd\_mode\_names@{osmo\_iofd\_mode\_names}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_mode\_names\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily const struct \textbf{ value\+\_\+string} osmo\+\_\+iofd\+\_\+mode\+\_\+names[$\,$]}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= \{}
\DoxyCodeLine{        \{ OSMO\_IO\_FD\_MODE\_READ\_WRITE, \textcolor{stringliteral}{"{}read/write"{}} \},}
\DoxyCodeLine{        \{ OSMO\_IO\_FD\_MODE\_RECVFROM\_SENDTO, \textcolor{stringliteral}{"{}recvfrom/sendto"{}} \},}
\DoxyCodeLine{        \{ OSMO\_IO\_FD\_MODE\_RECVMSG\_SENDMSG, \textcolor{stringliteral}{"{}recvmsg/sendmsg"{}} \},}
\DoxyCodeLine{        \{ 0, NULL \}}
\DoxyCodeLine{\}}

\end{DoxyCode}


Referenced by \textbf{ osmo\+\_\+iofd\+\_\+mode\+\_\+name()}.

\mbox{\label{group__osmo__io_ga93e9f1ee0b388b44d1d4cca2461f29fa}} 
\index{Osmocom I/O interface@{Osmocom I/O interface}!osmo\_iofd\_ops@{osmo\_iofd\_ops}}
\index{osmo\_iofd\_ops@{osmo\_iofd\_ops}!Osmocom I/O interface@{Osmocom I/O interface}}
\doxysubsubsection{osmo\_iofd\_ops}
{\footnotesize\ttfamily struct \textbf{ iofd\+\_\+backend\+\_\+ops} osmo\+\_\+iofd\+\_\+ops}



Referenced by \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+()}, \textbf{ iofd\+\_\+txqueue\+\_\+dequeue()}, \textbf{ iofd\+\_\+txqueue\+\_\+enqueue()}, \textbf{ iofd\+\_\+txqueue\+\_\+enqueue\+\_\+front()}, \textbf{ osmo\+\_\+iofd\+\_\+close()}, \textbf{ osmo\+\_\+iofd\+\_\+notify\+\_\+connected()}, \textbf{ osmo\+\_\+iofd\+\_\+register()}, \textbf{ osmo\+\_\+iofd\+\_\+set\+\_\+ioops()}, \textbf{ osmo\+\_\+iofd\+\_\+setup()}, and \textbf{ osmo\+\_\+iofd\+\_\+unregister()}.

