\doxysection{src/datagram.c File Reference}
\label{datagram_8c}\index{src/datagram.c@{src/datagram.c}}


Osmocom datagram socket helpers.  


{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$unistd.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$time.\+h$>$}\newline
{\ttfamily \#include $<$sys/fcntl.\+h$>$}\newline
{\ttfamily \#include $<$sys/socket.\+h$>$}\newline
{\ttfamily \#include $<$sys/ioctl.\+h$>$}\newline
{\ttfamily \#include $<$arpa/inet.\+h$>$}\newline
{\ttfamily \#include $<$netinet/in.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/linuxlist.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/select.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/utils.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/tlv.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/talloc.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/socket.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/netif/datagram.\+h$>$}\newline
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{datagram_8c_af41754fb826e8b8c65fb2e8f662feb69}} 
\#define {\bfseries OSMO\+\_\+\+DGRAM\+\_\+\+CLI\+\_\+\+F\+\_\+\+RECONF}~(1 $<$$<$ 0)
\item 
\mbox{\label{datagram_8c_a961607798deb93315134b1ed744a2503}} 
\#define {\bfseries OSMO\+\_\+\+DGRAM\+\_\+\+RX\+\_\+\+F\+\_\+\+RECONF}~(1 $<$$<$ 0)
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\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 
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\+\_\+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 
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 
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\+\_\+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 
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\+\_\+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 
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 
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 
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\+\_\+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}
Osmocom datagram socket helpers. 

