\section{Osmocom Stream Socket}
\label{group__stream}\index{Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ stream.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom stream socket helpers. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+stream\+\_\+cli}
\item 
struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link}
\item 
struct \textbf{ osmo\+\_\+stream\+\_\+srv}
\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__stream_ga123b7866ed4985a81246bfede79a8ea9}} 
\#define \textbf{ O\+S\+M\+O\+\_\+\+S\+T\+R\+E\+A\+M\+\_\+\+S\+C\+T\+P\+\_\+\+M\+S\+G\+\_\+\+F\+L\+A\+G\+S\+\_\+\+N\+O\+T\+I\+F\+I\+C\+A\+T\+I\+ON}~0x80 /$\ast$ sctp\+\_\+recvmsg() flags=\+M\+S\+G\+\_\+\+N\+O\+T\+I\+F\+I\+C\+A\+T\+I\+O\+N, msgb\+\_\+data() contains \char`\"{}union sctp\+\_\+notification$\ast$\char`\"{} $\ast$/
\begin{DoxyCompactList}\small\item\em Access S\+C\+TP flags from the msgb control buffer. \end{DoxyCompactList}\item 
\mbox{\label{group__stream_ga745784ba45ae5d91e4bce0ed2acbe57f}} 
\#define {\bfseries msgb\+\_\+sctp\+\_\+msg\+\_\+flags}(msg)~(msg)-\/$>$cb[2]
\item 
\mbox{\label{group__stream_ga2693c0cc5c6222dd9ed42c8c4bf8aec8}} 
\#define \textbf{ msgb\+\_\+sctp\+\_\+ppid}(msg)~(msg)-\/$>$cb[3]
\begin{DoxyCompactList}\small\item\em Access the S\+C\+TP P\+P\+ID from the msgb control buffer. \end{DoxyCompactList}\item 
\mbox{\label{group__stream_gac2c359892ad63309b59a4b402f6a3e81}} 
\#define \textbf{ msgb\+\_\+sctp\+\_\+stream}(msg)~(msg)-\/$>$cb[4]
\begin{DoxyCompactList}\small\item\em Access the S\+C\+TP Stream ID from the msgb control buffer. \end{DoxyCompactList}\item 
\mbox{\label{group__stream_ga9f55d0e90dc8cc6b2287312435cdde48}} 
\#define {\bfseries M\+S\+G\+\_\+\+N\+O\+S\+I\+G\+N\+AL}~0
\item 
\mbox{\label{group__stream_gae24e1d7bb86fa7bd90b7f38e0c686119}} 
\#define {\bfseries O\+S\+M\+O\+\_\+\+S\+T\+R\+E\+A\+M\+\_\+\+C\+L\+I\+\_\+\+F\+\_\+\+R\+E\+C\+O\+NF}~(1 $<$$<$ 0)
\item 
\mbox{\label{group__stream_gaccd8b711532f890d484fb9099f555855}} 
\#define {\bfseries O\+S\+M\+O\+\_\+\+S\+T\+R\+E\+A\+M\+\_\+\+C\+L\+I\+\_\+\+F\+\_\+\+N\+O\+D\+E\+L\+AY}~(1 $<$$<$ 1)
\item 
\mbox{\label{group__stream_ga52c6205e5d1b8348e500bae667feddbd}} 
\#define {\bfseries O\+S\+M\+O\+\_\+\+S\+T\+R\+E\+A\+M\+\_\+\+M\+A\+X\+\_\+\+A\+D\+D\+RS}~O\+S\+M\+O\+\_\+\+S\+O\+C\+K\+\_\+\+M\+A\+X\+\_\+\+A\+D\+D\+RS
\item 
\mbox{\label{group__stream_gaf1646f040c66d93634755e299dee3ec2}} 
\#define {\bfseries O\+S\+M\+O\+\_\+\+S\+T\+R\+E\+A\+M\+\_\+\+S\+R\+V\+\_\+\+F\+\_\+\+R\+E\+C\+O\+NF}~(1 $<$$<$ 0)
\item 
\mbox{\label{group__stream_gaeec66e7d4031dc9606558e6692a805ba}} 
\#define {\bfseries O\+S\+M\+O\+\_\+\+S\+T\+R\+E\+A\+M\+\_\+\+S\+R\+V\+\_\+\+F\+\_\+\+N\+O\+D\+E\+L\+AY}~(1 $<$$<$ 1)
\item 
\mbox{\label{group__stream_ga3ef7f446bbf20daa6188bdaade5b2e94}} 
\#define {\bfseries O\+S\+M\+O\+\_\+\+S\+T\+R\+E\+A\+M\+\_\+\+S\+R\+V\+\_\+\+F\+\_\+\+F\+L\+U\+S\+H\+\_\+\+D\+E\+S\+T\+R\+OY}~(1 $<$$<$ 0)
\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__stream_gaefb240abea020971d9a384b5e39826e5}} 
enum {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+state} \{ \newline
{\bfseries S\+T\+R\+E\+A\+M\+\_\+\+C\+L\+I\+\_\+\+S\+T\+A\+T\+E\+\_\+\+C\+L\+O\+S\+ED}, 
{\bfseries S\+T\+R\+E\+A\+M\+\_\+\+C\+L\+I\+\_\+\+S\+T\+A\+T\+E\+\_\+\+W\+A\+I\+T\+\_\+\+R\+E\+C\+O\+N\+N\+E\+CT}, 
{\bfseries S\+T\+R\+E\+A\+M\+\_\+\+C\+L\+I\+\_\+\+S\+T\+A\+T\+E\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+NG}, 
{\bfseries S\+T\+R\+E\+A\+M\+\_\+\+C\+L\+I\+\_\+\+S\+T\+A\+T\+E\+\_\+\+C\+O\+N\+N\+E\+C\+T\+ED}, 
\newline
{\bfseries S\+T\+R\+E\+A\+M\+\_\+\+C\+L\+I\+\_\+\+S\+T\+A\+T\+E\+\_\+\+M\+AX}
 \}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$ \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+create} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Create an Osmocom Stream Server Link A Stream Server Link is the listen()+accept() \char`\"{}parent\char`\"{} to individual Stream Servers. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+destroy} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link)
