\doxysection{Osmocom Datagram Socket}
\label{group__datagram}\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}}


This code is intended to abstract any use of datagram type sockets, such as UDP.  


\doxysubsubsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \textbf{ datagram.\+h}
\begin{DoxyCompactList}\small\item\em Osmocom datagram socket helpers. \end{DoxyCompactList}\item 
file \textbf{ datagram.\+c}
\begin{DoxyCompactList}\small\item\em Osmocom datagram socket helpers. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct osmo\+\_\+dgram\+\_\+tx $\ast$ \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+create} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Create an Osmocom datagram transmitter. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+destroy} (struct osmo\+\_\+dgram\+\_\+tx $\ast$conn)
\begin{DoxyCompactList}\small\item\em Destroy a Osmocom datagram transmitter. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+addr} (struct osmo\+\_\+dgram\+\_\+tx $\ast$conn, const char $\ast$addr)
\begin{DoxyCompactList}\small\item\em Set the remote address to which we transmit. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+port} (struct osmo\+\_\+dgram\+\_\+tx $\ast$conn, uint16\+\_\+t port)
\begin{DoxyCompactList}\small\item\em Set the remote port to which we transmit. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+local\+\_\+addr} (struct osmo\+\_\+dgram\+\_\+tx $\ast$conn, const char $\ast$addr)
\begin{DoxyCompactList}\small\item\em Set the local address from which we transmit. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+local\+\_\+port} (struct osmo\+\_\+dgram\+\_\+tx $\ast$conn, uint16\+\_\+t port)
\begin{DoxyCompactList}\small\item\em Set the local port from which we transmit. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+data} (struct osmo\+\_\+dgram\+\_\+tx $\ast$conn, void $\ast$data)
\begin{DoxyCompactList}\small\item\em Set application private data of the datagram transmitter. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+open} (struct osmo\+\_\+dgram\+\_\+tx $\ast$conn)
\begin{DoxyCompactList}\small\item\em Open connection of an Osmocom datagram transmitter. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+close} (struct osmo\+\_\+dgram\+\_\+tx $\ast$conn)
\begin{DoxyCompactList}\small\item\em Close an Osmocom Datagram Transmitter. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+send} (struct osmo\+\_\+dgram\+\_\+tx $\ast$conn, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Enqueue data to be sent via an Osmocom datagram transmitter. \end{DoxyCompactList}\item 
struct osmo\+\_\+dgram\+\_\+rx $\ast$ \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+create} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Create an Osmocom datagram receiver. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+set\+\_\+addr} (struct osmo\+\_\+dgram\+\_\+rx $\ast$conn, const char $\ast$addr)
\begin{DoxyCompactList}\small\item\em Set the local address to which we bind. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+set\+\_\+port} (struct osmo\+\_\+dgram\+\_\+rx $\ast$conn, uint16\+\_\+t port)
\begin{DoxyCompactList}\small\item\em Set the local port to which we bind. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+set\+\_\+read\+\_\+cb} (struct osmo\+\_\+dgram\+\_\+rx $\ast$conn, int($\ast$read\+\_\+cb)(struct osmo\+\_\+dgram\+\_\+rx $\ast$conn))
\begin{DoxyCompactList}\small\item\em Set the read() call-\/back of the datagram receiver. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+destroy} (struct osmo\+\_\+dgram\+\_\+rx $\ast$conn)
\begin{DoxyCompactList}\small\item\em Destroy the datagram receiver. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+open} (struct osmo\+\_\+dgram\+\_\+rx $\ast$conn)
\begin{DoxyCompactList}\small\item\em Open the datagram receiver. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+close} (struct osmo\+\_\+dgram\+\_\+rx $\ast$conn)
\begin{DoxyCompactList}\small\item\em Close the datagram receiver and unregister from select loop Does not destroy the datagram receiver, merely closes it! \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+recv} (struct osmo\+\_\+dgram\+\_\+rx $\ast$conn, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Receive data via Osmocom datagram receiver. \end{DoxyCompactList}\item 
struct osmo\+\_\+dgram $\ast$ \textbf{ osmo\+\_\+dgram\+\_\+create} (void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Create an Osmocom datagram transceiver (bidirectional) \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+destroy} (struct osmo\+\_\+dgram $\ast$conn)
\begin{DoxyCompactList}\small\item\em Destroy a Osmocom datagram transceiver. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+dgram\+\_\+open} (struct osmo\+\_\+dgram $\ast$conn)
\begin{DoxyCompactList}\small\item\em Open the datagram transceiver. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+close} (struct osmo\+\_\+dgram $\ast$conn)
\begin{DoxyCompactList}\small\item\em Close an Osmocom Datagram Transceiver. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+set\+\_\+local\+\_\+addr} (struct osmo\+\_\+dgram $\ast$conn, const char $\ast$addr)
\begin{DoxyCompactList}\small\item\em Set the local address to which we bind. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+set\+\_\+remote\+\_\+addr} (struct osmo\+\_\+dgram $\ast$conn, const char $\ast$addr)
\begin{DoxyCompactList}\small\item\em Set the remote address to which we transmit/connect. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+set\+\_\+local\+\_\+port} (struct osmo\+\_\+dgram $\ast$conn, uint16\+\_\+t port)
\begin{DoxyCompactList}\small\item\em Set the local port to which we bind. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+set\+\_\+remote\+\_\+port} (struct osmo\+\_\+dgram $\ast$conn, uint16\+\_\+t port)
\begin{DoxyCompactList}\small\item\em Set the remote port to which we transmit. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+set\+\_\+read\+\_\+cb} (struct osmo\+\_\+dgram $\ast$conn, int($\ast$read\+\_\+cb)(struct osmo\+\_\+dgram $\ast$conn))
\begin{DoxyCompactList}\small\item\em Set the read() call-\/back of the datagram receiver. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+set\+\_\+data} (struct osmo\+\_\+dgram $\ast$conn, void $\ast$data)
\begin{DoxyCompactList}\small\item\em Set application private data of the datagram transmitter. \end{DoxyCompactList}\item 
void $\ast$ \textbf{ osmo\+\_\+dgram\+\_\+get\+\_\+data} (struct osmo\+\_\+dgram $\ast$conn)
\begin{DoxyCompactList}\small\item\em Get application private data of the datagram transceiver. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+dgram\+\_\+send} (struct osmo\+\_\+dgram $\ast$conn, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Enqueue data to be sent via an Osmocom datagram transceiver. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+dgram\+\_\+recv} (struct osmo\+\_\+dgram $\ast$conn, struct msgb $\ast$msg)
\begin{DoxyCompactList}\small\item\em Receive data via Osmocom datagram transceiver. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This code is intended to abstract any use of datagram type sockets, such as UDP. 

