\doxysection{src/gsm/tlv\+\_\+parser.c File Reference}
\label{tlv__parser_8c}\index{src/gsm/tlv\_parser.c@{src/gsm/tlv\_parser.c}}
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/utils.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/logging.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/tlv.\+h$>$}\newline
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \textbf{ tlv\+\_\+dump} (struct \textbf{ tlv\+\_\+parsed} $\ast$dec)
\begin{DoxyCompactList}\small\item\em Dump parsed TLV structure to stdout. \end{DoxyCompactList}\item 
struct \textbf{ tlv\+\_\+parsed} $\ast$ \textbf{ osmo\+\_\+tlvp\+\_\+copy} (const struct \textbf{ tlv\+\_\+parsed} $\ast$tp\+\_\+orig, void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Copy \doxyref{tlv\+\_\+parsed}{p.}{structtlv__parsed} using given talloc context. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tlvp\+\_\+merge} (struct \textbf{ tlv\+\_\+parsed} $\ast$dst, const struct \textbf{ tlv\+\_\+parsed} $\ast$src)
\begin{DoxyCompactList}\small\item\em Merge all \doxyref{tlv\+\_\+parsed}{p.}{structtlv__parsed} attributes of \textquotesingle{}src\textquotesingle{} into \textquotesingle{}dst\textquotesingle{}. \end{DoxyCompactList}\item 
int \textbf{ tlv\+\_\+encode\+\_\+one} (struct \textbf{ msgb} $\ast$\textbf{ msg}, enum \textbf{ tlv\+\_\+type} \textbf{ type}, uint8\+\_\+t tag, unsigned int \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em Encode a single TLV into given message buffer. \end{DoxyCompactList}\item 
int \textbf{ tlv\+\_\+encode} (struct \textbf{ msgb} $\ast$\textbf{ msg}, const struct \textbf{ tlv\+\_\+definition} $\ast$def, const struct \textbf{ tlv\+\_\+parsed} $\ast$tp)
\begin{DoxyCompactList}\small\item\em Encode a set of decoded TLVs according to a given definition into a message buffer. \end{DoxyCompactList}\item 
int \textbf{ tlv\+\_\+encode\+\_\+ordered} (struct \textbf{ msgb} $\ast$\textbf{ msg}, const struct \textbf{ tlv\+\_\+definition} $\ast$def, const struct \textbf{ tlv\+\_\+parsed} $\ast$tp, const uint8\+\_\+t $\ast$tag\+\_\+order, unsigned int tag\+\_\+order\+\_\+len)
\begin{DoxyCompactList}\small\item\em Encode a set of decoded TLVs according to a given definition and IE order into a message buffer. \end{DoxyCompactList}\item 
int \textbf{ tlv\+\_\+parse\+\_\+one} (uint8\+\_\+t $\ast$o\+\_\+tag, uint16\+\_\+t $\ast$o\+\_\+len, const uint8\+\_\+t $\ast$$\ast$o\+\_\+val, const struct \textbf{ tlv\+\_\+definition} $\ast$def, const uint8\+\_\+t $\ast$buf, int buf\+\_\+len)
\begin{DoxyCompactList}\small\item\em Parse a single TLV encoded IE. \end{DoxyCompactList}\item 
int \textbf{ tlv\+\_\+parse} (struct \textbf{ tlv\+\_\+parsed} $\ast$dec, const struct \textbf{ tlv\+\_\+definition} $\ast$def, const uint8\+\_\+t $\ast$buf, int buf\+\_\+len, uint8\+\_\+t lv\+\_\+tag, uint8\+\_\+t lv\+\_\+tag2)
\begin{DoxyCompactList}\small\item\em Parse an entire buffer of TLV encoded Information Elements. \end{DoxyCompactList}\item 
int \textbf{ tlv\+\_\+parse2} (struct \textbf{ tlv\+\_\+parsed} $\ast$dec, int dec\+\_\+multiples, const struct \textbf{ tlv\+\_\+definition} $\ast$def, const uint8\+\_\+t $\ast$buf, int buf\+\_\+len, uint8\+\_\+t lv\+\_\+tag, uint8\+\_\+t lv\+\_\+tag2)
\begin{DoxyCompactList}\small\item\em Like \doxyref{tlv\+\_\+parse()}{p.}{group__tlv_gaa52227475e0050c2f0c78cb612e01d65}, but capable of decoding multiple occurences of the same IE. \end{DoxyCompactList}\item 
void \textbf{ tlv\+\_\+def\+\_\+patch} (struct \textbf{ tlv\+\_\+definition} $\ast$dst, const struct \textbf{ tlv\+\_\+definition} $\ast$src)
\begin{DoxyCompactList}\small\item\em take a master (src) \doxyref{tlv\+\_\+definition}{p.}{structtlv__definition} and fill up all empty slots in \textquotesingle{}dst\textquotesingle{} \end{DoxyCompactList}\item 
static \textbf{ \+\_\+\+\_\+attribute\+\_\+\+\_\+} ((constructor))
\item 
int \textbf{ osmo\+\_\+shift\+\_\+v\+\_\+fixed} (uint8\+\_\+t $\ast$$\ast$\textbf{ data}, size\+\_\+t $\ast$data\+\_\+len, size\+\_\+t \textbf{ len}, uint8\+\_\+t $\ast$$\ast$value)
\begin{DoxyCompactList}\small\item\em Advance the data pointer, subtract length and assign value pointer. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+match\+\_\+shift\+\_\+tv\+\_\+fixed} (uint8\+\_\+t $\ast$$\ast$\textbf{ data}, size\+\_\+t $\ast$data\+\_\+len, uint8\+\_\+t tag, size\+\_\+t \textbf{ len}, uint8\+\_\+t $\ast$$\ast$value)
\begin{DoxyCompactList}\small\item\em Match tag, check length and assign value pointer. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+match\+\_\+shift\+\_\+tlv} (uint8\+\_\+t $\ast$$\ast$\textbf{ data}, size\+\_\+t $\ast$data\+\_\+len, uint8\+\_\+t expected\+\_\+tag, uint8\+\_\+t $\ast$$\ast$value, size\+\_\+t $\ast$value\+\_\+len)
\begin{DoxyCompactList}\small\item\em Verify TLV header and advance data / subtract length. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+shift\+\_\+tlv} (uint8\+\_\+t $\ast$$\ast$\textbf{ data}, size\+\_\+t $\ast$data\+\_\+len, uint8\+\_\+t $\ast$tag, uint8\+\_\+t $\ast$$\ast$value, size\+\_\+t $\ast$value\+\_\+len)
\begin{DoxyCompactList}\small\item\em Extract TLV and advance data pointer + subtract length. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+shift\+\_\+lv} (uint8\+\_\+t $\ast$$\ast$\textbf{ data}, size\+\_\+t $\ast$data\+\_\+len, uint8\+\_\+t $\ast$$\ast$value, size\+\_\+t $\ast$value\+\_\+len)
\begin{DoxyCompactList}\small\item\em Extract LV and advance data pointer + subtract length. \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+msg\+\_\+name} (const struct \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+def} $\ast$pdef, uint8\+\_\+t \textbf{ msg\+\_\+type})
\begin{DoxyCompactList}\small\item\em get the message name for given msg\+\_\+type in protocol pdef \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+ie\+\_\+name} (const struct \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+def} $\ast$pdef, uint8\+\_\+t \textbf{ iei})
\begin{DoxyCompactList}\small\item\em get the IE name for given IEI in protocol pdef \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+validate\+\_\+tp} (const struct \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+def} $\ast$pdef, uint8\+\_\+t \textbf{ msg\+\_\+type}, const struct \textbf{ tlv\+\_\+parsed} $\ast$tp, int log\+\_\+subsys, const char $\ast$log\+\_\+pfx)
\begin{DoxyCompactList}\small\item\em Validate an already TLV-\/decoded message against the protocol definition. \end{DoxyCompactList}\item 
int \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+parse} (const struct \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+def} $\ast$pdef, struct \textbf{ tlv\+\_\+parsed} $\ast$dec, unsigned int dec\+\_\+multiples, uint8\+\_\+t \textbf{ msg\+\_\+type}, const uint8\+\_\+t $\ast$buf, unsigned int buf\+\_\+len, uint8\+\_\+t lv\+\_\+tag, uint8\+\_\+t lv\+\_\+tag2, int log\+\_\+subsys, const char $\ast$log\+\_\+pfx)
\begin{DoxyCompactList}\small\item\em Parse + Validate a TLV-\/encoded message against the protocol definition. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ tlv\+\_\+definition} \textbf{ tvlv\+\_\+att\+\_\+def}
\item 
struct \textbf{ tlv\+\_\+definition} \textbf{ vtvlv\+\_\+gan\+\_\+att\+\_\+def}
\item 
static \+\_\+\+\_\+thread char \textbf{ ienamebuf} [32]
\item 
static \+\_\+\+\_\+thread char \textbf{ msgnamebuf} [32]
\end{DoxyCompactItemize}
