\doxysection{xua\+\_\+msg.\+h}
\label{src_2xua__msg_8h_source}\index{src/xua\_msg.h@{src/xua\_msg.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*\ Routines\ for\ generating\ and\ parsing\ messages\ */}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*\ (C)\ 2011\ by\ Holger\ Hans\ Peter\ Freyther\ <zecke@selfish.org>}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ This\ program\ is\ free\ software;\ you\ can\ redistribute\ it\ and/or\ modify}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ it\ under\ the\ terms\ of\ the\ GNU\ General\ Public\ License\ as\ published\ by}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ the\ Free\ Software\ Foundation;\ either\ version\ 2\ of\ the\ License,\ or}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ (at\ your\ option)\ any\ later\ version.}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ This\ program\ is\ distributed\ in\ the\ hope\ that\ it\ will\ be\ useful,}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ but\ WITHOUT\ ANY\ WARRANTY;\ without\ even\ the\ implied\ warranty\ of}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ MERCHANTABILITY\ or\ FITNESS\ FOR\ A\ PARTICULAR\ PURPOSE.\ \ See\ the}}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *\ GNU\ General\ Public\ License\ for\ more\ details.}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ You\ should\ have\ received\ a\ copy\ of\ the\ GNU\ General\ Public\ License}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ along\ with\ this\ program.\ \ If\ not,\ see\ <http://www.gnu.org/licenses/>.}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#include\ "{}xua\_types.h"{}}}
\DoxyCodeLine{00021\ }
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#include\ <osmocom/core/linuxlist.h>}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#include\ <osmocom/sigtran/mtp\_sap.h>}}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#define\ XUA\_HDR(class,\ type)\ \ \ \ ((struct\ xua\_common\_hdr)\ \{\ .spare\ =\ 0,\ .msg\_class\ =\ (class),\ .msg\_type\ =\ (type)\ \})}}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00027\ \textcolor{keyword}{struct\ }msgb;}
\DoxyCodeLine{00028\ \textcolor{keyword}{struct\ }osmo\_sccp\_addr;}
\DoxyCodeLine{00029\ \textcolor{keyword}{struct\ }osmo\_sccp\_gt;}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ \textcolor{keyword}{struct\ }xua\_msg\ \{}
\DoxyCodeLine{00032\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }llist\_head\ entry;\ \textcolor{comment}{/*\ Allows\ queueing\ a\ xua\_msg\ into\ a\ llist\ */}}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }xua\_common\_hdr\ hdr;}
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }osmo\_mtp\_transfer\_param\ mtp;}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }llist\_head\ headers;}
\DoxyCodeLine{00037\ \};}
\DoxyCodeLine{00038\ }
\DoxyCodeLine{00039\ \textcolor{keyword}{struct\ }xua\_msg\_part\ \{}
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }llist\_head\ entry;}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ uint16\_t\ tag;}
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ uint16\_t\ len;}
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ uint8\_t\ \ *dat;}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00046\ \ \ \ \ \ \ \ \ \textcolor{comment}{/*\ TODO:\ keep\ small\ data\ in\ the\ struct\ for\ perf\ reasons\ */}}
\DoxyCodeLine{00047\ \};}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00049\ \textcolor{keyword}{struct\ }xua\_msg\_class\ \{}
\DoxyCodeLine{00050\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *name;}
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{struct\ }value\_string\ *msgt\_names;}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{struct\ }value\_string\ *iei\_names;}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ uint16\_t\ *mand\_ies[256];}
\DoxyCodeLine{00054\ \};}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00056\ \textcolor{keyword}{struct\ }xua\_dialect\ \{}
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *name;}
\DoxyCodeLine{00058\ \ \ \ \ \ \ \ \ uint16\_t\ port;}
\DoxyCodeLine{00059\ \ \ \ \ \ \ \ \ uint16\_t\ ppid;}
\DoxyCodeLine{00060\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ log\_subsys;}
\DoxyCodeLine{00061\ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{struct\ }xua\_msg\_class\ *\textcolor{keyword}{class}[256];}
\DoxyCodeLine{00062\ \};}
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00064\ \textcolor{keyword}{struct\ }xua\_msg\_event\_map\ \{}
\DoxyCodeLine{00065\ \ \ \ \ \ \ \ \ uint8\_t\ msg\_class;}
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ uint8\_t\ msg\_type;}
\DoxyCodeLine{00067\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ event;}
\DoxyCodeLine{00068\ \};}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ \textcolor{keyword}{extern}\ \textcolor{keyword}{const}\ \textcolor{keyword}{struct\ }xua\_dialect\ xua\_dialect\_sua;}
\DoxyCodeLine{00071\ \textcolor{keyword}{extern}\ \textcolor{keyword}{const}\ \textcolor{keyword}{struct\ }xua\_dialect\ xua\_dialect\_m3ua;}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ \textcolor{keywordtype}{void}\ osmo\_xua\_msg\_tall\_ctx\_init(\textcolor{keywordtype}{void}\ *ctx);}
\DoxyCodeLine{00074\ }
\DoxyCodeLine{00075\ \textcolor{keyword}{struct\ }xua\_msg\ *xua\_msg\_alloc(\textcolor{keywordtype}{void});}
\DoxyCodeLine{00076\ \textcolor{keywordtype}{void}\ xua\_msg\_free(\textcolor{keyword}{struct}\ xua\_msg\ *msg);}
\DoxyCodeLine{00077\ \textcolor{keyword}{struct\ }xua\_msg\ *xua\_msg\_copy(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *xua\_in);}
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00079\ \textcolor{keywordtype}{int}\ xua\_msg\_add\_data(\textcolor{keyword}{struct}\ xua\_msg\ *msg,\ uint16\_t\ tag,\ uint16\_t\ len,\ \textcolor{keyword}{const}\ uint8\_t\ *dat);}
\DoxyCodeLine{00080\ \textcolor{keywordtype}{int}\ xua\_msg\_add\_u32\_data(\textcolor{keyword}{struct}\ xua\_msg\ *msg,\ uint16\_t\ tag,\ uint16\_t\ len,\ \textcolor{keyword}{const}\ uint8\_t\ *dat);}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00082\ \textcolor{keyword}{struct\ }xua\_msg\_part\ *xua\_msg\_find\_tag(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *msg,\ uint16\_t\ tag);}
\DoxyCodeLine{00083\ \textcolor{keywordtype}{int}\ xua\_msg\_free\_tag(\textcolor{keyword}{struct}\ xua\_msg\ *xua,\ uint16\_t\ tag);}
\DoxyCodeLine{00084\ \textcolor{keywordtype}{int}\ xua\_msg\_copy\_part(\textcolor{keyword}{struct}\ xua\_msg\ *xua\_out,\ uint16\_t\ tag\_out,}
\DoxyCodeLine{00085\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *xua\_in,\ uint16\_t\ tag\_in);}
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00087\ \textcolor{keyword}{struct\ }xua\_msg\ *xua\_from\_msg(\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ version,\ uint16\_t\ len,\ uint8\_t\ *data);}
\DoxyCodeLine{00088\ \textcolor{keyword}{struct\ }msgb\ *xua\_to\_msg(\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ version,\ \textcolor{keyword}{struct}\ xua\_msg\ *msg);}
\DoxyCodeLine{00089\ }
\DoxyCodeLine{00090\ \textcolor{keyword}{struct\ }xua\_msg\ *xua\_from\_nested(\textcolor{keyword}{struct}\ xua\_msg\_part\ *outer);}
\DoxyCodeLine{00091\ }
\DoxyCodeLine{00092\ \textcolor{keywordtype}{int}\ msgb\_t16l16vp\_put(\textcolor{keyword}{struct}\ msgb\ *msg,\ uint16\_t\ tag,\ uint16\_t\ len,\ \textcolor{keyword}{const}\ uint8\_t\ *data);}
\DoxyCodeLine{00093\ \textcolor{keywordtype}{int}\ msgb\_t16l16vp\_put\_u32(\textcolor{keyword}{struct}\ msgb\ *msg,\ uint16\_t\ tag,\ uint32\_t\ val);}
\DoxyCodeLine{00094\ \textcolor{keywordtype}{int}\ xua\_msg\_add\_u32(\textcolor{keyword}{struct}\ xua\_msg\ *xua,\ uint16\_t\ iei,\ uint32\_t\ val);}
\DoxyCodeLine{00095\ uint32\_t\ xua\_msg\_part\_get\_u32(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\_part\ *part);}
\DoxyCodeLine{00096\ uint32\_t\ xua\_msg\_get\_u32(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *xua,\ uint16\_t\ iei);}
\DoxyCodeLine{00097\ \textcolor{keyword}{const}\ uint32\_t\ *xua\_msg\_get\_u32p(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *xua,\ uint16\_t\ iei,\ uint32\_t\ *out);}
\DoxyCodeLine{00098\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *xua\_msg\_part\_get\_str(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\_part\ *part);}
\DoxyCodeLine{00099\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *xua\_msg\_get\_str(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *xua,\ uint16\_t\ iei);}
\DoxyCodeLine{00100\ \textcolor{keywordtype}{int}\ xua\_msg\_get\_len(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *xua,\ uint16\_t\ iei);}
\DoxyCodeLine{00101\ \textcolor{keywordtype}{void}\ xua\_part\_add\_gt(\textcolor{keyword}{struct}\ msgb\ *msg,\ \textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_sccp\_gt\ *gt);}
\DoxyCodeLine{00102\ \textcolor{keywordtype}{int}\ xua\_msg\_add\_sccp\_addr(\textcolor{keyword}{struct}\ xua\_msg\ *xua,\ uint16\_t\ iei,\ \textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ osmo\_sccp\_addr\ *addr);}
\DoxyCodeLine{00103\ }
\DoxyCodeLine{00104\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *xua\_class\_msg\_name(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\_class\ *xmc,\ uint16\_t\ msg\_type);}
\DoxyCodeLine{00105\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *xua\_class\_iei\_name(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\_class\ *xmc,\ uint16\_t\ iei);}
\DoxyCodeLine{00106\ \textcolor{keywordtype}{char}\ *xua\_hdr\_dump(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *xua,\ \textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_dialect\ *dialect);}
\DoxyCodeLine{00107\ \textcolor{keywordtype}{char}\ *xua\_msg\_dump(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *xua,\ \textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_dialect\ *dialect);}
\DoxyCodeLine{00108\ \textcolor{keywordtype}{int}\ xua\_dialect\_check\_all\_mand\_ies(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_dialect\ *dialect,\ \textcolor{keyword}{struct}\ xua\_msg\ *xua);}
\DoxyCodeLine{00109\ }
\DoxyCodeLine{00110\ \textcolor{keywordtype}{int}\ xua\_msg\_event\_map(\textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\ *xua,}
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{struct}\ xua\_msg\_event\_map\ *maps,}
\DoxyCodeLine{00112\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ num\_maps);}

\end{DoxyCode}