\begin{DoxyCompactList}\small\item\em Destroy the stream server link. Closes + Releases Memory. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+nodelay} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, bool nodelay)
\begin{DoxyCompactList}\small\item\em Set the N\+O\+D\+E\+L\+AY socket option to avoid Nagle-\/like behavior Setting this to nodelay=true will automatically set the N\+O\+D\+E\+L\+AY socket option on any socket established via this server link, before calling the accept\+\_\+cb() \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addr} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, const char $\ast$addr)
\begin{DoxyCompactList}\small\item\em Set the local address to which we bind. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addrs} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, const char $\ast$$\ast$addr, size\+\_\+t addrcnt)
\begin{DoxyCompactList}\small\item\em Set the local address set to which we bind. Useful for protocols allowing bind on more than one address (such as S\+C\+TP) \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+port} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, uint16\+\_\+t port)
\begin{DoxyCompactList}\small\item\em Set the local port number to which we bind. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+proto} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, uint16\+\_\+t proto)
\begin{DoxyCompactList}\small\item\em Set the protocol for the stream server link. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+type} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, int type)
\begin{DoxyCompactList}\small\item\em Set the socket type for the stream server link. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+domain} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, int domain)
\begin{DoxyCompactList}\small\item\em Set the socket type for the stream server link. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+accept\+\_\+cb} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, int($\ast$accept\+\_\+cb)(struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, int fd))
\begin{DoxyCompactList}\small\item\em Set the accept() call-\/back of the stream server link. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+data} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, void $\ast$data)
\begin{DoxyCompactList}\small\item\em Set application private data of the stream server link. \end{DoxyCompactList}\item 
void $\ast$ \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+data} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link)
\begin{DoxyCompactList}\small\item\em Get application private data of the stream server link. \end{DoxyCompactList}\item 
char $\ast$ \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+sockname} (const struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link)
\begin{DoxyCompactList}\small\item\em Get description of the stream server link e. g. 127.\+0.\+0.\+1\+:1234. \end{DoxyCompactList}\item 
struct osmo\+\_\+fd $\ast$ \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+ofd} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link)
\begin{DoxyCompactList}\small\item\em Get Osmocom File Descriptor of the stream server link. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+open} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link)
\begin{DoxyCompactList}\small\item\em Open the stream server link. This actually initializes the underlying socket and binds it to the configured ip/port. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+close} (struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link)
\begin{DoxyCompactList}\small\item\em Close the stream server link and unregister from select loop Does not destroy the server link, merely closes it! \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$ \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+create} (void $\ast$ctx, struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, int fd, int($\ast$cb)(struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn), int($\ast$closed\+\_\+cb)(struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn), void $\ast$data)
\begin{DoxyCompactList}\small\item\em Create a Stream Server inside the specified link. \end{DoxyCompactList}\item 
void $\ast$ \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+data} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)
\begin{DoxyCompactList}\small\item\em Get application private data of the stream server. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$ \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+master} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)
\begin{DoxyCompactList}\small\item\em Get the master (Link) from a Stream Server. \end{DoxyCompactList}\item 
struct osmo\+\_\+fd $\ast$ \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+ofd} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)
\begin{DoxyCompactList}\small\item\em Get Osmocom File Descriptor of the stream server. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+destroy} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)
\begin{DoxyCompactList}\small\item\em Destroy given Stream Server This function closes the Stream Server socket, unregisters from select loop, invokes the connection\textquotesingle{}s closed\+\_\+cb() callback to allow A\+PI users to clean up any associated state they have for this connection, and then de-\/allocates associated memory. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+flush\+\_\+and\+\_\+destroy} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)
\begin{DoxyCompactList}\small\item\em Prepare to send out all pending messages on the connection\textquotesingle{}s Tx queue and then automatically destroy the stream with \doxyref{osmo\+\_\+stream\+\_\+srv\+\_\+destroy()}{p.}{group__stream_ga47f18e063f64f22cb74d58d8b7243bed}. This function disables queuing of new messages on the connection and also disables reception of new messages on the connection. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+data} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn, void $\ast$data)
\begin{DoxyCompactList}\small\item\em Set application private data of the stream server. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+send} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Enqueue data to be sent via an Osmocom stream server. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+recv} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Receive data via Osmocom stream server. \end{DoxyCompactList}\item 
\mbox{\label{group__stream_ga4a830f1d9990deb5b9b58f68927cefeb}} 
void {\bfseries osmo\+\_\+stream\+\_\+srv\+\_\+clear\+\_\+tx\+\_\+queue} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)
\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+nodelay} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, bool nodelay)
\begin{DoxyCompactList}\small\item\em Set the N\+O\+D\+E\+L\+AY socket option to avoid Nagle-\/like behavior Setting this to nodelay=true will automatically set the N\+O\+D\+E\+L\+AY socket option on any socket established via \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+open}{p.}{group__stream_ga86b4b9c8e563f8426d3cdae803e3ec38} or any re-\/connect. You have to set this {\itshape before} opening the socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, const char $\ast$addr)
\begin{DoxyCompactList}\small\item\em Set the remote address to which we connect. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addrs} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, const char $\ast$$\ast$addr, size\+\_\+t addrcnt)
\begin{DoxyCompactList}\small\item\em Set the remote address set to which we connect. Useful for protocols allowing connecting to more than one address (such as S\+C\+TP) \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, uint16\+\_\+t port)
\begin{DoxyCompactList}\small\item\em Set the remote port number to which we connect. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+type} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, int type)
\begin{DoxyCompactList}\small\item\em Set the socket type for the stream server link. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+domain} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, int domain)
\begin{DoxyCompactList}\small\item\em Set the socket type for the stream server link. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+proto} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, uint16\+\_\+t proto)
\begin{DoxyCompactList}\small\item\em Set the protocol for the stream client socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addr} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, const char $\ast$addr)
\begin{DoxyCompactList}\small\item\em Set the local address for the socket (to be bound to) \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addrs} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, const char $\ast$$\ast$addr, size\+\_\+t addrcnt)
\begin{DoxyCompactList}\small\item\em Set the local address set to which we connect. Useful for protocols allowing bind to more than one address (such as S\+C\+TP) \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+port} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, uint16\+\_\+t port)
\begin{DoxyCompactList}\small\item\em Set the local port number for the socket (to be bound to) \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, void $\ast$data)
\begin{DoxyCompactList}\small\item\em Set application private data of the stream client socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, int timeout)
\begin{DoxyCompactList}\small\item\em Set the reconnect time of the stream client socket. \end{DoxyCompactList}\item 
void $\ast$ \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+data} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\begin{DoxyCompactList}\small\item\em Get application private data of the stream client socket. \end{DoxyCompactList}\item 
char $\ast$ \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname} (const struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\begin{DoxyCompactList}\small\item\em Get the stream client socket description. \end{DoxyCompactList}\item 
struct osmo\+\_\+fd $\ast$ \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+ofd} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\begin{DoxyCompactList}\small\item\em Get Osmocom File Descriptor of the stream client socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, int($\ast$connect\+\_\+cb)(struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli))
\begin{DoxyCompactList}\small\item\em Set the call-\/back function called on connect of the stream client socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+disconnect\+\_\+cb} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, int($\ast$disconnect\+\_\+cb)(struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli))
\begin{DoxyCompactList}\small\item\em Set the call-\/back function called on disconnect of the stream client socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, int($\ast$read\+\_\+cb)(struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli))
\begin{DoxyCompactList}\small\item\em Set the call-\/back function called to read from the stream client socket. \end{DoxyCompactList}\item 
\mbox{\label{group__stream_ga11d2615f6197f33073ba7245e5ba95ee}} 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+reconnect} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\begin{DoxyCompactList}\small\item\em Re-\/connect an Osmocom Stream Client If re-\/connection is enabled for this client (which is the case unless negative timeout was explicitly set via \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout()}{p.}{group__stream_gade74792afe35f31dd2584c888db3dd62} call), we close any existing connection (if any) and schedule a re-\/connect timer. \end{DoxyCompactList}\item 
bool \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\begin{DoxyCompactList}\small\item\em Check if Osmocom Stream Client is in connected state. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$ \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+create} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Create an Osmocom stream client. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+destroy} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\begin{DoxyCompactList}\small\item\em Destroy a Osmocom stream client (includes close) \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+open} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\begin{DoxyCompactList}\small\item\em Open connection of an Osmocom stream client By default the client will automatically reconnect after default timeout. To disable this, use \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout()}{p.}{group__stream_gade74792afe35f31dd2584c888db3dd62} before calling this function. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+open2} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, int reconnect)
\begin{DoxyCompactList}\small\item\em D\+E\+P\+R\+E\+C\+A\+T\+ED\+: use \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout()}{p.}{group__stream_gade74792afe35f31dd2584c888db3dd62} or \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+reconnect()}{p.}{group__stream_ga11d2615f6197f33073ba7245e5ba95ee} instead! Open connection of an Osmocom stream client. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+close} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\begin{DoxyCompactList}\small\item\em Close an Osmocom Stream Client. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+send} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Enqueue data to be sent via an Osmocom stream client. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+recv} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Receive data via an Osmocom stream client. \end{DoxyCompactList}\item 
\mbox{\label{group__stream_gafa39b1dcc139ad12cbc38d51049bf14f}} 
void {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+clear\+\_\+tx\+\_\+queue} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\item 
\mbox{\label{group__stream_ga448c399fe6f684dd4d90ece67b43d4f7}} 
static int {\bfseries byte\+\_\+nonzero} (const uint8\+\_\+t $\ast$u8, unsigned int offset, unsigned int u8\+\_\+size)
\item 
\mbox{\label{group__stream_ga4d5a2353dfa596f2cdf9e6b6b9d2fad2}} 
static int {\bfseries determine\+\_\+sctp\+\_\+sockopt\+\_\+event\+\_\+subscribe\+\_\+size} (void)
\item 
\mbox{\label{group__stream_ga776bfe851c20f785cc35176aaaac9d3a}} 
static int {\bfseries sctp\+\_\+setsockopt\+\_\+events\+\_\+linux\+\_\+workaround} (int fd, const struct sctp\+\_\+event\+\_\+subscribe $\ast$event)
\item 
\mbox{\label{group__stream_ga050d8271074ad3dd37e8014fe287776f}} 
static int {\bfseries sctp\+\_\+sock\+\_\+activate\+\_\+events} (int fd)
\item 
\mbox{\label{group__stream_gaa2b1fa9b64847bc68c83fae9a92d737d}} 
static int {\bfseries setsockopt\+\_\+nodelay} (int fd, int proto, int on)
\item 
\mbox{\label{group__stream_gaf2461189e6614fd9a2b69a4821b36187}} 
static void {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+read} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\item 
\mbox{\label{group__stream_ga7262b897e83232efbb7b73fff2d14519}} 
static int {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+write} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\item 
\mbox{\label{group__stream_ga9a6f3de25795c699a25e0bb7e7f7bb12}} 
static int {\bfseries \+\_\+setsockopt\+\_\+nosigpipe} (struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)
\item 
\mbox{\label{group__stream_ga7080a18acf6e820aec2d8e33e178d2ae}} 
static int {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+fd\+\_\+cb} (struct osmo\+\_\+fd $\ast$ofd, unsigned int what)
\item 
\mbox{\label{group__stream_ga866e541e96ee1f64d2b550e4d502be2c}} 
static void {\bfseries cli\+\_\+timer\+\_\+cb} (void $\ast$data)
\item 
\mbox{\label{group__stream_gaa8d25448c4d0137b794e2b40efc26f81}} 
static int {\bfseries osmo\+\_\+stream\+\_\+srv\+\_\+fd\+\_\+cb} (struct osmo\+\_\+fd $\ast$ofd, unsigned int what)
\item 
\mbox{\label{group__stream_gaece198aea502c86c3c4447def631045a}} 
static int {\bfseries osmo\+\_\+stream\+\_\+srv\+\_\+read} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)
\item 
\mbox{\label{group__stream_ga126a75cba64e9c2ea17dabf8c2126c9f}} 
static void {\bfseries osmo\+\_\+stream\+\_\+srv\+\_\+write} (struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)
\item 
\mbox{\label{group__stream_ga66f9ef624e3f777e0ed6dd7d7d480330}} 
static int {\bfseries osmo\+\_\+stream\+\_\+srv\+\_\+cb} (struct osmo\+\_\+fd $\ast$ofd, unsigned int what)
\item 
\mbox{\label{group__stream_gaf567f994c41bfd37f1a2081bd60c9062}} 
static int {\bfseries \+\_\+sctp\+\_\+recvmsg\+\_\+wrapper} (int fd, struct msgb $\ast$msg)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__stream_gaad7f46df0c6ea7e105270ff665c2430b}} 
static unsigned int {\bfseries sctp\+\_\+sockopt\+\_\+event\+\_\+subscribe\+\_\+size} = 0
\item 
static const struct value\+\_\+string {\bfseries stream\+\_\+cli\+\_\+state\+\_\+names} [$\,$]
\end{DoxyCompactItemize}