It offers both transmitter and receiver side implementations, fully integrated with the libosmocore select loop abstraction. 

\doxysubsection{Function Documentation}
\label{group__datagram_ga46db4acbfc35668e35601338d64364ed} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_close@{osmo\_dgram\_close}}
\index{osmo\_dgram\_close@{osmo\_dgram\_close}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_close()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+close (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn }\end{DoxyParamCaption})}



Close an Osmocom Datagram Transceiver. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Osmocom Datagram Transceiver to be closed We unregister the socket fds from the osmocom select() loop and close them. \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+close()}, and \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+close()}.

\label{group__datagram_ga56ee60c89f1a3bc975ab0ede5b71ff15} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_create@{osmo\_dgram\_create}}
\index{osmo\_dgram\_create@{osmo\_dgram\_create}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_create()}
{\footnotesize\ttfamily struct osmo\+\_\+dgram $\ast$ osmo\+\_\+dgram\+\_\+create (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



Create an Osmocom datagram transceiver (bidirectional) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context from which to allocate memory This function allocates a new osmo\+\_\+dgram and initializes it with default values. Internally, the Transceiver is based on a tuple of transmitter (osmo\+\_\+dgram\+\_\+tx) and receiver (osmo\+\_\+dgram\+\_\+rx) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Osmocom Datagram Transceiver; NULL on error 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+create()}, \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+destroy()}, \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+set\+\_\+read\+\_\+cb()}, and \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+create()}.

\label{group__datagram_ga01fb36f8c19b2b64705d8263f7f53f59} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_destroy@{osmo\_dgram\_destroy}}
\index{osmo\_dgram\_destroy@{osmo\_dgram\_destroy}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_destroy()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn }\end{DoxyParamCaption})}



Destroy a Osmocom datagram transceiver. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transceiver to destroy \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+destroy()}, and \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+destroy()}.

\label{group__datagram_ga36d7e1f26af3308b51f95e06d1c742d7} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_get\_data@{osmo\_dgram\_get\_data}}
\index{osmo\_dgram\_get\_data@{osmo\_dgram\_get\_data}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_get\_data()}
{\footnotesize\ttfamily void $\ast$ osmo\+\_\+dgram\+\_\+get\+\_\+data (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn }\end{DoxyParamCaption})}



