\doxysection{include/osmocom/gsm/tlv.h File Reference}
\label{tlv_8h}\index{include/osmocom/gsm/tlv.h@{include/osmocom/gsm/tlv.h}}
{\ttfamily \#include $<$stdint.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/byteswap.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/bit16gen.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/bit32gen.\+h$>$}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ tlv\+\_\+p\+\_\+entry}
\begin{DoxyCompactList}\small\item\em Entry in a TLV parser array. \end{DoxyCompactList}\item 
struct \textbf{ tlv\+\_\+def}
\begin{DoxyCompactList}\small\item\em Definition of a single IE (Information Element) \end{DoxyCompactList}\item 
struct \textbf{ tlv\+\_\+definition}
\begin{DoxyCompactList}\small\item\em Definition of All 256 IE / TLV. \end{DoxyCompactList}\item 
struct \textbf{ tlv\+\_\+parsed}
\begin{DoxyCompactList}\small\item\em result of the TLV parser \end{DoxyCompactList}\item 
struct \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+msg\+\_\+def}
\item 
struct \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+ie\+\_\+def}
\item 
struct \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+def}
\begin{DoxyCompactList}\small\item\em Osmocom TLV protocol definition. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ LV\+\_\+\+GROSS\+\_\+\+LEN}(\textbf{ x})~(\textbf{ x}+1)
\begin{DoxyCompactList}\small\item\em gross length of a LV type field \end{DoxyCompactList}\item 
\#define \textbf{ TLV\+\_\+\+GROSS\+\_\+\+LEN}(\textbf{ x})~(\textbf{ x}+2)
\begin{DoxyCompactList}\small\item\em gross length of a TLV type field \end{DoxyCompactList}\item 
\#define \textbf{ TLV16\+\_\+\+GROSS\+\_\+\+LEN}(\textbf{ x})~((2$\ast$\textbf{ x})+2)
\begin{DoxyCompactList}\small\item\em gross length of a TLV16 type field \end{DoxyCompactList}\item 
\#define \textbf{ TL16\+V\+\_\+\+GROSS\+\_\+\+LEN}(\textbf{ x})~(\textbf{ x}+3)
\begin{DoxyCompactList}\small\item\em gross length of a TL16V type field \end{DoxyCompactList}\item 
\#define \textbf{ L16\+TV\+\_\+\+GROSS\+\_\+\+LEN}(\textbf{ x})~(\textbf{ x}+3)
\begin{DoxyCompactList}\small\item\em gross length of a L16\+TV type field \end{DoxyCompactList}\item 
\#define \textbf{ T16\+LV\+\_\+\+GROSS\+\_\+\+LEN}(\textbf{ x})~(\textbf{ x}+3)
\begin{DoxyCompactList}\small\item\em gross length of a T16\+LV type field \end{DoxyCompactList}\item 
\#define \textbf{ TVLV\+\_\+\+MAX\+\_\+\+ONEBYTE}~0x7f
\begin{DoxyCompactList}\small\item\em maximum length of TLV of one byte length \end{DoxyCompactList}\item 
\#define \textbf{ TLVP\+\_\+\+PRESENT}(\textbf{ x},  y)~(!!((\textbf{ x})-\/$>$lv[y].val))
\item 
\#define \textbf{ TLVP\+\_\+\+LEN}(\textbf{ x},  y)~(\textbf{ x})-\/$>$lv[y].\textbf{ len}
\item 
\#define \textbf{ TLVP\+\_\+\+VAL}(\textbf{ x},  y)~(\textbf{ x})-\/$>$lv[y].val
\item 
\#define \textbf{ TLVP\+\_\+\+PRES\+\_\+\+LEN}(tp,  tag,  min\+\_\+len)~ (\textbf{ TLVP\+\_\+\+PRESENT}(tp, tag) \&\& \textbf{ TLVP\+\_\+\+LEN}(tp, tag) $>$= min\+\_\+len)
\item 
\#define \textbf{ TLVP\+\_\+\+GET}(\+\_\+tp,  tag)~(\textbf{ TLVP\+\_\+\+PRESENT}(\+\_\+tp, tag)? \&(\+\_\+tp)-\/$>$lv[tag] \+: NULL)
\begin{DoxyCompactList}\small\item\em Return pointer to a TLV element if it is present. \end{DoxyCompactList}\item 
\#define \textbf{ TLVP\+\_\+\+GET\+\_\+\+MINLEN}(\+\_\+tp,  tag,  min\+\_\+len)~ (\textbf{ TLVP\+\_\+\+PRES\+\_\+\+LEN}(\+\_\+tp, tag, min\+\_\+len)? \&(\+\_\+tp)-\/$>$lv[tag] \+: NULL)
\begin{DoxyCompactList}\small\item\em Like \doxyref{TLVP\+\_\+\+GET()}{p.}{group__tlv_ga0118f8b167ebc8b8bfebbde8c02f96b1}, but enforcing a minimum val length. \end{DoxyCompactList}\item 
\#define \textbf{ TLVP\+\_\+\+VAL\+\_\+\+MINLEN}(\+\_\+tp,  tag,  min\+\_\+len)~ (\textbf{ TLVP\+\_\+\+PRES\+\_\+\+LEN}(\+\_\+tp, tag, min\+\_\+len)? (\+\_\+tp)-\/$>$lv[tag].val \+: NULL)
\begin{DoxyCompactList}\small\item\em Like \doxyref{TLVP\+\_\+\+VAL()}{p.}{group__tlv_ga1363d366c59dea2d85013d3eb135067c}, but enforcing a minimum val length. \end{DoxyCompactList}\item 
\#define \textbf{ MSG\+\_\+\+DEF}(\textbf{ name},  mand\+\_\+ies,  \textbf{ flags})~\{ \textbf{ name}, mand\+\_\+ies, \textbf{ ARRAY\+\_\+\+SIZE}(mand\+\_\+ies), \textbf{ flags} \}
\end{DoxyCompactItemize}
\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ osmo\+\_\+tlv\+\_\+parser\+\_\+error} \{ \newline
\textbf{ OSMO\+\_\+\+TLVP\+\_\+\+ERR\+\_\+\+OFS\+\_\+\+BEYOND\+\_\+\+BUFFER} = -\/1
, \newline
\textbf{ OSMO\+\_\+\+TLVP\+\_\+\+ERR\+\_\+\+OFS\+\_\+\+LEN\+\_\+\+BEYOND\+\_\+\+BUFFER} = -\/2
, \newline
\textbf{ OSMO\+\_\+\+TLVP\+\_\+\+ERR\+\_\+\+UNKNOWN\+\_\+\+TLV\+\_\+\+TYPE} = -\/3
, \newline
\textbf{ OSMO\+\_\+\+TLVP\+\_\+\+ERR\+\_\+\+MAND\+\_\+\+IE\+\_\+\+MISSING} = -\/50
, \newline
\textbf{ OSMO\+\_\+\+TLVP\+\_\+\+ERR\+\_\+\+IE\+\_\+\+TOO\+\_\+\+SHORT} = -\/51
 \}
