\doxysection{Osmocom Stream Client}
\label{group__stream__cli}\index{Osmocom Stream Client@{Osmocom Stream Client}}


This code is intended to abstract any client use of stream-\/type sockets, such as TCP and SCTP.  


\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__stream__cli_gaeedeb263ba5591a525c2863b67d9d596}} 
typedef int($\ast$ {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+connect\+\_\+cb\+\_\+t}) (struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\item 
\mbox{\label{group__stream__cli_ga57c24898c8f042cb91e08e0b15291292}} 
typedef int($\ast$ {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+disconnect\+\_\+cb\+\_\+t}) (struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\item 
\mbox{\label{group__stream__cli_gae44d82bcb4ef653edb7c170ea7af1594}} 
typedef int($\ast$ {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+read\+\_\+cb\+\_\+t}) (struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\item 
typedef int($\ast$ \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+read\+\_\+cb2\+\_\+t}) (struct osmo\+\_\+stream\+\_\+cli $\ast$cli, int res, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Completion call-\/back function when something was read from from the stream client socket. \end{DoxyCompactList}\item 
\mbox{\label{group__stream__cli_gab9e4869dd1dbf7f16f701950ad6f3fac}} 
typedef int($\ast$ {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+segmentation\+\_\+cb\+\_\+t}) (struct msgb $\ast$msg)
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{group__stream__cli_ga72a162cb959f4d3145087e076800b816}} 
enum {\bfseries osmo\+\_\+stream\+\_\+cli\+\_\+param} \{ \newline
{\bfseries OSMO\+\_\+\+STREAM\+\_\+\+CLI\+\_\+\+PAR\+\_\+\+SCTP\+\_\+\+SOCKOPT\+\_\+\+AUTH\+\_\+\+SUPPORTED}
, {\bfseries OSMO\+\_\+\+STREAM\+\_\+\+CLI\+\_\+\+PAR\+\_\+\+SCTP\+\_\+\+SOCKOPT\+\_\+\+ASCONF\+\_\+\+SUPPORTED}
, {\bfseries OSMO\+\_\+\+STREAM\+\_\+\+CLI\+\_\+\+PAR\+\_\+\+SCTP\+\_\+\+INIT\+\_\+\+NUM\+\_\+\+OSTREAMS}
, {\bfseries OSMO\+\_\+\+STREAM\+\_\+\+CLI\+\_\+\+PAR\+\_\+\+SCTP\+\_\+\+INIT\+\_\+\+MAX\+\_\+\+INSTREAMS}
, \newline
{\bfseries OSMO\+\_\+\+STREAM\+\_\+\+CLI\+\_\+\+PAR\+\_\+\+SCTP\+\_\+\+INIT\+\_\+\+MAX\+\_\+\+ATTEMPTS}
, {\bfseries OSMO\+\_\+\+STREAM\+\_\+\+CLI\+\_\+\+PAR\+\_\+\+SCTP\+\_\+\+INIT\+\_\+\+TIMEOUT}
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+name} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli, const char $\ast$name)
\begin{DoxyCompactList}\small\item\em Set a name on the cli object (used during logging). \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+name} (const struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Retrieve name previously set on the cli object (see \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+name()}{p.}{group__stream__cli_gaeb712dc553735736047f9b11d9583baa}). \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+nodelay} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli, bool nodelay)
\begin{DoxyCompactList}\small\item\em Set the NODELAY socket option to avoid Nagle-\/like behavior. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr} (struct 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 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. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port} (struct 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 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 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 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 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 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 bind. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+port} (struct 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 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 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 osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Retrieve application private data of the stream client socket. \end{DoxyCompactList}\item 
char $\ast$ \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname} (const struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Retrieve the stream client socket description. \end{DoxyCompactList}\item 
struct osmo\+\_\+fd $\ast$ \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+ofd} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Retrieve Osmocom File Descriptor of the stream client socket. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+fd} (const struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Retrieve file descriptor of the stream client socket. \end{DoxyCompactList}\item 
struct osmo\+\_\+io\+\_\+fd $\ast$ \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+iofd} (const struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Retrieve osmo\+\_\+io descriptor of the stream client socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli, osmo\+\_\+stream\+\_\+cli\+\_\+connect\+\_\+cb\+\_\+t connect\+\_\+cb)
\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 osmo\+\_\+stream\+\_\+cli $\ast$cli, osmo\+\_\+stream\+\_\+cli\+\_\+disconnect\+\_\+cb\+\_\+t disconnect\+\_\+cb)
\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 osmo\+\_\+stream\+\_\+cli $\ast$cli, osmo\+\_\+stream\+\_\+cli\+\_\+read\+\_\+cb\+\_\+t read\+\_\+cb)
\begin{DoxyCompactList}\small\item\em Set the call-\/back function called to read from the stream client socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb2} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli, \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+read\+\_\+cb2\+\_\+t} read\+\_\+cb)
\begin{DoxyCompactList}\small\item\em Set the call-\/back function called to read from the stream client socket. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+segmentation\+\_\+cb} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli, osmo\+\_\+stream\+\_\+cli\+\_\+segmentation\+\_\+cb\+\_\+t segmentation\+\_\+cb)
\begin{DoxyCompactList}\small\item\em Set the segmentation callback for the client. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+reconnect} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Re-\/connect an Osmocom Stream Client. \end{DoxyCompactList}\item 
bool \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Check if Osmocom Stream Client is in connected state. \end{DoxyCompactList}\item 
struct 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 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 osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Open connection of an Osmocom stream client. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+open2} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli, int reconnect)
\begin{DoxyCompactList}\small\item\em DEPRECATED\+: use \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout()}{p.}{group__stream__cli_gade74792afe35f31dd2584c888db3dd62} or \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+reconnect()}{p.}{group__stream__cli_ga11d2615f6197f33073ba7245e5ba95ee} instead! Open connection of an Osmocom stream client. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+close} (struct 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 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 osmo\+\_\+stream\+\_\+cli $\ast$cli, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Receive data via an Osmocom stream client in osmo\+\_\+fd mode. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+clear\+\_\+tx\+\_\+queue} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli)
\begin{DoxyCompactList}\small\item\em Clear the transmit queue of the stream client. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+param} (struct osmo\+\_\+stream\+\_\+cli $\ast$cli, enum osmo\+\_\+stream\+\_\+cli\+\_\+param par, void $\ast$val, size\+\_\+t val\+\_\+len)
\begin{DoxyCompactList}\small\item\em Set given parameter of stream client to given value. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This code is intended to abstract any client use of stream-\/type sockets, such as TCP and SCTP. 