\subsection{Detailed Description}
This code is intended to abstract any use of stream-\/type sockets, such as T\+CP and S\+C\+TP. It offers both server and client side implementations, fully integrated with the libosmocore select loop abstraction. 

\subsection{Function Documentation}
\mbox{\label{group__stream_gad217c1c1b83ac852e090afd49146db19}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+close@{osmo\+\_\+stream\+\_\+cli\+\_\+close}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+close@{osmo\+\_\+stream\+\_\+cli\+\_\+close}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+close()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+close (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli }\end{DoxyParamCaption})}



Close an Osmocom Stream Client. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Osmocom Stream Client to be closed We unregister the socket fd from the osmocom select() loop abstraction and close the socket \\
\hline
\end{DoxyParams}


Referenced by osmo\+\_\+stream\+\_\+cli\+\_\+destroy(), and osmo\+\_\+stream\+\_\+cli\+\_\+reconnect().

\mbox{\label{group__stream_ga1754a498abc27577a8e0b3b0f236c05b}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+create@{osmo\+\_\+stream\+\_\+cli\+\_\+create}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+create@{osmo\+\_\+stream\+\_\+cli\+\_\+create}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+create()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+create (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



Create an Osmocom stream client. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em ctx} & talloc context from which to allocate memory This function allocates a new \doxyref{osmo\+\_\+stream\+\_\+cli}{p.}{structosmo__stream__cli} and initializes it with default values (5s reconnect timer, T\+CP protocol) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
allocated stream client, or N\+U\+LL in case of error 
\end{DoxyReturn}
\mbox{\label{group__stream_ga9d0dac2f390c660c85fa347765f4f45a}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+destroy@{osmo\+\_\+stream\+\_\+cli\+\_\+destroy}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+destroy@{osmo\+\_\+stream\+\_\+cli\+\_\+destroy}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+destroy()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli }\end{DoxyParamCaption})}