\begin{DoxyCompactList}\small\item\em error return codes of various TLV parser functions \end{DoxyCompactList}\item 
enum \textbf{ tlv\+\_\+type} \{ \newline
\textbf{ TLV\+\_\+\+TYPE\+\_\+\+NONE}
, \newline
\textbf{ TLV\+\_\+\+TYPE\+\_\+\+FIXED}
, \newline
\textbf{ TLV\+\_\+\+TYPE\+\_\+T}
, \newline
\textbf{ TLV\+\_\+\+TYPE\+\_\+\+TV}
, \newline
\textbf{ TLV\+\_\+\+TYPE\+\_\+\+TLV}
, \newline
\textbf{ TLV\+\_\+\+TYPE\+\_\+\+TL16V}
, \newline
\textbf{ TLV\+\_\+\+TYPE\+\_\+\+Tv\+LV}
, \newline
\textbf{ TLV\+\_\+\+TYPE\+\_\+\+SINGLE\+\_\+\+TV}
, \newline
\textbf{ TLV\+\_\+\+TYPE\+\_\+v\+Tv\+LV\+\_\+\+GAN}
 \}
\begin{DoxyCompactList}\small\item\em TLV type. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static uint16\+\_\+t \textbf{ TVLV\+\_\+\+GROSS\+\_\+\+LEN} (uint16\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em gross length of a TVLV type field \end{DoxyCompactList}\item 
static uint16\+\_\+t \textbf{ VTVL\+\_\+\+GAN\+\_\+\+GROSS\+\_\+\+LEN} (uint16\+\_\+t tag, uint16\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em gross length of v\+TvL header (tag+len) \end{DoxyCompactList}\item 
static uint16\+\_\+t \textbf{ VTVLV\+\_\+\+GAN\+\_\+\+GROSS\+\_\+\+LEN} (uint16\+\_\+t tag, uint16\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em gross length of v\+Tv\+LV (tag+len+val) \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ lv\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a LV field \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tlv\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, uint8\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em Append a TLV field, a Tag-\/\+Length-\/\+Value field. \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tl\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, uint8\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em put (append) a TL field (a TLV field but omitting the value part). \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tlv16\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, uint8\+\_\+t \textbf{ len}, const uint16\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a TLV16 field \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tl16v\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, uint16\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a TL16V field \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tl16\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, uint16\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em put (append) a TL16 field. \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ t16lv\+\_\+put} (uint8\+\_\+t $\ast$buf, uint16\+\_\+t tag, uint8\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a TL16V field \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tvlv\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, uint16\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a Tv\+LV field \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tvl\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, uint16\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em put (append) a TvL field (a Tv\+LV with variable-\/size length, where the value part\textquotesingle{}s length is already known, but will be put() later). \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ vt\+\_\+gan\+\_\+put} (uint8\+\_\+t $\ast$buf, uint16\+\_\+t tag)
\begin{DoxyCompactList}\small\item\em put (append) a variable-\/length tag or variable-\/length length $\ast$ \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ vtvl\+\_\+gan\+\_\+put} (uint8\+\_\+t $\ast$buf, uint16\+\_\+t tag, uint16\+\_\+t \textbf{ len})
\item 
static uint8\+\_\+t $\ast$ \textbf{ vtvlv\+\_\+gan\+\_\+put} (uint8\+\_\+t $\ast$buf, uint16\+\_\+t tag, uint16\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tlv16\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint8\+\_\+t \textbf{ len}, const uint16\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a TLV16 field to \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tl16v\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint16\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a TL16V field to \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+t16lv\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint16\+\_\+t tag, uint8\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tvl\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint16\+\_\+t \textbf{ len})
\begin{DoxyCompactList}\small\item\em put (append) a TvL field to \textbf{ Message buffers}, i.\+e. \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tvlv\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint16\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a Tv\+LV field to \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tvlv\+\_\+put\+\_\+16be} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint16\+\_\+t val)
\begin{DoxyCompactList}\small\item\em put (append) a Tv\+LV field containing a big-\/endian 16bit value to msgb. \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tvlv\+\_\+put\+\_\+32be} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint32\+\_\+t val)
\begin{DoxyCompactList}\small\item\em put (append) a Tv\+LV field containing a big-\/endian 16bit value to msgb. \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+vtvlv\+\_\+gan\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint16\+\_\+t tag, uint16\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a v\+Tv\+LV field to \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+l16tv\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint16\+\_\+t \textbf{ len}, uint8\+\_\+t tag, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a L16\+TV field to \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ v\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t val)
\begin{DoxyCompactList}\small\item\em put (append) a V field \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tv\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, uint8\+\_\+t val)
\begin{DoxyCompactList}\small\item\em put (append) a TV field \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tv\+\_\+fixed\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, unsigned int \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a TVfixed field \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ tv16\+\_\+put} (uint8\+\_\+t $\ast$buf, uint8\+\_\+t tag, uint16\+\_\+t val)
\begin{DoxyCompactList}\small\item\em put (append) a TV16 field \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+lv\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a LV field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tlv\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint8\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a TLV field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tv\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint8\+\_\+t val)
\begin{DoxyCompactList}\small\item\em put (append) a TV field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tv\+\_\+fixed\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, unsigned int \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em put (append) a TVfixed field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+v\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t val)
\begin{DoxyCompactList}\small\item\em put (append) a V field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tl\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag)
\begin{DoxyCompactList}\small\item\em put (append) a TL fields to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tv16\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint16\+\_\+t val)
\begin{DoxyCompactList}\small\item\em put (append) a TV16 field (network order) to the given msgb \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tv32\+\_\+put} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint32\+\_\+t val)
\begin{DoxyCompactList}\small\item\em put (append) a TV32 field (network order) to the given msgb \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tlv\+\_\+push} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint8\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em push (prepend) a TLV field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tlv1\+\_\+push} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint8\+\_\+t val)
\begin{DoxyCompactList}\small\item\em push 1-\/byte tagged value \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tv\+\_\+push} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint8\+\_\+t val)
\begin{DoxyCompactList}\small\item\em push (prepend) a TV field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tv16\+\_\+push} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint16\+\_\+t val)
\begin{DoxyCompactList}\small\item\em push (prepend) a TV16 field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tv32\+\_\+push} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint32\+\_\+t val)
\begin{DoxyCompactList}\small\item\em push (prepend) a TV32 field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+tvlv\+\_\+push} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t tag, uint16\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\begin{DoxyCompactList}\small\item\em push (prepend) a Tv\+LV field to a \textbf{ Message buffers} \end{DoxyCompactList}\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+vtvl\+\_\+gan\+\_\+push} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint16\+\_\+t tag, uint16\+\_\+t \textbf{ len})
\item 
static uint8\+\_\+t $\ast$ \textbf{ msgb\+\_\+vtvlv\+\_\+gan\+\_\+push} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint16\+\_\+t tag, uint16\+\_\+t \textbf{ len}, const uint8\+\_\+t $\ast$val)
\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 
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 
static uint8\+\_\+t \textbf{ tlvp\+\_\+val8} (const struct \textbf{ tlv\+\_\+parsed} $\ast$tp, uint8\+\_\+t tag, uint8\+\_\+t default\+\_\+val)
\begin{DoxyCompactList}\small\item\em Obtain 1-\/byte TLV element. \end{DoxyCompactList}\item 
static uint16\+\_\+t \textbf{ tlvp\+\_\+val16\+\_\+unal} (const struct \textbf{ tlv\+\_\+parsed} $\ast$tp, int pos)
\begin{DoxyCompactList}\small\item\em Align given TLV element with 16 bit value to an even address. \end{DoxyCompactList}\item 
static uint32\+\_\+t \textbf{ tlvp\+\_\+val32\+\_\+unal} (const struct \textbf{ tlv\+\_\+parsed} $\ast$tp, int pos)
\begin{DoxyCompactList}\small\item\em Align given TLV element with 32 bit value to an address that is a multiple of 4. \end{DoxyCompactList}\item 
static uint16\+\_\+t \textbf{ tlvp\+\_\+val16be} (const struct \textbf{ tlv\+\_\+parsed} $\ast$tp, int pos)
\begin{DoxyCompactList}\small\item\em Retrieve (possibly unaligned) TLV element and convert to host byte order. \end{DoxyCompactList}\item 
static uint32\+\_\+t \textbf{ tlvp\+\_\+val32be} (const struct \textbf{ tlv\+\_\+parsed} $\ast$tp, int pos)
\begin{DoxyCompactList}\small\item\em Retrieve (possibly unaligned) TLV element and convert to host byte order. \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{ 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\+\_\+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\+\_\+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\+\_\+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}\item 
static uint32\+\_\+t \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+msgt\+\_\+flags} (const struct \textbf{ osmo\+\_\+tlv\+\_\+prot\+\_\+def} $\ast$pdef, uint8\+\_\+t \textbf{ msg\+\_\+type})
\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}
\end{DoxyCompactItemize}
