\doxysection{m3ua.\+h}
\label{m3ua_8h_source}\index{include/osmocom/sigtran/protocol/m3ua.h@{include/osmocom/sigtran/protocol/m3ua.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 \textcolor{comment}{/* RFC 4666 M3UA SCCP User Adaption  */}}
\DoxyCodeLine{2 }
\DoxyCodeLine{3 \textcolor{comment}{/* (C) 2017 by Harald Welte <laforge@gnumonks.org>}}
\DoxyCodeLine{4 \textcolor{comment}{ *}}
\DoxyCodeLine{5 \textcolor{comment}{ * All Rights Reserved}}
\DoxyCodeLine{6 \textcolor{comment}{ *}}
\DoxyCodeLine{7 \textcolor{comment}{ * This program is free software; you can redistribute it and/or modify}}
\DoxyCodeLine{8 \textcolor{comment}{ * it under the terms of the GNU General Public License as}}
\DoxyCodeLine{9 \textcolor{comment}{ * published by the Free Software Foundation; either version 2 of the}}
\DoxyCodeLine{10 \textcolor{comment}{ * License, or (at your option) any later version.}}
\DoxyCodeLine{11 \textcolor{comment}{ *}}
\DoxyCodeLine{12 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}}
\DoxyCodeLine{13 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}}
\DoxyCodeLine{14 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the}}
\DoxyCodeLine{15 \textcolor{comment}{ * GNU General Public License for more details.}}
\DoxyCodeLine{16 \textcolor{comment}{ *}}
\DoxyCodeLine{17 \textcolor{comment}{ * You should have received a copy of the GNU General Public License}}
\DoxyCodeLine{18 \textcolor{comment}{ * along with this program.  If not, see <http://www.gnu.org/licenses/>.}}
\DoxyCodeLine{19 \textcolor{comment}{ */}}
\DoxyCodeLine{20 }
\DoxyCodeLine{21 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{22 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{23 }
\DoxyCodeLine{24 \textcolor{preprocessor}{\#define M3UA\_VERSION    1}}
\DoxyCodeLine{25 \textcolor{preprocessor}{\#define M3UA\_PPID       3}}
\DoxyCodeLine{26 \textcolor{preprocessor}{\#define M3UA\_PORT       2905}}
\DoxyCodeLine{27 }
\DoxyCodeLine{28 \textcolor{comment}{/* 3.1.2 Message Classes */}}
\DoxyCodeLine{29 \textcolor{preprocessor}{\#define M3UA\_MSGC\_MGMT  0}}
\DoxyCodeLine{30 \textcolor{preprocessor}{\#define M3UA\_MSGC\_XFER  1}}
\DoxyCodeLine{31 \textcolor{preprocessor}{\#define M3UA\_MSGC\_SNM   2}}
\DoxyCodeLine{32 \textcolor{preprocessor}{\#define M3UA\_MSGC\_ASPSM 3}}
\DoxyCodeLine{33 \textcolor{preprocessor}{\#define M3UA\_MSGC\_ASPTM 4}}
\DoxyCodeLine{34 \textcolor{preprocessor}{\#define M3UA\_MSGC\_RKM   9}}
\DoxyCodeLine{35 }
\DoxyCodeLine{36 \textcolor{comment}{/* 3.1.3 Message Types */}}
\DoxyCodeLine{37 \textcolor{preprocessor}{\#define M3UA\_MGMT\_ERR   0}}
\DoxyCodeLine{38 \textcolor{preprocessor}{\#define M3UA\_MGMT\_NTFY  1}}
\DoxyCodeLine{39 }
\DoxyCodeLine{40 \textcolor{preprocessor}{\#define M3UA\_XFER\_DATA  1}}
\DoxyCodeLine{41 }
\DoxyCodeLine{42 \textcolor{preprocessor}{\#define M3UA\_SNM\_DUNA   1}}
\DoxyCodeLine{43 \textcolor{preprocessor}{\#define M3UA\_SNM\_DAVA   2}}
\DoxyCodeLine{44 \textcolor{preprocessor}{\#define M3UA\_SNM\_DAUD   3}}
\DoxyCodeLine{45 \textcolor{preprocessor}{\#define M3UA\_SNM\_SCON   4}}
\DoxyCodeLine{46 \textcolor{preprocessor}{\#define M3UA\_SNM\_DUPU   5}}
\DoxyCodeLine{47 \textcolor{preprocessor}{\#define M3UA\_SNM\_DRST   6}}
\DoxyCodeLine{48 }
\DoxyCodeLine{49 \textcolor{preprocessor}{\#define M3UA\_ASPSM\_UP           1}}
\DoxyCodeLine{50 \textcolor{preprocessor}{\#define M3UA\_ASPSM\_DOWN         2}}
\DoxyCodeLine{51 \textcolor{preprocessor}{\#define M3UA\_ASPSM\_BEAT         3}}
\DoxyCodeLine{52 \textcolor{preprocessor}{\#define M3UA\_ASPSM\_UP\_ACK       4}}
\DoxyCodeLine{53 \textcolor{preprocessor}{\#define M3UA\_ASPSM\_DOWN\_ACK     5}}
\DoxyCodeLine{54 \textcolor{preprocessor}{\#define M3UA\_ASPSM\_BEAT\_ACK     6}}
\DoxyCodeLine{55 }
\DoxyCodeLine{56 \textcolor{preprocessor}{\#define M3UA\_ASPTM\_ACTIVE       1}}
\DoxyCodeLine{57 \textcolor{preprocessor}{\#define M3UA\_ASPTM\_INACTIVE     2}}
\DoxyCodeLine{58 \textcolor{preprocessor}{\#define M3UA\_ASPTM\_ACTIVE\_ACK   3}}
\DoxyCodeLine{59 \textcolor{preprocessor}{\#define M3UA\_ASPTM\_INACTIVE\_ACK 4}}
\DoxyCodeLine{60 }
\DoxyCodeLine{61 \textcolor{preprocessor}{\#define M3UA\_RKM\_REG\_REQ        1}}
\DoxyCodeLine{62 \textcolor{preprocessor}{\#define M3UA\_RKM\_REG\_RSP        2}}
\DoxyCodeLine{63 \textcolor{preprocessor}{\#define M3UA\_RKM\_DEREG\_REQ      3}}
\DoxyCodeLine{64 \textcolor{preprocessor}{\#define M3UA\_RKM\_DEREG\_RSP      4}}
\DoxyCodeLine{65 }
\DoxyCodeLine{66 \textcolor{preprocessor}{\#define M3UA\_IEI\_INFO\_STRING    0x0004}}
\DoxyCodeLine{67 \textcolor{preprocessor}{\#define M3UA\_IEI\_ROUTE\_CTX      0x0006}}
\DoxyCodeLine{68 \textcolor{preprocessor}{\#define M3UA\_IEI\_DIAG\_INFO      0x0007}}
\DoxyCodeLine{69 \textcolor{preprocessor}{\#define M3UA\_IEI\_HEARDBT\_DATA   0x0009}}
\DoxyCodeLine{70 \textcolor{preprocessor}{\#define M3UA\_IEI\_TRAF\_MODE\_TYP  0x000b}}
\DoxyCodeLine{71 \textcolor{preprocessor}{\#define M3UA\_IEI\_ERR\_CODE       0x000c}}
\DoxyCodeLine{72 \textcolor{preprocessor}{\#define M3UA\_IEI\_STATUS         0x000d}}
\DoxyCodeLine{73 \textcolor{preprocessor}{\#define M3UA\_IEI\_ASP\_ID         0x0011}}
\DoxyCodeLine{74 \textcolor{preprocessor}{\#define M3UA\_IEI\_AFFECTED\_PC    0x0012}}
\DoxyCodeLine{75 \textcolor{preprocessor}{\#define M3UA\_IEI\_CORR\_ID        0x0013}}
\DoxyCodeLine{76 }
\DoxyCodeLine{77 \textcolor{comment}{/* 3.2 M3UA specific parameters */}}
\DoxyCodeLine{78 }
\DoxyCodeLine{79 \textcolor{preprocessor}{\#define M3UA\_IEI\_NET\_APPEAR     0x0200}}
\DoxyCodeLine{80 \textcolor{preprocessor}{\#define M3UA\_IEI\_USER\_CAUSE     0x0204}}
\DoxyCodeLine{81 \textcolor{preprocessor}{\#define M3UA\_IEI\_CONG\_IND       0x0205}}
\DoxyCodeLine{82 \textcolor{preprocessor}{\#define M3UA\_IEI\_CONC\_DEST      0x0206}}
\DoxyCodeLine{83 \textcolor{preprocessor}{\#define M3UA\_IEI\_ROUT\_KEY       0x0207}}
\DoxyCodeLine{84 \textcolor{preprocessor}{\#define M3UA\_IEI\_REG\_RESULT     0x0208}}
\DoxyCodeLine{85 \textcolor{preprocessor}{\#define M3UA\_IEI\_DEREG\_RESULT   0x0209}}
\DoxyCodeLine{86 \textcolor{preprocessor}{\#define M3UA\_IEI\_LOC\_RKEY\_ID    0x020a}}
\DoxyCodeLine{87 \textcolor{preprocessor}{\#define M3UA\_IEI\_DEST\_PC        0x020b}}
\DoxyCodeLine{88 \textcolor{preprocessor}{\#define M3UA\_IEI\_SVC\_IND        0x020c}}
\DoxyCodeLine{89 \textcolor{preprocessor}{\#define M3UA\_IEI\_ORIG\_PC        0x020e}}
\DoxyCodeLine{90 \textcolor{preprocessor}{\#define M3UA\_IEI\_PROT\_DATA      0x0210}}
\DoxyCodeLine{91 \textcolor{preprocessor}{\#define M3UA\_IEI\_REG\_STATUS     0x0212}}
\DoxyCodeLine{92 \textcolor{preprocessor}{\#define M3UA\_IEI\_DEREG\_STATUS   0x0213}}
\DoxyCodeLine{93 }
\DoxyCodeLine{94 \textcolor{comment}{/* 3.3.1 Payload Data Message */}}
\DoxyCodeLine{95 \textcolor{keyword}{struct }m3ua\_data\_hdr \{}
\DoxyCodeLine{96         uint32\_t opc;        \textcolor{comment}{/* Originating Point Code */}}
\DoxyCodeLine{97         uint32\_t dpc;        \textcolor{comment}{/* Destination Point Code */}}
\DoxyCodeLine{98         uint8\_t si;   \textcolor{comment}{/* Service Indicator */}}
\DoxyCodeLine{99         uint8\_t ni;   \textcolor{comment}{/* Network Indicator */}}
\DoxyCodeLine{100         uint8\_t mp;   \textcolor{comment}{/* Message Priority */}}
\DoxyCodeLine{101         uint8\_t sls; \textcolor{comment}{/* Signalling Link Selection */}}
\DoxyCodeLine{102 \} \_\_attribute\_\_ ((packed));}
\DoxyCodeLine{103 }
\DoxyCodeLine{104 \textcolor{comment}{/* 3.8.2 Notify */}}
\DoxyCodeLine{105 }
\DoxyCodeLine{106 \textcolor{preprocessor}{\#define M3UA\_NOTIFY(type, info) ((info) << 16 | (type))}}
\DoxyCodeLine{107 \textcolor{preprocessor}{\#define M3UA\_NOTIFY\_T\_STATCHG   1}}
\DoxyCodeLine{108 \textcolor{preprocessor}{\#define M3UA\_NOTIFY\_T\_OTHER     2}}
\DoxyCodeLine{109 }
\DoxyCodeLine{110 \textcolor{preprocessor}{\#define M3UA\_NOTIFY\_I\_RESERVED  1}}
\DoxyCodeLine{111 \textcolor{preprocessor}{\#define M3UA\_NOTIFY\_I\_AS\_INACT  2}}
\DoxyCodeLine{112 \textcolor{preprocessor}{\#define M3UA\_NOTIFY\_I\_AS\_ACT    3}}
\DoxyCodeLine{113 \textcolor{preprocessor}{\#define M3UA\_NOTIFY\_I\_AS\_PEND   4}}
\DoxyCodeLine{114 }
\DoxyCodeLine{115 \textcolor{preprocessor}{\#define M3UA\_NOTIFY\_I\_OT\_INS\_RES        1}}
\DoxyCodeLine{116 \textcolor{preprocessor}{\#define M3UA\_NOTIFY\_I\_OT\_ALT\_ASP\_ACT    2}}
\DoxyCodeLine{117 \textcolor{preprocessor}{\#define M3UA\_NOTIFY\_I\_OT\_ASP\_FAILURE    3}}
\DoxyCodeLine{118 }
\DoxyCodeLine{119 \textcolor{comment}{/* 3.6.2 Registration Status */}}
\DoxyCodeLine{120 \textcolor{keyword}{enum} m3ua\_rkm\_reg\_status \{}
\DoxyCodeLine{121         M3UA\_RKM\_REG\_SUCCESS                        = 0,}
\DoxyCodeLine{122         M3UA\_RKM\_REG\_ERR\_UNKNOWN                = 1,}
\DoxyCodeLine{123         M3UA\_RKM\_REG\_ERR\_INVAL\_DPC            = 2,}
\DoxyCodeLine{124         M3UA\_RKM\_REG\_ERR\_INVAL\_NET\_APPEAR      = 3,}
\DoxyCodeLine{125         M3UA\_RKM\_REG\_ERR\_INVAL\_RKEY          = 4,}
\DoxyCodeLine{126         M3UA\_RKM\_REG\_ERR\_PERM\_DENIED                = 5,}
\DoxyCodeLine{127         M3UA\_RKM\_REG\_ERR\_CANT\_SUPP\_UNQ\_RT      = 6,}
\DoxyCodeLine{128         M3UA\_RKM\_REG\_ERR\_RKEY\_NOT\_PROVD          = 7,}
\DoxyCodeLine{129         M3UA\_RKM\_REG\_ERR\_INSUFF\_RESRC              = 8,}
\DoxyCodeLine{130         M3UA\_RKM\_REG\_ERR\_UNSUPP\_RK\_PARAM        = 9,}
\DoxyCodeLine{131         M3UA\_RKM\_REG\_ERR\_UNSUPP\_TRAF\_MODE      = 10,}
\DoxyCodeLine{132         M3UA\_RKM\_REG\_ERR\_RKEY\_CHG\_REFUSED      = 11,}
\DoxyCodeLine{133         M3UA\_RKM\_REG\_ERR\_RKEY\_ALRDY\_REGD        = 12,}
\DoxyCodeLine{134 \};}
\DoxyCodeLine{135 }
\DoxyCodeLine{136 \textcolor{keyword}{enum} m3ua\_rkm\_dereg\_satus \{}
\DoxyCodeLine{137         M3UA\_RKM\_DEREG\_SUCCESS            = 0,}
\DoxyCodeLine{138         M3UA\_RKM\_DEREG\_ERR\_UNKNOWN    = 1,}
\DoxyCodeLine{139         M3UA\_RKM\_DEREG\_ERR\_INVAL\_RCTX      = 2,}
\DoxyCodeLine{140         M3UA\_RKM\_DEREG\_ERR\_PERM\_DENIED    = 3,}
\DoxyCodeLine{141         M3UA\_RKM\_DEREG\_ERR\_NOT\_REGD  = 4,}
\DoxyCodeLine{142         M3UA\_RKM\_DEREG\_ERR\_ASP\_ACTIVE      = 5,}
\DoxyCodeLine{143 \};}
\DoxyCodeLine{144 }
\DoxyCodeLine{145 \textcolor{comment}{/* 3.8.1 Error */}}
\DoxyCodeLine{146 \textcolor{keyword}{enum} m3ua\_error\_code \{}
\DoxyCodeLine{147         M3UA\_ERR\_INVALID\_VERSION        = 0x01,}
\DoxyCodeLine{148         \textcolor{comment}{/* not used in M3UA */}}
\DoxyCodeLine{149         M3UA\_ERR\_UNSUPP\_MSG\_CLASS      = 0x03,}
\DoxyCodeLine{150         M3UA\_ERR\_UNSUPP\_MSG\_TYPE        = 0x04,}
\DoxyCodeLine{151         M3UA\_ERR\_UNSUPP\_TRAF\_MOD\_TYP        = 0x05,}
\DoxyCodeLine{152         M3UA\_ERR\_UNEXPECTED\_MSG          = 0x06,}
\DoxyCodeLine{153         M3UA\_ERR\_PROTOCOL\_ERR              = 0x07,}
\DoxyCodeLine{154         \textcolor{comment}{/* not used in M3UA */}}
\DoxyCodeLine{155         M3UA\_ERR\_INVAL\_STREAM\_ID        = 0x09,}
\DoxyCodeLine{156         \textcolor{comment}{/* not used in M3UA */}}
\DoxyCodeLine{157         \textcolor{comment}{/* not used in M3UA */}}
\DoxyCodeLine{158         \textcolor{comment}{/* not used in M3UA */}}
\DoxyCodeLine{159         M3UA\_ERR\_REFUSED\_MGMT\_BLOCKING    = 0x0d,}
\DoxyCodeLine{160         M3UA\_ERR\_ASP\_ID\_REQD                = 0x0e,}
\DoxyCodeLine{161         M3UA\_ERR\_INVAL\_ASP\_ID              = 0x0f,}
\DoxyCodeLine{162         \textcolor{comment}{/* not used in M3UA */}}
\DoxyCodeLine{163         M3UA\_ERR\_INVAL\_PARAM\_VAL        = 0x11,}
\DoxyCodeLine{164         M3UA\_ERR\_PARAM\_FIELD\_ERR        = 0x12,}
\DoxyCodeLine{165         M3UA\_ERR\_UNEXP\_PARAM                = 0x13,}
\DoxyCodeLine{166         M3UA\_ERR\_DEST\_STATUS\_UNKN      = 0x14,}
\DoxyCodeLine{167         M3UA\_ERR\_INVAL\_NET\_APPEAR      = 0x15,}
\DoxyCodeLine{168         M3UA\_ERR\_MISSING\_PARAM            = 0x16,}
\DoxyCodeLine{169         \textcolor{comment}{/* not used in M3UA */}}
\DoxyCodeLine{170         \textcolor{comment}{/* not used in M3UA */}}
\DoxyCodeLine{171         M3UA\_ERR\_INVAL\_ROUT\_CTX          = 0x19,}
\DoxyCodeLine{172         M3UA\_ERR\_NO\_CONFGD\_AS\_FOR\_ASP      = 0x1a,}
\DoxyCodeLine{173 \};}
\DoxyCodeLine{174 }
\DoxyCodeLine{175 \textcolor{comment}{/* Traffic Mode Type */}}
\DoxyCodeLine{176 \textcolor{keyword}{enum} m3ua\_traffic\_mode \{}
\DoxyCodeLine{177         M3UA\_TMOD\_OVERRIDE    = 1,}
\DoxyCodeLine{178         M3UA\_TMOD\_LOADSHARE  = 2,}
\DoxyCodeLine{179         M3UA\_TMOD\_BCAST          = 3,}
\DoxyCodeLine{180 \};}

\end{DoxyCode}