An osmo\+\_\+stream\+\_\+cli represents a client implementation of a SOCK\+\_\+\+STREAM or SOCK\+\_\+\+SEQPACKET socket. It contains all the common logic like non-\/blocking outbound connect to a remote server, re-\/connecting after disconnect or connect failure, etc.

osmo\+\_\+stream\+\_\+cli can operate in two different modes\+:
\begin{DoxyEnumerate}
\item The legacy mode using osmo\+\_\+fd (from libosmocore)
\item The modern (2023) mode using osmo\+\_\+io\+\_\+fd (from libosmocore)
\end{DoxyEnumerate}

For any new applications, you definitely should use the modern mode, as it provides you with a higher layer of abstraction and allows you to perform efficient I/O using the io\+\_\+uring backend of osmo\+\_\+io.

A typical usage of osmo\+\_\+stream\+\_\+cli would look as follows\+:


\begin{DoxyItemize}
\item call \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+create()}{p.}{group__stream__cli_ga1754a498abc27577a8e0b3b0f236c05b} to create a new osmo\+\_\+stream\+\_\+cli
\item call \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr()}{p.}{group__stream__cli_ga0038e937cf0f36c59e0e3991523219a1} / \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port()}{p.}{group__stream__cli_gab8b9f65bebfeb83c6e33d102e9439770} to specify the remote address/port to connect to
\item optionally call further functions of the osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+$\ast$() family
\item call \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb()}{p.}{group__stream__cli_ga6a7d4b7df43a3f0487d343fe3cd0c6a7} to register the call-\/back called on completion of outbound connect()
\item call \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb2()}{p.}{group__stream__cli_ga7892eb77d40f08a254f654786d0b996b} to register the call-\/back called when incoming data has been read
\item call \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+open()}{p.}{group__stream__cli_ga86b4b9c8e563f8426d3cdae803e3ec38} to open the connection (start outbound connect process)
\end{DoxyItemize}