Get application private data of the datagram transceiver. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transceiver \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Application private data, as set by \doxyref{osmo\+\_\+dgram\+\_\+set\+\_\+data()}{p.}{group__datagram_gaa6a5fbd5f227d15cefe6b234fefb3b4d} 
\end{DoxyReturn}
\label{group__datagram_gac65de108c52dba83b178d6453e9fb545} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_open@{osmo\_dgram\_open}}
\index{osmo\_dgram\_open@{osmo\_dgram\_open}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_open()}
{\footnotesize\ttfamily int osmo\+\_\+dgram\+\_\+open (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn }\end{DoxyParamCaption})}



Open the datagram transceiver. 

This actually initializes the underlying sockets and binds/connects them to the configured ips/ports 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transceiver to open \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+close()}, \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+open()}, and \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+open()}.

\label{group__datagram_gaae58d13a6fd634ebfddd486d0d428c5e} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_recv@{osmo\_dgram\_recv}}
\index{osmo\_dgram\_recv@{osmo\_dgram\_recv}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_recv()}
{\footnotesize\ttfamily int osmo\+\_\+dgram\+\_\+recv (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Receive data via Osmocom datagram transceiver. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transceiver 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}


References \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+recv()}.

\label{group__datagram_ga01efa7269834a745d80910a64c6f61c0} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_rx\_close@{osmo\_dgram\_rx\_close}}
\index{osmo\_dgram\_rx\_close@{osmo\_dgram\_rx\_close}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_rx\_close()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+rx\+\_\+close (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+rx $\ast$}]{conn }\end{DoxyParamCaption})}



Close the datagram receiver and unregister from select loop Does not destroy the datagram receiver, merely closes it! 


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


Referenced by \textbf{ osmo\+\_\+dgram\+\_\+close()}, \textbf{ osmo\+\_\+dgram\+\_\+open()}, \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+destroy()}, and \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+open()}.

\label{group__datagram_gad7af9f04fe4847b0e2eefe35fa05a8b8} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_rx\_create@{osmo\_dgram\_rx\_create}}
\index{osmo\_dgram\_rx\_create@{osmo\_dgram\_rx\_create}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_rx\_create()}
{\footnotesize\ttfamily struct osmo\+\_\+dgram\+\_\+rx $\ast$ osmo\+\_\+dgram\+\_\+rx\+\_\+create (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



Create an Osmocom datagram receiver. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context from which to allocate memory This function allocates a new osmo\+\_\+dgram\+\_\+rx and initializes it with default values \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Datagram Receiver; NULL on error 
\end{DoxyReturn}


Referenced by \textbf{ osmo\+\_\+dgram\+\_\+create()}.

\label{group__datagram_ga6e4b92b9c7f210d1cb3782425d0bdac0} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_rx\_destroy@{osmo\_dgram\_rx\_destroy}}
\index{osmo\_dgram\_rx\_destroy@{osmo\_dgram\_rx\_destroy}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_rx\_destroy()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+rx\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+rx $\ast$}]{conn }\end{DoxyParamCaption})}



Destroy the datagram receiver. 

Releases Memory. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Receiver \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+close()}.



Referenced by \textbf{ osmo\+\_\+dgram\+\_\+create()}, and \textbf{ osmo\+\_\+dgram\+\_\+destroy()}.

\label{group__datagram_gaf558e9c2f02216ed95db039ddaf31050} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_rx\_open@{osmo\_dgram\_rx\_open}}
\index{osmo\_dgram\_rx\_open@{osmo\_dgram\_rx\_open}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_rx\_open()}
{\footnotesize\ttfamily int osmo\+\_\+dgram\+\_\+rx\+\_\+open (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+rx $\ast$}]{conn }\end{DoxyParamCaption})}



Open the datagram receiver. 

This actually initializes the underlying socket and binds it to the configured ip/port 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Receiver to open \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+close()}.



Referenced by \textbf{ osmo\+\_\+dgram\+\_\+open()}.