Destroy a Osmocom stream client (includes close) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to destroy \\
\hline
\end{DoxyParams}


References osmo\+\_\+stream\+\_\+cli\+\_\+close().

\mbox{\label{group__stream_ga606a53840677f3f5200887dc92f5de4d}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+data@{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+data}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+data@{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+data}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+data()}
{\footnotesize\ttfamily void $\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+data (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli }\end{DoxyParamCaption})}



Get application private data of the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Application private data, as set by \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data()}{p.}{group__stream_ga5e94c511d537f63337912bb50fb2dc28} 
\end{DoxyReturn}
\mbox{\label{group__stream_ga0615daa4aac253a3d530f35fddbc68bd}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+ofd@{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+ofd}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+ofd@{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+ofd}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+ofd()}
{\footnotesize\ttfamily struct osmo\+\_\+fd $\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+ofd (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli }\end{DoxyParamCaption})}



Get Osmocom File Descriptor of the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Pointer to osmo\+\_\+fd 
\end{DoxyReturn}
\mbox{\label{group__stream_gaecd148ae11f2f619aa52dd2900a15827}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname@{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname@{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname()}
{\footnotesize\ttfamily char $\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli }\end{DoxyParamCaption})}



Get the stream client socket description. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to examine \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Socket description or N\+U\+LL in case of error 
\end{DoxyReturn}
\mbox{\label{group__stream_ga79a09e9c9b8cc98991cd5eebdb41ed57}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected@{osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected@{osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected()}
{\footnotesize\ttfamily bool osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli }\end{DoxyParamCaption})}



Check if Osmocom Stream Client is in connected state. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Osmocom Stream Client \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if connected, false otherwise 
\end{DoxyReturn}
\mbox{\label{group__stream_ga86b4b9c8e563f8426d3cdae803e3ec38}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+open@{osmo\+\_\+stream\+\_\+cli\+\_\+open}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+open@{osmo\+\_\+stream\+\_\+cli\+\_\+open}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+open()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+open (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli }\end{DoxyParamCaption})}



