blob: 74fbfc41678771bf0fc0dab441e28cb332d32769 [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
Oliver Smith1d118ff2019-07-03 10:57:35 +0200541template GSUP_PDU tr_GSUP_CHECK_IMEI_REQ(
542 template hexstring imsi,
543 template hexstring imei
544) := tr_GSUP(
545 OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST,
546 {
547 tr_GSUP_IE_IMSI(imsi),
548 tr_GSUP_IE_IMEI(imei),
549 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT)
550 }
551);
552
553template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_RES(hexstring imsi, GSUP_IMEIResult result) :=
554 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
555 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI_Result(result)) });
556
Oliver Smith936dbe62019-06-04 15:54:17 +0200557template GSUP_PDU tr_GSUP_CHECK_IMEI_RES(template hexstring imsi, template GSUP_IMEIResult result) :=
558 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
559 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_IMEI_Result(result) });
560
Oliver Smith1d118ff2019-07-03 10:57:35 +0200561template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_ERR(hexstring imsi, integer cause) :=
562 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
563 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
564
Oliver Smith936dbe62019-06-04 15:54:17 +0200565template GSUP_PDU tr_GSUP_CHECK_IMEI_ERR(template hexstring imsi, template integer cause) :=
566 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
567 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
568
Harald Welte167458a2018-01-27 15:58:16 +0100569
570template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := {
571 tag := OSMO_GSUP_CANCEL_TYPE_IE,
572 len := 0, /* overwritten */
573 val := {
574 cancel_type := ctype
575 }
576}
577
578template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) :=
579 tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype});
580
Harald Welte6abb9fe2018-02-17 15:24:48 +0100581template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) :=
582 tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain});
583
Harald Weltedf327232017-12-28 22:51:51 +0100584template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := {
585 tag := iei,
586 len := ?,
587 val := val
588}
589
590template (value) GSUP_IE ts_GSUP_IE_IMSI(hexstring imsi) := {
591 tag := OSMO_GSUP_IMSI_IE,
592 len := 0, /* overwritten */
593 val := {
594 imsi := imsi
595 }
596}
597
598template GSUP_IE tr_GSUP_IE_IMSI(template hexstring imsi) := {
599 tag := OSMO_GSUP_IMSI_IE,
600 len := ?,
601 val := {
602 imsi := imsi
603 }
604}
605
Harald Welte6ff81902018-01-21 19:09:08 +0100606template (value) GSUP_IE ts_GSUP_IE_MSISDN(hexstring msisdn) := {
607 tag := OSMO_GSUP_MSISDN_IE,
608 len := 0, /* overwritten */
609 val := {
Harald Welte3f95be82018-01-27 00:48:13 +0100610 msisdn := ts_GSUP_MSISDN(msisdn)
Harald Welte6ff81902018-01-21 19:09:08 +0100611 }
612}
613
614template GSUP_IE tr_GSUP_IE_MSISDN(template hexstring msisdn) := {
615 tag := OSMO_GSUP_MSISDN_IE,
616 len := ?,
617 val := {
Harald Welte3f95be82018-01-27 00:48:13 +0100618 msisdn := tr_GSUP_MSISDN(msisdn)
Harald Welte6ff81902018-01-21 19:09:08 +0100619 }
620}
621
622
Harald Weltedf327232017-12-28 22:51:51 +0100623template (value) GSUP_IE ts_GSUP_IE_Cause(integer cause) := {
624 tag := OSMO_GSUP_CAUSE_IE,
625 len := 0, /* overwritten */
626 val := {
627 cause := cause
628 }
629}
630
631template GSUP_IE tr_GSUP_IE_Cause(template integer cause) := {
632 tag := OSMO_GSUP_CAUSE_IE,
633 len := ?,
634 val := {
635 cause := cause
636 }
637}
638
639template (value) GSUP_IE ts_GSUP_IE_AUTS(octetstring auts) := {
640 tag := OSMO_GSUP_AUTS_IE,
641 len := 0, /* overwritten */
642 val := {
643 auts := auts
644 }
645}
646
Alexander Couzensd24973d2018-09-04 16:10:14 +0200647template GSUP_IE tr_GSUP_IE_AUTS(template octetstring auts) := {
648 tag := OSMO_GSUP_AUTS_IE,
649 len := ?,
650 val := {
651 auts := auts
652 }
653}
654
Harald Weltedf327232017-12-28 22:51:51 +0100655template (value) GSUP_IE ts_GSUP_IE_RAND(octetstring rand) := {
656 tag := OSMO_GSUP_RAND_IE,
657 len := 0, /* overwritten */
658 val := {
659 rand := rand
660 }
661}
662
Alexander Couzensd24973d2018-09-04 16:10:14 +0200663template GSUP_IE tr_GSUP_IE_RAND(template octetstring rand) := {
664 tag := OSMO_GSUP_RAND_IE,
665 len := ?,
666 val := {
667 rand := rand
668 }
669}
670
Harald Welte77a8eba2018-01-22 21:22:32 +0100671template (value) GSUP_IE ts_GSUP_IE_SRES(octetstring sres) := {
672 tag := OSMO_GSUP_SRES_IE,
673 len := 0, /* overwritten */
674 val := {
675 sres := sres
676 }
677}
678
679template (value) GSUP_IE ts_GSUP_IE_Kc(octetstring kc) := {
680 tag := OSMO_GSUP_KC_IE,
681 len := 0, /* overwritten */
682 val := {
683 kc := kc
684 }
685}
686
687template (value) GSUP_IE ts_GSUP_IE_IK(octetstring ik) := {
688 tag := OSMO_GSUP_IK_IE,
689 len := 0, /* overwritten */
690 val := {
691 ik := ik
692 }
693}
694
695template (value) GSUP_IE ts_GSUP_IE_CK(octetstring ck) := {
696 tag := OSMO_GSUP_CK_IE,
697 len := 0, /* overwritten */
698 val := {
699 ck := ck
700 }
701}
702
703template (value) GSUP_IE ts_GSUP_IE_AUTN(octetstring autn) := {
704 tag := OSMO_GSUP_AUTN_IE,
705 len := 0, /* overwritten */
706 val := {
707 autn := autn
708 }
709}
710
711template (value) GSUP_IE ts_GSUP_IE_RES(octetstring res) := {
712 tag := OSMO_GSUP_RES_IE,
713 len := 0, /* overwritten */
714 val := {
715 res := res
716 }
717}
Harald Weltedf327232017-12-28 22:51:51 +0100718
Harald Welteeded9ad2018-02-17 20:57:34 +0100719template (value) GSUP_IE ts_GSUP_IE_APN(octetstring apn) := {
720 tag := OSMO_GSUP_ACCESS_POINT_NAME_IE,
721 len := 0, /* overwritten */
722 val := {
723 apn := apn
724 }
725}
726
Harald Welte958f8b42018-03-01 23:40:17 +0100727template (value) GSUP_IE ts_GSUP_IE_CnDomain(GSUP_CnDomain dom) := {
728 tag := OSMO_GSUP_CN_DOMAIN_IE,
729 len := 0, /* overwritten */
730 val := {
731 cn_domain := dom
732 }
733}
Harald Weltedf327232017-12-28 22:51:51 +0100734
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700735template (value) GSUP_IE ts_GSUP_IE_SessionId(OCT4 sid) := {
736 tag := OSMO_GSUP_SESSION_ID_IE,
737 len := 0, /* overwritten */
738 val := {
739 session_id := sid
740 }
741}
742template GSUP_IE tr_GSUP_IE_SessionId(template OCT4 sid) := {
743 tag := OSMO_GSUP_SESSION_ID_IE,
744 len := ?,
745 val := {
746 session_id := sid
747 }
748}
749
750template (value) GSUP_IE ts_GSUP_IE_SessionState(GSUP_SessionState state) := {
751 tag := OSMO_GSUP_SESSION_STATE_IE,
752 len := 0, /* overwritten */
753 val := {
754 session_state := state
755 }
756}
757template GSUP_IE tr_GSUP_IE_SessionState(template GSUP_SessionState state) := {
758 tag := OSMO_GSUP_SESSION_STATE_IE,
759 len := ?,
760 val := {
761 session_state := state
762 }
763}
764
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700765template (value) GSUP_IE ts_GSUP_IE_SM_RP_MR(OCT1 ref) := {
766 tag := OSMO_GSUP_SM_RP_MR_IE,
767 len := 0, /* overwritten */
768 val := {
769 sm_rp_mr := ref
770 }
771}
772template GSUP_IE tr_GSUP_IE_SM_RP_MR(template OCT1 ref) := {
773 tag := OSMO_GSUP_SM_RP_MR_IE,
774 len := ?,
775 val := {
776 sm_rp_mr := ref
777 }
778}
779
780template (value) GSUP_IE ts_GSUP_IE_SM_RP_CAUSE(OCT1 cause) := {
781 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
782 len := 0, /* overwritten */
783 val := {
784 sm_rp_cause := cause
785 }
786}
787template GSUP_IE tr_GSUP_IE_SM_RP_CAUSE(template OCT1 cause) := {
788 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
789 len := ?,
790 val := {
791 sm_rp_cause := cause
792 }
793}
794
795template (value) GSUP_IE ts_GSUP_IE_SM_RP_MMS(OCT1 mms) := {
796 tag := OSMO_GSUP_SM_RP_MMS_IE,
797 len := 0, /* overwritten */
798 val := {
799 sm_rp_mms := mms
800 }
801}
802template GSUP_IE tr_GSUP_IE_SM_RP_MMS(template OCT1 mms) := {
803 tag := OSMO_GSUP_SM_RP_MMS_IE,
804 len := ?,
805 val := {
806 sm_rp_mms := mms
807 }
808}
809
Oliver Smith936dbe62019-06-04 15:54:17 +0200810template (value) GSUP_IE ts_GSUP_IE_IMEI(hexstring imei) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100811 tag := OSMO_GSUP_IMEI_IE,
812 len := 0, /* overwritten */
813 val := {
Oliver Smith936dbe62019-06-04 15:54:17 +0200814 imei := ts_GSUP_IMEI(imei)
Oliver Smithc5748292019-02-22 15:02:48 +0100815 }
816}
Oliver Smith936dbe62019-06-04 15:54:17 +0200817template GSUP_IE tr_GSUP_IE_IMEI(template hexstring imei) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100818 tag := OSMO_GSUP_IMEI_IE,
819 len := ?,
820 val := {
Oliver Smith936dbe62019-06-04 15:54:17 +0200821 imei := tr_GSUP_IMEI(imei)
Oliver Smithc5748292019-02-22 15:02:48 +0100822 }
823}
824
Oliver Smith936dbe62019-06-04 15:54:17 +0200825template (value) GSUP_IE ts_GSUP_IE_IMEI_Result(GSUP_IMEIResult result) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100826 tag := OSMO_GSUP_IMEI_RESULT_IE,
827 len := 0, /* overwritten */
828 val := {
829 imei_result := result
830 }
831}
Oliver Smith936dbe62019-06-04 15:54:17 +0200832template GSUP_IE tr_GSUP_IE_IMEI_Result(template GSUP_IMEIResult result) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100833 tag := OSMO_GSUP_IMEI_RESULT_IE,
834 len := ?,
835 val := {
836 imei_result := result
837 }
838}
839
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700840/* Possible identity types for SM-RP-{OA|DA} IEs */
841type enumerated GSUP_SM_RP_ODA_IdType {
842 OSMO_GSUP_SM_RP_ODA_ID_NONE ('00'O),
843 OSMO_GSUP_SM_RP_ODA_ID_IMSI ('01'O),
844 OSMO_GSUP_SM_RP_ODA_ID_MSISDN ('02'O),
845 OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR ('03'O),
846 /* Special value for noSM-RP-DA and noSM-RP-OA */
847 OSMO_GSUP_SM_RP_ODA_ID_NULL ('FF'O)
848} with { variant "FIELDLENGTH(8)" };
849
850/**
851 * SM-RP-DA represents the SM Destination Address, see 7.6.8.1.
852 * It can be either of the following:
853 * - IMSI
854 * - LMSI (not implemented)
855 * - MSISDN
856 * - roaming number (not implemented)
857 * - service centre address
858 */
859type union GSUP_SM_RP_DA_ID {
860 hexstring imsi,
861 hexstring msisdn,
862 hexstring smsc_addr
863};
864
865type record GSUP_SM_RP_DA {
866 GSUP_SM_RP_ODA_IdType id_type,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700867 GSUP_SM_RP_DA_ID id_enc optional
Vadim Yanitskiyf1f39bd2018-12-14 08:00:33 +0700868} with { variant (id_enc) "CROSSTAG(
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700869 imsi, id_type = OSMO_GSUP_SM_RP_ODA_ID_IMSI;
870 msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN;
871 smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR;
872 /* FIXME: how to handle noSM-RP-DA? */
873 )"
874};
875
876template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_IMSI(hexstring imsi) := {
877 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700878 id_enc := { imsi := imsi }
879}
880template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_IMSI(template hexstring imsi) := {
881 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700882 id_enc := { imsi := imsi }
883}
884
885template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_MSISDN(hexstring msisdn) := {
886 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700887 id_enc := { msisdn := msisdn }
888}
889template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_MSISDN(template hexstring msisdn) := {
890 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700891 id_enc := { msisdn := msisdn }
892}
893
894template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_SMSC_ADDR(hexstring smsc_addr) := {
895 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700896 id_enc := { smsc_addr := smsc_addr }
897}
898template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_SMSC_ADDR(template hexstring smsc_addr) := {
899 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700900 id_enc := { smsc_addr := smsc_addr }
901}
902
903template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_NULL := {
904 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700905 id_enc := omit
906}
907template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_NULL := {
908 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700909 id_enc := omit
910}
911
912template (value) GSUP_IE ts_GSUP_IE_SM_RP_DA(GSUP_SM_RP_DA val) := {
913 tag := OSMO_GSUP_SM_RP_DA_IE,
914 len := 0, /* overwritten */
915 val := {
916 sm_rp_da := val
917 }
918}
919template GSUP_IE tr_GSUP_IE_SM_RP_DA(template GSUP_SM_RP_DA val) := {
920 tag := OSMO_GSUP_SM_RP_DA_IE,
921 len := ?,
922 val := {
923 sm_rp_da := val
924 }
925}
926
927/**
928 * SM-RP-OA represents the SM Originating Address, see 7.6.8.2.
929 * It can be either of the following:
930 * - MSISDN
931 * - service centre address
932 */
933type union GSUP_SM_RP_OA_ID {
934 hexstring msisdn,
935 hexstring smsc_addr
936};
937
938type record GSUP_SM_RP_OA {
939 GSUP_SM_RP_ODA_IdType id_type,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700940 GSUP_SM_RP_OA_ID id_enc optional
Vadim Yanitskiyf1f39bd2018-12-14 08:00:33 +0700941} with { variant (id_enc) "CROSSTAG(
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700942 msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN;
943 smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR;
944 /* FIXME: how to handle noSM-RP-OA? */
945 )"
946};
947
948template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_MSISDN(hexstring msisdn) := {
949 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700950 id_enc := { msisdn := msisdn }
951}
952template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_MSISDN(template hexstring msisdn) := {
953 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700954 id_enc := { msisdn := msisdn }
955}
956
957template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_SMSC_ADDR(hexstring smsc_addr) := {
958 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700959 id_enc := { smsc_addr := smsc_addr }
960}
961template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_SMSC_ADDR(template hexstring smsc_addr) := {
962 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700963 id_enc := { smsc_addr := smsc_addr }
964}
965
966template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_NULL := {
967 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700968 id_enc := omit
969}
970template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_NULL := {
971 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700972 id_enc := omit
973}
974
975template (value) GSUP_IE ts_GSUP_IE_SM_RP_OA(GSUP_SM_RP_OA val) := {
976 tag := OSMO_GSUP_SM_RP_OA_IE,
977 len := 0, /* overwritten */
978 val := {
979 sm_rp_oa := val
980 }
981}
982template GSUP_IE tr_GSUP_IE_SM_RP_OA(template GSUP_SM_RP_OA val) := {
983 tag := OSMO_GSUP_SM_RP_OA_IE,
984 len := ?,
985 val := {
986 sm_rp_oa := val
987 }
988}
989
990/* SM-RP-UI represents the SM TPDU, see 7.6.8.4 */
991template (value) GSUP_IE ts_GSUP_IE_SM_RP_UI(octetstring val) := {
992 tag := OSMO_GSUP_SM_RP_UI_IE,
993 len := 0, /* overwritten */
994 val := {
995 sm_rp_ui := val
996 }
997}
998template GSUP_IE tr_GSUP_IE_SM_RP_UI(template octetstring val) := {
999 tag := OSMO_GSUP_SM_RP_UI_IE,
1000 len := ?,
1001 val := {
1002 sm_rp_ui := val
1003 }
1004}
1005
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001006/* SM Alert Reason types, see 7.6.8.8 */
1007type enumerated GSUP_SM_ALERT_RSN_Type {
1008 GSUP_SM_ALERT_RSN_TYPE_NONE ('00'O),
1009 GSUP_SM_ALERT_RSN_TYPE_MS_PRESENT ('01'O),
1010 GSUP_SM_ALERT_RSN_TYPE_MEM_AVAIL ('02'O)
1011} with { variant "FIELDLENGTH(8)" };
1012
1013/* SM Alert Reason IE (used in READY-FOR-SM), see 7.6.8.8 */
1014template (value) GSUP_IE ts_GSUP_IE_SM_ALERT_RSN(GSUP_SM_ALERT_RSN_Type rsn) := {
1015 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
1016 len := 0, /* overwritten */
1017 val := {
1018 sm_alert_rsn := rsn
1019 }
1020}
1021template GSUP_IE tr_GSUP_IE_SM_ALERT_RSN(template GSUP_SM_ALERT_RSN_Type rsn) := {
1022 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
1023 len := ?,
1024 val := {
1025 sm_alert_rsn := rsn
1026 }
1027}
1028
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001029template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := {
1030 tag := OSMO_GSUP_SS_INFO_IE,
1031 len := 0, /* overwritten */
1032 val := {
1033 ss_info := ss
1034 }
1035}
1036template GSUP_IE tr_GSUP_IE_SSInfo(template octetstring ss) := {
1037 tag := OSMO_GSUP_SS_INFO_IE,
1038 len := ?,
1039 val := {
1040 ss_info := ss
1041 }
1042}
1043
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001044template GSUP_IE tr_GSUP_IE_Message_Class(template GSUP_Message_Class val) := {
1045 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1046 len := ?,
1047 val := {
1048 message_class := val
1049 }
1050}
1051
1052template (value) GSUP_IE ts_GSUP_IE_Message_Class(GSUP_Message_Class val) := {
1053 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1054 len := 0, /* overwritten */
1055 val := {
1056 message_class := val
1057 }
1058}
1059
1060template GSUP_IE tr_GSUP_IE_Source_Name(template octetstring name) := {
1061 tag := OSMO_GSUP_SOURCE_NAME_IE,
1062 len := ?,
1063 val := {
1064 source_name := name
1065 }
1066}
1067
1068template (value) GSUP_IE ts_GSUP_IE_Source_Name(octetstring name) := {
1069 tag := OSMO_GSUP_SOURCE_NAME_IE,
1070 len := 0, /* overwritten */
1071 val := {
1072 source_name := name
1073 }
1074}
1075
1076template GSUP_IE tr_GSUP_IE_Destination_Name(template octetstring name) := {
1077 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1078 len := ?,
1079 val := {
1080 destination_name := name
1081 }
1082}
1083
1084template (value) GSUP_IE ts_GSUP_IE_Destination_Name(octetstring name) := {
1085 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1086 len := 0, /* overwritten */
1087 val := {
1088 destination_name := name
1089 }
1090}
1091
1092template GSUP_IE tr_GSUP_IE_AN_APDU(template GSUP_AN_APDU an_apdu) := {
1093 tag := OSMO_GSUP_AN_APDU_IE,
1094 len := ?,
1095 val := {
1096 an_apdu := an_apdu
1097 }
1098}
1099
1100template (value) GSUP_IE ts_GSUP_IE_AN_APDU(GSUP_AN_APDU an_apdu) := {
1101 tag := OSMO_GSUP_AN_APDU_IE,
1102 len := 0, /* overwritten */
1103 val := {
1104 an_apdu := an_apdu
1105 }
1106}
1107
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001108private function f_gen_ts_ss_ies(
1109 hexstring imsi,
1110 OCT4 sid,
1111 GSUP_SessionState state,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001112 template (omit) octetstring ss := omit,
1113 template (omit) integer cause := omit
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001114) return GSUP_IEs {
1115 /* Mandatory IEs */
1116 var GSUP_IEs ies := {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001117 valueof(ts_GSUP_IE_IMSI(imsi))
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001118 };
1119
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001120 /* Cause IE is needed for PROC_SS_ERR */
1121 if (isvalue(cause)) {
1122 ies := ies & { valueof(ts_GSUP_IE_Cause(valueof(cause))) };
1123 }
1124
1125 /* Mandatory session IEs */
1126 ies := ies & { valueof(ts_GSUP_IE_SessionId(sid)) };
1127 ies := ies & { valueof(ts_GSUP_IE_SessionState(state)) };
1128
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001129 /* Optional SS payload */
1130 if (isvalue(ss)) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001131 ies := ies & { valueof(ts_GSUP_IE_SSInfo(valueof(ss))) };
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001132 }
1133
1134 return ies;
1135}
1136private function f_gen_tr_ss_ies(
1137 template hexstring imsi,
1138 template OCT4 sid := ?,
1139 template GSUP_SessionState state := ?,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001140 template octetstring ss := omit,
1141 template integer cause := omit
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001142) return template GSUP_IEs {
1143 /* Mandatory IEs */
1144 var template GSUP_IEs ies := {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001145 tr_GSUP_IE_IMSI(imsi)
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001146 };
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001147 var integer idx := 1;
1148
1149 /* Cause IE is needed for PROC_SS_ERR */
1150 if (istemplatekind(cause, "*")) {
1151 ies[idx] := *;
1152 idx := idx + 1;
1153 } else if (not istemplatekind(cause, "omit")) {
1154 ies[idx] := tr_GSUP_IE_Cause(cause);
1155 idx := idx + 1;
1156 }
1157
1158 /* Mandatory session IEs */
1159 ies[idx] := tr_GSUP_IE_SessionId(sid);
1160 ies[idx + 1] := tr_GSUP_IE_SessionState(state);
1161 idx := idx + 2;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001162
1163 /* Optional SS payload */
1164 if (istemplatekind(ss, "*")) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001165 ies[idx] := *;
1166 idx := idx + 1;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001167 } else if (not istemplatekind(ss, "omit")) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001168 ies[idx] := tr_GSUP_IE_SSInfo(ss);
1169 idx := idx + 1;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001170 }
1171
Harald Welte0622a9f2019-05-11 10:58:15 +02001172 /* the GSUP Message Class IE is optional, as old implementations don't have it yet */
1173 var template GSUP_IEs ies2 := ies;
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001174 ies2[idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD);
1175 idx := idx + 1;
Harald Welte0622a9f2019-05-11 10:58:15 +02001176
1177 return (ies, ies2);
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001178}
1179
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001180template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ(
1181 hexstring imsi,
1182 OCT4 sid,
1183 GSUP_SessionState state,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001184 template (omit) octetstring ss := omit
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001185) := ts_GSUP(
1186 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001187 f_gen_ts_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001188);
1189template GSUP_PDU tr_GSUP_PROC_SS_REQ(
1190 template hexstring imsi,
1191 template OCT4 sid := ?,
1192 template GSUP_SessionState state := ?,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001193 template octetstring ss := *
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001194) := tr_GSUP(
1195 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001196 f_gen_tr_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001197);
1198
1199template (value) GSUP_PDU ts_GSUP_PROC_SS_RES(
1200 hexstring imsi,
1201 OCT4 sid,
1202 GSUP_SessionState state,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001203 template (omit) octetstring ss := omit
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001204) := ts_GSUP(
1205 OSMO_GSUP_MSGT_PROC_SS_RESULT,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001206 f_gen_ts_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001207);
1208template GSUP_PDU tr_GSUP_PROC_SS_RES(
1209 template hexstring imsi,
1210 template OCT4 sid := ?,
1211 template GSUP_SessionState state := ?,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001212 template octetstring ss := *
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001213) := tr_GSUP(
1214 OSMO_GSUP_MSGT_PROC_SS_RESULT,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001215 f_gen_tr_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001216);
1217
1218template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR(
1219 hexstring imsi,
1220 OCT4 sid,
Vadim Yanitskiy21c42332018-11-29 00:18:05 +07001221 GSUP_SessionState state,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001222 integer cause
1223) := ts_GSUP(
1224 OSMO_GSUP_MSGT_PROC_SS_ERROR,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001225 f_gen_ts_ss_ies(imsi, sid, state, cause := cause)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001226);
1227template GSUP_PDU tr_GSUP_PROC_SS_ERR(
1228 template hexstring imsi,
1229 template OCT4 sid := ?,
Vadim Yanitskiy21c42332018-11-29 00:18:05 +07001230 template GSUP_SessionState state := ?,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001231 template integer cause := ?
1232) := tr_GSUP(
1233 OSMO_GSUP_MSGT_PROC_SS_ERROR,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001234 f_gen_tr_ss_ies(imsi, sid, state, cause := cause)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001235);
Harald Weltedf327232017-12-28 22:51:51 +01001236
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001237template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_REQ(
1238 hexstring imsi,
1239 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1240 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1241 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1242 octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1243) := ts_GSUP(
1244 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1245 {
1246 valueof(ts_GSUP_IE_IMSI(imsi)),
1247 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1248 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1249 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1250 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui))
1251 }
1252);
1253template GSUP_PDU tr_GSUP_MO_FORWARD_SM_REQ(
1254 template hexstring imsi := ?,
1255 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1256 template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1257 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1258 template octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1259) := tr_GSUP(
1260 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1261 {
1262 tr_GSUP_IE_IMSI(imsi),
1263 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1264 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1265 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001266 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
1267 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001268 }
1269);
1270
1271template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_RES(
1272 hexstring imsi,
1273 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1274) := ts_GSUP(
1275 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1276 {
1277 valueof(ts_GSUP_IE_IMSI(imsi)),
1278 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1279 }
1280);
1281template GSUP_PDU tr_GSUP_MO_FORWARD_SM_RES(
1282 template hexstring imsi := ?,
1283 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1284) := tr_GSUP(
1285 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1286 {
1287 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001288 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1289 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001290 }
1291);
1292
1293template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_ERR(
1294 hexstring imsi,
1295 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1296 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1297) := ts_GSUP(
1298 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1299 {
1300 valueof(ts_GSUP_IE_IMSI(imsi)),
1301 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1302 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1303 }
1304);
1305template GSUP_PDU tr_GSUP_MO_FORWARD_SM_ERR(
1306 template hexstring imsi := ?,
1307 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1308 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1309) := tr_GSUP(
1310 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1311 {
1312 tr_GSUP_IE_IMSI(imsi),
1313 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001314 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1315 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001316 }
1317);
1318
1319template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_REQ(
1320 hexstring imsi,
1321 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1322 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1323 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1324 octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1325 OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1326) := ts_GSUP(
1327 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1328 {
1329 /**
1330 * TODO: add MT-specific fields (and IEs):
1331 * - smDeliveryTimer
1332 * - smDeliveryStartTime
1333 */
1334 valueof(ts_GSUP_IE_IMSI(imsi)),
1335 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1336 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1337 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1338 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)),
1339 valueof(ts_GSUP_IE_SM_RP_MMS(sm_rp_mms))
1340 }
1341);
1342template GSUP_PDU tr_GSUP_MT_FORWARD_SM_REQ(
1343 template hexstring imsi := ?,
1344 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1345 template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1346 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1347 template octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1348 template OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1349) := tr_GSUP(
1350 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1351 {
1352 /**
1353 * TODO: add MT-specific fields (and IEs):
1354 * - smDeliveryTimer
1355 * - smDeliveryStartTime
1356 */
1357 tr_GSUP_IE_IMSI(imsi),
1358 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1359 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1360 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
1361 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001362 tr_GSUP_IE_SM_RP_MMS(sm_rp_mms),
1363 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001364 }
1365);
1366
1367template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_RES(
1368 hexstring imsi,
1369 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1370) := ts_GSUP(
1371 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1372 {
1373 valueof(ts_GSUP_IE_IMSI(imsi)),
1374 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1375 }
1376);
1377template GSUP_PDU tr_GSUP_MT_FORWARD_SM_RES(
1378 template hexstring imsi := ?,
1379 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1380) := tr_GSUP(
1381 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1382 {
1383 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001384 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1385 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001386 }
1387);
1388
1389template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_ERR(
1390 hexstring imsi,
1391 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1392 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1393) := ts_GSUP(
1394 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1395 {
1396 valueof(ts_GSUP_IE_IMSI(imsi)),
1397 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1398 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1399 }
1400);
1401template GSUP_PDU tr_GSUP_MT_FORWARD_SM_ERR(
1402 template hexstring imsi := ?,
1403 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1404 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1405) := tr_GSUP(
1406 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1407 {
1408 tr_GSUP_IE_IMSI(imsi),
1409 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001410 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1411 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001412 }
1413);
1414
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001415template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_REQ(
1416 hexstring imsi,
1417 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1418 GSUP_SM_ALERT_RSN_Type sm_alert_rsn /* SM Alert Reason, see 7.6.8.8 */
1419) := ts_GSUP(
1420 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1421 {
1422 valueof(ts_GSUP_IE_IMSI(imsi)),
1423 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1424 valueof(ts_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn))
1425 }
1426);
1427template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_REQ(
1428 template hexstring imsi := ?,
1429 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1430 template GSUP_SM_ALERT_RSN_Type sm_alert_rsn := ? /* SM Alert Reason, see 7.6.8.8 */
1431) := tr_GSUP(
1432 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1433 {
1434 tr_GSUP_IE_IMSI(imsi),
1435 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001436 tr_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn),
1437 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001438 }
1439);
1440
1441template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_RES(
1442 hexstring imsi,
1443 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1444) := ts_GSUP(
1445 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1446 {
1447 valueof(ts_GSUP_IE_IMSI(imsi)),
1448 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1449 }
1450);
1451template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_RES(
1452 template hexstring imsi := ?,
1453 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1454) := tr_GSUP(
1455 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1456 {
1457 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001458 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1459 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001460 }
1461);
1462
1463template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_ERR(
1464 hexstring imsi,
1465 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1466 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1467) := ts_GSUP(
1468 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1469 {
1470 valueof(ts_GSUP_IE_IMSI(imsi)),
1471 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1472 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1473 }
1474);
1475template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_ERR(
1476 template hexstring imsi := ?,
1477 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1478 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1479) := tr_GSUP(
1480 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1481 {
1482 tr_GSUP_IE_IMSI(imsi),
1483 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001484 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1485 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001486 }
1487);
1488
Harald Weltef9d449e2018-06-24 22:27:47 +02001489function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) return boolean {
1490 for (var integer i := 0; i < sizeof(msg.ies); i := i+1) {
1491 if (msg.ies[i].tag == iei) {
1492 ret := msg.ies[i].val;
1493 return true;
1494 }
1495 }
1496 return false;
1497}
1498
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001499template GSUP_AN_APDU t_GSUP_AN_APDU(
1500 template GSUP_AN_PROTO an_proto := ?,
1501 template octetstring pdu := ?
1502) := {
1503 proto := an_proto,
1504 pdu := pdu
1505};
1506
1507template GSUP_PDU tr_GSUP_E_AN_APDU(
1508 template GSUP_MessageType msgt,
1509 template hexstring imsi := ?,
1510 template octetstring source_name := ?,
1511 template octetstring destination_name := ?,
1512 template GSUP_AN_APDU an_apdu := ?
1513) := tr_GSUP(
1514 msgt,
1515 {
1516 tr_GSUP_IE_IMSI(imsi),
1517 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1518 tr_GSUP_IE_Source_Name(source_name),
1519 tr_GSUP_IE_Destination_Name(destination_name),
1520 tr_GSUP_IE_AN_APDU(an_apdu)
1521 }
1522);
1523
1524template GSUP_PDU tr_GSUP_E_NO_PDU(
1525 template GSUP_MessageType msgt,
1526 template hexstring imsi := ?,
1527 template octetstring source_name := ?,
1528 template octetstring destination_name := ?
1529) := tr_GSUP(
1530 msgt,
1531 {
1532 tr_GSUP_IE_IMSI(imsi),
1533 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1534 tr_GSUP_IE_Source_Name(source_name),
1535 tr_GSUP_IE_Destination_Name(destination_name)
1536 }
1537);
1538
1539template (value) GSUP_PDU ts_GSUP_E_AN_APDU(
1540 GSUP_MessageType msgt,
1541 hexstring imsi,
1542 octetstring source_name,
1543 octetstring destination_name,
1544 GSUP_AN_APDU an_apdu
1545) := ts_GSUP(
1546 msgt,
1547 {
1548 valueof(ts_GSUP_IE_IMSI(imsi)),
1549 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1550 valueof(ts_GSUP_IE_Source_Name(source_name)),
1551 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1552 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1553 }
1554);
1555
1556template (value) GSUP_PDU ts_GSUP_E_PrepareHandoverResult(
1557 hexstring imsi,
1558 hexstring msisdn,
1559 octetstring source_name,
1560 octetstring destination_name,
1561 GSUP_AN_APDU an_apdu
1562) := ts_GSUP(
1563 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT,
1564 {
1565 valueof(ts_GSUP_IE_IMSI(imsi)),
1566 valueof(ts_GSUP_IE_MSISDN(msisdn)),
1567 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1568 valueof(ts_GSUP_IE_Source_Name(source_name)),
1569 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1570 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1571 }
1572);
Harald Weltef9d449e2018-06-24 22:27:47 +02001573
Harald Weltedf327232017-12-28 22:51:51 +01001574} with { encode "RAW"; variant "FIELDORDER(msb)" }