\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{1 \textcolor{comment}{/* Routines for generating and parsing messages */}}
\DoxyCodeLine{2 \textcolor{comment}{/* (C) 2011 by Holger Hans Peter Freyther <zecke@selfish.org>}}
\DoxyCodeLine{3 \textcolor{comment}{ *}}
\DoxyCodeLine{4 \textcolor{comment}{ * This program is free software; you can redistribute it and/or modify}}
\DoxyCodeLine{5 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}}
\DoxyCodeLine{6 \textcolor{comment}{ * the Free Software Foundation; either version 2 of the License, or}}
\DoxyCodeLine{7 \textcolor{comment}{ * (at your option) any later version.}}
\DoxyCodeLine{8 \textcolor{comment}{ *}}
\DoxyCodeLine{9 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}}
\DoxyCodeLine{10 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}}
\DoxyCodeLine{11 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the}}
\DoxyCodeLine{12 \textcolor{comment}{ * GNU General Public License for more details.}}
\DoxyCodeLine{13 \textcolor{comment}{ *}}
\DoxyCodeLine{14 \textcolor{comment}{ * You should have received a copy of the GNU General Public License}}
\DoxyCodeLine{15 \textcolor{comment}{ * along with this program.  If not, see <http://www.gnu.org/licenses/>.}}
\DoxyCodeLine{16 \textcolor{comment}{ *}}
\DoxyCodeLine{17 \textcolor{comment}{ */}}
\DoxyCodeLine{18 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{19 }
\DoxyCodeLine{20 \textcolor{preprocessor}{\#include "{}xua\_types.h"{}}}
\DoxyCodeLine{21 }
\DoxyCodeLine{22 \textcolor{preprocessor}{\#include <osmocom/core/linuxlist.h>}}
\DoxyCodeLine{23 \textcolor{preprocessor}{\#include <osmocom/sigtran/mtp\_sap.h>}}
\DoxyCodeLine{24 }
\DoxyCodeLine{25 \textcolor{preprocessor}{\#define XUA\_HDR(class, type)    ((struct xua\_common\_hdr) \{ .spare = 0, .msg\_class = (class), .msg\_type = (type) \})}}
\DoxyCodeLine{26 }
\DoxyCodeLine{27 \textcolor{keyword}{struct }msgb;}
\DoxyCodeLine{28 \textcolor{keyword}{struct }osmo\_sccp\_addr;}
\DoxyCodeLine{29 \textcolor{keyword}{struct }osmo\_sccp\_gt;}
\DoxyCodeLine{30 }
\DoxyCodeLine{31 \textcolor{keyword}{struct }xua\_msg \{}
\DoxyCodeLine{32         \textcolor{keyword}{struct }llist\_head entry; \textcolor{comment}{/* Allows queueing a xua\_msg into a llist */}}
\DoxyCodeLine{33         \textcolor{keyword}{struct }xua\_common\_hdr hdr;}
\DoxyCodeLine{34         \textcolor{keyword}{struct }osmo\_mtp\_transfer\_param mtp;}
\DoxyCodeLine{35 }
\DoxyCodeLine{36         \textcolor{keyword}{struct }llist\_head headers;}
\DoxyCodeLine{37 \};}
\DoxyCodeLine{38 }
\DoxyCodeLine{39 \textcolor{keyword}{struct }xua\_msg\_part \{}
\DoxyCodeLine{40         \textcolor{keyword}{struct }llist\_head entry;}
\DoxyCodeLine{41 }
\DoxyCodeLine{42         uint16\_t tag;}
\DoxyCodeLine{43         uint16\_t len;}
\DoxyCodeLine{44         uint8\_t  *dat;}
\DoxyCodeLine{45 }
\DoxyCodeLine{46         \textcolor{comment}{/* TODO: keep small data in the struct for perf reasons */}}
\DoxyCodeLine{47 \};}
\DoxyCodeLine{48 }
\DoxyCodeLine{49 \textcolor{keyword}{struct }xua\_msg\_class \{}
\DoxyCodeLine{50         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name;}
\DoxyCodeLine{51         \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string *msgt\_names;}
\DoxyCodeLine{52         \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string *iei\_names;}
\DoxyCodeLine{53         \textcolor{keyword}{const} uint16\_t *mand\_ies[256];}
\DoxyCodeLine{54 \};}
\DoxyCodeLine{55 }
\DoxyCodeLine{56 \textcolor{keyword}{struct }xua\_dialect \{}
\DoxyCodeLine{57         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name;}
\DoxyCodeLine{58         uint16\_t port;}
\DoxyCodeLine{59         uint16\_t ppid;}
\DoxyCodeLine{60         \textcolor{keywordtype}{int} log\_subsys;}
\DoxyCodeLine{61         \textcolor{keyword}{const} \textcolor{keyword}{struct }xua\_msg\_class *\textcolor{keyword}{class}[256];}
\DoxyCodeLine{62 \};}
\DoxyCodeLine{63 }
\DoxyCodeLine{64 \textcolor{keyword}{struct }xua\_msg\_event\_map \{}
\DoxyCodeLine{65         uint8\_t msg\_class;}
\DoxyCodeLine{66         uint8\_t msg\_type;}
\DoxyCodeLine{67         \textcolor{keywordtype}{int} event;}
\DoxyCodeLine{68 \};}
\DoxyCodeLine{69 }
\DoxyCodeLine{70 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }xua\_dialect xua\_dialect\_sua;}
\DoxyCodeLine{71 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }xua\_dialect xua\_dialect\_m3ua;}
\DoxyCodeLine{72 }
\DoxyCodeLine{73 \textcolor{keywordtype}{void} osmo\_xua\_msg\_tall\_ctx\_init(\textcolor{keywordtype}{void} *ctx);}
\DoxyCodeLine{74 }
\DoxyCodeLine{75 \textcolor{keyword}{struct }xua\_msg *xua\_msg\_alloc(\textcolor{keywordtype}{void});}
\DoxyCodeLine{76 \textcolor{keywordtype}{void} xua\_msg\_free(\textcolor{keyword}{struct} xua\_msg *msg);}
\DoxyCodeLine{77 }
\DoxyCodeLine{78 \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{79 }
\DoxyCodeLine{80 \textcolor{keyword}{struct }xua\_msg\_part *xua\_msg\_find\_tag(\textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg *msg, uint16\_t tag);}
\DoxyCodeLine{81 \textcolor{keywordtype}{int} xua\_msg\_free\_tag(\textcolor{keyword}{struct} xua\_msg *xua, uint16\_t tag);}
\DoxyCodeLine{82 \textcolor{keywordtype}{int} xua\_msg\_copy\_part(\textcolor{keyword}{struct} xua\_msg *xua\_out, uint16\_t tag\_out,}
\DoxyCodeLine{83                       \textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg *xua\_in, uint16\_t tag\_in);}
\DoxyCodeLine{84 }
\DoxyCodeLine{85 \textcolor{keyword}{struct }xua\_msg *xua\_from\_msg(\textcolor{keyword}{const} \textcolor{keywordtype}{int} version, uint16\_t len, uint8\_t *data);}
\DoxyCodeLine{86 \textcolor{keyword}{struct }msgb *xua\_to\_msg(\textcolor{keyword}{const} \textcolor{keywordtype}{int} version, \textcolor{keyword}{struct} xua\_msg *msg);}
\DoxyCodeLine{87 }
\DoxyCodeLine{88 \textcolor{keyword}{struct }xua\_msg *xua\_from\_nested(\textcolor{keyword}{struct} xua\_msg\_part *outer);}
\DoxyCodeLine{89 }
\DoxyCodeLine{90 \textcolor{keywordtype}{int} msgb\_t16l16vp\_put(\textcolor{keyword}{struct} msgb *msg, uint16\_t tag, uint16\_t len, \textcolor{keyword}{const} uint8\_t *data);}
\DoxyCodeLine{91 \textcolor{keywordtype}{int} msgb\_t16l16vp\_put\_u32(\textcolor{keyword}{struct} msgb *msg, uint16\_t tag, uint32\_t val);}
\DoxyCodeLine{92 \textcolor{keywordtype}{int} xua\_msg\_add\_u32(\textcolor{keyword}{struct} xua\_msg *xua, uint16\_t iei, uint32\_t val);}
\DoxyCodeLine{93 uint32\_t xua\_msg\_part\_get\_u32(\textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg\_part *part);}
\DoxyCodeLine{94 uint32\_t xua\_msg\_get\_u32(\textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg *xua, uint16\_t iei);}
\DoxyCodeLine{95 \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{96 \textcolor{keyword}{const} \textcolor{keywordtype}{char} *xua\_msg\_part\_get\_str(\textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg\_part *part);}
\DoxyCodeLine{97 \textcolor{keyword}{const} \textcolor{keywordtype}{char} *xua\_msg\_get\_str(\textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg *xua, uint16\_t iei);}
\DoxyCodeLine{98 \textcolor{keywordtype}{int} xua\_msg\_get\_len(\textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg *xua, uint16\_t iei);}
\DoxyCodeLine{99 \textcolor{keywordtype}{void} xua\_part\_add\_gt(\textcolor{keyword}{struct} msgb *msg, \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_sccp\_gt *gt);}
\DoxyCodeLine{100 \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{101 }
\DoxyCodeLine{102 \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{103 \textcolor{keyword}{const} \textcolor{keywordtype}{char} *xua\_class\_iei\_name(\textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg\_class *xmc, uint16\_t iei);}
\DoxyCodeLine{104 \textcolor{keywordtype}{char} *xua\_hdr\_dump(\textcolor{keyword}{struct} xua\_msg *xua, \textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_dialect *dialect);}
\DoxyCodeLine{105 \textcolor{keywordtype}{char} *xua\_msg\_dump(\textcolor{keyword}{struct} xua\_msg *xua, \textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_dialect *dialect);}
\DoxyCodeLine{106 \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{107 }
\DoxyCodeLine{108 \textcolor{keywordtype}{int} xua\_msg\_event\_map(\textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg *xua,}
\DoxyCodeLine{109                       \textcolor{keyword}{const} \textcolor{keyword}{struct} xua\_msg\_event\_map *maps,}
\DoxyCodeLine{110                       \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} num\_maps);}

\end{DoxyCode}