Open connection of an Osmocom stream client By default the client will automatically reconnect after default timeout. To disable this, use \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout()}{p.}{group__stream_gade74792afe35f31dd2584c888db3dd62} before calling this function. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to connect \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
negative on error, 0 on success 
\end{DoxyReturn}
\mbox{\label{group__stream_ga127866794591d16a0eb7244f2fe666ef}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+open2@{osmo\+\_\+stream\+\_\+cli\+\_\+open2}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+open2@{osmo\+\_\+stream\+\_\+cli\+\_\+open2}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+open2()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+open2 (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{int}]{reconnect }\end{DoxyParamCaption})}



D\+E\+P\+R\+E\+C\+A\+T\+ED\+: use \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout()}{p.}{group__stream_gade74792afe35f31dd2584c888db3dd62} or \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+reconnect()}{p.}{group__stream_ga11d2615f6197f33073ba7245e5ba95ee} instead! Open connection of an Osmocom stream client. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to connect \\
\hline
\mbox{\tt in}  & {\em reconect} & 1 if we should not automatically reconnect \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
negative on error, 0 on success 
\end{DoxyReturn}
\mbox{\label{group__stream_ga06f9743c19068bb720a4949ae8467243}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+recv@{osmo\+\_\+stream\+\_\+cli\+\_\+recv}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+recv@{osmo\+\_\+stream\+\_\+cli\+\_\+recv}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+recv()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+recv (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Receive data via an Osmocom stream client. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client through which we want to send \\
\hline
 & {\em msg} & pre-\/allocate message buffer to which received data is appended \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of bytes read; $<$=0 in case of error 
\end{DoxyReturn}
\mbox{\label{group__stream_gaacf415b97e1184baadeee5c60387422b}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+send@{osmo\+\_\+stream\+\_\+cli\+\_\+send}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+send@{osmo\+\_\+stream\+\_\+cli\+\_\+send}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+send()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+send (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Enqueue data to be sent via an Osmocom stream client. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client through which we want to send \\
\hline
\mbox{\tt in}  & {\em msg} & Message buffer to enqueue in transmit queue \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga0038e937cf0f36c59e0e3991523219a1}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



Set the remote address to which we connect. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em addr} & Remote IP address \\
\hline
\end{DoxyParams}


References osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addrs().

\mbox{\label{group__stream_gaab1e7ef0ccc88e124c5f7bbb5e46c29c}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addrs@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addrs}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addrs@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addrs}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addrs()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addrs (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{const char $\ast$$\ast$}]{addr,  }\item[{size\+\_\+t}]{addrcnt }\end{DoxyParamCaption})}



Set the remote address set to which we connect. Useful for protocols allowing connecting to more than one address (such as S\+C\+TP) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em addr} & Remote IP address set \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
negative on error, 0 on success 
\end{DoxyReturn}


Referenced by osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr().

\mbox{\label{group__stream_gab588bfd88a3cc775875981e2ee66e295}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{int($\ast$)(struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)}]{connect\+\_\+cb }\end{DoxyParamCaption})}



Set the call-\/back function called on connect of the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em connect\+\_\+cb} & Call-\/back function to be called upon connect \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga5e94c511d537f63337912bb50fb2dc28}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Set application private data of the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em data} & User-\/specific data (available in call-\/back functions) \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga23e5c1799a8225607543de39a56ca449}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+disconnect\+\_\+cb@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+disconnect\+\_\+cb}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+disconnect\+\_\+cb@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+disconnect\+\_\+cb}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+disconnect\+\_\+cb()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+disconnect\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{int($\ast$)(struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)}]{disconnect\+\_\+cb }\end{DoxyParamCaption})}



Set the call-\/back function called on disconnect of the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em disconnect\+\_\+cb} & Call-\/back function to be called upon disconnect \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga33ce730fc91ebade9b7188fa220656c6}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+domain@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+domain}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+domain@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+domain}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+domain()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+domain (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{int}]{domain }\end{DoxyParamCaption})}



Set the socket type for the stream server link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em type} & Socket Domain (like A\+F\+\_\+\+U\+N\+S\+P\+EC (default for IP), A\+F\+\_\+\+U\+N\+IX, A\+F\+\_\+\+I\+N\+ET, ...) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, negative on error. 
\end{DoxyReturn}
\mbox{\label{group__stream_ga70420e7c664cc4c4e69ac4d3476e7f53}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addr@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addr}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addr@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addr}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addr()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addr (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



Set the local address for the socket (to be bound to) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em port} & Local host name \\
\hline
\end{DoxyParams}


References osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addrs().

\mbox{\label{group__stream_ga090fc3fcd1706b815ef5a729921c100e}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addrs@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addrs}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addrs@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addrs}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addrs()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addrs (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{const char $\ast$$\ast$}]{addr,  }\item[{size\+\_\+t}]{addrcnt }\end{DoxyParamCaption})}



Set the local address set to which we connect. Useful for protocols allowing bind to more than one address (such as S\+C\+TP) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em addr} & Local IP address set \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
negative on error, 0 on success 
\end{DoxyReturn}


Referenced by osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addr().

\mbox{\label{group__stream_ga4d83e3cf7fdf7eb354c2015ff9bed98a}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+port@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+port}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+port@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+port}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+port()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+port (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



Set the local port number for the socket (to be bound to) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em port} & Local port number \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_gaa196e78db6ca32abb1473566b4f1b04b}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+nodelay@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+nodelay}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+nodelay@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+nodelay}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+nodelay()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+nodelay (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{bool}]{nodelay }\end{DoxyParamCaption})}



