libosmo-sigtran 2.2.1.95-893c Osmocom SIGTRAN library

m3ua.h
Go to the documentation of this file.
1/* RFC 4666 M3UA SCCP User Adaption */
2
3/* (C) 2017 by Harald Welte <laforge@gnumonks.org>
4 *
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22#include <stdint.h>
23
24#define M3UA_VERSION 1
25#define M3UA_PPID 3
26#define M3UA_PORT 2905
27
28/* 3.1.2 Message Classes */
29#define M3UA_MSGC_MGMT 0
30#define M3UA_MSGC_XFER 1
31#define M3UA_MSGC_SNM 2
32#define M3UA_MSGC_ASPSM 3
33#define M3UA_MSGC_ASPTM 4
34#define M3UA_MSGC_RKM 9
35
36/* 3.1.3 Message Types */
37#define M3UA_MGMT_ERR 0
38#define M3UA_MGMT_NTFY 1
39
40#define M3UA_XFER_DATA 1
41
42#define M3UA_SNM_DUNA 1
43#define M3UA_SNM_DAVA 2
44#define M3UA_SNM_DAUD 3
45#define M3UA_SNM_SCON 4
46#define M3UA_SNM_DUPU 5
47#define M3UA_SNM_DRST 6
48
49#define M3UA_ASPSM_UP 1
50#define M3UA_ASPSM_DOWN 2
51#define M3UA_ASPSM_BEAT 3
52#define M3UA_ASPSM_UP_ACK 4
53#define M3UA_ASPSM_DOWN_ACK 5
54#define M3UA_ASPSM_BEAT_ACK 6
55
56#define M3UA_ASPTM_ACTIVE 1
57#define M3UA_ASPTM_INACTIVE 2
58#define M3UA_ASPTM_ACTIVE_ACK 3
59#define M3UA_ASPTM_INACTIVE_ACK 4
60
61#define M3UA_RKM_REG_REQ 1
62#define M3UA_RKM_REG_RSP 2
63#define M3UA_RKM_DEREG_REQ 3
64#define M3UA_RKM_DEREG_RSP 4
65
66#define M3UA_IEI_INFO_STRING 0x0004
67#define M3UA_IEI_ROUTE_CTX 0x0006
68#define M3UA_IEI_DIAG_INFO 0x0007
69#define M3UA_IEI_HEARDBT_DATA 0x0009
70#define M3UA_IEI_TRAF_MODE_TYP 0x000b
71#define M3UA_IEI_ERR_CODE 0x000c
72#define M3UA_IEI_STATUS 0x000d
73#define M3UA_IEI_ASP_ID 0x0011
74#define M3UA_IEI_AFFECTED_PC 0x0012
75#define M3UA_IEI_CORR_ID 0x0013
76
77/* 3.2 M3UA specific parameters */
78
79#define M3UA_IEI_NET_APPEAR 0x0200
80#define M3UA_IEI_USER_CAUSE 0x0204
81#define M3UA_IEI_CONG_IND 0x0205
82#define M3UA_IEI_CONC_DEST 0x0206
83#define M3UA_IEI_ROUT_KEY 0x0207
84#define M3UA_IEI_REG_RESULT 0x0208
85#define M3UA_IEI_DEREG_RESULT 0x0209
86#define M3UA_IEI_LOC_RKEY_ID 0x020a
87#define M3UA_IEI_DEST_PC 0x020b
88#define M3UA_IEI_SVC_IND 0x020c
89#define M3UA_IEI_ORIG_PC 0x020e
90#define M3UA_IEI_PROT_DATA 0x0210
91#define M3UA_IEI_REG_STATUS 0x0212
92#define M3UA_IEI_DEREG_STATUS 0x0213
93
94/* 3.3.1 Payload Data Message */
95 struct m3ua_data_hdr {
96 uint32_t opc; /* Originating Point Code */
97 uint32_t dpc; /* Destination Point Code */
98 uint8_t si; /* Service Indicator */
99 uint8_t ni; /* Network Indicator */
100 uint8_t mp; /* Message Priority */
101 uint8_t sls; /* Signalling Link Selection */
102} __attribute__ ((packed));
103
104/* 3.8.2 Notify */
105
106#define M3UA_NOTIFY(type, info) ((info) << 16 | (type))
107#define M3UA_NOTIFY_T_STATCHG 1
108#define M3UA_NOTIFY_T_OTHER 2
109
110#define M3UA_NOTIFY_I_RESERVED 1
111#define M3UA_NOTIFY_I_AS_INACT 2
112#define M3UA_NOTIFY_I_AS_ACT 3
113#define M3UA_NOTIFY_I_AS_PEND 4
114
115#define M3UA_NOTIFY_I_OT_INS_RES 1
116#define M3UA_NOTIFY_I_OT_ALT_ASP_ACT 2
117#define M3UA_NOTIFY_I_OT_ASP_FAILURE 3
118
119/* 3.6.2 Registration Status */
120 enum m3ua_rkm_reg_status {
121 M3UA_RKM_REG_SUCCESS = 0,
122 M3UA_RKM_REG_ERR_UNKNOWN = 1,
123 M3UA_RKM_REG_ERR_INVAL_DPC = 2,
124 M3UA_RKM_REG_ERR_INVAL_NET_APPEAR = 3,
125 M3UA_RKM_REG_ERR_INVAL_RKEY = 4,
126 M3UA_RKM_REG_ERR_PERM_DENIED = 5,
127 M3UA_RKM_REG_ERR_CANT_SUPP_UNQ_RT = 6,
128 M3UA_RKM_REG_ERR_RKEY_NOT_PROVD = 7,
129 M3UA_RKM_REG_ERR_INSUFF_RESRC = 8,
130 M3UA_RKM_REG_ERR_UNSUPP_RK_PARAM = 9,
131 M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE = 10,
132 M3UA_RKM_REG_ERR_RKEY_CHG_REFUSED = 11,
133 M3UA_RKM_REG_ERR_RKEY_ALRDY_REGD = 12,
134};
135
136 enum m3ua_rkm_dereg_satus {
137 M3UA_RKM_DEREG_SUCCESS = 0,
138 M3UA_RKM_DEREG_ERR_UNKNOWN = 1,
139 M3UA_RKM_DEREG_ERR_INVAL_RCTX = 2,
140 M3UA_RKM_DEREG_ERR_PERM_DENIED = 3,
141 M3UA_RKM_DEREG_ERR_NOT_REGD = 4,
142 M3UA_RKM_DEREG_ERR_ASP_ACTIVE = 5,
143};
144
145/* 3.8.1 Error */
146 enum m3ua_error_code {
147 M3UA_ERR_INVALID_VERSION = 0x01,
148 /* not used in M3UA */
149 M3UA_ERR_UNSUPP_MSG_CLASS = 0x03,
150 M3UA_ERR_UNSUPP_MSG_TYPE = 0x04,
151 M3UA_ERR_UNSUPP_TRAF_MOD_TYP = 0x05,
152 M3UA_ERR_UNEXPECTED_MSG = 0x06,
153 M3UA_ERR_PROTOCOL_ERR = 0x07,
154 /* not used in M3UA */
155 M3UA_ERR_INVAL_STREAM_ID = 0x09,
156 /* not used in M3UA */
157 /* not used in M3UA */
158 /* not used in M3UA */
159 M3UA_ERR_REFUSED_MGMT_BLOCKING = 0x0d,
160 M3UA_ERR_ASP_ID_REQD = 0x0e,
161 M3UA_ERR_INVAL_ASP_ID = 0x0f,
162 /* not used in M3UA */
163 M3UA_ERR_INVAL_PARAM_VAL = 0x11,
164 M3UA_ERR_PARAM_FIELD_ERR = 0x12,
165 M3UA_ERR_UNEXP_PARAM = 0x13,
166 M3UA_ERR_DEST_STATUS_UNKN = 0x14,
167 M3UA_ERR_INVAL_NET_APPEAR = 0x15,
168 M3UA_ERR_MISSING_PARAM = 0x16,
169 /* not used in M3UA */
170 /* not used in M3UA */
171 M3UA_ERR_INVAL_ROUT_CTX = 0x19,
172 M3UA_ERR_NO_CONFGD_AS_FOR_ASP = 0x1a,
173};
174
175/* Traffic Mode Type */
176 enum m3ua_traffic_mode {
177 M3UA_TMOD_OVERRIDE = 1,
178 M3UA_TMOD_LOADSHARE = 2,
179 M3UA_TMOD_BCAST = 3,
180};
m3ua_rkm_reg_status
m3ua_rkm_reg_status
Definition: m3ua.h:120
M3UA_RKM_REG_ERR_INVAL_RKEY
@ M3UA_RKM_REG_ERR_INVAL_RKEY
Definition: m3ua.h:125
M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE
@ M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE
Definition: m3ua.h:131
M3UA_RKM_REG_ERR_INVAL_NET_APPEAR
@ M3UA_RKM_REG_ERR_INVAL_NET_APPEAR
Definition: m3ua.h:124
M3UA_RKM_REG_ERR_RKEY_ALRDY_REGD
@ M3UA_RKM_REG_ERR_RKEY_ALRDY_REGD
Definition: m3ua.h:133
M3UA_RKM_REG_ERR_RKEY_NOT_PROVD
@ M3UA_RKM_REG_ERR_RKEY_NOT_PROVD
Definition: m3ua.h:128
M3UA_RKM_REG_SUCCESS
@ M3UA_RKM_REG_SUCCESS
Definition: m3ua.h:121
M3UA_RKM_REG_ERR_UNSUPP_RK_PARAM
@ M3UA_RKM_REG_ERR_UNSUPP_RK_PARAM
Definition: m3ua.h:130
M3UA_RKM_REG_ERR_CANT_SUPP_UNQ_RT
@ M3UA_RKM_REG_ERR_CANT_SUPP_UNQ_RT
Definition: m3ua.h:127
M3UA_RKM_REG_ERR_RKEY_CHG_REFUSED
@ M3UA_RKM_REG_ERR_RKEY_CHG_REFUSED
Definition: m3ua.h:132
M3UA_RKM_REG_ERR_PERM_DENIED
@ M3UA_RKM_REG_ERR_PERM_DENIED
Definition: m3ua.h:126
M3UA_RKM_REG_ERR_INSUFF_RESRC
@ M3UA_RKM_REG_ERR_INSUFF_RESRC
Definition: m3ua.h:129
M3UA_RKM_REG_ERR_INVAL_DPC
@ M3UA_RKM_REG_ERR_INVAL_DPC
Definition: m3ua.h:123
M3UA_RKM_REG_ERR_UNKNOWN
@ M3UA_RKM_REG_ERR_UNKNOWN
Definition: m3ua.h:122
m3ua_rkm_dereg_satus
m3ua_rkm_dereg_satus
Definition: m3ua.h:136
M3UA_RKM_DEREG_ERR_UNKNOWN
@ M3UA_RKM_DEREG_ERR_UNKNOWN
Definition: m3ua.h:138
M3UA_RKM_DEREG_ERR_INVAL_RCTX
@ M3UA_RKM_DEREG_ERR_INVAL_RCTX
Definition: m3ua.h:139
M3UA_RKM_DEREG_SUCCESS
@ M3UA_RKM_DEREG_SUCCESS
Definition: m3ua.h:137
M3UA_RKM_DEREG_ERR_PERM_DENIED
@ M3UA_RKM_DEREG_ERR_PERM_DENIED
Definition: m3ua.h:140
M3UA_RKM_DEREG_ERR_NOT_REGD
@ M3UA_RKM_DEREG_ERR_NOT_REGD
Definition: m3ua.h:141
M3UA_RKM_DEREG_ERR_ASP_ACTIVE
@ M3UA_RKM_DEREG_ERR_ASP_ACTIVE
Definition: m3ua.h:142
m3ua_error_code
m3ua_error_code
Definition: m3ua.h:146
M3UA_ERR_INVAL_STREAM_ID
@ M3UA_ERR_INVAL_STREAM_ID
Definition: m3ua.h:155
M3UA_ERR_INVALID_VERSION
@ M3UA_ERR_INVALID_VERSION
Definition: m3ua.h:147
M3UA_ERR_ASP_ID_REQD
@ M3UA_ERR_ASP_ID_REQD
Definition: m3ua.h:160
M3UA_ERR_INVAL_PARAM_VAL
@ M3UA_ERR_INVAL_PARAM_VAL
Definition: m3ua.h:163
M3UA_ERR_INVAL_NET_APPEAR
@ M3UA_ERR_INVAL_NET_APPEAR
Definition: m3ua.h:167
M3UA_ERR_PROTOCOL_ERR
@ M3UA_ERR_PROTOCOL_ERR
Definition: m3ua.h:153
M3UA_ERR_PARAM_FIELD_ERR
@ M3UA_ERR_PARAM_FIELD_ERR
Definition: m3ua.h:164
M3UA_ERR_UNEXPECTED_MSG
@ M3UA_ERR_UNEXPECTED_MSG
Definition: m3ua.h:152
M3UA_ERR_UNEXP_PARAM
@ M3UA_ERR_UNEXP_PARAM
Definition: m3ua.h:165
M3UA_ERR_INVAL_ASP_ID
@ M3UA_ERR_INVAL_ASP_ID
Definition: m3ua.h:161
M3UA_ERR_NO_CONFGD_AS_FOR_ASP
@ M3UA_ERR_NO_CONFGD_AS_FOR_ASP
Definition: m3ua.h:172
M3UA_ERR_UNSUPP_TRAF_MOD_TYP
@ M3UA_ERR_UNSUPP_TRAF_MOD_TYP
Definition: m3ua.h:151
M3UA_ERR_UNSUPP_MSG_TYPE
@ M3UA_ERR_UNSUPP_MSG_TYPE
Definition: m3ua.h:150
M3UA_ERR_MISSING_PARAM
@ M3UA_ERR_MISSING_PARAM
Definition: m3ua.h:168
M3UA_ERR_INVAL_ROUT_CTX
@ M3UA_ERR_INVAL_ROUT_CTX
Definition: m3ua.h:171
M3UA_ERR_REFUSED_MGMT_BLOCKING
@ M3UA_ERR_REFUSED_MGMT_BLOCKING
Definition: m3ua.h:159
M3UA_ERR_DEST_STATUS_UNKN
@ M3UA_ERR_DEST_STATUS_UNKN
Definition: m3ua.h:166
M3UA_ERR_UNSUPP_MSG_CLASS
@ M3UA_ERR_UNSUPP_MSG_CLASS
Definition: m3ua.h:149
__attribute__
enum m3ua_rkm_reg_status __attribute__
m3ua_traffic_mode
m3ua_traffic_mode
Definition: m3ua.h:176
M3UA_TMOD_BCAST
@ M3UA_TMOD_BCAST
Definition: m3ua.h:179
M3UA_TMOD_OVERRIDE
@ M3UA_TMOD_OVERRIDE
Definition: m3ua.h:177
M3UA_TMOD_LOADSHARE
@ M3UA_TMOD_LOADSHARE
Definition: m3ua.h:178
m3ua_data_hdr
Definition: m3ua.h:95
m3ua_data_hdr::sls
uint8_t sls
Definition: m3ua.h:101
m3ua_data_hdr::dpc
uint32_t dpc
Definition: m3ua.h:97
m3ua_data_hdr::mp
uint8_t mp
Definition: m3ua.h:100
m3ua_data_hdr::opc
uint32_t opc
Definition: m3ua.h:96
m3ua_data_hdr::si
uint8_t si
Definition: m3ua.h:98
m3ua_data_hdr::ni
uint8_t ni
Definition: m3ua.h:99