\label{group__datagram_ga16d69e998c663cdec0b76560a2d8cfb9} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_rx\_recv@{osmo\_dgram\_rx\_recv}}
\index{osmo\_dgram\_rx\_recv@{osmo\_dgram\_rx\_recv}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_rx\_recv()}
{\footnotesize\ttfamily int osmo\+\_\+dgram\+\_\+rx\+\_\+recv (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+rx $\ast$}]{conn,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Receive data via Osmocom datagram receiver. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Receiver 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 (might be 0 for empty UDP packet), negative on error. 
\end{DoxyReturn}


Referenced by \textbf{ osmo\+\_\+dgram\+\_\+recv()}.

\label{group__datagram_gad378ba5cc66ee0c27a277906d8434e31} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_rx\_set\_addr@{osmo\_dgram\_rx\_set\_addr}}
\index{osmo\_dgram\_rx\_set\_addr@{osmo\_dgram\_rx\_set\_addr}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_rx\_set\_addr()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+rx\+\_\+set\+\_\+addr (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+rx $\ast$}]{conn,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



Set the local address to which we bind. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Receiver to modify \\
\hline
\mbox{\texttt{ in}}  & {\em addr} & Local IP address \\
\hline
\end{DoxyParams}


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

\label{group__datagram_gafbd947def18d8e34062876433ac05e91} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_rx\_set\_port@{osmo\_dgram\_rx\_set\_port}}
\index{osmo\_dgram\_rx\_set\_port@{osmo\_dgram\_rx\_set\_port}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_rx\_set\_port()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+rx\+\_\+set\+\_\+port (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+rx $\ast$}]{conn,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



Set the local port to which we bind. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Receiver to modify \\
\hline
\mbox{\texttt{ in}}  & {\em port} & Local port number \\
\hline
\end{DoxyParams}


Referenced by \textbf{ osmo\+\_\+dgram\+\_\+set\+\_\+local\+\_\+port()}.

\label{group__datagram_ga5a0f7221b8583aac5153f167c4e2177d} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_rx\_set\_read\_cb@{osmo\_dgram\_rx\_set\_read\_cb}}
\index{osmo\_dgram\_rx\_set\_read\_cb@{osmo\_dgram\_rx\_set\_read\_cb}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_rx\_set\_read\_cb()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+rx\+\_\+set\+\_\+read\+\_\+cb (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+rx $\ast$}]{conn,  }\item[{int($\ast$)(struct osmo\+\_\+dgram\+\_\+rx $\ast$conn)}]{read\+\_\+cb }\end{DoxyParamCaption})}



Set the read() call-\/back of the datagram receiver. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Receiver to modify \\
\hline
\mbox{\texttt{ in}}  & {\em read\+\_\+cb} & Call-\/back function executed after read() \\
\hline
\end{DoxyParams}


Referenced by \textbf{ osmo\+\_\+dgram\+\_\+create()}.

\label{group__datagram_ga66d6c9d5f0243a4f7ed458c62d8e20dd} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_send@{osmo\_dgram\_send}}
\index{osmo\_dgram\_send@{osmo\_dgram\_send}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_send()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+send (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Enqueue data to be sent via an Osmocom datagram transceiver. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transceiver 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\+\_\+dgram\+\_\+tx\+\_\+send()}.

\label{group__datagram_gaa6a5fbd5f227d15cefe6b234fefb3b4d} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_set\_data@{osmo\_dgram\_set\_data}}
\index{osmo\_dgram\_set\_data@{osmo\_dgram\_set\_data}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_set\_data()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+set\+\_\+data (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Set application private data of the datagram transmitter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transmitter to modify \\
\hline
\mbox{\texttt{ in}}  & {\em data} & User-\/specific data (available in call-\/back functions) \\
\hline
\end{DoxyParams}
\label{group__datagram_gaf21d974e14fa22f910313b240d31d40f} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_set\_local\_addr@{osmo\_dgram\_set\_local\_addr}}
\index{osmo\_dgram\_set\_local\_addr@{osmo\_dgram\_set\_local\_addr}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_set\_local\_addr()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+set\+\_\+local\+\_\+addr (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



Set the local address to which we bind. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transceiver to modify \\
\hline
\mbox{\texttt{ in}}  & {\em addr} & Local IP address \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+set\+\_\+addr()}.

\label{group__datagram_ga9180ae9a36a9927d4bdb49cdc5708b1f} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_set\_local\_port@{osmo\_dgram\_set\_local\_port}}
\index{osmo\_dgram\_set\_local\_port@{osmo\_dgram\_set\_local\_port}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_set\_local\_port()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+set\+\_\+local\+\_\+port (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



Set the local port to which we bind. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transceiver to modify \\
\hline
\mbox{\texttt{ in}}  & {\em port} & Local Port Number \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+rx\+\_\+set\+\_\+port()}.

\label{group__datagram_ga6b6ef2f02e3d260f1e84a2ecf8c67b5a} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_set\_read\_cb@{osmo\_dgram\_set\_read\_cb}}
\index{osmo\_dgram\_set\_read\_cb@{osmo\_dgram\_set\_read\_cb}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_set\_read\_cb()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+set\+\_\+read\+\_\+cb (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn,  }\item[{int($\ast$)(struct osmo\+\_\+dgram $\ast$conn)}]{read\+\_\+cb }\end{DoxyParamCaption})}