Set the N\+O\+D\+E\+L\+AY socket option to avoid Nagle-\/like behavior Setting this to nodelay=true will automatically set the N\+O\+D\+E\+L\+AY socket option on any socket established via \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+open}{p.}{group__stream_ga86b4b9c8e563f8426d3cdae803e3ec38} or any re-\/connect. You have to set this {\itshape before} opening the socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream client whose sockets are to be configured \\
\hline
\mbox{\tt in}  & {\em nodelay} & whether to set (true) N\+O\+D\+E\+L\+AY before connect() \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_gab8b9f65bebfeb83c6e33d102e9439770}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



Set the remote port number to which we connect. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em port} & Remote port number \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga91d57aa94a370520540d7272af66a23b}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+proto@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+proto}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+proto@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+proto}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+proto()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+proto (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{uint16\+\_\+t}]{proto }\end{DoxyParamCaption})}



Set the protocol for the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em proto} & Protocol (like I\+P\+P\+R\+O\+T\+O\+\_\+\+T\+CP (default), I\+P\+P\+R\+O\+T\+O\+\_\+\+S\+C\+TP, ...) \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_gad1d1817f25694ea126779262cddf4fbd}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{int($\ast$)(struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$cli)}]{read\+\_\+cb }\end{DoxyParamCaption})}



Set the call-\/back function called to read from the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em read\+\_\+cb} & Call-\/back function to be called when we want to read \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_gade74792afe35f31dd2584c888db3dd62}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{int}]{timeout }\end{DoxyParamCaption})}



Set the reconnect time of the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em timeout} & Re-\/connect timeout in seconds or negative value to disable auto-\/reconnection \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga5e5c4c9aacc1cd1d303c0295018594cb}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+type@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+type}}
\index{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+type@{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+type}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+type()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+type (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+cli} $\ast$}]{cli,  }\item[{int}]{type }\end{DoxyParamCaption})}



Set the socket type for the stream server link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\tt in}  & {\em type} & Socket Type (like S\+O\+C\+K\+\_\+\+S\+T\+R\+E\+AM (default), S\+O\+C\+K\+\_\+\+S\+E\+Q\+P\+A\+C\+K\+ET, ...) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, negative on error. 
\end{DoxyReturn}
\mbox{\label{group__stream_ga36df4fc3b268efbe4b4f02e51542d543}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+create@{osmo\+\_\+stream\+\_\+srv\+\_\+create}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+create@{osmo\+\_\+stream\+\_\+srv\+\_\+create}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+create()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$ osmo\+\_\+stream\+\_\+srv\+\_\+create (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx,  }\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{int}]{fd,  }\item[{int($\ast$)(struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)}]{cb,  }\item[{int($\ast$)(struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$conn)}]{closed\+\_\+cb,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Create a Stream Server inside the specified link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em ctx} & talloc allocation context from which to allocate \\
\hline
\mbox{\tt in}  & {\em link} & Stream Server Link to which we belong \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Stream Server in case of success; N\+U\+LL on error 
\end{DoxyReturn}
\mbox{\label{group__stream_ga47f18e063f64f22cb74d58d8b7243bed}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+destroy@{osmo\+\_\+stream\+\_\+srv\+\_\+destroy}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+destroy@{osmo\+\_\+stream\+\_\+srv\+\_\+destroy}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+destroy()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$}]{conn }\end{DoxyParamCaption})}



Destroy given Stream Server This function closes the Stream Server socket, unregisters from select loop, invokes the connection\textquotesingle{}s closed\+\_\+cb() callback to allow A\+PI users to clean up any associated state they have for this connection, and then de-\/allocates associated memory. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em conn} & Stream Server to be destroyed \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_gae2a0ef01097d964c71e38600b4c078d5}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+data@{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+data}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+data@{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+data}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+data()}
{\footnotesize\ttfamily void $\ast$ osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+data (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$}]{conn }\end{DoxyParamCaption})}



Get application private data of the stream server. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em conn} & Stream Server \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Application private data, as set by \doxyref{osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+data()}{p.}{group__stream_ga9891663b20714d72f992e44ad1e92eea} 
\end{DoxyReturn}
\mbox{\label{group__stream_ga9cf689935bf6ffac4f86f56219d73c8e}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+master@{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+master}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+master@{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+master}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+master()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$ osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+master (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$}]{conn }\end{DoxyParamCaption})}



Get the master (Link) from a Stream Server. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em conn} & Stream Server of which we want to know the Link \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Link through which the given Stream Server is established 
\end{DoxyReturn}
\mbox{\label{group__stream_ga47bbca4f12717db2e6158eefe6310b9b}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+ofd@{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+ofd}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+ofd@{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+ofd}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+ofd()}
{\footnotesize\ttfamily struct osmo\+\_\+fd $\ast$ osmo\+\_\+stream\+\_\+srv\+\_\+get\+\_\+ofd (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$}]{conn }\end{DoxyParamCaption})}



Get Osmocom File Descriptor of the stream server. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em conn} & Stream Server \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Pointer to osmo\+\_\+fd 
\end{DoxyReturn}
\mbox{\label{group__stream_gad325d97b09c724e830c98d76b890520d}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+close@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+close}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+close@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+close}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+close()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+close (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link }\end{DoxyParamCaption})}



Close the stream server link and unregister from select loop Does not destroy the server link, merely closes it! 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to close \\
\hline
\end{DoxyParams}


Referenced by osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+destroy().

\mbox{\label{group__stream_gaad262988c7ac365566f03843c560f892}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+create@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+create}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+create@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+create}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+create()}
{\footnotesize\ttfamily struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+create (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



Create an Osmocom Stream Server Link A Stream Server Link is the listen()+accept() \char`\"{}parent\char`\"{} to individual Stream Servers. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em ctx} & talloc allocation context \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Stream Server Link with default values (T\+CP) 
\end{DoxyReturn}
\mbox{\label{group__stream_ga882acaaa5935422b0e09a2ce8c8019ec}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+destroy@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+destroy}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+destroy@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+destroy}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+destroy()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link }\end{DoxyParamCaption})}



