blob: e6275388fad992e375fabcc612237195f6891f20 [file] [log] [blame]
Harald Weltedf327232017-12-28 22:51:51 +01001module GSUP_Types {
2
Harald Welte35bb7162018-01-03 21:07:52 +01003/* GSUP_Types, defining abstract TTCN-3 data types for the GSUP protocol.
4 *
5 * GSUP is a non-standard protocol used between OsmoMSC/OsmoSGSN and OsmoHLR
6 * in order to replace the complex TCAP/MAP protocol.
7 *
Harald Welte34b5a952019-05-27 11:54:11 +02008 * (C) 2017-2019 by Harald Welte <laforge@gnumonks.org>
9 * contributions by sysmocom - s.f.m.c. GmbH
Harald Welte35bb7162018-01-03 21:07:52 +010010 * All rights reserved.
11 *
12 * Released under the terms of GNU General Public License, Version 2 or
13 * (at your option) any later version.
Harald Welte34b5a952019-05-27 11:54:11 +020014 *
15 * SPDX-License-Identifier: GPL-2.0-or-later
Harald Welte35bb7162018-01-03 21:07:52 +010016 */
17
Harald Weltedf327232017-12-28 22:51:51 +010018import from General_Types all;
19import from Osmocom_Types all;
20
21type enumerated GSUP_IEI {
22 OSMO_GSUP_IMSI_IE ('01'O),
23 OSMO_GSUP_CAUSE_IE ('02'O),
24 OSMO_GSUP_AUTH_TUPLE_IE ('03'O),
25 OSMO_GSUP_PDP_INFO_COMPL_IE ('04'O),
26 OSMO_GSUP_PDP_INFO_IE ('05'O),
27 OSMO_GSUP_CANCEL_TYPE_IE ('06'O),
28 OSMO_GSUP_FREEZE_PTMSI_IE ('07'O),
29 OSMO_GSUP_MSISDN_IE ('08'O),
30 OSMO_GSUP_HLR_NUMBER_IE ('09'O),
31 OSMO_GSUP_PDP_CONTEXT_ID_IE ('10'O),
32 OSMO_GSUP_PDP_TYPE_IE ('11'O),
33 OSMO_GSUP_ACCESS_POINT_NAME_IE ('12'O),
34 OSMO_GSUP_PDP_QOS_IE ('13'O),
35 OSMO_GSUP_CHARG_CHAR_IE ('14'O),
36
37 OSMO_GSUP_RAND_IE ('20'O),
38 OSMO_GSUP_SRES_IE ('21'O),
39 OSMO_GSUP_KC_IE ('22'O),
40 OSMO_GSUP_IK_IE ('23'O),
41 OSMO_GSUP_CK_IE ('24'O),
42 OSMO_GSUP_AUTN_IE ('25'O),
43 OSMO_GSUP_AUTS_IE ('26'O),
44 OSMO_GSUP_RES_IE ('27'O),
Vadim Yanitskiyb761d142018-06-02 21:05:04 +070045 OSMO_GSUP_CN_DOMAIN_IE ('28'O),
46
47 OSMO_GSUP_SESSION_ID_IE ('30'O),
48 OSMO_GSUP_SESSION_STATE_IE ('31'O),
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +070049 OSMO_GSUP_SS_INFO_IE ('35'O),
50
51 /* SM related IEs (see 3GPP TS 29.002, section 7.6.8) */
52 OSMO_GSUP_SM_RP_MR_IE ('40'O),
53 OSMO_GSUP_SM_RP_DA_IE ('41'O),
54 OSMO_GSUP_SM_RP_OA_IE ('42'O),
55 OSMO_GSUP_SM_RP_UI_IE ('43'O),
56 OSMO_GSUP_SM_RP_CAUSE_IE ('44'O),
Vadim Yanitskiy88e23232018-11-13 03:04:02 +070057 OSMO_GSUP_SM_RP_MMS_IE ('45'O),
Oliver Smithc5748292019-02-22 15:02:48 +010058 OSMO_GSUP_SM_ALERT_RSN_IE ('46'O),
59
60 OSMO_GSUP_IMEI_IE ('50'O),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +020061 OSMO_GSUP_IMEI_RESULT_IE ('51'O),
62
63 OSMO_GSUP_MESSAGE_CLASS_IE ('0a'O),
64
65 OSMO_GSUP_SOURCE_NAME_IE ('60'O),
66 OSMO_GSUP_DESTINATION_NAME_IE ('61'O),
67 OSMO_GSUP_AN_APDU_IE ('62'O),
68 OSMO_GSUP_CAUSE_RR_IE ('63'O),
69 OSMO_GSUP_CAUSE_BSSAP_IE ('64'O),
70 OSMO_GSUP_CAUSE_SM_IE ('65'O)
Harald Weltedf327232017-12-28 22:51:51 +010071} with { variant "FIELDLENGTH(8)" };
72
73type enumerated GSUP_MessageType {
74 OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST ('00000100'B),
75 OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR ('00000101'B),
76 OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT ('00000110'B),
77
78 OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST ('00001000'B),
79 OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR ('00001001'B),
80 OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT ('00001010'B),
81
82 OSMO_GSUP_MSGT_AUTH_FAIL_REPORT ('00001011'B),
83
84 OSMO_GSUP_MSGT_PURGE_MS_REQUEST ('00001100'B),
85 OSMO_GSUP_MSGT_PURGE_MS_ERROR ('00001101'B),
86 OSMO_GSUP_MSGT_PURGE_MS_RESULT ('00001110'B),
87
88 OSMO_GSUP_MSGT_INSERT_DATA_REQUEST ('00010000'B),
89 OSMO_GSUP_MSGT_INSERT_DATA_ERROR ('00010001'B),
90 OSMO_GSUP_MSGT_INSERT_DATA_RESULT ('00010010'B),
91
92 OSMO_GSUP_MSGT_DELETE_DATA_REQUEST ('00010100'B),
93 OSMO_GSUP_MSGT_DELETE_DATA_ERROR ('00010101'B),
94 OSMO_GSUP_MSGT_DELETE_DATA_RESULT ('00010110'B),
95
96 OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST ('00011100'B),
97 OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR ('00011101'B),
Vadim Yanitskiyb761d142018-06-02 21:05:04 +070098 OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT ('00011110'B),
99
100 OSMO_GSUP_MSGT_PROC_SS_REQUEST ('00100000'B),
101 OSMO_GSUP_MSGT_PROC_SS_ERROR ('00100001'B),
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700102 OSMO_GSUP_MSGT_PROC_SS_RESULT ('00100010'B),
103
104 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST ('00100100'B),
105 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR ('00100101'B),
106 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT ('00100110'B),
107
108 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST ('00101000'B),
109 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR ('00101001'B),
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700110 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT ('00101010'B),
111
112 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST ('00101100'B),
113 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR ('00101101'B),
Oliver Smithc5748292019-02-22 15:02:48 +0100114 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT ('00101110'B),
115
116 OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST ('00110000'B),
117 OSMO_GSUP_MSGT_CHECK_IMEI_ERROR ('00110001'B),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200118 OSMO_GSUP_MSGT_CHECK_IMEI_RESULT ('00110010'B),
119
120 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_REQUEST ('00110100'B),
121 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_ERROR ('00110101'B),
122 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT ('00110110'B),
123
124 OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_REQUEST ('00111000'B),
125 OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_ERROR ('00111001'B),
126 OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_RESULT ('00111010'B),
127
128 OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_REQUEST ('00111100'B),
129 OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_ERROR ('00111101'B),
130 OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_RESULT ('00111110'B),
131
132 OSMO_GSUP_MSGT_E_PROCESS_ACCESS_SIGNALLING_REQUEST ('01000000'B),
133 OSMO_GSUP_MSGT_E_FORWARD_ACCESS_SIGNALLING_REQUEST ('01000100'B),
134
135 OSMO_GSUP_MSGT_E_CLOSE ('01000111'B),
136 OSMO_GSUP_MSGT_E_ABORT ('01001011'B),
137
138 OSMO_GSUP_MSGT_E_ROUTING_ERROR ('01001110'B)
Harald Weltedf327232017-12-28 22:51:51 +0100139} with { variant "FIELDLENGTH(8)" };
140
141type enumerated GSUP_CancelType {
Alexander Couzens4786b3f2018-09-16 03:33:30 +0200142 OSMO_GSUP_CANCEL_TYPE_UPDATE (0),
143 OSMO_GSUP_CANCEL_TYPE_WITHDRAW (1)
Harald Weltedf327232017-12-28 22:51:51 +0100144} with { variant "FIELDLENGTH(8)" };
145
146type enumerated GSUP_CnDomain {
147 OSMO_GSUP_CN_DOMAIN_PS (1),
148 OSMO_GSUP_CN_DOMAIN_CS (2)
149} with { variant "FIELDLENGTH(8)" };
150
Oliver Smithc5748292019-02-22 15:02:48 +0100151type enumerated GSUP_IMEIResult {
152 OSMO_GSUP_IMEI_RESULT_ACK (0),
153 OSMO_GSUP_IMEI_RESULT_NACK (1)
154} with { variant "FIELDLENGTH(8)" };
155
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700156type enumerated GSUP_SessionState {
157 OSMO_GSUP_SESSION_STATE_NONE (0),
158 OSMO_GSUP_SESSION_STATE_BEGIN (1),
159 OSMO_GSUP_SESSION_STATE_CONTINUE (2),
160 OSMO_GSUP_SESSION_STATE_END (3)
161} with { variant "FIELDLENGTH(8)" };
162
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200163type enumerated GSUP_Message_Class {
164 OSMO_GSUP_MESSAGE_CLASS_UNSET (0),
165 OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT (1),
166 OSMO_GSUP_MESSAGE_CLASS_SMS (2),
167 OSMO_GSUP_MESSAGE_CLASS_USSD (3),
168 OSMO_GSUP_MESSAGE_CLASS_INTER_MSC (4)
169} with { variant "FIELDLENGTH(8)" };
170
Harald Welte3f95be82018-01-27 00:48:13 +0100171type record GSUP_MSISDN {
172 uint8_t len,
173 hexstring digits optional
174} with { variant (len) "LENGTHTO(digits)" };
175
Oliver Smithc5748292019-02-22 15:02:48 +0100176type record GSUP_IMEI {
177 uint8_t len,
178 hexstring digits optional
179} with { variant (len) "LENGTHTO(digits)" };
180
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200181type enumerated GSUP_AN_PROTO {
182 OSMO_GSUP_AN_PROTO_48006 (1),
183 OSMO_GSUP_AN_PROTO_25413 (2)
184} with { variant "FIELDLENGTH(8)" };
185
186type record GSUP_AN_APDU {
187 GSUP_AN_PROTO proto,
188 octetstring pdu
189};
190
Harald Weltedf327232017-12-28 22:51:51 +0100191type record GSUP_IE {
192 GSUP_IEI tag,
193 uint8_t len,
194 GSUP_IeValue val
195} with { variant (len) "LENGTHTO(val)"
196 variant (val) "CROSSTAG(imsi, tag = OSMO_GSUP_IMSI_IE;
197 cause, tag = OSMO_GSUP_CAUSE_IE;
198 cancel_type, tag = OSMO_GSUP_CANCEL_TYPE_IE;
Harald Welte77a8eba2018-01-22 21:22:32 +0100199 auth_tuple, tag = OSMO_GSUP_AUTH_TUPLE_IE;
Harald Weltedf327232017-12-28 22:51:51 +0100200 auts, tag = OSMO_GSUP_AUTS_IE;
201 rand, tag = OSMO_GSUP_RAND_IE;
Harald Welte77a8eba2018-01-22 21:22:32 +0100202 sres, tag = OSMO_GSUP_SRES_IE;
203 kc, tag = OSMO_GSUP_KC_IE;
204 ik, tag = OSMO_GSUP_IK_IE;
205 ck, tag = OSMO_GSUP_CK_IE;
206 autn, tag = OSMO_GSUP_AUTN_IE;
207 res, tag = OSMO_GSUP_RES_IE;
Harald Weltedf327232017-12-28 22:51:51 +0100208 msisdn, tag = OSMO_GSUP_MSISDN_IE;
209 hlr_number, tag = OSMO_GSUP_HLR_NUMBER_IE;
210 cn_domain, tag = OSMO_GSUP_CN_DOMAIN_IE;
Harald Welteeded9ad2018-02-17 20:57:34 +0100211 pdp_info, tag = OSMO_GSUP_PDP_INFO_IE;
212 apn, tag = OSMO_GSUP_ACCESS_POINT_NAME_IE;
213 pdp_qos, tag = OSMO_GSUP_PDP_QOS_IE;
214 pdp_type, tag = OSMO_GSUP_PDP_TYPE_IE;
215 charg_char, tag = OSMO_GSUP_CHARG_CHAR_IE;
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700216 session_state, tag = OSMO_GSUP_SESSION_STATE_IE;
217 session_id, tag = OSMO_GSUP_SESSION_ID_IE;
218 ss_info, tag = OSMO_GSUP_SS_INFO_IE;
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700219 sm_rp_mr, tag = OSMO_GSUP_SM_RP_MR_IE;
220 sm_rp_da, tag = OSMO_GSUP_SM_RP_DA_IE;
221 sm_rp_oa, tag = OSMO_GSUP_SM_RP_OA_IE;
222 sm_rp_ui, tag = OSMO_GSUP_SM_RP_UI_IE;
223 sm_rp_cause, tag = OSMO_GSUP_SM_RP_CAUSE_IE;
224 sm_rp_mms, tag = OSMO_GSUP_SM_RP_MMS_IE;
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700225 sm_alert_rsn, tag = OSMO_GSUP_SM_ALERT_RSN_IE;
Oliver Smithc5748292019-02-22 15:02:48 +0100226 imei, tag = OSMO_GSUP_IMEI_IE;
227 imei_result, tag = OSMO_GSUP_IMEI_RESULT_IE;
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200228 message_class, tag = OSMO_GSUP_MESSAGE_CLASS_IE;
229 source_name, tag = OSMO_GSUP_SOURCE_NAME_IE;
230 destination_name, tag = OSMO_GSUP_DESTINATION_NAME_IE;
231 an_apdu, tag = OSMO_GSUP_AN_APDU_IE;
232 cause_rr, tag = OSMO_GSUP_CAUSE_RR_IE;
233 cause_bssap, tag = OSMO_GSUP_CAUSE_BSSAP_IE;
234 cause_sm, tag = OSMO_GSUP_CAUSE_SM_IE;
Harald Welteeded9ad2018-02-17 20:57:34 +0100235 )"
Harald Weltedf327232017-12-28 22:51:51 +0100236};
237
238type record of GSUP_IE GSUP_IEs;
239
240type union GSUP_IeValue {
241 hexstring imsi,
242 integer cause,
243 GSUP_CancelType cancel_type,
244 //boolean pdp_info_compl,
245 //boolean freeze_ptmsi,
Harald Weltedf327232017-12-28 22:51:51 +0100246 GSUP_IEs auth_tuple,
247 octetstring auts,
248 octetstring rand,
Harald Welte77a8eba2018-01-22 21:22:32 +0100249 octetstring sres,
250 octetstring kc,
251 octetstring ik,
252 octetstring ck,
253 octetstring autn,
254 octetstring res,
Harald Welte3f95be82018-01-27 00:48:13 +0100255 GSUP_MSISDN msisdn,
Harald Weltedf327232017-12-28 22:51:51 +0100256 octetstring hlr_number,
257 GSUP_CnDomain cn_domain,
Harald Welteeded9ad2018-02-17 20:57:34 +0100258 /* PDP context + nested IEs */
259 GSUP_IEs pdp_info,
260 octetstring apn,
261 octetstring pdp_qos,
262 OCT2 pdp_type,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700263 octetstring charg_char,
264 /* Session information */
265 GSUP_SessionState session_state,
266 OCT4 session_id,
267 /* Supplementary Services */
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700268 octetstring ss_info,
269 /* Short Message Service */
270 OCT1 sm_rp_mr,
271 GSUP_SM_RP_DA sm_rp_da,
272 GSUP_SM_RP_OA sm_rp_oa,
273 octetstring sm_rp_ui,
274 OCT1 sm_rp_cause,
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700275 OCT1 sm_rp_mms,
Oliver Smithc5748292019-02-22 15:02:48 +0100276 GSUP_SM_ALERT_RSN_Type sm_alert_rsn,
277
278 GSUP_IMEI imei,
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200279 GSUP_IMEIResult imei_result,
280
281 GSUP_Message_Class message_class,
282
283 octetstring source_name,
284 octetstring destination_name,
285
286 GSUP_AN_APDU an_apdu,
287
288 OCT1 cause_rr,
289 OCT1 cause_bssap,
290 OCT1 cause_sm
Harald Weltedf327232017-12-28 22:51:51 +0100291};
292
293type record GSUP_PDU {
294 GSUP_MessageType msg_type,
295 GSUP_IEs ies
296};
297
298external function enc_GSUP_PDU(in GSUP_PDU msg) return octetstring
299 with { extension "prototype(convert) encode(RAW)" };
300
301external function dec_GSUP_PDU(in octetstring msg) return GSUP_PDU
302 with { extension "prototype(convert) decode(RAW)" };
303
Harald Welte2f562b12018-01-24 20:52:38 +0100304function f_gsup_postprocess_decoded(inout GSUP_PDU gsup) {
305 if (gsup.ies[0].tag == OSMO_GSUP_IMSI_IE) {
306 /* if last digit is 'F', then there's an odd number of digits and we must strip the F */
307 var integer num_digits := lengthof(gsup.ies[0].val.imsi);
308 if (gsup.ies[0].val.imsi[num_digits-1] == 'F'H) {
309 gsup.ies[0].val.imsi := substr(gsup.ies[0].val.imsi, 0, num_digits-1);
310 }
311 }
312}
313
314function f_gsup_preprocess_encoded(inout GSUP_PDU gsup) {
315 if (ischosen(gsup.ies[0].val.imsi)) {
316 /* if number of digits is odd, add a 'F' as padding at the end */
317 var integer num_digits := lengthof(gsup.ies[0].val.imsi);
318 if (num_digits rem 2 == 1) {
319 gsup.ies[0].val.imsi := gsup.ies[0].val.imsi & 'F'H;
320 }
321 }
322}
323
Harald Welte3f95be82018-01-27 00:48:13 +0100324template (value) GSUP_MSISDN ts_GSUP_MSISDN(hexstring digits,
325 BIT3 ton := '000'B,
326 BIT4 npi := '0000'B) := {
327 len := 0, /* overwritten */
328 /* numberingPlanIdentification := npi,
329 typeOfNumber := ton,
330 ext1 := '0'B, */
331 digits := digits
332}
333
334template GSUP_MSISDN tr_GSUP_MSISDN(template hexstring digits,
335 template BIT3 ton := ?,
336 template BIT4 npi := ?) := {
337 len := ?,
338 /* numberingPlanIdentification := npi,
339 typeOfNumber := ton,
340 ext1 := '0'B, */
341 digits := digits
342}
343
344
Harald Weltedf327232017-12-28 22:51:51 +0100345
Harald Welte77a8eba2018-01-22 21:22:32 +0100346template GSUP_IE ts_GSUP_IE_AuthTuple2G(octetstring rand, octetstring sres,
347 octetstring kc) := {
348 tag := OSMO_GSUP_AUTH_TUPLE_IE,
349 len := 0, /* overwritten */
350 val := {
351 auth_tuple := {
352 valueof(ts_GSUP_IE_RAND(rand)),
353 valueof(ts_GSUP_IE_SRES(sres)),
354 valueof(ts_GSUP_IE_Kc(kc))
355 }
356 }
357}
358
359template GSUP_IE ts_GSUP_IE_AuthTuple2G3G(octetstring rand, octetstring sres,
360 octetstring kc, octetstring ik,
361 octetstring ck, octetstring autn,
362 octetstring res) := {
363 tag := OSMO_GSUP_AUTH_TUPLE_IE,
364 len := 0, /* overwritten */
365 val := {
366 auth_tuple := {
367 valueof(ts_GSUP_IE_RAND(rand)),
368 valueof(ts_GSUP_IE_SRES(sres)),
369 valueof(ts_GSUP_IE_Kc(kc)),
370 valueof(ts_GSUP_IE_IK(ik)),
371 valueof(ts_GSUP_IE_CK(ck)),
372 valueof(ts_GSUP_IE_AUTN(autn)),
373 valueof(ts_GSUP_IE_RES(res))
374 }
375 }
376}
377
Harald Welteeded9ad2018-02-17 20:57:34 +0100378template GSUP_IE ts_GSUP_IE_PdpInfo(octetstring apn, octetstring pdp_type, octetstring pdp_qos) := {
379 tag := OSMO_GSUP_PDP_INFO_IE,
380 len := 0, /* overwritten */
381 val := {
382 pdp_info := {
383 valueof(ts_GSUP_IE_APN(apn)),
384 valueof(ts_GSUP_IE_PDP_TYPE(pdp_type)),
385 valueof(ts_GSUP_IE_PDP_QOS(pdp_qos))
386 }
387 }
388}
389
390template (value) GSUP_IE ts_GSUP_IE_PDP_TYPE(OCT2 pdp_type) := {
391 tag := OSMO_GSUP_PDP_TYPE_IE,
392 len := 0,
393 val := {
394 pdp_type := pdp_type
395 }
396}
397
398template (value) GSUP_IE ts_GSUP_IE_PDP_QOS(octetstring pdp_qos) := {
399 tag := OSMO_GSUP_PDP_QOS_IE,
400 len := 0,
401 val := {
402 pdp_qos := pdp_qos
403 }
404}
405
406
Harald Weltedf327232017-12-28 22:51:51 +0100407template GSUP_PDU tr_GSUP(template GSUP_MessageType msgt := ?, template GSUP_IEs ies := *) := {
408 msg_type := msgt,
409 ies := ies
410}
411
Harald Welte8a1dd532018-01-27 15:38:18 +0100412template GSUP_PDU tr_GSUP_IMSI(template GSUP_MessageType msgt := ?, template hexstring imsi) := {
413 msg_type := msgt,
414 ies := { tr_GSUP_IE_IMSI(imsi), * }
415}
416
Harald Weltedf327232017-12-28 22:51:51 +0100417template GSUP_PDU ts_GSUP(GSUP_MessageType msgt, GSUP_IEs ies := {}) := {
418 msg_type := msgt,
419 ies := ies
420}
421
Oliver Smith936dbe62019-06-04 15:54:17 +0200422template (value) GSUP_IMEI ts_GSUP_IMEI(hexstring digits) := {
423 len := 0, /* overwritten */
424 digits := digits
425}
426
427template GSUP_IMEI tr_GSUP_IMEI(template hexstring digits) := {
428 len := ?,
429 digits := digits
430}
431
432
Harald Welte6aa04e32018-01-27 15:35:19 +0100433template (value) GSUP_PDU ts_GSUP_SAI_REQ(hexstring imsi) :=
Harald Weltedf327232017-12-28 22:51:51 +0100434 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { valueof(ts_GSUP_IE_IMSI(imsi)) });
435
Harald Welteef9fa872018-01-22 03:00:17 +0100436template GSUP_PDU tr_GSUP_SAI_REQ(template hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100437 tr_GSUP_IMSI(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, imsi);
Harald Welteef9fa872018-01-22 03:00:17 +0100438
Alexander Couzensd24973d2018-09-04 16:10:14 +0200439template GSUP_PDU tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC(
440 template hexstring imsi,
441 template octetstring auts,
442 template octetstring rand) :=
443 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
444 tr_GSUP_IE_IMSI(imsi),
445 tr_GSUP_IE_AUTS(auts),
446 tr_GSUP_IE_RAND(rand),
447 *
448 });
449
Harald Welte77a8eba2018-01-22 21:22:32 +0100450template (value) GSUP_PDU ts_GSUP_SAI_RES(hexstring imsi, GSUP_IE auth_tuple) :=
451 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, {
452 valueof(ts_GSUP_IE_IMSI(imsi)), auth_tuple });
453
Harald Weltedf327232017-12-28 22:51:51 +0100454template GSUP_PDU tr_GSUP_SAI_ERR(template hexstring imsi, template integer cause) :=
Harald Welte071ed732018-01-23 19:53:52 +0100455 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, {
Harald Weltedf327232017-12-28 22:51:51 +0100456 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
457
Harald Welte6aa04e32018-01-27 15:35:19 +0100458template (value) GSUP_PDU ts_GSUP_SAI_ERR(hexstring imsi, integer cause) :=
459 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, {
460 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
Harald Welte071ed732018-01-23 19:53:52 +0100461
462
Harald Weltedf327232017-12-28 22:51:51 +0100463template GSUP_PDU tr_GSUP_SAI_RES(template hexstring imsi) :=
Harald Weltec2c52552018-03-01 21:20:39 +0100464 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, {
Harald Weltedf327232017-12-28 22:51:51 +0100465 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE(OSMO_GSUP_AUTH_TUPLE_IE), * });
466
Harald Weltec2c52552018-03-01 21:20:39 +0100467template (value) GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi) :=
468 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, {
469 valueof(ts_GSUP_IE_IMSI(imsi)) });
470
Harald Weltedfe94dd2018-01-21 13:55:22 +0100471template GSUP_PDU tr_GSUP_UL_REQ(template hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100472 tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, imsi);
Harald Weltedfe94dd2018-01-21 13:55:22 +0100473
Harald Welte6aa04e32018-01-27 15:35:19 +0100474template (value) GSUP_PDU ts_GSUP_UL_RES(hexstring imsi) :=
Harald Weltedfe94dd2018-01-21 13:55:22 +0100475 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, { valueof(ts_GSUP_IE_IMSI(imsi)) });
476
Harald Weltec2c52552018-03-01 21:20:39 +0100477template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi) :=
478 tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, imsi);
479
Harald Welte6aa04e32018-01-27 15:35:19 +0100480template (value) GSUP_PDU ts_GSUP_UL_ERR(hexstring imsi, integer cause) :=
Harald Welte6ff81902018-01-21 19:09:08 +0100481 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, {
482 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
483
Harald Weltec2c52552018-03-01 21:20:39 +0100484template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?) :=
485 tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, {
486 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
487
Harald Welte6aa04e32018-01-27 15:35:19 +0100488template (value) GSUP_PDU ts_GSUP_ISD_REQ(hexstring imsi, hexstring msisdn) :=
Harald Welte6ff81902018-01-21 19:09:08 +0100489 ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, {
490 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_MSISDN(msisdn)) });
491
Harald Weltec2c52552018-03-01 21:20:39 +0100492template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?) :=
493 tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, {
Harald Welte8f6ac162018-03-01 22:43:28 +0100494 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_MSISDN(msisdn), * });
Harald Weltec2c52552018-03-01 21:20:39 +0100495
496template (value) GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi) :=
497 ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, {
498 valueof(ts_GSUP_IE_IMSI(imsi)) });
499
Harald Welte6ff81902018-01-21 19:09:08 +0100500template GSUP_PDU tr_GSUP_ISD_RES(template hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100501 tr_GSUP_IMSI(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, imsi);
Harald Weltedf327232017-12-28 22:51:51 +0100502
Harald Weltec638f4d2018-01-24 22:00:36 +0100503template GSUP_PDU tr_GSUP_AUTH_FAIL_IND(hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100504 tr_GSUP_IMSI(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT, imsi);
Harald Weltedf327232017-12-28 22:51:51 +0100505
Harald Welte167458a2018-01-27 15:58:16 +0100506template (value) GSUP_PDU ts_GSUP_CL_REQ(hexstring imsi, GSUP_CancelType ctype) :=
507 ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST, {
508 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CancelType(ctype)) });
509
510template GSUP_PDU tr_GSUP_CL_RES(template hexstring imsi) :=
511 tr_GSUP_IMSI(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, imsi);
512
513template GSUP_PDU tr_GSUP_CL_ERR(template hexstring imsi, template integer cause := ?) :=
514 tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR, {
Alexander Couzens4cfff3a2018-05-22 17:08:36 +0200515 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause), * });
Harald Welte167458a2018-01-27 15:58:16 +0100516
Harald Welte958f8b42018-03-01 23:40:17 +0100517template (value) GSUP_PDU ts_GSUP_PURGE_MS_REQ(hexstring imsi, GSUP_CnDomain dom) :=
518 ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, {
519 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) });
520
Harald Welte6abb9fe2018-02-17 15:24:48 +0100521template GSUP_PDU tr_GSUP_PURGE_MS_REQ(template hexstring imsi, template GSUP_CnDomain dom := ?) :=
522 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, {
523 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_CnDomain(dom) });
524
525template (value) GSUP_PDU ts_GSUP_PURGE_MS_RES(hexstring imsi) :=
526 ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, {
527 valueof(ts_GSUP_IE_IMSI(imsi)) });
528
Harald Welte958f8b42018-03-01 23:40:17 +0100529template GSUP_PDU tr_GSUP_PURGE_MS_RES(template hexstring imsi) :=
530 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, {
531 tr_GSUP_IE_IMSI(imsi), * });
532
533template GSUP_PDU tr_GSUP_PURGE_MS_ERR(template hexstring imsi, template integer cause) :=
534 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_ERROR, {
535 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
536
Oliver Smith936dbe62019-06-04 15:54:17 +0200537template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_REQ(hexstring imsi, hexstring imei) :=
538 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, {
539 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI(imei)) });
540
541template GSUP_PDU tr_GSUP_CHECK_IMEI_RES(template hexstring imsi, template GSUP_IMEIResult result) :=
542 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
543 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_IMEI_Result(result) });
544
545template GSUP_PDU tr_GSUP_CHECK_IMEI_ERR(template hexstring imsi, template integer cause) :=
546 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
547 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
548
Harald Welte167458a2018-01-27 15:58:16 +0100549
550template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := {
551 tag := OSMO_GSUP_CANCEL_TYPE_IE,
552 len := 0, /* overwritten */
553 val := {
554 cancel_type := ctype
555 }
556}
557
558template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) :=
559 tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype});
560
Harald Welte6abb9fe2018-02-17 15:24:48 +0100561template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) :=
562 tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain});
563
Harald Weltedf327232017-12-28 22:51:51 +0100564template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := {
565 tag := iei,
566 len := ?,
567 val := val
568}
569
570template (value) GSUP_IE ts_GSUP_IE_IMSI(hexstring imsi) := {
571 tag := OSMO_GSUP_IMSI_IE,
572 len := 0, /* overwritten */
573 val := {
574 imsi := imsi
575 }
576}
577
578template GSUP_IE tr_GSUP_IE_IMSI(template hexstring imsi) := {
579 tag := OSMO_GSUP_IMSI_IE,
580 len := ?,
581 val := {
582 imsi := imsi
583 }
584}
585
Harald Welte6ff81902018-01-21 19:09:08 +0100586template (value) GSUP_IE ts_GSUP_IE_MSISDN(hexstring msisdn) := {
587 tag := OSMO_GSUP_MSISDN_IE,
588 len := 0, /* overwritten */
589 val := {
Harald Welte3f95be82018-01-27 00:48:13 +0100590 msisdn := ts_GSUP_MSISDN(msisdn)
Harald Welte6ff81902018-01-21 19:09:08 +0100591 }
592}
593
594template GSUP_IE tr_GSUP_IE_MSISDN(template hexstring msisdn) := {
595 tag := OSMO_GSUP_MSISDN_IE,
596 len := ?,
597 val := {
Harald Welte3f95be82018-01-27 00:48:13 +0100598 msisdn := tr_GSUP_MSISDN(msisdn)
Harald Welte6ff81902018-01-21 19:09:08 +0100599 }
600}
601
602
Harald Weltedf327232017-12-28 22:51:51 +0100603template (value) GSUP_IE ts_GSUP_IE_Cause(integer cause) := {
604 tag := OSMO_GSUP_CAUSE_IE,
605 len := 0, /* overwritten */
606 val := {
607 cause := cause
608 }
609}
610
611template GSUP_IE tr_GSUP_IE_Cause(template integer cause) := {
612 tag := OSMO_GSUP_CAUSE_IE,
613 len := ?,
614 val := {
615 cause := cause
616 }
617}
618
619template (value) GSUP_IE ts_GSUP_IE_AUTS(octetstring auts) := {
620 tag := OSMO_GSUP_AUTS_IE,
621 len := 0, /* overwritten */
622 val := {
623 auts := auts
624 }
625}
626
Alexander Couzensd24973d2018-09-04 16:10:14 +0200627template GSUP_IE tr_GSUP_IE_AUTS(template octetstring auts) := {
628 tag := OSMO_GSUP_AUTS_IE,
629 len := ?,
630 val := {
631 auts := auts
632 }
633}
634
Harald Weltedf327232017-12-28 22:51:51 +0100635template (value) GSUP_IE ts_GSUP_IE_RAND(octetstring rand) := {
636 tag := OSMO_GSUP_RAND_IE,
637 len := 0, /* overwritten */
638 val := {
639 rand := rand
640 }
641}
642
Alexander Couzensd24973d2018-09-04 16:10:14 +0200643template GSUP_IE tr_GSUP_IE_RAND(template octetstring rand) := {
644 tag := OSMO_GSUP_RAND_IE,
645 len := ?,
646 val := {
647 rand := rand
648 }
649}
650
Harald Welte77a8eba2018-01-22 21:22:32 +0100651template (value) GSUP_IE ts_GSUP_IE_SRES(octetstring sres) := {
652 tag := OSMO_GSUP_SRES_IE,
653 len := 0, /* overwritten */
654 val := {
655 sres := sres
656 }
657}
658
659template (value) GSUP_IE ts_GSUP_IE_Kc(octetstring kc) := {
660 tag := OSMO_GSUP_KC_IE,
661 len := 0, /* overwritten */
662 val := {
663 kc := kc
664 }
665}
666
667template (value) GSUP_IE ts_GSUP_IE_IK(octetstring ik) := {
668 tag := OSMO_GSUP_IK_IE,
669 len := 0, /* overwritten */
670 val := {
671 ik := ik
672 }
673}
674
675template (value) GSUP_IE ts_GSUP_IE_CK(octetstring ck) := {
676 tag := OSMO_GSUP_CK_IE,
677 len := 0, /* overwritten */
678 val := {
679 ck := ck
680 }
681}
682
683template (value) GSUP_IE ts_GSUP_IE_AUTN(octetstring autn) := {
684 tag := OSMO_GSUP_AUTN_IE,
685 len := 0, /* overwritten */
686 val := {
687 autn := autn
688 }
689}
690
691template (value) GSUP_IE ts_GSUP_IE_RES(octetstring res) := {
692 tag := OSMO_GSUP_RES_IE,
693 len := 0, /* overwritten */
694 val := {
695 res := res
696 }
697}
Harald Weltedf327232017-12-28 22:51:51 +0100698
Harald Welteeded9ad2018-02-17 20:57:34 +0100699template (value) GSUP_IE ts_GSUP_IE_APN(octetstring apn) := {
700 tag := OSMO_GSUP_ACCESS_POINT_NAME_IE,
701 len := 0, /* overwritten */
702 val := {
703 apn := apn
704 }
705}
706
Harald Welte958f8b42018-03-01 23:40:17 +0100707template (value) GSUP_IE ts_GSUP_IE_CnDomain(GSUP_CnDomain dom) := {
708 tag := OSMO_GSUP_CN_DOMAIN_IE,
709 len := 0, /* overwritten */
710 val := {
711 cn_domain := dom
712 }
713}
Harald Weltedf327232017-12-28 22:51:51 +0100714
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700715template (value) GSUP_IE ts_GSUP_IE_SessionId(OCT4 sid) := {
716 tag := OSMO_GSUP_SESSION_ID_IE,
717 len := 0, /* overwritten */
718 val := {
719 session_id := sid
720 }
721}
722template GSUP_IE tr_GSUP_IE_SessionId(template OCT4 sid) := {
723 tag := OSMO_GSUP_SESSION_ID_IE,
724 len := ?,
725 val := {
726 session_id := sid
727 }
728}
729
730template (value) GSUP_IE ts_GSUP_IE_SessionState(GSUP_SessionState state) := {
731 tag := OSMO_GSUP_SESSION_STATE_IE,
732 len := 0, /* overwritten */
733 val := {
734 session_state := state
735 }
736}
737template GSUP_IE tr_GSUP_IE_SessionState(template GSUP_SessionState state) := {
738 tag := OSMO_GSUP_SESSION_STATE_IE,
739 len := ?,
740 val := {
741 session_state := state
742 }
743}
744
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700745template (value) GSUP_IE ts_GSUP_IE_SM_RP_MR(OCT1 ref) := {
746 tag := OSMO_GSUP_SM_RP_MR_IE,
747 len := 0, /* overwritten */
748 val := {
749 sm_rp_mr := ref
750 }
751}
752template GSUP_IE tr_GSUP_IE_SM_RP_MR(template OCT1 ref) := {
753 tag := OSMO_GSUP_SM_RP_MR_IE,
754 len := ?,
755 val := {
756 sm_rp_mr := ref
757 }
758}
759
760template (value) GSUP_IE ts_GSUP_IE_SM_RP_CAUSE(OCT1 cause) := {
761 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
762 len := 0, /* overwritten */
763 val := {
764 sm_rp_cause := cause
765 }
766}
767template GSUP_IE tr_GSUP_IE_SM_RP_CAUSE(template OCT1 cause) := {
768 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
769 len := ?,
770 val := {
771 sm_rp_cause := cause
772 }
773}
774
775template (value) GSUP_IE ts_GSUP_IE_SM_RP_MMS(OCT1 mms) := {
776 tag := OSMO_GSUP_SM_RP_MMS_IE,
777 len := 0, /* overwritten */
778 val := {
779 sm_rp_mms := mms
780 }
781}
782template GSUP_IE tr_GSUP_IE_SM_RP_MMS(template OCT1 mms) := {
783 tag := OSMO_GSUP_SM_RP_MMS_IE,
784 len := ?,
785 val := {
786 sm_rp_mms := mms
787 }
788}
789
Oliver Smith936dbe62019-06-04 15:54:17 +0200790template (value) GSUP_IE ts_GSUP_IE_IMEI(hexstring imei) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100791 tag := OSMO_GSUP_IMEI_IE,
792 len := 0, /* overwritten */
793 val := {
Oliver Smith936dbe62019-06-04 15:54:17 +0200794 imei := ts_GSUP_IMEI(imei)
Oliver Smithc5748292019-02-22 15:02:48 +0100795 }
796}
Oliver Smith936dbe62019-06-04 15:54:17 +0200797template GSUP_IE tr_GSUP_IE_IMEI(template hexstring imei) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100798 tag := OSMO_GSUP_IMEI_IE,
799 len := ?,
800 val := {
Oliver Smith936dbe62019-06-04 15:54:17 +0200801 imei := tr_GSUP_IMEI(imei)
Oliver Smithc5748292019-02-22 15:02:48 +0100802 }
803}
804
Oliver Smith936dbe62019-06-04 15:54:17 +0200805template (value) GSUP_IE ts_GSUP_IE_IMEI_Result(GSUP_IMEIResult result) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100806 tag := OSMO_GSUP_IMEI_RESULT_IE,
807 len := 0, /* overwritten */
808 val := {
809 imei_result := result
810 }
811}
Oliver Smith936dbe62019-06-04 15:54:17 +0200812template GSUP_IE tr_GSUP_IE_IMEI_Result(template GSUP_IMEIResult result) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100813 tag := OSMO_GSUP_IMEI_RESULT_IE,
814 len := ?,
815 val := {
816 imei_result := result
817 }
818}
819
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700820/* Possible identity types for SM-RP-{OA|DA} IEs */
821type enumerated GSUP_SM_RP_ODA_IdType {
822 OSMO_GSUP_SM_RP_ODA_ID_NONE ('00'O),
823 OSMO_GSUP_SM_RP_ODA_ID_IMSI ('01'O),
824 OSMO_GSUP_SM_RP_ODA_ID_MSISDN ('02'O),
825 OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR ('03'O),
826 /* Special value for noSM-RP-DA and noSM-RP-OA */
827 OSMO_GSUP_SM_RP_ODA_ID_NULL ('FF'O)
828} with { variant "FIELDLENGTH(8)" };
829
830/**
831 * SM-RP-DA represents the SM Destination Address, see 7.6.8.1.
832 * It can be either of the following:
833 * - IMSI
834 * - LMSI (not implemented)
835 * - MSISDN
836 * - roaming number (not implemented)
837 * - service centre address
838 */
839type union GSUP_SM_RP_DA_ID {
840 hexstring imsi,
841 hexstring msisdn,
842 hexstring smsc_addr
843};
844
845type record GSUP_SM_RP_DA {
846 GSUP_SM_RP_ODA_IdType id_type,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700847 GSUP_SM_RP_DA_ID id_enc optional
Vadim Yanitskiyf1f39bd2018-12-14 08:00:33 +0700848} with { variant (id_enc) "CROSSTAG(
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700849 imsi, id_type = OSMO_GSUP_SM_RP_ODA_ID_IMSI;
850 msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN;
851 smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR;
852 /* FIXME: how to handle noSM-RP-DA? */
853 )"
854};
855
856template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_IMSI(hexstring imsi) := {
857 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700858 id_enc := { imsi := imsi }
859}
860template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_IMSI(template hexstring imsi) := {
861 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700862 id_enc := { imsi := imsi }
863}
864
865template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_MSISDN(hexstring msisdn) := {
866 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700867 id_enc := { msisdn := msisdn }
868}
869template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_MSISDN(template hexstring msisdn) := {
870 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700871 id_enc := { msisdn := msisdn }
872}
873
874template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_SMSC_ADDR(hexstring smsc_addr) := {
875 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700876 id_enc := { smsc_addr := smsc_addr }
877}
878template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_SMSC_ADDR(template hexstring smsc_addr) := {
879 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700880 id_enc := { smsc_addr := smsc_addr }
881}
882
883template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_NULL := {
884 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700885 id_enc := omit
886}
887template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_NULL := {
888 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700889 id_enc := omit
890}
891
892template (value) GSUP_IE ts_GSUP_IE_SM_RP_DA(GSUP_SM_RP_DA val) := {
893 tag := OSMO_GSUP_SM_RP_DA_IE,
894 len := 0, /* overwritten */
895 val := {
896 sm_rp_da := val
897 }
898}
899template GSUP_IE tr_GSUP_IE_SM_RP_DA(template GSUP_SM_RP_DA val) := {
900 tag := OSMO_GSUP_SM_RP_DA_IE,
901 len := ?,
902 val := {
903 sm_rp_da := val
904 }
905}
906
907/**
908 * SM-RP-OA represents the SM Originating Address, see 7.6.8.2.
909 * It can be either of the following:
910 * - MSISDN
911 * - service centre address
912 */
913type union GSUP_SM_RP_OA_ID {
914 hexstring msisdn,
915 hexstring smsc_addr
916};
917
918type record GSUP_SM_RP_OA {
919 GSUP_SM_RP_ODA_IdType id_type,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700920 GSUP_SM_RP_OA_ID id_enc optional
Vadim Yanitskiyf1f39bd2018-12-14 08:00:33 +0700921} with { variant (id_enc) "CROSSTAG(
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700922 msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN;
923 smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR;
924 /* FIXME: how to handle noSM-RP-OA? */
925 )"
926};
927
928template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_MSISDN(hexstring msisdn) := {
929 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700930 id_enc := { msisdn := msisdn }
931}
932template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_MSISDN(template hexstring msisdn) := {
933 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700934 id_enc := { msisdn := msisdn }
935}
936
937template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_SMSC_ADDR(hexstring smsc_addr) := {
938 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700939 id_enc := { smsc_addr := smsc_addr }
940}
941template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_SMSC_ADDR(template hexstring smsc_addr) := {
942 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700943 id_enc := { smsc_addr := smsc_addr }
944}
945
946template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_NULL := {
947 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700948 id_enc := omit
949}
950template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_NULL := {
951 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700952 id_enc := omit
953}
954
955template (value) GSUP_IE ts_GSUP_IE_SM_RP_OA(GSUP_SM_RP_OA val) := {
956 tag := OSMO_GSUP_SM_RP_OA_IE,
957 len := 0, /* overwritten */
958 val := {
959 sm_rp_oa := val
960 }
961}
962template GSUP_IE tr_GSUP_IE_SM_RP_OA(template GSUP_SM_RP_OA val) := {
963 tag := OSMO_GSUP_SM_RP_OA_IE,
964 len := ?,
965 val := {
966 sm_rp_oa := val
967 }
968}
969
970/* SM-RP-UI represents the SM TPDU, see 7.6.8.4 */
971template (value) GSUP_IE ts_GSUP_IE_SM_RP_UI(octetstring val) := {
972 tag := OSMO_GSUP_SM_RP_UI_IE,
973 len := 0, /* overwritten */
974 val := {
975 sm_rp_ui := val
976 }
977}
978template GSUP_IE tr_GSUP_IE_SM_RP_UI(template octetstring val) := {
979 tag := OSMO_GSUP_SM_RP_UI_IE,
980 len := ?,
981 val := {
982 sm_rp_ui := val
983 }
984}
985
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700986/* SM Alert Reason types, see 7.6.8.8 */
987type enumerated GSUP_SM_ALERT_RSN_Type {
988 GSUP_SM_ALERT_RSN_TYPE_NONE ('00'O),
989 GSUP_SM_ALERT_RSN_TYPE_MS_PRESENT ('01'O),
990 GSUP_SM_ALERT_RSN_TYPE_MEM_AVAIL ('02'O)
991} with { variant "FIELDLENGTH(8)" };
992
993/* SM Alert Reason IE (used in READY-FOR-SM), see 7.6.8.8 */
994template (value) GSUP_IE ts_GSUP_IE_SM_ALERT_RSN(GSUP_SM_ALERT_RSN_Type rsn) := {
995 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
996 len := 0, /* overwritten */
997 val := {
998 sm_alert_rsn := rsn
999 }
1000}
1001template GSUP_IE tr_GSUP_IE_SM_ALERT_RSN(template GSUP_SM_ALERT_RSN_Type rsn) := {
1002 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
1003 len := ?,
1004 val := {
1005 sm_alert_rsn := rsn
1006 }
1007}
1008
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001009template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := {
1010 tag := OSMO_GSUP_SS_INFO_IE,
1011 len := 0, /* overwritten */
1012 val := {
1013 ss_info := ss
1014 }
1015}
1016template GSUP_IE tr_GSUP_IE_SSInfo(template octetstring ss) := {
1017 tag := OSMO_GSUP_SS_INFO_IE,
1018 len := ?,
1019 val := {
1020 ss_info := ss
1021 }
1022}
1023
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001024template GSUP_IE tr_GSUP_IE_Message_Class(template GSUP_Message_Class val) := {
1025 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1026 len := ?,
1027 val := {
1028 message_class := val
1029 }
1030}
1031
1032template (value) GSUP_IE ts_GSUP_IE_Message_Class(GSUP_Message_Class val) := {
1033 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1034 len := 0, /* overwritten */
1035 val := {
1036 message_class := val
1037 }
1038}
1039
1040template GSUP_IE tr_GSUP_IE_Source_Name(template octetstring name) := {
1041 tag := OSMO_GSUP_SOURCE_NAME_IE,
1042 len := ?,
1043 val := {
1044 source_name := name
1045 }
1046}
1047
1048template (value) GSUP_IE ts_GSUP_IE_Source_Name(octetstring name) := {
1049 tag := OSMO_GSUP_SOURCE_NAME_IE,
1050 len := 0, /* overwritten */
1051 val := {
1052 source_name := name
1053 }
1054}
1055
1056template GSUP_IE tr_GSUP_IE_Destination_Name(template octetstring name) := {
1057 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1058 len := ?,
1059 val := {
1060 destination_name := name
1061 }
1062}
1063
1064template (value) GSUP_IE ts_GSUP_IE_Destination_Name(octetstring name) := {
1065 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1066 len := 0, /* overwritten */
1067 val := {
1068 destination_name := name
1069 }
1070}
1071
1072template GSUP_IE tr_GSUP_IE_AN_APDU(template GSUP_AN_APDU an_apdu) := {
1073 tag := OSMO_GSUP_AN_APDU_IE,
1074 len := ?,
1075 val := {
1076 an_apdu := an_apdu
1077 }
1078}
1079
1080template (value) GSUP_IE ts_GSUP_IE_AN_APDU(GSUP_AN_APDU an_apdu) := {
1081 tag := OSMO_GSUP_AN_APDU_IE,
1082 len := 0, /* overwritten */
1083 val := {
1084 an_apdu := an_apdu
1085 }
1086}
1087
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001088private function f_gen_ts_ss_ies(
1089 hexstring imsi,
1090 OCT4 sid,
1091 GSUP_SessionState state,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001092 template (omit) octetstring ss := omit,
1093 template (omit) integer cause := omit
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001094) return GSUP_IEs {
1095 /* Mandatory IEs */
1096 var GSUP_IEs ies := {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001097 valueof(ts_GSUP_IE_IMSI(imsi))
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001098 };
1099
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001100 /* Cause IE is needed for PROC_SS_ERR */
1101 if (isvalue(cause)) {
1102 ies := ies & { valueof(ts_GSUP_IE_Cause(valueof(cause))) };
1103 }
1104
1105 /* Mandatory session IEs */
1106 ies := ies & { valueof(ts_GSUP_IE_SessionId(sid)) };
1107 ies := ies & { valueof(ts_GSUP_IE_SessionState(state)) };
1108
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001109 /* Optional SS payload */
1110 if (isvalue(ss)) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001111 ies := ies & { valueof(ts_GSUP_IE_SSInfo(valueof(ss))) };
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001112 }
1113
1114 return ies;
1115}
1116private function f_gen_tr_ss_ies(
1117 template hexstring imsi,
1118 template OCT4 sid := ?,
1119 template GSUP_SessionState state := ?,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001120 template octetstring ss := omit,
1121 template integer cause := omit
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001122) return template GSUP_IEs {
1123 /* Mandatory IEs */
1124 var template GSUP_IEs ies := {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001125 tr_GSUP_IE_IMSI(imsi)
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001126 };
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001127 var integer idx := 1;
1128
1129 /* Cause IE is needed for PROC_SS_ERR */
1130 if (istemplatekind(cause, "*")) {
1131 ies[idx] := *;
1132 idx := idx + 1;
1133 } else if (not istemplatekind(cause, "omit")) {
1134 ies[idx] := tr_GSUP_IE_Cause(cause);
1135 idx := idx + 1;
1136 }
1137
1138 /* Mandatory session IEs */
1139 ies[idx] := tr_GSUP_IE_SessionId(sid);
1140 ies[idx + 1] := tr_GSUP_IE_SessionState(state);
1141 idx := idx + 2;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001142
1143 /* Optional SS payload */
1144 if (istemplatekind(ss, "*")) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001145 ies[idx] := *;
1146 idx := idx + 1;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001147 } else if (not istemplatekind(ss, "omit")) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001148 ies[idx] := tr_GSUP_IE_SSInfo(ss);
1149 idx := idx + 1;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001150 }
1151
Harald Welte0622a9f2019-05-11 10:58:15 +02001152 /* the GSUP Message Class IE is optional, as old implementations don't have it yet */
1153 var template GSUP_IEs ies2 := ies;
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001154 ies2[idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD);
1155 idx := idx + 1;
Harald Welte0622a9f2019-05-11 10:58:15 +02001156
1157 return (ies, ies2);
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001158}
1159
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001160template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ(
1161 hexstring imsi,
1162 OCT4 sid,
1163 GSUP_SessionState state,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001164 template (omit) octetstring ss := omit
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001165) := ts_GSUP(
1166 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001167 f_gen_ts_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001168);
1169template GSUP_PDU tr_GSUP_PROC_SS_REQ(
1170 template hexstring imsi,
1171 template OCT4 sid := ?,
1172 template GSUP_SessionState state := ?,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001173 template octetstring ss := *
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001174) := tr_GSUP(
1175 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001176 f_gen_tr_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001177);
1178
1179template (value) GSUP_PDU ts_GSUP_PROC_SS_RES(
1180 hexstring imsi,
1181 OCT4 sid,
1182 GSUP_SessionState state,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001183 template (omit) octetstring ss := omit
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001184) := ts_GSUP(
1185 OSMO_GSUP_MSGT_PROC_SS_RESULT,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001186 f_gen_ts_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001187);
1188template GSUP_PDU tr_GSUP_PROC_SS_RES(
1189 template hexstring imsi,
1190 template OCT4 sid := ?,
1191 template GSUP_SessionState state := ?,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001192 template octetstring ss := *
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001193) := tr_GSUP(
1194 OSMO_GSUP_MSGT_PROC_SS_RESULT,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001195 f_gen_tr_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001196);
1197
1198template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR(
1199 hexstring imsi,
1200 OCT4 sid,
Vadim Yanitskiy21c42332018-11-29 00:18:05 +07001201 GSUP_SessionState state,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001202 integer cause
1203) := ts_GSUP(
1204 OSMO_GSUP_MSGT_PROC_SS_ERROR,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001205 f_gen_ts_ss_ies(imsi, sid, state, cause := cause)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001206);
1207template GSUP_PDU tr_GSUP_PROC_SS_ERR(
1208 template hexstring imsi,
1209 template OCT4 sid := ?,
Vadim Yanitskiy21c42332018-11-29 00:18:05 +07001210 template GSUP_SessionState state := ?,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001211 template integer cause := ?
1212) := tr_GSUP(
1213 OSMO_GSUP_MSGT_PROC_SS_ERROR,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001214 f_gen_tr_ss_ies(imsi, sid, state, cause := cause)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001215);
Harald Weltedf327232017-12-28 22:51:51 +01001216
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001217template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_REQ(
1218 hexstring imsi,
1219 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1220 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1221 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1222 octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1223) := ts_GSUP(
1224 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1225 {
1226 valueof(ts_GSUP_IE_IMSI(imsi)),
1227 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1228 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1229 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1230 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui))
1231 }
1232);
1233template GSUP_PDU tr_GSUP_MO_FORWARD_SM_REQ(
1234 template hexstring imsi := ?,
1235 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1236 template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1237 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1238 template octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1239) := tr_GSUP(
1240 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1241 {
1242 tr_GSUP_IE_IMSI(imsi),
1243 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1244 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1245 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001246 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
1247 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001248 }
1249);
1250
1251template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_RES(
1252 hexstring imsi,
1253 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1254) := ts_GSUP(
1255 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1256 {
1257 valueof(ts_GSUP_IE_IMSI(imsi)),
1258 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1259 }
1260);
1261template GSUP_PDU tr_GSUP_MO_FORWARD_SM_RES(
1262 template hexstring imsi := ?,
1263 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1264) := tr_GSUP(
1265 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1266 {
1267 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001268 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1269 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001270 }
1271);
1272
1273template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_ERR(
1274 hexstring imsi,
1275 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1276 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1277) := ts_GSUP(
1278 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1279 {
1280 valueof(ts_GSUP_IE_IMSI(imsi)),
1281 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1282 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1283 }
1284);
1285template GSUP_PDU tr_GSUP_MO_FORWARD_SM_ERR(
1286 template hexstring imsi := ?,
1287 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1288 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1289) := tr_GSUP(
1290 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1291 {
1292 tr_GSUP_IE_IMSI(imsi),
1293 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001294 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1295 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001296 }
1297);
1298
1299template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_REQ(
1300 hexstring imsi,
1301 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1302 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1303 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1304 octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1305 OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1306) := ts_GSUP(
1307 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1308 {
1309 /**
1310 * TODO: add MT-specific fields (and IEs):
1311 * - smDeliveryTimer
1312 * - smDeliveryStartTime
1313 */
1314 valueof(ts_GSUP_IE_IMSI(imsi)),
1315 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1316 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1317 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1318 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)),
1319 valueof(ts_GSUP_IE_SM_RP_MMS(sm_rp_mms))
1320 }
1321);
1322template GSUP_PDU tr_GSUP_MT_FORWARD_SM_REQ(
1323 template hexstring imsi := ?,
1324 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1325 template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1326 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1327 template octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1328 template OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1329) := tr_GSUP(
1330 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1331 {
1332 /**
1333 * TODO: add MT-specific fields (and IEs):
1334 * - smDeliveryTimer
1335 * - smDeliveryStartTime
1336 */
1337 tr_GSUP_IE_IMSI(imsi),
1338 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1339 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1340 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
1341 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001342 tr_GSUP_IE_SM_RP_MMS(sm_rp_mms),
1343 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001344 }
1345);
1346
1347template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_RES(
1348 hexstring imsi,
1349 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1350) := ts_GSUP(
1351 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1352 {
1353 valueof(ts_GSUP_IE_IMSI(imsi)),
1354 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1355 }
1356);
1357template GSUP_PDU tr_GSUP_MT_FORWARD_SM_RES(
1358 template hexstring imsi := ?,
1359 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1360) := tr_GSUP(
1361 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1362 {
1363 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001364 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1365 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001366 }
1367);
1368
1369template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_ERR(
1370 hexstring imsi,
1371 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1372 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1373) := ts_GSUP(
1374 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1375 {
1376 valueof(ts_GSUP_IE_IMSI(imsi)),
1377 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1378 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1379 }
1380);
1381template GSUP_PDU tr_GSUP_MT_FORWARD_SM_ERR(
1382 template hexstring imsi := ?,
1383 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1384 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1385) := tr_GSUP(
1386 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1387 {
1388 tr_GSUP_IE_IMSI(imsi),
1389 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001390 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1391 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001392 }
1393);
1394
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001395template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_REQ(
1396 hexstring imsi,
1397 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1398 GSUP_SM_ALERT_RSN_Type sm_alert_rsn /* SM Alert Reason, see 7.6.8.8 */
1399) := ts_GSUP(
1400 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1401 {
1402 valueof(ts_GSUP_IE_IMSI(imsi)),
1403 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1404 valueof(ts_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn))
1405 }
1406);
1407template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_REQ(
1408 template hexstring imsi := ?,
1409 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1410 template GSUP_SM_ALERT_RSN_Type sm_alert_rsn := ? /* SM Alert Reason, see 7.6.8.8 */
1411) := tr_GSUP(
1412 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1413 {
1414 tr_GSUP_IE_IMSI(imsi),
1415 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001416 tr_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn),
1417 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001418 }
1419);
1420
1421template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_RES(
1422 hexstring imsi,
1423 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1424) := ts_GSUP(
1425 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1426 {
1427 valueof(ts_GSUP_IE_IMSI(imsi)),
1428 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1429 }
1430);
1431template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_RES(
1432 template hexstring imsi := ?,
1433 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1434) := tr_GSUP(
1435 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1436 {
1437 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001438 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1439 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001440 }
1441);
1442
1443template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_ERR(
1444 hexstring imsi,
1445 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1446 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1447) := ts_GSUP(
1448 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1449 {
1450 valueof(ts_GSUP_IE_IMSI(imsi)),
1451 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1452 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1453 }
1454);
1455template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_ERR(
1456 template hexstring imsi := ?,
1457 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1458 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1459) := tr_GSUP(
1460 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1461 {
1462 tr_GSUP_IE_IMSI(imsi),
1463 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001464 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1465 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001466 }
1467);
1468
Harald Weltef9d449e2018-06-24 22:27:47 +02001469function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) return boolean {
1470 for (var integer i := 0; i < sizeof(msg.ies); i := i+1) {
1471 if (msg.ies[i].tag == iei) {
1472 ret := msg.ies[i].val;
1473 return true;
1474 }
1475 }
1476 return false;
1477}
1478
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001479template GSUP_AN_APDU t_GSUP_AN_APDU(
1480 template GSUP_AN_PROTO an_proto := ?,
1481 template octetstring pdu := ?
1482) := {
1483 proto := an_proto,
1484 pdu := pdu
1485};
1486
1487template GSUP_PDU tr_GSUP_E_AN_APDU(
1488 template GSUP_MessageType msgt,
1489 template hexstring imsi := ?,
1490 template octetstring source_name := ?,
1491 template octetstring destination_name := ?,
1492 template GSUP_AN_APDU an_apdu := ?
1493) := tr_GSUP(
1494 msgt,
1495 {
1496 tr_GSUP_IE_IMSI(imsi),
1497 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1498 tr_GSUP_IE_Source_Name(source_name),
1499 tr_GSUP_IE_Destination_Name(destination_name),
1500 tr_GSUP_IE_AN_APDU(an_apdu)
1501 }
1502);
1503
1504template GSUP_PDU tr_GSUP_E_NO_PDU(
1505 template GSUP_MessageType msgt,
1506 template hexstring imsi := ?,
1507 template octetstring source_name := ?,
1508 template octetstring destination_name := ?
1509) := tr_GSUP(
1510 msgt,
1511 {
1512 tr_GSUP_IE_IMSI(imsi),
1513 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1514 tr_GSUP_IE_Source_Name(source_name),
1515 tr_GSUP_IE_Destination_Name(destination_name)
1516 }
1517);
1518
1519template (value) GSUP_PDU ts_GSUP_E_AN_APDU(
1520 GSUP_MessageType msgt,
1521 hexstring imsi,
1522 octetstring source_name,
1523 octetstring destination_name,
1524 GSUP_AN_APDU an_apdu
1525) := ts_GSUP(
1526 msgt,
1527 {
1528 valueof(ts_GSUP_IE_IMSI(imsi)),
1529 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1530 valueof(ts_GSUP_IE_Source_Name(source_name)),
1531 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1532 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1533 }
1534);
1535
1536template (value) GSUP_PDU ts_GSUP_E_PrepareHandoverResult(
1537 hexstring imsi,
1538 hexstring msisdn,
1539 octetstring source_name,
1540 octetstring destination_name,
1541 GSUP_AN_APDU an_apdu
1542) := ts_GSUP(
1543 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT,
1544 {
1545 valueof(ts_GSUP_IE_IMSI(imsi)),
1546 valueof(ts_GSUP_IE_MSISDN(msisdn)),
1547 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1548 valueof(ts_GSUP_IE_Source_Name(source_name)),
1549 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1550 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1551 }
1552);
Harald Weltef9d449e2018-06-24 22:27:47 +02001553
Harald Weltedf327232017-12-28 22:51:51 +01001554} with { encode "RAW"; variant "FIELDORDER(msb)" }