Once the connection is established, your connect\+\_\+cb is called to notify you.

You may send data to the connection using osmo\+\_\+tream\+\_\+cli\+\_\+send().

Any received inbound data on the connection is reported vie the read\+\_\+cb. 

\doxysubsection{Typedef Documentation}
\mbox{\label{group__stream__cli_ga113d99fd2e25ce01e98db0a6aa21c89c}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_read\_cb2\_t@{osmo\_stream\_cli\_read\_cb2\_t}}
\index{osmo\_stream\_cli\_read\_cb2\_t@{osmo\_stream\_cli\_read\_cb2\_t}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_read\_cb2\_t}
{\footnotesize\ttfamily typedef int($\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+read\+\_\+cb2\+\_\+t) (struct osmo\+\_\+stream\+\_\+cli $\ast$cli, int res, struct msgb $\ast$msg)}



Completion call-\/back function when something was read from from the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client that got receive event. \\
\hline
\mbox{\texttt{ in}}  & {\em res} & return value of the read()/recvmsg()/... call, or -\/errno in case of error. \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & message buffer containing the read data. Ownership is transferred to the call-\/back, and it must make sure to msgb\+\_\+free() it eventually! \\
\hline
\end{DoxyParams}


\doxysubsection{Function Documentation}
\mbox{\label{group__stream__cli_gafa39b1dcc139ad12cbc38d51049bf14f}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_clear\_tx\_queue@{osmo\_stream\_cli\_clear\_tx\_queue}}
\index{osmo\_stream\_cli\_clear\_tx\_queue@{osmo\_stream\_cli\_clear\_tx\_queue}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_clear\_tx\_queue()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+clear\+\_\+tx\+\_\+queue (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Clear the transmit queue of the stream client. 

Calling this function wil clear (delete) any pending, not-\/yet transmitted data from the transmit queue. \mbox{\label{group__stream__cli_gad217c1c1b83ac852e090afd49146db19}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_close@{osmo\_stream\_cli\_close}}
\index{osmo\_stream\_cli\_close@{osmo\_stream\_cli\_close}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_close()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+close (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Close an Osmocom Stream Client. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ 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 \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+destroy()}, and \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+reconnect()}.

\mbox{\label{group__stream__cli_ga1754a498abc27577a8e0b3b0f236c05b}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_create@{osmo\_stream\_cli\_create}}
\index{osmo\_stream\_cli\_create@{osmo\_stream\_cli\_create}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_create()}
{\footnotesize\ttfamily struct 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{\texttt{ in}}  & {\em ctx} & talloc context from which to allocate memory This function allocates a new osmo\+\_\+stream\+\_\+cli and initializes it with default values (5s reconnect timer, TCP protocol) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
allocated stream client, or NULL in case of error 
\end{DoxyReturn}
\mbox{\label{group__stream__cli_ga9d0dac2f390c660c85fa347765f4f45a}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_destroy@{osmo\_stream\_cli\_destroy}}
\index{osmo\_stream\_cli\_destroy@{osmo\_stream\_cli\_destroy}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_destroy()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Destroy a Osmocom stream client (includes close). 


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


References \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+close()}.

\mbox{\label{group__stream__cli_ga606a53840677f3f5200887dc92f5de4d}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_get\_data@{osmo\_stream\_cli\_get\_data}}
\index{osmo\_stream\_cli\_get\_data@{osmo\_stream\_cli\_get\_data}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_get\_data()}
{\footnotesize\ttfamily void $\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+data (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Retrieve application private data of the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ 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__cli_ga5e94c511d537f63337912bb50fb2dc28} 
\end{DoxyReturn}
\mbox{\label{group__stream__cli_gaffc6ac3b28d87c910294a2f522a1eaab}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_get\_fd@{osmo\_stream\_cli\_get\_fd}}
\index{osmo\_stream\_cli\_get\_fd@{osmo\_stream\_cli\_get\_fd}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_get\_fd()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+fd (\begin{DoxyParamCaption}\item[{const struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Retrieve file descriptor of the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client of which we want to obtain the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
File descriptor or negative in case of error 
\end{DoxyReturn}


Referenced by \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname()}.

\mbox{\label{group__stream__cli_gac32d0489dd05ab89fb0c54dfd360d5b3}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_get\_iofd@{osmo\_stream\_cli\_get\_iofd}}
\index{osmo\_stream\_cli\_get\_iofd@{osmo\_stream\_cli\_get\_iofd}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_get\_iofd()}
{\footnotesize\ttfamily struct osmo\+\_\+io\+\_\+fd $\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+iofd (\begin{DoxyParamCaption}\item[{const struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Retrieve osmo\+\_\+io descriptor of the stream client socket. 

This function must not be called on a stream client in legacy osmo\+\_\+fd mode! The iofd is only valid once/after \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+open()}{p.}{group__stream__cli_ga86b4b9c8e563f8426d3cdae803e3ec38} has successfully returned. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client of which we want to obtain the file descriptor \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
osmo\+\_\+io\+\_\+fd of stream client, or NULL if stream not yet opened. 
\end{DoxyReturn}
\mbox{\label{group__stream__cli_ga0967921ed380123e3f54fd35375741bf}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_get\_name@{osmo\_stream\_cli\_get\_name}}
\index{osmo\_stream\_cli\_get\_name@{osmo\_stream\_cli\_get\_name}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_get\_name()}
{\footnotesize\ttfamily const char $\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+name (\begin{DoxyParamCaption}\item[{const struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Retrieve name previously set on the cli object (see \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+name()}{p.}{group__stream__cli_gaeb712dc553735736047f9b11d9583baa}). 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & stream\+\_\+cli whose name is to be retrieved \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The name to be set on cli; NULL if never set 
\end{DoxyReturn}
\mbox{\label{group__stream__cli_ga0615daa4aac253a3d530f35fddbc68bd}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_get\_ofd@{osmo\_stream\_cli\_get\_ofd}}
\index{osmo\_stream\_cli\_get\_ofd@{osmo\_stream\_cli\_get\_ofd}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_get\_ofd()}
{\footnotesize\ttfamily struct osmo\+\_\+fd $\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+ofd (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Retrieve Osmocom File Descriptor of the stream client socket. 

This function only works in case you operate osmo\+\_\+stream\+\_\+cli in osmo\+\_\+fd mode! 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Pointer to osmo\+\_\+fd 
\end{DoxyReturn}
\mbox{\label{group__stream__cli_gaecd148ae11f2f619aa52dd2900a15827}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_get\_sockname@{osmo\_stream\_cli\_get\_sockname}}
\index{osmo\_stream\_cli\_get\_sockname@{osmo\_stream\_cli\_get\_sockname}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_get\_sockname()}
{\footnotesize\ttfamily char $\ast$ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+sockname (\begin{DoxyParamCaption}\item[{const struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Retrieve the stream client socket description. 

Calling this function will build a string that describes the socket in terms of its local/remote address/port. The returned name is stored in a static buffer; it is hence not re-\/entrant or thread-\/safe. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to examine \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Socket description or NULL in case of error 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+get\+\_\+fd()}.

\mbox{\label{group__stream__cli_ga79a09e9c9b8cc98991cd5eebdb41ed57}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_is\_connected@{osmo\_stream\_cli\_is\_connected}}
\index{osmo\_stream\_cli\_is\_connected@{osmo\_stream\_cli\_is\_connected}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_is\_connected()}
{\footnotesize\ttfamily bool osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Check if Osmocom Stream Client is in connected state. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Osmocom Stream Client \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if connected, false otherwise 
\end{DoxyReturn}


Referenced by \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+send()}.

\mbox{\label{group__stream__cli_ga86b4b9c8e563f8426d3cdae803e3ec38}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_open@{osmo\_stream\_cli\_open}}
\index{osmo\_stream\_cli\_open@{osmo\_stream\_cli\_open}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_open()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+open (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



Open connection of an Osmocom stream client. 

This will initiate an non-\/blocking outbound connect to the configured destination (server) address. By default the client will automatically attempt to reconnect after default timeout. To disable this, use \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout()}{p.}{group__stream__cli_gade74792afe35f31dd2584c888db3dd62} before calling this function. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ 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__cli_ga127866794591d16a0eb7244f2fe666ef}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_open2@{osmo\_stream\_cli\_open2}}
\index{osmo\_stream\_cli\_open2@{osmo\_stream\_cli\_open2}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_open2()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+open2 (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{int}]{reconnect }\end{DoxyParamCaption})}



DEPRECATED\+: use \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout()}{p.}{group__stream__cli_gade74792afe35f31dd2584c888db3dd62} or \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+reconnect()}{p.}{group__stream__cli_ga11d2615f6197f33073ba7245e5ba95ee} instead! Open connection of an Osmocom stream client. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to connect \\
\hline
\mbox{\texttt{ 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__cli_ga11d2615f6197f33073ba7245e5ba95ee}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_reconnect@{osmo\_stream\_cli\_reconnect}}
\index{osmo\_stream\_cli\_reconnect@{osmo\_stream\_cli\_reconnect}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_reconnect()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+reconnect (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli }\end{DoxyParamCaption})}



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__cli_gade74792afe35f31dd2584c888db3dd62} call), we close any existing connection (if any) and schedule a re-\/connect timer 

References \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+close()}.

\mbox{\label{group__stream__cli_ga06f9743c19068bb720a4949ae8467243}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_recv@{osmo\_stream\_cli\_recv}}
\index{osmo\_stream\_cli\_recv@{osmo\_stream\_cli\_recv}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_recv()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+recv (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Receive data via an Osmocom stream client in osmo\+\_\+fd mode. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ 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}
Application programs using the legacy osmo\+\_\+fd mode of osmo\+\_\+stream\+\_\+cli will use this function to read/receive from a stream client socket after they have been notified that it is readable (via select/poll).

If conn is an SCTP connection, additional specific considerations shall be taken\+:
\begin{DoxyItemize}
\item msg-\/$>$cb is always filled with SCTP ppid, and SCTP stream values, see msgb\+\_\+sctp\+\_\+$\ast$() APIs.
\item If an SCTP notification was received when reading from the SCTP socket, msgb\+\_\+sctp\+\_\+msg\+\_\+flags(msg) will contain bit flag OSMO\+\_\+\+STREAM\+\_\+\+SCTP\+\_\+\+MSG\+\_\+\+FLAGS\+\_\+\+NOTIFICATION 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 -\/EAGAIN (if conn is considered still alive after the notification) resembling the standard recv() API. 
\end{DoxyItemize}\mbox{\label{group__stream__cli_gaacf415b97e1184baadeee5c60387422b}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_send@{osmo\_stream\_cli\_send}}
\index{osmo\_stream\_cli\_send@{osmo\_stream\_cli\_send}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_send()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+send (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Enqueue data to be sent via an Osmocom stream client. 

This is the function you use for writing/sending/transmitting data via the osmo\+\_\+stream\+\_\+cli. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client through which we want to send \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & Message buffer to enqueue in transmit queue \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+is\+\_\+connected()}.

\mbox{\label{group__stream__cli_ga0038e937cf0f36c59e0e3991523219a1}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_addr@{osmo\_stream\_cli\_set\_addr}}
\index{osmo\_stream\_cli\_set\_addr@{osmo\_stream\_cli\_set\_addr}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_addr()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addr (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



Set the remote address to which we connect. 

Any changes to this setting will only become active upon next (re)connect. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em addr} & Remote IP address \\
\hline
\end{DoxyParams}


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

\mbox{\label{group__stream__cli_gaab1e7ef0ccc88e124c5f7bbb5e46c29c}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_addrs@{osmo\_stream\_cli\_set\_addrs}}
\index{osmo\_stream\_cli\_set\_addrs@{osmo\_stream\_cli\_set\_addrs}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_addrs()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+addrs (\begin{DoxyParamCaption}\item[{struct 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 SCTP) Any changes to this setting will only become active upon next (re)connect. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em addr} & Remote IP address set \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
negative on error, 0 on success 
\end{DoxyReturn}


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

\mbox{\label{group__stream__cli_ga6a7d4b7df43a3f0487d343fe3cd0c6a7}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!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 Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_connect\_cb()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+connect\+\_\+cb (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{osmo\+\_\+stream\+\_\+cli\+\_\+connect\+\_\+cb\+\_\+t}]{connect\+\_\+cb }\end{DoxyParamCaption})}



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

The call-\/back function registered via this function will be called upon completion of the non-\/blocking outbound connect operation. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em connect\+\_\+cb} & Call-\/back function to be called upon connect \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_ga5e94c511d537f63337912bb50fb2dc28}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_data@{osmo\_stream\_cli\_set\_data}}
\index{osmo\_stream\_cli\_set\_data@{osmo\_stream\_cli\_set\_data}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_data()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+data (\begin{DoxyParamCaption}\item[{struct 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{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em data} & User-\/specific data (available in call-\/back functions) \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_ga6640b82a47028434455471bb52d9f577}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!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 Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_disconnect\_cb()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+disconnect\+\_\+cb (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{osmo\+\_\+stream\+\_\+cli\+\_\+disconnect\+\_\+cb\+\_\+t}]{disconnect\+\_\+cb }\end{DoxyParamCaption})}



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


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



Set the socket type for the stream server link. 

Any changes to this setting will only become active upon next (re)connect. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em type} & Socket Domain (like AF\+\_\+\+UNSPEC (default for IP), AF\+\_\+\+UNIX, AF\+\_\+\+INET, ...) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, negative -\/errno on error. 
\end{DoxyReturn}
\mbox{\label{group__stream__cli_ga70420e7c664cc4c4e69ac4d3476e7f53}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!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 Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_local\_addr()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addr (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



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

Any changes to this setting will only become active upon next (re)connect. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em port} & Local host name \\
\hline
\end{DoxyParams}


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

\mbox{\label{group__stream__cli_ga090fc3fcd1706b815ef5a729921c100e}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!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 Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_local\_addrs()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+addrs (\begin{DoxyParamCaption}\item[{struct 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 bind. 

Useful for protocols allowing bind to more than one address (such as SCTP) Any changes to this setting will only become active upon next (re)connect. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em addr} & Local IP address set \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
negative on error, 0 on success 
\end{DoxyReturn}


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

\mbox{\label{group__stream__cli_ga4d83e3cf7fdf7eb354c2015ff9bed98a}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!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 Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_local\_port()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+local\+\_\+port (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



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

Any changes to this setting will only become active upon next (re)connect. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em port} & Local port number \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_gaeb712dc553735736047f9b11d9583baa}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_name@{osmo\_stream\_cli\_set\_name}}
\index{osmo\_stream\_cli\_set\_name@{osmo\_stream\_cli\_set\_name}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_name()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+name (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



Set a name on the cli object (used during logging). 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & stream\+\_\+cli whose name is to be set \\
\hline
\mbox{\texttt{ in}}  & {\em name} & the name to be set on cli \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_gaa196e78db6ca32abb1473566b4f1b04b}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_nodelay@{osmo\_stream\_cli\_set\_nodelay}}
\index{osmo\_stream\_cli\_set\_nodelay@{osmo\_stream\_cli\_set\_nodelay}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_nodelay()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+nodelay (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{bool}]{nodelay }\end{DoxyParamCaption})}



Set the NODELAY socket option to avoid Nagle-\/like behavior. 

Setting this to nodelay=true will automatically set the NODELAY socket option on any socket established via \doxyref{osmo\+\_\+stream\+\_\+cli\+\_\+open}{p.}{group__stream__cli_ga86b4b9c8e563f8426d3cdae803e3ec38} or any re-\/connect. You have to set this {\itshape before} opening the socket. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream client whose sockets are to be configured \\
\hline
\mbox{\texttt{ in}}  & {\em nodelay} & whether to set (true) NODELAY before connect() \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_ga0638e98001fa4bdd36533718472dfac7}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_param@{osmo\_stream\_cli\_set\_param}}
\index{osmo\_stream\_cli\_set\_param@{osmo\_stream\_cli\_set\_param}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_param()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+param (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{enum osmo\+\_\+stream\+\_\+cli\+\_\+param}]{par,  }\item[{void $\ast$}]{val,  }\item[{size\+\_\+t}]{val\+\_\+len }\end{DoxyParamCaption})}



Set given parameter of stream client to given value. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & stream client on which to set parameter. \\
\hline
\mbox{\texttt{ in}}  & {\em par} & identifier of the parameter to be set. \\
\hline
\mbox{\texttt{ in}}  & {\em val} & value of the parameter to be set. \\
\hline
\mbox{\texttt{ in}}  & {\em val\+\_\+len} & length of the parameter value. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 in success; negative -\/errno on error. 
\end{DoxyReturn}
\mbox{\label{group__stream__cli_gab8b9f65bebfeb83c6e33d102e9439770}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_port@{osmo\_stream\_cli\_set\_port}}
\index{osmo\_stream\_cli\_set\_port@{osmo\_stream\_cli\_set\_port}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_port()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+port (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



Set the remote port number to which we connect. 

Any changes to this setting will only become active upon next (re)connect. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em port} & Remote port number \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_ga91d57aa94a370520540d7272af66a23b}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_proto@{osmo\_stream\_cli\_set\_proto}}
\index{osmo\_stream\_cli\_set\_proto@{osmo\_stream\_cli\_set\_proto}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_proto()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+proto (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{uint16\+\_\+t}]{proto }\end{DoxyParamCaption})}



Set the protocol for the stream client socket. 

Any changes to this setting will only become active upon next (re)connect. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em proto} & Protocol (like IPPROTO\+\_\+\+TCP (default), IPPROTO\+\_\+\+SCTP, ...) \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_ga798f23db7e2e1d999775589db8a73d03}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!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 Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_read\_cb()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{osmo\+\_\+stream\+\_\+cli\+\_\+read\+\_\+cb\+\_\+t}]{read\+\_\+cb }\end{DoxyParamCaption})}



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

This function will implicitly configure osmo\+\_\+stream\+\_\+cli to use legacy osmo\+\_\+ofd mode. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em read\+\_\+cb} & Call-\/back function to be called when we want to read \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_ga7892eb77d40f08a254f654786d0b996b}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_read\_cb2@{osmo\_stream\_cli\_set\_read\_cb2}}
\index{osmo\_stream\_cli\_set\_read\_cb2@{osmo\_stream\_cli\_set\_read\_cb2}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_read\_cb2()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+read\+\_\+cb2 (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{\textbf{ osmo\+\_\+stream\+\_\+cli\+\_\+read\+\_\+cb2\+\_\+t}}]{read\+\_\+cb }\end{DoxyParamCaption})}



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