Destroy the stream server link. Closes + Releases Memory. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link \\
\hline
\end{DoxyParams}


References osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+close().

\mbox{\label{group__stream_gacb5d68c2a6a9663f99266c70747bce04}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+data@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+data}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+data@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+data}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+data()}
{\footnotesize\ttfamily void $\ast$ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+data (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link }\end{DoxyParamCaption})}



Get application private data of the stream server link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to modify \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Application private data, as set by \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data()}{p.}{group__stream_ga5e94c511d537f63337912bb50fb2dc28} 
\end{DoxyReturn}
\mbox{\label{group__stream_ga7b8981351a154c357fcefd39c31ad42a}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+ofd@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+ofd}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+ofd@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+ofd}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+ofd()}
{\footnotesize\ttfamily struct osmo\+\_\+fd $\ast$ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+ofd (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link }\end{DoxyParamCaption})}



Get Osmocom File Descriptor of the stream server link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Pointer to osmo\+\_\+fd 
\end{DoxyReturn}
\mbox{\label{group__stream_ga7d7b6af7df24e90dc758a088bae6316d}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+sockname@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+sockname}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+sockname@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+sockname}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+sockname()}
{\footnotesize\ttfamily char $\ast$ osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+get\+\_\+sockname (\begin{DoxyParamCaption}\item[{const struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link }\end{DoxyParamCaption})}



Get description of the stream server link e. g. 127.\+0.\+0.\+1\+:1234. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to examine \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Link description or N\+U\+LL in case of error 
\end{DoxyReturn}
\mbox{\label{group__stream_ga603b89074d3e8c0fb44144ab1864f0d4}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+open@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+open}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+open@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+open}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+open()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+open (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link }\end{DoxyParamCaption})}



Open the stream server link. This actually initializes the underlying socket and binds it to the configured ip/port. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to open \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
negative on error, 0 on success 
\end{DoxyReturn}
\mbox{\label{group__stream_ga1eea525d4e1e7a24c9c08881994ceb7e}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+accept\+\_\+cb@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+accept\+\_\+cb}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+accept\+\_\+cb@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+accept\+\_\+cb}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+accept\+\_\+cb()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+accept\+\_\+cb (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{int($\ast$)(struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$link, int fd)}]{accept\+\_\+cb }\end{DoxyParamCaption})}



Set the accept() call-\/back of the stream server link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link \\
\hline
\mbox{\tt in}  & {\em accept\+\_\+cb} & Call-\/back function executed upon accept() \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_gacece90116484e34540def69b05c66f57}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addr@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addr}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addr@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addr}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addr()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addr (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



Set the local address to which we bind. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to modify \\
\hline
\mbox{\tt in}  & {\em addr} & Local IP address \\
\hline
\end{DoxyParams}


References osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addrs().

\mbox{\label{group__stream_gaadabca7d23c52c39e291bf7e05f0055b}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addrs@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addrs}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addrs@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addrs}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addrs()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addrs (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{const char $\ast$$\ast$}]{addr,  }\item[{size\+\_\+t}]{addrcnt }\end{DoxyParamCaption})}



Set the local address set to which we bind. Useful for protocols allowing bind on more than one address (such as S\+C\+TP) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to modify \\
\hline
\mbox{\tt in}  & {\em addr} & Local IP address \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
negative on error, 0 on success 
\end{DoxyReturn}


Referenced by osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+addr().

\mbox{\label{group__stream_ga5ef0f0c85a52c08e8c10d36a8f44e392}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+data@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+data}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+data@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+data}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+data()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+data (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Set application private data of the stream server link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to modify \\
\hline
\mbox{\tt in}  & {\em data} & User-\/specific data (available in call-\/back functions) \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga9629b516297c31f34af48e4630973dab}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+domain@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+domain}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+domain@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+domain}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+domain()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+domain (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{int}]{domain }\end{DoxyParamCaption})}



Set the socket type for the stream server link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to modify \\
\hline
\mbox{\tt in}  & {\em type} & Socket Domain (like A\+F\+\_\+\+U\+N\+S\+P\+EC (default for IP), A\+F\+\_\+\+U\+N\+IX, A\+F\+\_\+\+I\+N\+ET, ...) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, negative on error. 
\end{DoxyReturn}
\mbox{\label{group__stream_ga41e8ad2c761aaa00313aa11d1f29a3ed}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+nodelay@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+nodelay}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+nodelay@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+nodelay}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+nodelay()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+nodelay (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{bool}]{nodelay }\end{DoxyParamCaption})}



Set the N\+O\+D\+E\+L\+AY socket option to avoid Nagle-\/like behavior Setting this to nodelay=true will automatically set the N\+O\+D\+E\+L\+AY socket option on any socket established via this server link, before calling the accept\+\_\+cb() 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & server link whose sockets are to be configured \\
\hline
\mbox{\tt in}  & {\em nodelay} & whether to set (true) N\+O\+D\+E\+L\+AY after accept \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga76bbbafd1d8dc9c9ebffd301503b6dd9}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+port@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+port}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+port@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+port}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+port()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+port (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



Set the local port number to which we bind. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to modify \\
\hline
\mbox{\tt in}  & {\em port} & Local port number \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga2508987133a93863d2a50103004b0f36}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+proto@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+proto}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+proto@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+proto}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+proto()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+proto (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{uint16\+\_\+t}]{proto }\end{DoxyParamCaption})}