Set the read() call-\/back of the datagram receiver. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Receiver to modify \\
\hline
\mbox{\texttt{ in}}  & {\em read\+\_\+cb} & Call-\/back function executed after read() \\
\hline
\end{DoxyParams}
\label{group__datagram_ga6677ee8d976d2e1bed8e0c01e103c18f} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_set\_remote\_addr@{osmo\_dgram\_set\_remote\_addr}}
\index{osmo\_dgram\_set\_remote\_addr@{osmo\_dgram\_set\_remote\_addr}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_set\_remote\_addr()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+set\+\_\+remote\+\_\+addr (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



Set the remote address to which we transmit/connect. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transceiver to modify \\
\hline
\mbox{\texttt{ in}}  & {\em addr} & Remote IP address \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+addr()}.

\label{group__datagram_ga27bf4c1d8e4c30ef7b4ec49665d6fc90} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_set\_remote\_port@{osmo\_dgram\_set\_remote\_port}}
\index{osmo\_dgram\_set\_remote\_port@{osmo\_dgram\_set\_remote\_port}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_set\_remote\_port()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+set\+\_\+remote\+\_\+port (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram $\ast$}]{conn,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



Set the remote port to which we transmit. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transceiver to modify \\
\hline
\mbox{\texttt{ in}}  & {\em port} & Remote Port Number \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+port()}.

\label{group__datagram_ga0eb580467681e8fa91be35a83a74f132} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_close@{osmo\_dgram\_tx\_close}}
\index{osmo\_dgram\_tx\_close@{osmo\_dgram\_tx\_close}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_close()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+tx\+\_\+close (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+tx $\ast$}]{conn }\end{DoxyParamCaption})}



Close an Osmocom Datagram Transmitter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Osmocom Datagram Transmitter 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\+\_\+dgram\+\_\+close()}, \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+destroy()}, and \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+open()}.

\label{group__datagram_gadeaa837f3df8382bd7a50e668b9d3a61} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_create@{osmo\_dgram\_tx\_create}}
\index{osmo\_dgram\_tx\_create@{osmo\_dgram\_tx\_create}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_create()}
{\footnotesize\ttfamily struct osmo\+\_\+dgram\+\_\+tx $\ast$ osmo\+\_\+dgram\+\_\+tx\+\_\+create (\begin{DoxyParamCaption}\item[{void $\ast$}]{ctx }\end{DoxyParamCaption})}



Create an Osmocom datagram transmitter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ctx} & talloc context from which to allocate memory This function allocates a new osmo\+\_\+dgram\+\_\+tx and initializes it with default values \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Osmocom Datagram Transmitter; NULL on error 
\end{DoxyReturn}


Referenced by \textbf{ osmo\+\_\+dgram\+\_\+create()}.

\label{group__datagram_gaad6f9ca0688cd4a8a95ec6002f52ded5} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_destroy@{osmo\_dgram\_tx\_destroy}}
\index{osmo\_dgram\_tx\_destroy@{osmo\_dgram\_tx\_destroy}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_destroy()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+tx\+\_\+destroy (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+tx $\ast$}]{conn }\end{DoxyParamCaption})}



Destroy a Osmocom datagram transmitter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transmitter to destroy \\
\hline
\end{DoxyParams}


References \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+close()}.



Referenced by \textbf{ osmo\+\_\+dgram\+\_\+destroy()}.

\label{group__datagram_ga8d712623df3862e55ad248dc5ecd626c} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_open@{osmo\_dgram\_tx\_open}}
\index{osmo\_dgram\_tx\_open@{osmo\_dgram\_tx\_open}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_open()}
{\footnotesize\ttfamily int osmo\+\_\+dgram\+\_\+tx\+\_\+open (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+tx $\ast$}]{conn }\end{DoxyParamCaption})}



Open connection of an Osmocom datagram transmitter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Stream Client to connect \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success; negative in case of error 
\end{DoxyReturn}


References \textbf{ osmo\+\_\+dgram\+\_\+tx\+\_\+close()}.



