\doxysection{src/core/gsmtap\+\_\+util.c File Reference}
\label{gsmtap__util_8c}\index{src/core/gsmtap\_util.c@{src/core/gsmtap\_util.c}}


GSMTAP support code in libosmocore.  


{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\newline
{\ttfamily \#include $<$osmocom/core/gsmtap\+\_\+util.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/gsmtap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/talloc.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/select.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/socket.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/byteswap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/utils.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/protocol/gsm\+\_\+04\+\_\+08.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/rsl.\+h$>$}\newline
{\ttfamily \#include $<$sys/types.\+h$>$}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$unistd.\+h$>$}\newline
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ gsmtap\+\_\+inst}
\begin{DoxyCompactList}\small\item\em one gsmtap instance Until \doxyref{gsmtap\+\_\+inst\+\_\+fd()}{p.}{group__gsmtap_gad201f805caa17a143201ecce09a21208} is removed from the API at some point in the future, we have to keep the first member as \textquotesingle{}int\textquotesingle{} and the second as \textquotesingle{}struct \doxyref{osmo\+\_\+wqueue}{p.}{structosmo__wqueue}\textquotesingle{} (this effectively makes sure that the struct member wq.\+bfd.\+fd maintains the same memory offset from the start of the struct) to ensure that inlined static \textquotesingle{}instances\textquotesingle{} of \doxyref{gsmtap\+\_\+inst\+\_\+fd()}{p.}{group__gsmtap_gad201f805caa17a143201ecce09a21208} in old binaries keep working the way they used to even with \doxyref{gsmtap\+\_\+inst}{p.}{structgsmtap__inst} objects obtained from newer versions of libosmocore \end{DoxyCompactList}\item 
struct \textbf{ \+\_\+gsmtap\+\_\+inst\+\_\+legacy}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ osmo\+\_\+static\+\_\+assert} (offsetof(struct \textbf{ gsmtap\+\_\+inst}, wq)==offsetof(struct \textbf{ \+\_\+gsmtap\+\_\+inst\+\_\+legacy}, wq), gsmtap\+\_\+inst\+\_\+new\+\_\+wq\+\_\+offset\+\_\+equals\+\_\+legacy\+\_\+wq\+\_\+offset)
\item 
int \textbf{ gsmtap\+\_\+inst\+\_\+fd} (struct \textbf{ gsmtap\+\_\+inst} $\ast$gti)
\begin{DoxyCompactList}\small\item\em Deprecated, use \doxyref{gsmtap\+\_\+inst\+\_\+fd2()}{p.}{group__gsmtap_gade1327e89e4b4fe0e08bf9947ec99a04} instead. \end{DoxyCompactList}\item 
int \textbf{ gsmtap\+\_\+inst\+\_\+fd2} (const struct \textbf{ gsmtap\+\_\+inst} $\ast$gti)
\begin{DoxyCompactList}\small\item\em obtain the file descriptor associated with a gsmtap instance \end{DoxyCompactList}\item 
uint8\+\_\+t \textbf{ chantype\+\_\+rsl2gsmtap2} (uint8\+\_\+t rsl\+\_\+chantype, uint8\+\_\+t \textbf{ link\+\_\+id}, bool user\+\_\+plane)
\begin{DoxyCompactList}\small\item\em convert RSL channel number to GSMTAP channel type \end{DoxyCompactList}\item 
uint8\+\_\+t \textbf{ chantype\+\_\+rsl2gsmtap} (uint8\+\_\+t rsl\+\_\+chantype, uint8\+\_\+t \textbf{ link\+\_\+id})
\begin{DoxyCompactList}\small\item\em convert RSL channel number to GSMTAP channel type \end{DoxyCompactList}\item 
void \textbf{ chantype\+\_\+gsmtap2rsl} (uint8\+\_\+t gsmtap\+\_\+chantype, uint8\+\_\+t $\ast$rsl\+\_\+chantype, uint8\+\_\+t $\ast$\textbf{ link\+\_\+id})
\begin{DoxyCompactList}\small\item\em convert GSMTAP channel type to RSL channel number + Link ID \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsmtap\+\_\+makemsg\+\_\+ex} (uint8\+\_\+t \textbf{ type}, uint16\+\_\+t \textbf{ arfcn}, uint8\+\_\+t \textbf{ ts}, uint8\+\_\+t chan\+\_\+type, uint8\+\_\+t ss, uint32\+\_\+t fn, int8\+\_\+t \textbf{ signal\+\_\+dbm}, int8\+\_\+t snr, const uint8\+\_\+t $\ast$\textbf{ data}, unsigned int \textbf{ len})
\begin{DoxyCompactList}\small\item\em create an arbitrary type GSMTAP message \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsmtap\+\_\+makemsg} (uint16\+\_\+t \textbf{ arfcn}, uint8\+\_\+t \textbf{ ts}, uint8\+\_\+t chan\+\_\+type, uint8\+\_\+t ss, uint32\+\_\+t fn, int8\+\_\+t \textbf{ signal\+\_\+dbm}, int8\+\_\+t snr, const uint8\+\_\+t $\ast$\textbf{ data}, unsigned int \textbf{ len})
\begin{DoxyCompactList}\small\item\em create L1/\+L2 data and put it into GSMTAP \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
const struct \textbf{ value\+\_\+string} \textbf{ gsmtap\+\_\+gsm\+\_\+channel\+\_\+names} [$\,$]
\item 
const struct \textbf{ value\+\_\+string} \textbf{ gsmtap\+\_\+type\+\_\+names} [$\,$]
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
GSMTAP support code in libosmocore. 

