\doxysection{include/osmocom/gsm/gsm48.h File Reference}
\label{gsm48_8h}\index{include/osmocom/gsm/gsm48.h@{include/osmocom/gsm/gsm48.h}}
{\ttfamily \#include $<$stdbool.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/defs.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/tlv.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/protocol/gsm\+\_\+04\+\_\+08.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/protocol/gsm\+\_\+23\+\_\+003.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/gsm48\+\_\+ie.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/gsm23003.\+h$>$}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ gprs\+\_\+ra\+\_\+id}
\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ GSM\+\_\+\+RESERVED\+\_\+\+TMSI}~0x\+FFFFFFFF
\item 
\#define \textbf{ GSM\+\_\+\+MCC\+\_\+\+MNC\+\_\+\+INVALID}~0x\+FFFF
\item 
\#define \textbf{ GSM48\+\_\+\+MID\+\_\+\+MAX\+\_\+\+SIZE}~11
\item 
\#define \textbf{ gsm48\+\_\+push\+\_\+l3hdr\+\_\+tid}(\textbf{ msg},  pdisc,  tid,  \textbf{ msg\+\_\+type})~ \textbf{ gsm48\+\_\+push\+\_\+l3hdr}(\textbf{ msg}, (pdisc \& 0x0f) $\vert$ (tid $<$$<$ 4), \textbf{ msg\+\_\+type})
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
const char $\ast$ \textbf{ gsm48\+\_\+cc\+\_\+state\+\_\+name} (uint8\+\_\+t state)
\begin{DoxyCompactList}\small\item\em return string representation of CC State \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ gsm48\+\_\+cc\+\_\+msg\+\_\+name} (uint8\+\_\+t msgtype)
\begin{DoxyCompactList}\small\item\em return string representation of CC Message Type \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ gsm48\+\_\+rr\+\_\+msg\+\_\+name} (uint8\+\_\+t msgtype)
\begin{DoxyCompactList}\small\item\em return string representation of RR Message Type \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ gsm48\+\_\+rr\+\_\+short\+\_\+pd\+\_\+msg\+\_\+name} (uint8\+\_\+t msgtype)
\begin{DoxyCompactList}\small\item\em return string representation of RR Message Type using the RR short protocol discriminator \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ rr\+\_\+cause\+\_\+name} (uint8\+\_\+t \textbf{ cause})
\begin{DoxyCompactList}\small\item\em return string representation of RR Cause value \end{DoxyCompactList}\item 
const char $\ast$ \textbf{ osmo\+\_\+rai\+\_\+name} (const struct \textbf{ gprs\+\_\+ra\+\_\+id} $\ast$rai)
\begin{DoxyCompactList}\small\item\em Return MCC-\/\+MNC-\/\+LAC-\/\+RAC as string, in a static buffer. \end{DoxyCompactList}\item 
char $\ast$ \textbf{ osmo\+\_\+rai\+\_\+name\+\_\+buf} (char $\ast$buf, size\+\_\+t buf\+\_\+len, const struct \textbf{ gprs\+\_\+ra\+\_\+id} $\ast$rai)
\begin{DoxyCompactList}\small\item\em Return MCC-\/\+MNC-\/\+LAC-\/\+RAC as string, in a caller-\/provided output buffer. \end{DoxyCompactList}\item 
char $\ast$ \textbf{ osmo\+\_\+rai\+\_\+name\+\_\+c} (const void $\ast$ctx, const struct \textbf{ gprs\+\_\+ra\+\_\+id} $\ast$rai)
\begin{DoxyCompactList}\small\item\em Return MCC-\/\+MNC-\/\+LAC-\/\+RAC as string, in dynamically-\/allocated output buffer. \end{DoxyCompactList}\item 
void \textbf{ osmo\+\_\+rai\+\_\+to\+\_\+gprs} (struct \textbf{ gprs\+\_\+ra\+\_\+id} $\ast$dest, const struct \textbf{ osmo\+\_\+routing\+\_\+area\+\_\+id} $\ast$src)
\begin{DoxyCompactList}\small\item\em Convert \doxyref{osmo\+\_\+routing\+\_\+area\+\_\+id}{p.}{structosmo__routing__area__id} (new) into \doxyref{gprs\+\_\+ra\+\_\+id}{p.}{structgprs__ra__id} (old) \end{DoxyCompactList}\item 
void \textbf{ gprs\+\_\+rai\+\_\+to\+\_\+osmo} (struct \textbf{ osmo\+\_\+routing\+\_\+area\+\_\+id} $\ast$dest, const struct \textbf{ gprs\+\_\+ra\+\_\+id} $\ast$src)
\begin{DoxyCompactList}\small\item\em Convert \doxyref{gprs\+\_\+ra\+\_\+id}{p.}{structgprs__ra__id} (old) into \doxyref{osmo\+\_\+routing\+\_\+area\+\_\+id}{p.}{structosmo__routing__area__id} (new) \end{DoxyCompactList}\item 
int \textbf{ gsm48\+\_\+decode\+\_\+lai} (struct \textbf{ gsm48\+\_\+loc\+\_\+area\+\_\+id} $\ast$\textbf{ lai}, uint16\+\_\+t $\ast$mcc, uint16\+\_\+t $\ast$mnc, uint16\+\_\+t $\ast$\textbf{ lac}) \textbf{ OSMO\+\_\+\+DEPRECATED}(\char`\"{}Use \textbf{ gsm48\+\_\+decode\+\_\+lai2}() \textbf{ instead}
\item 
void \textbf{ gsm48\+\_\+decode\+\_\+lai2} (const struct \textbf{ gsm48\+\_\+loc\+\_\+area\+\_\+id} $\ast$\textbf{ lai}, struct \textbf{ osmo\+\_\+location\+\_\+area\+\_\+id} $\ast$decoded)
\begin{DoxyCompactList}\small\item\em Decode TS 04.\+08 Location Area Identifier. \end{DoxyCompactList}\item 
void \textbf{ gsm48\+\_\+generate\+\_\+lai} (struct \textbf{ gsm48\+\_\+loc\+\_\+area\+\_\+id} $\ast$lai48, uint16\+\_\+t mcc, uint16\+\_\+t mnc, uint16\+\_\+t \textbf{ lac}) \textbf{ OSMO\+\_\+\+DEPRECATED}(\char`\"{}Use \textbf{ gsm48\+\_\+generate\+\_\+lai2}() \textbf{ instead}
\item 
void \textbf{ gsm48\+\_\+generate\+\_\+lai2} (struct \textbf{ gsm48\+\_\+loc\+\_\+area\+\_\+id} $\ast$lai48, const struct \textbf{ osmo\+\_\+location\+\_\+area\+\_\+id} $\ast$\textbf{ lai})
\begin{DoxyCompactList}\small\item\em Encode TS 04.\+08 Location Area Identifier. \end{DoxyCompactList}\item 
void \textbf{ gsm48\+\_\+mcc\+\_\+mnc\+\_\+from\+\_\+bcd} (uint8\+\_\+t $\ast$bcd\+\_\+src, uint16\+\_\+t $\ast$mcc, uint16\+\_\+t $\ast$mnc) \textbf{ OSMO\+\_\+\+DEPRECATED}(\char`\"{}Use \textbf{ osmo\+\_\+plmn\+\_\+from\+\_\+bcd}() \textbf{ instead}
\item 
struct \textbf{ gsm48\+\_\+hdr} $\ast$ \textbf{ gsm48\+\_\+push\+\_\+l3hdr} (struct \textbf{ msgb} $\ast$\textbf{ msg}, uint8\+\_\+t pdisc, uint8\+\_\+t \textbf{ msg\+\_\+type})
\begin{DoxyCompactList}\small\item\em Wrap a given \doxyref{msg}{p.}{gsm__08__08_8h_a22fb9e0346dd94237971f7d829821bfa} with \doxyref{gsm48\+\_\+hdr}{p.}{structgsm48__hdr} structure. \end{DoxyCompactList}\item 
enum \textbf{ gsm48\+\_\+chan\+\_\+mode} \textbf{ gsm48\+\_\+chan\+\_\+mode\+\_\+to\+\_\+vamos} (enum \textbf{ gsm48\+\_\+chan\+\_\+mode} \textbf{ mode})
\begin{DoxyCompactList}\small\item\em Translate GSM48\+\_\+\+CMODE\+\_\+\+SPEECH\+\_\+$\ast$ to its corresponding GSM48\+\_\+\+CMODE\+\_\+\+SPEECH\+\_\+$\ast$\+\_\+\+VAMOS mode. \end{DoxyCompactList}\item 
enum \textbf{ gsm48\+\_\+chan\+\_\+mode} \textbf{ gsm48\+\_\+chan\+\_\+mode\+\_\+to\+\_\+non\+\_\+vamos} (enum \textbf{ gsm48\+\_\+chan\+\_\+mode} \textbf{ mode})
\begin{DoxyCompactList}\small\item\em Translate GSM48\+\_\+\+CMODE\+\_\+\+SPEECH\+\_\+$\ast$\+\_\+\+VAMOS to its corresponding GSM48\+\_\+\+CMODE\+\_\+\+SPEECH\+\_\+$\ast$ non-\/vamos mode. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
const struct \textbf{ tlv\+\_\+definition} \textbf{ gsm48\+\_\+att\+\_\+tlvdef}
\begin{DoxyCompactList}\small\item\em TLV parser definitions for TS 04.\+08 CC. \end{DoxyCompactList}\item 
const struct \textbf{ tlv\+\_\+definition} \textbf{ gsm48\+\_\+rr\+\_\+att\+\_\+tlvdef}
\begin{DoxyCompactList}\small\item\em TLV parser definitions for TS 04.\+08 RR. \end{DoxyCompactList}\item 
const struct \textbf{ tlv\+\_\+definition} \textbf{ gsm48\+\_\+mm\+\_\+att\+\_\+tlvdef}
\begin{DoxyCompactList}\small\item\em TLV parser definitions for TS 04.\+08 MM. \end{DoxyCompactList}\item 
int to not lose leading zeros in the \textbf{ MNC}
\item 
int \textbf{ gsm48\+\_\+generate\+\_\+mid\+\_\+from\+\_\+tmsi} $\ast$(uint8\+\_\+t $\ast$buf, uint32\+\_\+t tmsi) \textbf{ OSMO\+\_\+\+DEPRECATED\+\_\+\+OUTSIDE}(\char`\"{}Instead us \textbf{ l} )
\end{DoxyCompactItemize}


\doxysubsection{Macro Definition Documentation}
\mbox{\label{gsm48_8h_a4a47469d6b8d662d71c7bc14ae7bb30a}} 
\index{gsm48.h@{gsm48.h}!GSM48\_MID\_MAX\_SIZE@{GSM48\_MID\_MAX\_SIZE}}
\index{GSM48\_MID\_MAX\_SIZE@{GSM48\_MID\_MAX\_SIZE}!gsm48.h@{gsm48.h}}
\doxysubsubsection{GSM48\_MID\_MAX\_SIZE}
{\footnotesize\ttfamily \#define GSM48\+\_\+\+MID\+\_\+\+MAX\+\_\+\+SIZE~11}

\mbox{\label{gsm48_8h_ab4b765a844fc6421430c8a625d9469af}} 
\index{gsm48.h@{gsm48.h}!gsm48\_push\_l3hdr\_tid@{gsm48\_push\_l3hdr\_tid}}
\index{gsm48\_push\_l3hdr\_tid@{gsm48\_push\_l3hdr\_tid}!gsm48.h@{gsm48.h}}
\doxysubsubsection{gsm48\_push\_l3hdr\_tid}
{\footnotesize\ttfamily \#define gsm48\+\_\+push\+\_\+l3hdr\+\_\+tid(\begin{DoxyParamCaption}\item[{}]{\textbf{ msg},  }\item[{}]{pdisc,  }\item[{}]{tid,  }\item[{}]{\textbf{ msg\+\_\+type} }\end{DoxyParamCaption})~ \textbf{ gsm48\+\_\+push\+\_\+l3hdr}(\textbf{ msg}, (pdisc \& 0x0f) $\vert$ (tid $<$$<$ 4), \textbf{ msg\+\_\+type})}

\mbox{\label{gsm48_8h_ae338102f162377e214da8a0b415cfd43}} 
\index{gsm48.h@{gsm48.h}!GSM\_MCC\_MNC\_INVALID@{GSM\_MCC\_MNC\_INVALID}}
\index{GSM\_MCC\_MNC\_INVALID@{GSM\_MCC\_MNC\_INVALID}!gsm48.h@{gsm48.h}}
\doxysubsubsection{GSM\_MCC\_MNC\_INVALID}
{\footnotesize\ttfamily \#define GSM\+\_\+\+MCC\+\_\+\+MNC\+\_\+\+INVALID~0x\+FFFF}

\mbox{\label{gsm48_8h_a07b1c93d457b55a722344ec84fadc283}} 
\index{gsm48.h@{gsm48.h}!GSM\_RESERVED\_TMSI@{GSM\_RESERVED\_TMSI}}
\index{GSM\_RESERVED\_TMSI@{GSM\_RESERVED\_TMSI}!gsm48.h@{gsm48.h}}
\doxysubsubsection{GSM\_RESERVED\_TMSI}
{\footnotesize\ttfamily \#define GSM\+\_\+\+RESERVED\+\_\+\+TMSI~0x\+FFFFFFFF}



\doxysubsection{Function Documentation}
\mbox{\label{gsm48_8h_a72687415c0d2d05d519197a74962b5a0}} 
\index{gsm48.h@{gsm48.h}!gsm48\_decode\_lai@{gsm48\_decode\_lai}}
\index{gsm48\_decode\_lai@{gsm48\_decode\_lai}!gsm48.h@{gsm48.h}}
\doxysubsubsection{gsm48\_decode\_lai()}
{\footnotesize\ttfamily int gsm48\+\_\+decode\+\_\+lai (\begin{DoxyParamCaption}\item[{struct \textbf{ gsm48\+\_\+loc\+\_\+area\+\_\+id} $\ast$}]{lai,  }\item[{uint16\+\_\+t $\ast$}]{mcc,  }\item[{uint16\+\_\+t $\ast$}]{mnc,  }\item[{uint16\+\_\+t $\ast$}]{lac }\end{DoxyParamCaption})}

\mbox{\label{gsm48_8h_a178e184533d26861beb2ceebe24a494c}} 
\index{gsm48.h@{gsm48.h}!gsm48\_generate\_lai@{gsm48\_generate\_lai}}
\index{gsm48\_generate\_lai@{gsm48\_generate\_lai}!gsm48.h@{gsm48.h}}
\doxysubsubsection{gsm48\_generate\_lai()}
{\footnotesize\ttfamily void gsm48\+\_\+generate\+\_\+lai (\begin{DoxyParamCaption}\item[{struct \textbf{ gsm48\+\_\+loc\+\_\+area\+\_\+id} $\ast$}]{lai48,  }\item[{uint16\+\_\+t}]{mcc,  }\item[{uint16\+\_\+t}]{mnc,  }\item[{uint16\+\_\+t}]{lac }\end{DoxyParamCaption})}

\mbox{\label{gsm48_8h_a0c594e4ab168db031daddb63393c8eaf}} 
\index{gsm48.h@{gsm48.h}!gsm48\_mcc\_mnc\_from\_bcd@{gsm48\_mcc\_mnc\_from\_bcd}}
\index{gsm48\_mcc\_mnc\_from\_bcd@{gsm48\_mcc\_mnc\_from\_bcd}!gsm48.h@{gsm48.h}}
\doxysubsubsection{gsm48\_mcc\_mnc\_from\_bcd()}
{\footnotesize\ttfamily void gsm48\+\_\+mcc\+\_\+mnc\+\_\+from\+\_\+bcd (\begin{DoxyParamCaption}\item[{uint8\+\_\+t $\ast$}]{bcd\+\_\+src,  }\item[{uint16\+\_\+t $\ast$}]{mcc,  }\item[{uint16\+\_\+t $\ast$}]{mnc }\end{DoxyParamCaption})}



References \textbf{ OSMO\+\_\+\+DEPRECATED}.



\doxysubsection{Variable Documentation}
\mbox{\label{gsm48_8h_a5a4b89875a33c5ad7faeb71383dc05ed}} 
\index{gsm48.h@{gsm48.h}!l@{l}}
\index{l@{l}!gsm48.h@{gsm48.h}}
\doxysubsubsection{l}
{\footnotesize\ttfamily $\ast$ l}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{= osmo\_mobile\_identity\_encode\_msgb(...)\textcolor{stringliteral}{"{});}}
\DoxyCodeLine{\textcolor{stringliteral}{int gsm48\_generate\_mid\_from\_imsi(uint8\_t *buf, const char *imsi)}}
\DoxyCodeLine{\textcolor{stringliteral}{        OSMO\_DEPRECATED\_OUTSIDE("{}}Instead use: l = msgb\_tl\_put(msg, GSM48\_IE\_MOBILE\_ID)}

\end{DoxyCode}


Referenced by \textbf{ gsm0808\+\_\+create\+\_\+perform\+\_\+location\+\_\+response()}, \textbf{ gsm0808\+\_\+enc\+\_\+lcs\+\_\+cause()}, \textbf{ gsm\+\_\+7bit\+\_\+decode\+\_\+n\+\_\+hdr()}, \textbf{ osmo\+\_\+bssmap\+\_\+le\+\_\+enc\+\_\+perform\+\_\+loc\+\_\+abort()}, \textbf{ osmo\+\_\+bssmap\+\_\+le\+\_\+enc\+\_\+perform\+\_\+loc\+\_\+req()}, \textbf{ osmo\+\_\+bssmap\+\_\+le\+\_\+enc\+\_\+perform\+\_\+loc\+\_\+resp()}, \textbf{ osmo\+\_\+bssmap\+\_\+le\+\_\+ie\+\_\+enc\+\_\+apdu()}, and \textbf{ SHA1\+Transform()}.

\mbox{\label{gsm48_8h_a727ba753efdd717fcade332c871ccd54}} 
\index{gsm48.h@{gsm48.h}!MNC@{MNC}}
\index{MNC@{MNC}!gsm48.h@{gsm48.h}}
\doxysubsubsection{MNC}
{\footnotesize\ttfamily void to not lose leading zeros in the MNC}