Referenced by \textbf{ osmo\+\_\+dgram\+\_\+open()}.

\label{group__datagram_gad4638b9943090f5bf1a7b75fa8efde46} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_send@{osmo\_dgram\_tx\_send}}
\index{osmo\_dgram\_tx\_send@{osmo\_dgram\_tx\_send}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_send()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+tx\+\_\+send (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+tx $\ast$}]{conn,  }\item[{struct msgb $\ast$}]{msg }\end{DoxyParamCaption})}



Enqueue data to be sent via an Osmocom datagram transmitter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transmitter through which we want to send \\
\hline
\mbox{\texttt{ in}}  & {\em msg} & Message buffer to enqueue in transmit queue \\
\hline
\end{DoxyParams}


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

\label{group__datagram_ga94fe94f64f1285715db36eb1f2e9deaa} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_set\_addr@{osmo\_dgram\_tx\_set\_addr}}
\index{osmo\_dgram\_tx\_set\_addr@{osmo\_dgram\_tx\_set\_addr}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_set\_addr()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+addr (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+tx $\ast$}]{conn,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



Set the remote address to which we transmit. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transmitter to modify \\
\hline
\mbox{\texttt{ in}}  & {\em addr} & Remote IP address \\
\hline
\end{DoxyParams}


Referenced by \textbf{ osmo\+\_\+dgram\+\_\+set\+\_\+remote\+\_\+addr()}.

\label{group__datagram_ga095ce94e65f1607026c37c12e6f5e9c0} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_set\_data@{osmo\_dgram\_tx\_set\_data}}
\index{osmo\_dgram\_tx\_set\_data@{osmo\_dgram\_tx\_set\_data}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_set\_data()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+data (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+tx $\ast$}]{conn,  }\item[{void $\ast$}]{data }\end{DoxyParamCaption})}



Set application private data of the datagram transmitter. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transmitter to modify \\
\hline
\mbox{\texttt{ in}}  & {\em data} & User-\/specific data (available in call-\/back functions) \\
\hline
\end{DoxyParams}
\label{group__datagram_ga6c843f43db5439f8f0ba38f72dbb1a20} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_set\_local\_addr@{osmo\_dgram\_tx\_set\_local\_addr}}
\index{osmo\_dgram\_tx\_set\_local\_addr@{osmo\_dgram\_tx\_set\_local\_addr}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_set\_local\_addr()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+local\+\_\+addr (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+tx $\ast$}]{conn,  }\item[{const char $\ast$}]{addr }\end{DoxyParamCaption})}



Set the local address from which we transmit. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transmitter to modify \\
\hline
\mbox{\texttt{ in}}  & {\em addr} & Local IP address \\
\hline
\end{DoxyParams}
\label{group__datagram_gae2962232548d41621520c6c71da423a5} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_set\_local\_port@{osmo\_dgram\_tx\_set\_local\_port}}
\index{osmo\_dgram\_tx\_set\_local\_port@{osmo\_dgram\_tx\_set\_local\_port}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_set\_local\_port()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+local\+\_\+port (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+tx $\ast$}]{conn,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



Set the local port from which we transmit. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transmitter to modify \\
\hline
\mbox{\texttt{ in}}  & {\em port} & Local Port Number \\
\hline
\end{DoxyParams}
\label{group__datagram_ga48d7e39656886b52aa176fc1b14c84cf} 
\index{Osmocom Datagram Socket@{Osmocom Datagram Socket}!osmo\_dgram\_tx\_set\_port@{osmo\_dgram\_tx\_set\_port}}
\index{osmo\_dgram\_tx\_set\_port@{osmo\_dgram\_tx\_set\_port}!Osmocom Datagram Socket@{Osmocom Datagram Socket}}
\doxysubsubsection{osmo\_dgram\_tx\_set\_port()}
{\footnotesize\ttfamily void osmo\+\_\+dgram\+\_\+tx\+\_\+set\+\_\+port (\begin{DoxyParamCaption}\item[{struct osmo\+\_\+dgram\+\_\+tx $\ast$}]{conn,  }\item[{uint16\+\_\+t}]{port }\end{DoxyParamCaption})}



Set the remote port to which we transmit. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em conn} & Datagram Transmitter to modify \\
\hline
\mbox{\texttt{ in}}  & {\em port} & Remote Port Number \\
\hline
\end{DoxyParams}


Referenced by \textbf{ osmo\+\_\+dgram\+\_\+set\+\_\+remote\+\_\+port()}.

