\doxysection{include/osmocom/core/tun.h File Reference}
\label{tun_8h}\index{include/osmocom/core/tun.h@{include/osmocom/core/tun.h}}


tunnel network device convenience functions.  


{\ttfamily \#include $<$stddef.\+h$>$}\newline
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/socket.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/netdev.\+h$>$}\newline
\doxysubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef int($\ast$ \textbf{ osmo\+\_\+tundev\+\_\+data\+\_\+ind\+\_\+cb\+\_\+t}) (struct \textbf{ osmo\+\_\+tundev} $\ast$tun, struct \textbf{ msgb} $\ast$\textbf{ msg})
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ osmo\+\_\+tundev} $\ast$ \textbf{ osmo\+\_\+tundev\+\_\+alloc} (void $\ast$ctx, const char $\ast$\textbf{ name})
\begin{DoxyCompactList}\small\item\em Allocate a new tundev object. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+tundev\+\_\+free} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Free an allocated tundev object. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tundev\+\_\+open} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Open the tunnel device owned by the tundev object. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tundev\+\_\+close} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Close the tunnel device owned by the tundev object. \end{DoxyCompactList}\item 
bool \textbf{ osmo\+\_\+tundev\+\_\+is\+\_\+open} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Retrieve whether the tundev object is in \char`\"{}opened\char`\"{} state. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+tundev\+\_\+set\+\_\+priv\+\_\+data} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev, void $\ast$priv\+\_\+data)
\begin{DoxyCompactList}\small\item\em Set private user data pointer on the tundev object. \end{DoxyCompactList}\item 
void $\ast$ \textbf{ osmo\+\_\+tundev\+\_\+get\+\_\+priv\+\_\+data} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Get private user data pointer from the tundev object. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+tundev\+\_\+set\+\_\+data\+\_\+ind\+\_\+cb} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev, \textbf{ osmo\+\_\+tundev\+\_\+data\+\_\+ind\+\_\+cb\+\_\+t} data\+\_\+ind\+\_\+cb)
\begin{DoxyCompactList}\small\item\em Set data\+\_\+ind\+\_\+cb callback, called when a new packet is received on the tun interface. \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+tundev\+\_\+get\+\_\+name} (const struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Get name used to identify the tundev object. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tundev\+\_\+get\+\_\+fd} (const struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Get FD associated to the tundev object. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tundev\+\_\+set\+\_\+dev\+\_\+name} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev, const char $\ast$dev\+\_\+name)
\begin{DoxyCompactList}\small\item\em Set name used to name the tunnel interface created by the tundev object. \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+tundev\+\_\+get\+\_\+dev\+\_\+name} (const struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Get name used to name the tunnel interface created by the tundev object. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tundev\+\_\+set\+\_\+netns\+\_\+name} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev, const char $\ast$netns)
\begin{DoxyCompactList}\small\item\em Set name of the network namespace to use when opening the tunnel interface. \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+tundev\+\_\+get\+\_\+netns\+\_\+name} (const struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Get name of network namespace used when opening the tunnel interface. \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+netdev} $\ast$ \textbf{ osmo\+\_\+tundev\+\_\+get\+\_\+netdev} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev)
\begin{DoxyCompactList}\small\item\em Get netdev managing the tunnel interface of tundev. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tundev\+\_\+send} (struct \textbf{ osmo\+\_\+tundev} $\ast$tundev, struct \textbf{ msgb} $\ast$\textbf{ msg})
\begin{DoxyCompactList}\small\item\em Submit a packet to the tunnel device managed by the tundev object. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
tunnel network device convenience functions. 



\doxysubsection{Typedef Documentation}
\mbox{\label{tun_8h_a076cdf0d89e71c9804bd0acde8560204}} 
\index{tun.h@{tun.h}!osmo\_tundev\_data\_ind\_cb\_t@{osmo\_tundev\_data\_ind\_cb\_t}}
\index{osmo\_tundev\_data\_ind\_cb\_t@{osmo\_tundev\_data\_ind\_cb\_t}!tun.h@{tun.h}}
\doxysubsubsection{osmo\_tundev\_data\_ind\_cb\_t}
{\footnotesize\ttfamily typedef int($\ast$ osmo\+\_\+tundev\+\_\+data\+\_\+ind\+\_\+cb\+\_\+t) (struct \textbf{ osmo\+\_\+tundev} $\ast$tun, struct \textbf{ msgb} $\ast$\textbf{ msg})}