This function will implicitly configure osmo\+\_\+stream\+\_\+cli to use osmo\+\_\+iofd mode. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em read\+\_\+cb} & Call-\/back function to be called when data was read from the socket \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_gade74792afe35f31dd2584c888db3dd62}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!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 Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_reconnect\_timeout()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+reconnect\+\_\+timeout (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{int}]{timeout }\end{DoxyParamCaption})}



Set the reconnect time of the stream client socket. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em timeout} & Re-\/connect timeout in seconds or negative value to disable auto-\/reconnection \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_gab6094559935824750d82b9164ed76910}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_segmentation\_cb@{osmo\_stream\_cli\_set\_segmentation\_cb}}
\index{osmo\_stream\_cli\_set\_segmentation\_cb@{osmo\_stream\_cli\_set\_segmentation\_cb}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_segmentation\_cb()}
{\footnotesize\ttfamily void osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+segmentation\+\_\+cb (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{osmo\+\_\+stream\+\_\+cli\+\_\+segmentation\+\_\+cb\+\_\+t}]{segmentation\+\_\+cb }\end{DoxyParamCaption})}



Set the segmentation callback for the client. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em segmentation\+\_\+cb} & Target segmentation callback \\
\hline
\end{DoxyParams}
\mbox{\label{group__stream__cli_ga5e5c4c9aacc1cd1d303c0295018594cb}} 
\index{Osmocom Stream Client@{Osmocom Stream Client}!osmo\_stream\_cli\_set\_type@{osmo\_stream\_cli\_set\_type}}
\index{osmo\_stream\_cli\_set\_type@{osmo\_stream\_cli\_set\_type}!Osmocom Stream Client@{Osmocom Stream Client}}
\doxysubsubsection{osmo\_stream\_cli\_set\_type()}
{\footnotesize\ttfamily int osmo\+\_\+stream\+\_\+cli\+\_\+set\+\_\+type (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+stream\+\_\+cli $\ast$}]{cli,  }\item[{int}]{type }\end{DoxyParamCaption})}



Set the socket type for the stream server link. 

Any changes to this setting will only become active upon next (re)connect. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cli} & Stream Client to modify \\
\hline
\mbox{\texttt{ in}}  & {\em type} & Socket Type (like SOCK\+\_\+\+STREAM (default), SOCK\+\_\+\+SEQPACKET, ...) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
zero on success, negative -\/errno on error. 
\end{DoxyReturn}