Set the protocol for the stream server link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to modify \\
\hline
\mbox{\tt in}  & {\em proto} & Protocol (like I\+P\+P\+R\+O\+T\+O\+\_\+\+T\+CP (default), I\+P\+P\+R\+O\+T\+O\+\_\+\+S\+C\+TP, ...) \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga1903f9aa2e6f9283ebcf20f573b1d970}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+type@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+type}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+type@{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+type}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+type()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+srv\+\_\+link\+\_\+set\+\_\+type (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv\+\_\+link} $\ast$}]{link,  }\item[{int}]{type }\end{DoxyParamCaption})}



Set the socket type for the stream server link. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em link} & Stream Server Link to modify \\
\hline
\mbox{\tt in}  & {\em type} & Socket Type (like S\+O\+C\+K\+\_\+\+S\+T\+R\+E\+AM (default), S\+O\+C\+K\+\_\+\+S\+E\+Q\+P\+A\+C\+K\+ET, ...) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, negative on error. 
\end{DoxyReturn}
\mbox{\label{group__stream_gac86242c41223c525c770ff7e7515d83e}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+recv@{osmo\+\_\+stream\+\_\+srv\+\_\+recv}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+recv@{osmo\+\_\+stream\+\_\+srv\+\_\+recv}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+recv()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+srv\+\_\+recv (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$}]{conn,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Receive data via Osmocom stream server. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em conn} & Stream Server from which to receive \\
\hline
 & {\em msg} & pre-\/allocate message buffer to which received data is appended \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of bytes read, negative on error.
\end{DoxyReturn}
If conn is an S\+C\+TP connection, additional specific considerations shall be taken\+:
\begin{DoxyItemize}
\item msg-\/$>$cb is always filled with S\+C\+TP ppid, and S\+C\+TP stream values, see msgb\+\_\+sctp\+\_\+$\ast$() A\+P\+Is.
\item If an S\+C\+TP notification was received when reading from the S\+C\+TP socket, msgb\+\_\+sctp\+\_\+msg\+\_\+flags(msg) will contain bit flag O\+S\+M\+O\+\_\+\+S\+T\+R\+E\+A\+M\+\_\+\+S\+C\+T\+P\+\_\+\+M\+S\+G\+\_\+\+F\+L\+A\+G\+S\+\_\+\+N\+O\+T\+I\+F\+I\+C\+A\+T\+I\+ON set, and the msgb will contain a \char`\"{}union sctp\+\_\+notification\char`\"{} instead of user data. In this case the return code will be either 0 (if conn is considered dead after the notification) or -\/\+E\+A\+G\+A\+IN (if conn is considered still alive after the notification) resembling the standard recv() A\+PI. 
\end{DoxyItemize}\mbox{\label{group__stream_gaa1589994cf6eab27742cafee6b7fb491}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+send@{osmo\+\_\+stream\+\_\+srv\+\_\+send}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+send@{osmo\+\_\+stream\+\_\+srv\+\_\+send}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+send()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+send (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$}]{conn,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Enqueue data to be sent via an Osmocom stream server. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em conn} & Stream Server through which we want to send \\
\hline
\mbox{\tt in}  & {\em msg} & Message buffer to enqueue in transmit queue \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga9891663b20714d72f992e44ad1e92eea}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+data@{osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+data}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+data@{osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+data}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+data()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+data (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$}]{conn,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Set application private data of the stream server. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em conn} & Stream Server to modify \\
\hline
\mbox{\tt in}  & {\em data} & User-\/specific data (available in call-\/back functions) \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream_ga8390ce6740e56eb22215e1c5805c95f1}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+flush\+\_\+and\+\_\+destroy@{osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+flush\+\_\+and\+\_\+destroy}}
\index{osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+flush\+\_\+and\+\_\+destroy@{osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+flush\+\_\+and\+\_\+destroy}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+flush\+\_\+and\+\_\+destroy()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+srv\+\_\+set\+\_\+flush\+\_\+and\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct \textbf{ osmo\+\_\+stream\+\_\+srv} $\ast$}]{conn }\end{DoxyParamCaption})}



Prepare to send out all pending messages on the connection\textquotesingle{}s Tx queue and then automatically destroy the stream with \doxyref{osmo\+\_\+stream\+\_\+srv\+\_\+destroy()}{p.}{group__stream_ga47f18e063f64f22cb74d58d8b7243bed}. This function disables queuing of new messages on the connection and also disables reception of new messages on the connection. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em conn} & Stream Server to modify \\
\hline
\end{DoxyParams}


\subsection{Variable Documentation}
\mbox{\label{group__stream_gabc297deef700516694f2eab8d4455113}} 
\index{Osmocom Stream Socket@{Osmocom Stream Socket}!stream\+\_\+cli\+\_\+state\+\_\+names@{stream\+\_\+cli\+\_\+state\+\_\+names}}
\index{stream\+\_\+cli\+\_\+state\+\_\+names@{stream\+\_\+cli\+\_\+state\+\_\+names}!Osmocom Stream Socket@{Osmocom Stream Socket}}
\subsubsection{stream\+\_\+cli\+\_\+state\+\_\+names}
{\footnotesize\ttfamily const struct value\+\_\+string stream\+\_\+cli\+\_\+state\+\_\+names[$\,$]\hspace{0.3cm}{\ttfamily [static]}}

{\bfseries Initial value\+:}
\begin{DoxyCode}
= \{
        \{ STREAM\_CLI\_STATE\_CLOSED,       \textcolor{stringliteral}{"CLOSED"} \},
        \{ STREAM\_CLI\_STATE\_WAIT\_RECONNECT, \textcolor{stringliteral}{"WAIT\_RECONNECT"} \},
        \{ STREAM\_CLI\_STATE\_CONNECTING,     \textcolor{stringliteral}{"CONNECTING"} \},
        \{ STREAM\_CLI\_STATE\_CONNECTED,      \textcolor{stringliteral}{"CONNECTED"} \},
        \{ 0, NULL \}
\}
\end{DoxyCode}
