\doxysection{include/osmocom/gsm/gsm0480.h File Reference}
\label{gsm0480_8h}\index{include/osmocom/gsm/gsm0480.h@{include/osmocom/gsm/gsm0480.h}}
{\ttfamily \#include $<$osmocom/core/defs.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/core/msgb.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/protocol/gsm\+\_\+04\+\_\+08.\+h$>$}\newline
{\ttfamily \#include $<$osmocom/gsm/protocol/gsm\+\_\+04\+\_\+80.\+h$>$}\newline
\doxysubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ ussd\+\_\+request}
\item 
struct \textbf{ ss\+\_\+request}
\begin{DoxyCompactList}\small\item\em This structure represents some meaningful parts of a decoded and/or to be encoded GSM 04.\+80 message. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \textbf{ GSM0480\+\_\+\+USSD\+\_\+\+OCTET\+\_\+\+STRING\+\_\+\+LEN}~160
\begin{DoxyCompactList}\small\item\em According to the GSM 04.\+80 (version 5.\+0.\+0) specification Annex A \char`\"{}\+Expanded ASN.\+1 Module \char`\"{}SS-\/\+Protocol"{}, the maximum size of a USSD OCTET STRING field is 160 bytes. \end{DoxyCompactList}\item 
\#define \textbf{ GSM0480\+\_\+\+USSD\+\_\+7\+BIT\+\_\+\+STRING\+\_\+\+LEN}~182
\begin{DoxyCompactList}\small\item\em Thus according to ETSI TS 123 038 (version 10.\+0.\+0) specification 6.\+1.\+2.\+3 \char`\"{}\+USSD packing of 7 bit characters\char`\"{}, in 160 octets, it\textquotesingle{}s possible to pack (160 $\ast$ 8) / 7 = 182.\+8, that is 182 characters. \end{DoxyCompactList}\item 
\#define \textbf{ MAX\+\_\+\+LEN\+\_\+\+USSD\+\_\+\+STRING}~31
\begin{DoxyCompactList}\small\item\em DEPRECATED\+: this definition doesn\textquotesingle{}t follow any specification, so we only keep it for compatibility reasons. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static const char $\ast$ \textbf{ gsm0480\+\_\+comp\+\_\+type\+\_\+name} (uint8\+\_\+t comp\+\_\+type)
\item 
static const char $\ast$ \textbf{ gsm0480\+\_\+op\+\_\+code\+\_\+name} (uint8\+\_\+t op\+\_\+code)
\item 
int \textbf{ gsm0480\+\_\+decode\+\_\+ussd\+\_\+request} (const struct \textbf{ gsm48\+\_\+hdr} $\ast$\textbf{ hdr}, uint16\+\_\+t \textbf{ len}, struct \textbf{ ussd\+\_\+request} $\ast$request) \textbf{ OSMO\+\_\+\+DEPRECATED}(\char`\"{}Use \textbf{ gsm0480\+\_\+decode\+\_\+ss\+\_\+request}() \textbf{ instead}\char`\"{})
\item 
int \textbf{ gsm0480\+\_\+extract\+\_\+ie\+\_\+by\+\_\+tag} (const struct \textbf{ gsm48\+\_\+hdr} $\ast$\textbf{ hdr}, uint16\+\_\+t msg\+\_\+len, uint8\+\_\+t $\ast$$\ast$ie, uint16\+\_\+t $\ast$ie\+\_\+len, uint8\+\_\+t ie\+\_\+tag)
\begin{DoxyCompactList}\small\item\em Get pointer to the IE of a given type. \end{DoxyCompactList}\item 
int \textbf{ gsm0480\+\_\+parse\+\_\+facility\+\_\+ie} (const uint8\+\_\+t $\ast$facility\+\_\+ie, uint16\+\_\+t \textbf{ length}, struct \textbf{ ss\+\_\+request} $\ast$req)
\begin{DoxyCompactList}\small\item\em Parse the components of a given Facility IE. \end{DoxyCompactList}\item 
int \textbf{ gsm0480\+\_\+decode\+\_\+ss\+\_\+request} (const struct \textbf{ gsm48\+\_\+hdr} $\ast$\textbf{ hdr}, uint16\+\_\+t \textbf{ len}, struct \textbf{ ss\+\_\+request} $\ast$request)
\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+msgb\+\_\+alloc\+\_\+name} (const char $\ast$\textbf{ name})
\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+gen\+\_\+ussd\+\_\+resp\+\_\+7bit} (uint8\+\_\+t invoke\+\_\+id, const char $\ast$text)
\begin{DoxyCompactList}\small\item\em Generate a USSD Return\+Result component containing a string in default GSM alphabet. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+gen\+\_\+return\+\_\+error} (uint8\+\_\+t invoke\+\_\+id, uint8\+\_\+t error\+\_\+code)
\begin{DoxyCompactList}\small\item\em Generate a Return\+Error component (see section 3.\+6.\+1) and given error code (see section 3.\+6.\+6). \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+gen\+\_\+reject} (int invoke\+\_\+id, uint8\+\_\+t problem\+\_\+tag, uint8\+\_\+t problem\+\_\+code)
\begin{DoxyCompactList}\small\item\em Generate a Reject component (see section 3.\+6.\+1) and given error code (see section 3.\+6.\+7). \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+create\+\_\+ussd\+\_\+resp} (uint8\+\_\+t invoke\+\_\+id, uint8\+\_\+t trans\+\_\+id, const char $\ast$text)
\begin{DoxyCompactList}\small\item\em Legacy helper\+: Generate USSD response including FACILITY IE + L3 header. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+create\+\_\+unstructured\+SS\+\_\+\+Notify} (int alert\+Pattern, const char $\ast$text)
\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+create\+\_\+notify\+SS} (const char $\ast$text)
\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+create\+\_\+ussd\+\_\+notify} (int \textbf{ level}, const char $\ast$text)
\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+create\+\_\+ussd\+\_\+release\+\_\+complete} (void) \textbf{ OSMO\+\_\+\+DEPRECATED}(\char`\"{}Use \textbf{ gsm0480\+\_\+create\+\_\+release\+\_\+complete}() instead.\char`\"{})
\begin{DoxyCompactList}\small\item\em Deprecated, use \doxyref{gsm0480\+\_\+create\+\_\+release\+\_\+complete()}{p.}{gsm0480_8c_a8f7d0de538ef9c351254b4ca4a1c1a8a} instead. \end{DoxyCompactList}\item 
struct \textbf{ msgb} $\ast$ \textbf{ gsm0480\+\_\+create\+\_\+release\+\_\+complete} (uint8\+\_\+t trans\+\_\+id)
\begin{DoxyCompactList}\small\item\em Create a GSM 04.\+80 Release complete (see 2.\+5) message, prefixed by GSM 04.\+08 L3 header with a given transaction ID. \end{DoxyCompactList}\item 
int \textbf{ gsm0480\+\_\+wrap\+\_\+invoke} (struct \textbf{ msgb} $\ast$\textbf{ msg}, int op, int \textbf{ link\+\_\+id})
\item 
int \textbf{ gsm0480\+\_\+wrap\+\_\+facility} (struct \textbf{ msgb} $\ast$\textbf{ msg})
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
const struct \textbf{ value\+\_\+string} \textbf{ gsm0480\+\_\+comp\+\_\+type\+\_\+names} [$\,$]
\item 
const struct \textbf{ value\+\_\+string} \textbf{ gsm0480\+\_\+op\+\_\+code\+\_\+names} [$\,$]
\end{DoxyCompactItemize}


\doxysubsection{Macro Definition Documentation}
\mbox{\label{gsm0480_8h_a10b99c7798df7f67496d20ba8b525dd2}} 
\index{gsm0480.h@{gsm0480.h}!GSM0480\_USSD\_7BIT\_STRING\_LEN@{GSM0480\_USSD\_7BIT\_STRING\_LEN}}
\index{GSM0480\_USSD\_7BIT\_STRING\_LEN@{GSM0480\_USSD\_7BIT\_STRING\_LEN}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{GSM0480\_USSD\_7BIT\_STRING\_LEN}
{\footnotesize\ttfamily \#define GSM0480\+\_\+\+USSD\+\_\+7\+BIT\+\_\+\+STRING\+\_\+\+LEN~182}



Thus according to ETSI TS 123 038 (version 10.\+0.\+0) specification 6.\+1.\+2.\+3 \char`\"{}\+USSD packing of 7 bit characters\char`\"{}, in 160 octets, it\textquotesingle{}s possible to pack (160 $\ast$ 8) / 7 = 182.\+8, that is 182 characters. 

The remaining 6 bits are set to zero. \mbox{\label{gsm0480_8h_a91e907ae564669fc9639876b71e0536e}} 
\index{gsm0480.h@{gsm0480.h}!GSM0480\_USSD\_OCTET\_STRING\_LEN@{GSM0480\_USSD\_OCTET\_STRING\_LEN}}
\index{GSM0480\_USSD\_OCTET\_STRING\_LEN@{GSM0480\_USSD\_OCTET\_STRING\_LEN}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{GSM0480\_USSD\_OCTET\_STRING\_LEN}
{\footnotesize\ttfamily \#define GSM0480\+\_\+\+USSD\+\_\+\+OCTET\+\_\+\+STRING\+\_\+\+LEN~160}



According to the GSM 04.\+80 (version 5.\+0.\+0) specification Annex A \char`\"{}\+Expanded ASN.\+1 Module \char`\"{}SS-\/\+Protocol"{}, the maximum size of a USSD OCTET STRING field is 160 bytes. 

\mbox{\label{gsm0480_8h_a6727673f6418babf85659d68831c5ea9}} 
\index{gsm0480.h@{gsm0480.h}!MAX\_LEN\_USSD\_STRING@{MAX\_LEN\_USSD\_STRING}}
\index{MAX\_LEN\_USSD\_STRING@{MAX\_LEN\_USSD\_STRING}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{MAX\_LEN\_USSD\_STRING}
{\footnotesize\ttfamily \#define MAX\+\_\+\+LEN\+\_\+\+USSD\+\_\+\+STRING~31}



DEPRECATED\+: this definition doesn\textquotesingle{}t follow any specification, so we only keep it for compatibility reasons. 

It\textquotesingle{}s strongly recommended to use correct definitions above. 

\doxysubsection{Function Documentation}
\mbox{\label{gsm0480_8h_afcd701bee8bf33a8b003ea093247e562}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_comp\_type\_name@{gsm0480\_comp\_type\_name}}
\index{gsm0480\_comp\_type\_name@{gsm0480\_comp\_type\_name}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_comp\_type\_name()}
{\footnotesize\ttfamily static const char $\ast$ gsm0480\+\_\+comp\+\_\+type\+\_\+name (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{comp\+\_\+type }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ get\+\_\+value\+\_\+string()}, and \textbf{ gsm0480\+\_\+comp\+\_\+type\+\_\+names}.

\mbox{\label{gsm0480_8h_a3d5f9e2a7f869160129fe7b45ad4f101}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_create\_notifySS@{gsm0480\_create\_notifySS}}
\index{gsm0480\_create\_notifySS@{gsm0480\_create\_notifySS}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_create\_notifySS()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+create\+\_\+notify\+SS (\begin{DoxyParamCaption}\item[{const char $\ast$}]{text }\end{DoxyParamCaption})}



References \textbf{ data}, \textbf{ gsm0480\+\_\+msgb\+\_\+alloc\+\_\+name()}, \textbf{ GSM\+\_\+0480\+\_\+\+SEQUENCE\+\_\+\+TAG}, \textbf{ gsm\+\_\+7bit\+\_\+encode\+\_\+n\+\_\+ussd()}, \textbf{ len}, \textbf{ msg}, \textbf{ msgb\+\_\+put()}, \textbf{ msgb\+\_\+put\+\_\+u8()}, and \textbf{ msgb\+\_\+tailroom()}.

\mbox{\label{gsm0480_8h_a8f7d0de538ef9c351254b4ca4a1c1a8a}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_create\_release\_complete@{gsm0480\_create\_release\_complete}}
\index{gsm0480\_create\_release\_complete@{gsm0480\_create\_release\_complete}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_create\_release\_complete()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+create\+\_\+release\+\_\+complete (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{trans\+\_\+id }\end{DoxyParamCaption})}



Create a GSM 04.\+80 Release complete (see 2.\+5) message, prefixed by GSM 04.\+08 L3 header with a given transaction ID. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em trans\+\_\+id} & GSM 04.\+07 transaction identifier (and TI flag) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
message buffer containing the Release complete message 
\end{DoxyReturn}


References \textbf{ gsm0480\+\_\+msgb\+\_\+alloc\+\_\+name()}, \textbf{ GSM0480\+\_\+\+MTYPE\+\_\+\+RELEASE\+\_\+\+COMPLETE}, \textbf{ GSM48\+\_\+\+PDISC\+\_\+\+NC\+\_\+\+SS}, \textbf{ gsm48\+\_\+push\+\_\+l3hdr\+\_\+tid}, and \textbf{ msg}.

\mbox{\label{gsm0480_8h_ae541d92d514691bfa0c24101172d4c92}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_create\_unstructuredSS\_Notify@{gsm0480\_create\_unstructuredSS\_Notify}}
\index{gsm0480\_create\_unstructuredSS\_Notify@{gsm0480\_create\_unstructuredSS\_Notify}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_create\_unstructuredSS\_Notify()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+create\+\_\+unstructured\+SS\+\_\+\+Notify (\begin{DoxyParamCaption}\item[{int}]{alert\+Pattern,  }\item[{const char $\ast$}]{text }\end{DoxyParamCaption})}



References \textbf{ ASN1\+\_\+\+OCTET\+\_\+\+STRING\+\_\+\+TAG}, \textbf{ data}, \textbf{ gsm0480\+\_\+msgb\+\_\+alloc\+\_\+name()}, \textbf{ GSM\+\_\+0480\+\_\+\+SEQUENCE\+\_\+\+TAG}, \textbf{ gsm\+\_\+7bit\+\_\+encode\+\_\+n\+\_\+ussd()}, \textbf{ len}, \textbf{ msg}, \textbf{ msgb\+\_\+put()}, \textbf{ msgb\+\_\+put\+\_\+u8()}, and \textbf{ msgb\+\_\+tailroom()}.



Referenced by \textbf{ gsm0480\+\_\+create\+\_\+ussd\+\_\+notify()}.

\mbox{\label{gsm0480_8h_ac9aa8b2cb64b88d784a2463058edf852}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_create\_ussd\_notify@{gsm0480\_create\_ussd\_notify}}
\index{gsm0480\_create\_ussd\_notify@{gsm0480\_create\_ussd\_notify}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_create\_ussd\_notify()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+create\+\_\+ussd\+\_\+notify (\begin{DoxyParamCaption}\item[{int}]{level,  }\item[{const char $\ast$}]{text }\end{DoxyParamCaption})}



References \textbf{ gsm0480\+\_\+create\+\_\+unstructured\+SS\+\_\+\+Notify()}, \textbf{ GSM0480\+\_\+\+MTYPE\+\_\+\+REGISTER}, \textbf{ GSM0480\+\_\+\+OP\+\_\+\+CODE\+\_\+\+USS\+\_\+\+NOTIFY}, \textbf{ gsm0480\+\_\+wrap\+\_\+facility()}, \textbf{ gsm0480\+\_\+wrap\+\_\+invoke()}, \textbf{ GSM48\+\_\+\+PDISC\+\_\+\+NC\+\_\+\+SS}, \textbf{ gsm48\+\_\+push\+\_\+l3hdr()}, \textbf{ level}, and \textbf{ msg}.

\mbox{\label{gsm0480_8h_ad6dcddfafa78aeebc90862923967cff2}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_create\_ussd\_release\_complete@{gsm0480\_create\_ussd\_release\_complete}}
\index{gsm0480\_create\_ussd\_release\_complete@{gsm0480\_create\_ussd\_release\_complete}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_create\_ussd\_release\_complete()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+create\+\_\+ussd\+\_\+release\+\_\+complete (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Deprecated, use \doxyref{gsm0480\+\_\+create\+\_\+release\+\_\+complete()}{p.}{gsm0480_8c_a8f7d0de538ef9c351254b4ca4a1c1a8a} instead. 



References \textbf{ gsm0480\+\_\+msgb\+\_\+alloc\+\_\+name()}, \textbf{ GSM0480\+\_\+\+MTYPE\+\_\+\+RELEASE\+\_\+\+COMPLETE}, \textbf{ GSM48\+\_\+\+PDISC\+\_\+\+NC\+\_\+\+SS}, \textbf{ gsm48\+\_\+push\+\_\+l3hdr()}, and \textbf{ msg}.

\mbox{\label{gsm0480_8h_a80ddefa588adfe9e1a4b00c2636395ea}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_create\_ussd\_resp@{gsm0480\_create\_ussd\_resp}}
\index{gsm0480\_create\_ussd\_resp@{gsm0480\_create\_ussd\_resp}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_create\_ussd\_resp()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+create\+\_\+ussd\+\_\+resp (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{invoke\+\_\+id,  }\item[{uint8\+\_\+t}]{trans\+\_\+id,  }\item[{const char $\ast$}]{text }\end{DoxyParamCaption})}



Legacy helper\+: Generate USSD response including FACILITY IE + L3 header. 

This function is just like \doxyref{gsm0480\+\_\+gen\+\_\+ussd\+\_\+resp\+\_\+7bit}{p.}{gsm0480_8c_aebd096ae1a396411c9c28211789189cf}, but it generates not only the FACILITY value, but the full L3 message including message header and FACILITY IE Tag+\+Length. 

References \textbf{ gsm0480\+\_\+gen\+\_\+ussd\+\_\+resp\+\_\+7bit()}, \textbf{ GSM0480\+\_\+\+IE\+\_\+\+FACILITY}, \textbf{ GSM0480\+\_\+\+MTYPE\+\_\+\+RELEASE\+\_\+\+COMPLETE}, \textbf{ GSM48\+\_\+\+PDISC\+\_\+\+NC\+\_\+\+SS}, \textbf{ gsm48\+\_\+push\+\_\+l3hdr\+\_\+tid}, \textbf{ msg}, and \textbf{ msgb\+\_\+push\+\_\+tl()}.

\mbox{\label{gsm0480_8h_a6400c42733694b30f31569e42639918e}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_decode\_ss\_request@{gsm0480\_decode\_ss\_request}}
\index{gsm0480\_decode\_ss\_request@{gsm0480\_decode\_ss\_request}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_decode\_ss\_request()}
{\footnotesize\ttfamily int gsm0480\+\_\+decode\+\_\+ss\+\_\+request (\begin{DoxyParamCaption}\item[{const struct \textbf{ gsm48\+\_\+hdr} $\ast$}]{hdr,  }\item[{uint16\+\_\+t}]{len,  }\item[{struct \textbf{ ss\+\_\+request} $\ast$}]{request }\end{DoxyParamCaption})}

Check Protocol Discriminator see TS GSM 04.\+07 and GSM 04.\+80

References \textbf{ DLGLOBAL}, \textbf{ gsm48\+\_\+hdr\+\_\+pdisc()}, \textbf{ GSM48\+\_\+\+PDISC\+\_\+\+NC\+\_\+\+SS}, \textbf{ hdr}, \textbf{ len}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGP}, \textbf{ parse\+\_\+ss()}, \textbf{ gsm48\+\_\+hdr\+::proto\+\_\+discr}, and \textbf{ ss\+\_\+request\+::transaction\+\_\+id}.

\mbox{\label{gsm0480_8h_a2a233dc83083935c03d97897d950a4d1}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_decode\_ussd\_request@{gsm0480\_decode\_ussd\_request}}
\index{gsm0480\_decode\_ussd\_request@{gsm0480\_decode\_ussd\_request}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_decode\_ussd\_request()}
{\footnotesize\ttfamily int gsm0480\+\_\+decode\+\_\+ussd\+\_\+request (\begin{DoxyParamCaption}\item[{const struct \textbf{ gsm48\+\_\+hdr} $\ast$}]{hdr,  }\item[{uint16\+\_\+t}]{len,  }\item[{struct \textbf{ ussd\+\_\+request} $\ast$}]{request }\end{DoxyParamCaption})}



References \textbf{ DLGLOBAL}, \textbf{ gsm48\+\_\+hdr\+\_\+pdisc()}, \textbf{ GSM48\+\_\+\+PDISC\+\_\+\+NC\+\_\+\+SS}, \textbf{ hdr}, \textbf{ ussd\+\_\+request\+::invoke\+\_\+id}, \textbf{ ss\+\_\+request\+::invoke\+\_\+id}, \textbf{ len}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGP}, \textbf{ parse\+\_\+ss()}, \textbf{ gsm48\+\_\+hdr\+::proto\+\_\+discr}, \textbf{ ussd\+\_\+request\+::text}, \textbf{ ussd\+\_\+request\+::transaction\+\_\+id}, \textbf{ ss\+\_\+request\+::transaction\+\_\+id}, and \textbf{ ss\+\_\+request\+::ussd\+\_\+text}.

\mbox{\label{gsm0480_8h_a6e1593202a6686b8dae7d6e70f5c33f3}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_extract\_ie\_by\_tag@{gsm0480\_extract\_ie\_by\_tag}}
\index{gsm0480\_extract\_ie\_by\_tag@{gsm0480\_extract\_ie\_by\_tag}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_extract\_ie\_by\_tag()}
{\footnotesize\ttfamily int gsm0480\+\_\+extract\+\_\+ie\+\_\+by\+\_\+tag (\begin{DoxyParamCaption}\item[{const struct \textbf{ gsm48\+\_\+hdr} $\ast$}]{hdr,  }\item[{uint16\+\_\+t}]{msg\+\_\+len,  }\item[{uint8\+\_\+t $\ast$$\ast$}]{ie,  }\item[{uint16\+\_\+t $\ast$}]{ie\+\_\+len,  }\item[{uint8\+\_\+t}]{ie\+\_\+tag }\end{DoxyParamCaption})}



Get pointer to the IE of a given type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em hdr} & Pointer to the message starting from header \\
\hline
\mbox{\texttt{ in}}  & {\em msg\+\_\+len} & Length of the whole message + header \\
\hline
\mbox{\texttt{ out}}  & {\em ie} & External pointer to be set \\
\hline
\mbox{\texttt{ out}}  & {\em ie\+\_\+len} & External IE length variable \\
\hline
\mbox{\texttt{ in}}  & {\em ie\+\_\+tag} & Tag value of the required IE \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 in case of success, otherwise -\/ERRNO
\end{DoxyReturn}
This function iterates over existing IEs within a given message (depending on its type), and looks for the one with given ie\+\_\+tag value. If the IE is found, the external pointer pointed by ie will be set to its value part (omitting TL), and ie\+\_\+len will be set to the length. Otherwise, e.\+g. in case of parsing error, both ie and ie\+\_\+len are set to NULL and 0 respectively. 

References \textbf{ gsm48\+\_\+hdr\+::data}, \textbf{ GSM0480\+\_\+\+IE\+\_\+\+FACILITY}, \textbf{ GSM0480\+\_\+\+MTYPE\+\_\+\+FACILITY}, \textbf{ GSM0480\+\_\+\+MTYPE\+\_\+\+REGISTER}, \textbf{ GSM0480\+\_\+\+MTYPE\+\_\+\+RELEASE\+\_\+\+COMPLETE}, \textbf{ gsm48\+\_\+hdr\+\_\+msg\+\_\+type}, \textbf{ gsm48\+\_\+hdr\+\_\+pdisc()}, \textbf{ GSM48\+\_\+\+PDISC\+\_\+\+NC\+\_\+\+SS}, \textbf{ hdr}, \textbf{ len}, and \textbf{ msg\+\_\+type}.

\mbox{\label{gsm0480_8h_ae19217d05280490bd9e340f356761893}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_gen\_reject@{gsm0480\_gen\_reject}}
\index{gsm0480\_gen\_reject@{gsm0480\_gen\_reject}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_gen\_reject()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+gen\+\_\+reject (\begin{DoxyParamCaption}\item[{int}]{invoke\+\_\+id,  }\item[{uint8\+\_\+t}]{problem\+\_\+tag,  }\item[{uint8\+\_\+t}]{problem\+\_\+code }\end{DoxyParamCaption})}



Generate a Reject component (see section 3.\+6.\+1) and given error code (see section 3.\+6.\+7). 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em invoke\+\_\+id} & Invoke\+ID of the request \\
\hline
\mbox{\texttt{ in}}  & {\em problem\+\_\+tag} & Problem code tag (table 3.\+13) \\
\hline
\mbox{\texttt{ in}}  & {\em problem\+\_\+code} & Problem code (table 3.\+14-\/3.\+17) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
message buffer containing the Reject component
\end{DoxyReturn}
Note\+: if Invoke\+ID is not available, e.\+g. when message parsing failed, any incorrect vlue can be passed (0x00 $>$ x $>$ 0xff), so the universal NULL-\/tag (see table 3.\+6) will be used instead. 

References \textbf{ ASN1\+\_\+\+NULL\+\_\+\+TYPE\+\_\+\+TAG}, \textbf{ GSM0480\+\_\+\+COMPIDTAG\+\_\+\+INVOKE\+\_\+\+ID}, \textbf{ GSM0480\+\_\+\+CTYPE\+\_\+\+REJECT}, \textbf{ gsm0480\+\_\+msgb\+\_\+alloc\+\_\+name()}, \textbf{ msg}, \textbf{ msgb\+\_\+push\+\_\+tl()}, \textbf{ msgb\+\_\+tlv1\+\_\+push()}, and \textbf{ msgb\+\_\+tv\+\_\+push()}.

\mbox{\label{gsm0480_8h_a398eae9d465b1a4fc6a5994ce4d84ff8}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_gen\_return\_error@{gsm0480\_gen\_return\_error}}
\index{gsm0480\_gen\_return\_error@{gsm0480\_gen\_return\_error}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_gen\_return\_error()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+gen\+\_\+return\+\_\+error (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{invoke\+\_\+id,  }\item[{uint8\+\_\+t}]{error\+\_\+code }\end{DoxyParamCaption})}



Generate a Return\+Error component (see section 3.\+6.\+1) and given error code (see section 3.\+6.\+6). 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em invoke\+\_\+id} & Invoke\+ID of the request \\
\hline
\mbox{\texttt{ in}}  & {\em error\+\_\+code} & Error code (section 4.\+5) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
message buffer containing the Reject component 
\end{DoxyReturn}


References \textbf{ GSM0480\+\_\+\+COMPIDTAG\+\_\+\+INVOKE\+\_\+\+ID}, \textbf{ GSM0480\+\_\+\+CTYPE\+\_\+\+RETURN\+\_\+\+ERROR}, \textbf{ gsm0480\+\_\+msgb\+\_\+alloc\+\_\+name()}, \textbf{ GSM\+\_\+0480\+\_\+\+ERROR\+\_\+\+CODE\+\_\+\+TAG}, \textbf{ msg}, \textbf{ msgb\+\_\+push\+\_\+tl()}, and \textbf{ msgb\+\_\+tlv1\+\_\+push()}.

\mbox{\label{gsm0480_8h_aebd096ae1a396411c9c28211789189cf}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_gen\_ussd\_resp\_7bit@{gsm0480\_gen\_ussd\_resp\_7bit}}
\index{gsm0480\_gen\_ussd\_resp\_7bit@{gsm0480\_gen\_ussd\_resp\_7bit}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_gen\_ussd\_resp\_7bit()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+gen\+\_\+ussd\+\_\+resp\+\_\+7bit (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{invoke\+\_\+id,  }\item[{const char $\ast$}]{text }\end{DoxyParamCaption})}



Generate a USSD Return\+Result component containing a string in default GSM alphabet. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em invoke\+\_\+id} & Invoke\+ID of the request to which we respond \\
\hline
\mbox{\texttt{ in}}  & {\em text} & USSD text in ASCII; to be encoded as GSM 7-\/but alphabet \\
\hline
\end{DoxyParams}


References \textbf{ ASN1\+\_\+\+OCTET\+\_\+\+STRING\+\_\+\+TAG}, \textbf{ GSM0480\+\_\+\+COMPIDTAG\+\_\+\+INVOKE\+\_\+\+ID}, \textbf{ GSM0480\+\_\+\+CTYPE\+\_\+\+RETURN\+\_\+\+RESULT}, \textbf{ gsm0480\+\_\+msgb\+\_\+alloc\+\_\+name()}, \textbf{ GSM0480\+\_\+\+OP\+\_\+\+CODE\+\_\+\+PROCESS\+\_\+\+USS\+\_\+\+REQ}, \textbf{ GSM0480\+\_\+\+OPERATION\+\_\+\+CODE}, \textbf{ GSM\+\_\+0480\+\_\+\+SEQUENCE\+\_\+\+TAG}, \textbf{ gsm\+\_\+7bit\+\_\+encode\+\_\+n\+\_\+ussd()}, \textbf{ msg}, \textbf{ msgb\+\_\+push\+\_\+tl()}, \textbf{ msgb\+\_\+put()}, \textbf{ msgb\+\_\+tailroom()}, and \textbf{ msgb\+\_\+tlv1\+\_\+push()}.



Referenced by \textbf{ gsm0480\+\_\+create\+\_\+ussd\+\_\+resp()}.

\mbox{\label{gsm0480_8h_aba483f5e97431b4e4be10414228805de}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_msgb\_alloc\_name@{gsm0480\_msgb\_alloc\_name}}
\index{gsm0480\_msgb\_alloc\_name@{gsm0480\_msgb\_alloc\_name}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_msgb\_alloc\_name()}
{\footnotesize\ttfamily struct \textbf{ msgb} $\ast$ gsm0480\+\_\+msgb\+\_\+alloc\+\_\+name (\begin{DoxyParamCaption}\item[{const char $\ast$}]{name }\end{DoxyParamCaption})}



References \textbf{ msgb\+\_\+alloc\+\_\+headroom()}, and \textbf{ name}.



Referenced by \textbf{ gsm0480\+\_\+create\+\_\+notify\+SS()}, \textbf{ gsm0480\+\_\+create\+\_\+release\+\_\+complete()}, \textbf{ gsm0480\+\_\+create\+\_\+unstructured\+SS\+\_\+\+Notify()}, \textbf{ gsm0480\+\_\+create\+\_\+ussd\+\_\+release\+\_\+complete()}, \textbf{ gsm0480\+\_\+gen\+\_\+reject()}, \textbf{ gsm0480\+\_\+gen\+\_\+return\+\_\+error()}, and \textbf{ gsm0480\+\_\+gen\+\_\+ussd\+\_\+resp\+\_\+7bit()}.

\mbox{\label{gsm0480_8h_a45601e7f4a11eb628509cc7b69ad2082}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_op\_code\_name@{gsm0480\_op\_code\_name}}
\index{gsm0480\_op\_code\_name@{gsm0480\_op\_code\_name}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_op\_code\_name()}
{\footnotesize\ttfamily static const char $\ast$ gsm0480\+\_\+op\+\_\+code\+\_\+name (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{op\+\_\+code }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



References \textbf{ get\+\_\+value\+\_\+string()}, and \textbf{ gsm0480\+\_\+op\+\_\+code\+\_\+names}.

\mbox{\label{gsm0480_8h_a809a2c262a50acc5b728705b7415ebcf}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_parse\_facility\_ie@{gsm0480\_parse\_facility\_ie}}
\index{gsm0480\_parse\_facility\_ie@{gsm0480\_parse\_facility\_ie}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_parse\_facility\_ie()}
{\footnotesize\ttfamily int gsm0480\+\_\+parse\+\_\+facility\+\_\+ie (\begin{DoxyParamCaption}\item[{const uint8\+\_\+t $\ast$}]{facility\+\_\+ie,  }\item[{uint16\+\_\+t}]{length,  }\item[{struct \textbf{ ss\+\_\+request} $\ast$}]{req }\end{DoxyParamCaption})}



Parse the components of a given Facility IE. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em facility\+\_\+ie} & The Facility IE \\
\hline
\mbox{\texttt{ in}}  & {\em length} & The length of Facility IE \\
\hline
\mbox{\texttt{ out}}  & {\em req} & Abstract representation of SS message \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 in case of success, otherwise -\/ERRNO 
\end{DoxyReturn}
The internal functions are using inverted return codes, where \textquotesingle{}0\textquotesingle{} means error/failure. While a common approach is to return negative errno in case of any failure, and \textquotesingle{}0\textquotesingle{} if all is ok.

References \textbf{ DLGLOBAL}, \textbf{ GSM0480\+\_\+\+CTYPE\+\_\+\+INVOKE}, \textbf{ GSM0480\+\_\+\+CTYPE\+\_\+\+REJECT}, \textbf{ GSM0480\+\_\+\+CTYPE\+\_\+\+RETURN\+\_\+\+ERROR}, \textbf{ GSM0480\+\_\+\+CTYPE\+\_\+\+RETURN\+\_\+\+RESULT}, \textbf{ length}, \textbf{ LOGL\+\_\+\+ERROR}, \textbf{ LOGP}, \textbf{ parse\+\_\+ss\+\_\+invoke()}, and \textbf{ parse\+\_\+ss\+\_\+return\+\_\+result()}.



Referenced by \textbf{ parse\+\_\+ss\+\_\+facility()}, and \textbf{ parse\+\_\+ss\+\_\+info\+\_\+elements()}.

\mbox{\label{gsm0480_8h_ae192c22d2a9fe65d0467182afb5f4fa5}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_wrap\_facility@{gsm0480\_wrap\_facility}}
\index{gsm0480\_wrap\_facility@{gsm0480\_wrap\_facility}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_wrap\_facility()}
{\footnotesize\ttfamily int gsm0480\+\_\+wrap\+\_\+facility (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg }\end{DoxyParamCaption})}



References \textbf{ GSM0480\+\_\+\+IE\+\_\+\+FACILITY}, \textbf{ msg}, and \textbf{ msgb\+\_\+push\+\_\+tl()}.



Referenced by \textbf{ gsm0480\+\_\+create\+\_\+ussd\+\_\+notify()}.

\mbox{\label{gsm0480_8h_a9d0831f628338fe09404291acb0d8ae2}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_wrap\_invoke@{gsm0480\_wrap\_invoke}}
\index{gsm0480\_wrap\_invoke@{gsm0480\_wrap\_invoke}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_wrap\_invoke()}
{\footnotesize\ttfamily int gsm0480\+\_\+wrap\+\_\+invoke (\begin{DoxyParamCaption}\item[{struct \textbf{ msgb} $\ast$}]{msg,  }\item[{int}]{op,  }\item[{int}]{link\+\_\+id }\end{DoxyParamCaption})}



References \textbf{ GSM0480\+\_\+\+COMPIDTAG\+\_\+\+INVOKE\+\_\+\+ID}, \textbf{ GSM0480\+\_\+\+CTYPE\+\_\+\+INVOKE}, \textbf{ GSM0480\+\_\+\+OPERATION\+\_\+\+CODE}, \textbf{ link\+\_\+id}, \textbf{ msg}, \textbf{ msgb\+\_\+push\+\_\+tl()}, and \textbf{ msgb\+\_\+tlv1\+\_\+push()}.



Referenced by \textbf{ gsm0480\+\_\+create\+\_\+ussd\+\_\+notify()}.



\doxysubsection{Variable Documentation}
\mbox{\label{gsm0480_8h_a0c266598b3c89223582e832b92c237a9}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_comp\_type\_names@{gsm0480\_comp\_type\_names}}
\index{gsm0480\_comp\_type\_names@{gsm0480\_comp\_type\_names}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_comp\_type\_names}
{\footnotesize\ttfamily const struct \textbf{ value\+\_\+string} gsm0480\+\_\+comp\+\_\+type\+\_\+names[$\,$]\hspace{0.3cm}{\ttfamily [extern]}}



Referenced by \textbf{ gsm0480\+\_\+comp\+\_\+type\+\_\+name()}.

\mbox{\label{gsm0480_8h_a9be2c039ca8045f1aaeea972b6f8bb8b}} 
\index{gsm0480.h@{gsm0480.h}!gsm0480\_op\_code\_names@{gsm0480\_op\_code\_names}}
\index{gsm0480\_op\_code\_names@{gsm0480\_op\_code\_names}!gsm0480.h@{gsm0480.h}}
\doxysubsubsection{gsm0480\_op\_code\_names}
{\footnotesize\ttfamily const struct \textbf{ value\+\_\+string} gsm0480\+\_\+op\+\_\+code\+\_\+names[$\,$]\hspace{0.3cm}{\ttfamily [extern]}}



Referenced by \textbf{ gsm0480\+\_\+op\+\_\+code\+\_\+name()}.

