blob: d4b1db1ca9972c761a34cdd6466aeeead7e32833 [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),
Harald Welte0a1fd0e2019-12-03 20:01:08 +010046 OSMO_GSUP_SUPPORTED_RAT_TYPES_IE ('29'O),
47 OSMO_GSUP_CURRENT_RAT_TYPE_IE ('2a'O),
Vadim Yanitskiyb761d142018-06-02 21:05:04 +070048
49 OSMO_GSUP_SESSION_ID_IE ('30'O),
50 OSMO_GSUP_SESSION_STATE_IE ('31'O),
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +070051 OSMO_GSUP_SS_INFO_IE ('35'O),
52
53 /* SM related IEs (see 3GPP TS 29.002, section 7.6.8) */
54 OSMO_GSUP_SM_RP_MR_IE ('40'O),
55 OSMO_GSUP_SM_RP_DA_IE ('41'O),
56 OSMO_GSUP_SM_RP_OA_IE ('42'O),
57 OSMO_GSUP_SM_RP_UI_IE ('43'O),
58 OSMO_GSUP_SM_RP_CAUSE_IE ('44'O),
Vadim Yanitskiy88e23232018-11-13 03:04:02 +070059 OSMO_GSUP_SM_RP_MMS_IE ('45'O),
Oliver Smithc5748292019-02-22 15:02:48 +010060 OSMO_GSUP_SM_ALERT_RSN_IE ('46'O),
61
62 OSMO_GSUP_IMEI_IE ('50'O),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +020063 OSMO_GSUP_IMEI_RESULT_IE ('51'O),
64
65 OSMO_GSUP_MESSAGE_CLASS_IE ('0a'O),
66
67 OSMO_GSUP_SOURCE_NAME_IE ('60'O),
68 OSMO_GSUP_DESTINATION_NAME_IE ('61'O),
69 OSMO_GSUP_AN_APDU_IE ('62'O),
70 OSMO_GSUP_CAUSE_RR_IE ('63'O),
71 OSMO_GSUP_CAUSE_BSSAP_IE ('64'O),
72 OSMO_GSUP_CAUSE_SM_IE ('65'O)
Harald Weltedf327232017-12-28 22:51:51 +010073} with { variant "FIELDLENGTH(8)" };
74
75type enumerated GSUP_MessageType {
76 OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST ('00000100'B),
77 OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR ('00000101'B),
78 OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT ('00000110'B),
79
80 OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST ('00001000'B),
81 OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR ('00001001'B),
82 OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT ('00001010'B),
83
84 OSMO_GSUP_MSGT_AUTH_FAIL_REPORT ('00001011'B),
85
86 OSMO_GSUP_MSGT_PURGE_MS_REQUEST ('00001100'B),
87 OSMO_GSUP_MSGT_PURGE_MS_ERROR ('00001101'B),
88 OSMO_GSUP_MSGT_PURGE_MS_RESULT ('00001110'B),
89
90 OSMO_GSUP_MSGT_INSERT_DATA_REQUEST ('00010000'B),
91 OSMO_GSUP_MSGT_INSERT_DATA_ERROR ('00010001'B),
92 OSMO_GSUP_MSGT_INSERT_DATA_RESULT ('00010010'B),
93
94 OSMO_GSUP_MSGT_DELETE_DATA_REQUEST ('00010100'B),
95 OSMO_GSUP_MSGT_DELETE_DATA_ERROR ('00010101'B),
96 OSMO_GSUP_MSGT_DELETE_DATA_RESULT ('00010110'B),
97
98 OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST ('00011100'B),
99 OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR ('00011101'B),
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700100 OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT ('00011110'B),
101
102 OSMO_GSUP_MSGT_PROC_SS_REQUEST ('00100000'B),
103 OSMO_GSUP_MSGT_PROC_SS_ERROR ('00100001'B),
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700104 OSMO_GSUP_MSGT_PROC_SS_RESULT ('00100010'B),
105
106 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST ('00100100'B),
107 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR ('00100101'B),
108 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT ('00100110'B),
109
110 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST ('00101000'B),
111 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR ('00101001'B),
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700112 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT ('00101010'B),
113
114 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST ('00101100'B),
115 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR ('00101101'B),
Oliver Smithc5748292019-02-22 15:02:48 +0100116 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT ('00101110'B),
117
118 OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST ('00110000'B),
119 OSMO_GSUP_MSGT_CHECK_IMEI_ERROR ('00110001'B),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200120 OSMO_GSUP_MSGT_CHECK_IMEI_RESULT ('00110010'B),
121
122 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_REQUEST ('00110100'B),
123 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_ERROR ('00110101'B),
124 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT ('00110110'B),
125
126 OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_REQUEST ('00111000'B),
127 OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_ERROR ('00111001'B),
128 OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_RESULT ('00111010'B),
129
130 OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_REQUEST ('00111100'B),
131 OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_ERROR ('00111101'B),
132 OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_RESULT ('00111110'B),
133
134 OSMO_GSUP_MSGT_E_PROCESS_ACCESS_SIGNALLING_REQUEST ('01000000'B),
135 OSMO_GSUP_MSGT_E_FORWARD_ACCESS_SIGNALLING_REQUEST ('01000100'B),
136
137 OSMO_GSUP_MSGT_E_CLOSE ('01000111'B),
138 OSMO_GSUP_MSGT_E_ABORT ('01001011'B),
139
140 OSMO_GSUP_MSGT_E_ROUTING_ERROR ('01001110'B)
Harald Weltedf327232017-12-28 22:51:51 +0100141} with { variant "FIELDLENGTH(8)" };
142
143type enumerated GSUP_CancelType {
Alexander Couzens4786b3f2018-09-16 03:33:30 +0200144 OSMO_GSUP_CANCEL_TYPE_UPDATE (0),
145 OSMO_GSUP_CANCEL_TYPE_WITHDRAW (1)
Harald Weltedf327232017-12-28 22:51:51 +0100146} with { variant "FIELDLENGTH(8)" };
147
148type enumerated GSUP_CnDomain {
149 OSMO_GSUP_CN_DOMAIN_PS (1),
150 OSMO_GSUP_CN_DOMAIN_CS (2)
151} with { variant "FIELDLENGTH(8)" };
152
Oliver Smithc5748292019-02-22 15:02:48 +0100153type enumerated GSUP_IMEIResult {
154 OSMO_GSUP_IMEI_RESULT_ACK (0),
155 OSMO_GSUP_IMEI_RESULT_NACK (1)
156} with { variant "FIELDLENGTH(8)" };
157
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700158type enumerated GSUP_SessionState {
159 OSMO_GSUP_SESSION_STATE_NONE (0),
160 OSMO_GSUP_SESSION_STATE_BEGIN (1),
161 OSMO_GSUP_SESSION_STATE_CONTINUE (2),
162 OSMO_GSUP_SESSION_STATE_END (3)
163} with { variant "FIELDLENGTH(8)" };
164
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200165type enumerated GSUP_Message_Class {
166 OSMO_GSUP_MESSAGE_CLASS_UNSET (0),
167 OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT (1),
168 OSMO_GSUP_MESSAGE_CLASS_SMS (2),
169 OSMO_GSUP_MESSAGE_CLASS_USSD (3),
170 OSMO_GSUP_MESSAGE_CLASS_INTER_MSC (4)
171} with { variant "FIELDLENGTH(8)" };
172
Harald Welte3f95be82018-01-27 00:48:13 +0100173type record GSUP_MSISDN {
174 uint8_t len,
175 hexstring digits optional
176} with { variant (len) "LENGTHTO(digits)" };
177
Oliver Smithc5748292019-02-22 15:02:48 +0100178type record GSUP_IMEI {
179 uint8_t len,
180 hexstring digits optional
181} with { variant (len) "LENGTHTO(digits)" };
182
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200183type enumerated GSUP_AN_PROTO {
184 OSMO_GSUP_AN_PROTO_48006 (1),
185 OSMO_GSUP_AN_PROTO_25413 (2)
186} with { variant "FIELDLENGTH(8)" };
187
188type record GSUP_AN_APDU {
189 GSUP_AN_PROTO proto,
190 octetstring pdu
191};
192
Harald Weltedf327232017-12-28 22:51:51 +0100193type record GSUP_IE {
194 GSUP_IEI tag,
195 uint8_t len,
196 GSUP_IeValue val
197} with { variant (len) "LENGTHTO(val)"
198 variant (val) "CROSSTAG(imsi, tag = OSMO_GSUP_IMSI_IE;
199 cause, tag = OSMO_GSUP_CAUSE_IE;
200 cancel_type, tag = OSMO_GSUP_CANCEL_TYPE_IE;
Harald Welte77a8eba2018-01-22 21:22:32 +0100201 auth_tuple, tag = OSMO_GSUP_AUTH_TUPLE_IE;
Harald Weltedf327232017-12-28 22:51:51 +0100202 auts, tag = OSMO_GSUP_AUTS_IE;
203 rand, tag = OSMO_GSUP_RAND_IE;
Harald Welte77a8eba2018-01-22 21:22:32 +0100204 sres, tag = OSMO_GSUP_SRES_IE;
205 kc, tag = OSMO_GSUP_KC_IE;
206 ik, tag = OSMO_GSUP_IK_IE;
207 ck, tag = OSMO_GSUP_CK_IE;
208 autn, tag = OSMO_GSUP_AUTN_IE;
209 res, tag = OSMO_GSUP_RES_IE;
Harald Weltedf327232017-12-28 22:51:51 +0100210 msisdn, tag = OSMO_GSUP_MSISDN_IE;
211 hlr_number, tag = OSMO_GSUP_HLR_NUMBER_IE;
212 cn_domain, tag = OSMO_GSUP_CN_DOMAIN_IE;
Harald Welteeded9ad2018-02-17 20:57:34 +0100213 pdp_info, tag = OSMO_GSUP_PDP_INFO_IE;
214 apn, tag = OSMO_GSUP_ACCESS_POINT_NAME_IE;
215 pdp_qos, tag = OSMO_GSUP_PDP_QOS_IE;
216 pdp_type, tag = OSMO_GSUP_PDP_TYPE_IE;
217 charg_char, tag = OSMO_GSUP_CHARG_CHAR_IE;
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700218 session_state, tag = OSMO_GSUP_SESSION_STATE_IE;
219 session_id, tag = OSMO_GSUP_SESSION_ID_IE;
220 ss_info, tag = OSMO_GSUP_SS_INFO_IE;
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700221 sm_rp_mr, tag = OSMO_GSUP_SM_RP_MR_IE;
222 sm_rp_da, tag = OSMO_GSUP_SM_RP_DA_IE;
223 sm_rp_oa, tag = OSMO_GSUP_SM_RP_OA_IE;
224 sm_rp_ui, tag = OSMO_GSUP_SM_RP_UI_IE;
225 sm_rp_cause, tag = OSMO_GSUP_SM_RP_CAUSE_IE;
226 sm_rp_mms, tag = OSMO_GSUP_SM_RP_MMS_IE;
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700227 sm_alert_rsn, tag = OSMO_GSUP_SM_ALERT_RSN_IE;
Oliver Smithc5748292019-02-22 15:02:48 +0100228 imei, tag = OSMO_GSUP_IMEI_IE;
229 imei_result, tag = OSMO_GSUP_IMEI_RESULT_IE;
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200230 message_class, tag = OSMO_GSUP_MESSAGE_CLASS_IE;
231 source_name, tag = OSMO_GSUP_SOURCE_NAME_IE;
232 destination_name, tag = OSMO_GSUP_DESTINATION_NAME_IE;
233 an_apdu, tag = OSMO_GSUP_AN_APDU_IE;
234 cause_rr, tag = OSMO_GSUP_CAUSE_RR_IE;
235 cause_bssap, tag = OSMO_GSUP_CAUSE_BSSAP_IE;
236 cause_sm, tag = OSMO_GSUP_CAUSE_SM_IE;
Harald Welte0a1fd0e2019-12-03 20:01:08 +0100237 supported_rat_types, tag = OSMO_GSUP_SUPPORTED_RAT_TYPES_IE;
238 current_rat_type, tag = OSMO_GSUP_CURRENT_RAT_TYPE_IE;
Harald Welteeded9ad2018-02-17 20:57:34 +0100239 )"
Harald Weltedf327232017-12-28 22:51:51 +0100240};
241
242type record of GSUP_IE GSUP_IEs;
243
Harald Welte8eebb6c2019-08-22 12:40:03 +0200244type enumerated GSUP_RatType {
245 RAT_TYPE_UNKNOWN (0),
246 RAT_TYPE_GERAN_A (1),
247 RAT_TYPE_UTRAN_Iu (2),
248 RAT_TYPE_EUTRAN_SGs (3)
249} with { variant "FIELDLENGTH(8)" };
250
251type record of GSUP_RatType GSUP_RatTypes;
252
Harald Weltedf327232017-12-28 22:51:51 +0100253type union GSUP_IeValue {
254 hexstring imsi,
255 integer cause,
256 GSUP_CancelType cancel_type,
257 //boolean pdp_info_compl,
258 //boolean freeze_ptmsi,
Harald Weltedf327232017-12-28 22:51:51 +0100259 GSUP_IEs auth_tuple,
260 octetstring auts,
261 octetstring rand,
Harald Welte77a8eba2018-01-22 21:22:32 +0100262 octetstring sres,
263 octetstring kc,
264 octetstring ik,
265 octetstring ck,
266 octetstring autn,
267 octetstring res,
Harald Welte3f95be82018-01-27 00:48:13 +0100268 GSUP_MSISDN msisdn,
Harald Weltedf327232017-12-28 22:51:51 +0100269 octetstring hlr_number,
270 GSUP_CnDomain cn_domain,
Harald Welteeded9ad2018-02-17 20:57:34 +0100271 /* PDP context + nested IEs */
272 GSUP_IEs pdp_info,
273 octetstring apn,
274 octetstring pdp_qos,
275 OCT2 pdp_type,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700276 octetstring charg_char,
277 /* Session information */
278 GSUP_SessionState session_state,
279 OCT4 session_id,
280 /* Supplementary Services */
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700281 octetstring ss_info,
282 /* Short Message Service */
283 OCT1 sm_rp_mr,
284 GSUP_SM_RP_DA sm_rp_da,
285 GSUP_SM_RP_OA sm_rp_oa,
286 octetstring sm_rp_ui,
287 OCT1 sm_rp_cause,
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700288 OCT1 sm_rp_mms,
Oliver Smithc5748292019-02-22 15:02:48 +0100289 GSUP_SM_ALERT_RSN_Type sm_alert_rsn,
290
291 GSUP_IMEI imei,
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200292 GSUP_IMEIResult imei_result,
293
294 GSUP_Message_Class message_class,
295
296 octetstring source_name,
297 octetstring destination_name,
298
299 GSUP_AN_APDU an_apdu,
300
301 OCT1 cause_rr,
302 OCT1 cause_bssap,
Harald Welte8eebb6c2019-08-22 12:40:03 +0200303 OCT1 cause_sm,
304
Harald Welte0a1fd0e2019-12-03 20:01:08 +0100305 GSUP_RatTypes supported_rat_types,
306 GSUP_RatType current_rat_type
Harald Weltedf327232017-12-28 22:51:51 +0100307};
308
309type record GSUP_PDU {
310 GSUP_MessageType msg_type,
311 GSUP_IEs ies
312};
313
314external function enc_GSUP_PDU(in GSUP_PDU msg) return octetstring
315 with { extension "prototype(convert) encode(RAW)" };
316
317external function dec_GSUP_PDU(in octetstring msg) return GSUP_PDU
318 with { extension "prototype(convert) decode(RAW)" };
319
Harald Welte2f562b12018-01-24 20:52:38 +0100320function f_gsup_postprocess_decoded(inout GSUP_PDU gsup) {
321 if (gsup.ies[0].tag == OSMO_GSUP_IMSI_IE) {
322 /* if last digit is 'F', then there's an odd number of digits and we must strip the F */
323 var integer num_digits := lengthof(gsup.ies[0].val.imsi);
324 if (gsup.ies[0].val.imsi[num_digits-1] == 'F'H) {
325 gsup.ies[0].val.imsi := substr(gsup.ies[0].val.imsi, 0, num_digits-1);
326 }
327 }
328}
329
330function f_gsup_preprocess_encoded(inout GSUP_PDU gsup) {
331 if (ischosen(gsup.ies[0].val.imsi)) {
332 /* if number of digits is odd, add a 'F' as padding at the end */
333 var integer num_digits := lengthof(gsup.ies[0].val.imsi);
334 if (num_digits rem 2 == 1) {
335 gsup.ies[0].val.imsi := gsup.ies[0].val.imsi & 'F'H;
336 }
337 }
338}
339
Harald Welte3f95be82018-01-27 00:48:13 +0100340template (value) GSUP_MSISDN ts_GSUP_MSISDN(hexstring digits,
341 BIT3 ton := '000'B,
342 BIT4 npi := '0000'B) := {
343 len := 0, /* overwritten */
344 /* numberingPlanIdentification := npi,
345 typeOfNumber := ton,
346 ext1 := '0'B, */
347 digits := digits
348}
349
350template GSUP_MSISDN tr_GSUP_MSISDN(template hexstring digits,
351 template BIT3 ton := ?,
352 template BIT4 npi := ?) := {
353 len := ?,
354 /* numberingPlanIdentification := npi,
355 typeOfNumber := ton,
356 ext1 := '0'B, */
357 digits := digits
358}
359
360
Harald Weltedf327232017-12-28 22:51:51 +0100361
Harald Welte77a8eba2018-01-22 21:22:32 +0100362template GSUP_IE ts_GSUP_IE_AuthTuple2G(octetstring rand, octetstring sres,
363 octetstring kc) := {
364 tag := OSMO_GSUP_AUTH_TUPLE_IE,
365 len := 0, /* overwritten */
366 val := {
367 auth_tuple := {
368 valueof(ts_GSUP_IE_RAND(rand)),
369 valueof(ts_GSUP_IE_SRES(sres)),
370 valueof(ts_GSUP_IE_Kc(kc))
371 }
372 }
373}
374
375template GSUP_IE ts_GSUP_IE_AuthTuple2G3G(octetstring rand, octetstring sres,
376 octetstring kc, octetstring ik,
377 octetstring ck, octetstring autn,
378 octetstring res) := {
379 tag := OSMO_GSUP_AUTH_TUPLE_IE,
380 len := 0, /* overwritten */
381 val := {
382 auth_tuple := {
383 valueof(ts_GSUP_IE_RAND(rand)),
384 valueof(ts_GSUP_IE_SRES(sres)),
385 valueof(ts_GSUP_IE_Kc(kc)),
386 valueof(ts_GSUP_IE_IK(ik)),
387 valueof(ts_GSUP_IE_CK(ck)),
388 valueof(ts_GSUP_IE_AUTN(autn)),
389 valueof(ts_GSUP_IE_RES(res))
390 }
391 }
392}
393
Harald Welteeded9ad2018-02-17 20:57:34 +0100394template GSUP_IE ts_GSUP_IE_PdpInfo(octetstring apn, octetstring pdp_type, octetstring pdp_qos) := {
395 tag := OSMO_GSUP_PDP_INFO_IE,
396 len := 0, /* overwritten */
397 val := {
398 pdp_info := {
399 valueof(ts_GSUP_IE_APN(apn)),
400 valueof(ts_GSUP_IE_PDP_TYPE(pdp_type)),
401 valueof(ts_GSUP_IE_PDP_QOS(pdp_qos))
402 }
403 }
404}
405
406template (value) GSUP_IE ts_GSUP_IE_PDP_TYPE(OCT2 pdp_type) := {
407 tag := OSMO_GSUP_PDP_TYPE_IE,
408 len := 0,
409 val := {
410 pdp_type := pdp_type
411 }
412}
413
414template (value) GSUP_IE ts_GSUP_IE_PDP_QOS(octetstring pdp_qos) := {
415 tag := OSMO_GSUP_PDP_QOS_IE,
416 len := 0,
417 val := {
418 pdp_qos := pdp_qos
419 }
420}
421
422
Harald Weltedf327232017-12-28 22:51:51 +0100423template GSUP_PDU tr_GSUP(template GSUP_MessageType msgt := ?, template GSUP_IEs ies := *) := {
424 msg_type := msgt,
425 ies := ies
426}
427
Harald Welte8a1dd532018-01-27 15:38:18 +0100428template GSUP_PDU tr_GSUP_IMSI(template GSUP_MessageType msgt := ?, template hexstring imsi) := {
429 msg_type := msgt,
430 ies := { tr_GSUP_IE_IMSI(imsi), * }
431}
432
Harald Weltedf327232017-12-28 22:51:51 +0100433template GSUP_PDU ts_GSUP(GSUP_MessageType msgt, GSUP_IEs ies := {}) := {
434 msg_type := msgt,
435 ies := ies
436}
437
Oliver Smith936dbe62019-06-04 15:54:17 +0200438template (value) GSUP_IMEI ts_GSUP_IMEI(hexstring digits) := {
439 len := 0, /* overwritten */
440 digits := digits
441}
442
443template GSUP_IMEI tr_GSUP_IMEI(template hexstring digits) := {
444 len := ?,
445 digits := digits
446}
447
448
Harald Welte6aa04e32018-01-27 15:35:19 +0100449template (value) GSUP_PDU ts_GSUP_SAI_REQ(hexstring imsi) :=
Harald Weltedf327232017-12-28 22:51:51 +0100450 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { valueof(ts_GSUP_IE_IMSI(imsi)) });
451
Harald Welte8eebb6c2019-08-22 12:40:03 +0200452template (value) GSUP_PDU ts_GSUP_SAI_REQ_EPS(hexstring imsi) :=
453 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
454 valueof(ts_GSUP_IE_IMSI(imsi)),
Harald Welte0a1fd0e2019-12-03 20:01:08 +0100455 valueof(ts_GSUP_IE_CURRENT_RAT_TYPE(RAT_TYPE_EUTRAN_SGs))
Harald Welte8eebb6c2019-08-22 12:40:03 +0200456 });
457
Harald Welteef9fa872018-01-22 03:00:17 +0100458template GSUP_PDU tr_GSUP_SAI_REQ(template hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100459 tr_GSUP_IMSI(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, imsi);
Harald Welteef9fa872018-01-22 03:00:17 +0100460
Alexander Couzensd24973d2018-09-04 16:10:14 +0200461template GSUP_PDU tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC(
462 template hexstring imsi,
463 template octetstring auts,
464 template octetstring rand) :=
465 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
466 tr_GSUP_IE_IMSI(imsi),
467 tr_GSUP_IE_AUTS(auts),
468 tr_GSUP_IE_RAND(rand),
469 *
470 });
471
Harald Welte77a8eba2018-01-22 21:22:32 +0100472template (value) GSUP_PDU ts_GSUP_SAI_RES(hexstring imsi, GSUP_IE auth_tuple) :=
473 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, {
474 valueof(ts_GSUP_IE_IMSI(imsi)), auth_tuple });
475
Harald Weltedf327232017-12-28 22:51:51 +0100476template GSUP_PDU tr_GSUP_SAI_ERR(template hexstring imsi, template integer cause) :=
Harald Welte071ed732018-01-23 19:53:52 +0100477 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, {
Harald Weltedf327232017-12-28 22:51:51 +0100478 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
479
Harald Welte6aa04e32018-01-27 15:35:19 +0100480template (value) GSUP_PDU ts_GSUP_SAI_ERR(hexstring imsi, integer cause) :=
481 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, {
482 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
Harald Welte071ed732018-01-23 19:53:52 +0100483
484
Harald Weltedf327232017-12-28 22:51:51 +0100485template GSUP_PDU tr_GSUP_SAI_RES(template hexstring imsi) :=
Harald Weltec2c52552018-03-01 21:20:39 +0100486 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, {
Harald Weltedf327232017-12-28 22:51:51 +0100487 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE(OSMO_GSUP_AUTH_TUPLE_IE), * });
488
Harald Weltec2c52552018-03-01 21:20:39 +0100489template (value) GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi) :=
490 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, {
491 valueof(ts_GSUP_IE_IMSI(imsi)) });
492
Harald Weltedfe94dd2018-01-21 13:55:22 +0100493template GSUP_PDU tr_GSUP_UL_REQ(template hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100494 tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, imsi);
Harald Weltedfe94dd2018-01-21 13:55:22 +0100495
Harald Welte6aa04e32018-01-27 15:35:19 +0100496template (value) GSUP_PDU ts_GSUP_UL_RES(hexstring imsi) :=
Harald Weltedfe94dd2018-01-21 13:55:22 +0100497 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, { valueof(ts_GSUP_IE_IMSI(imsi)) });
498
Harald Weltec2c52552018-03-01 21:20:39 +0100499template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi) :=
500 tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, imsi);
501
Harald Welte6aa04e32018-01-27 15:35:19 +0100502template (value) GSUP_PDU ts_GSUP_UL_ERR(hexstring imsi, integer cause) :=
Harald Welte6ff81902018-01-21 19:09:08 +0100503 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, {
504 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
505
Harald Weltec2c52552018-03-01 21:20:39 +0100506template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?) :=
507 tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, {
508 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
509
Harald Welte6aa04e32018-01-27 15:35:19 +0100510template (value) GSUP_PDU ts_GSUP_ISD_REQ(hexstring imsi, hexstring msisdn) :=
Harald Welte6ff81902018-01-21 19:09:08 +0100511 ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, {
512 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_MSISDN(msisdn)) });
513
Harald Weltec2c52552018-03-01 21:20:39 +0100514template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?) :=
515 tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, {
Harald Welte8f6ac162018-03-01 22:43:28 +0100516 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_MSISDN(msisdn), * });
Harald Weltec2c52552018-03-01 21:20:39 +0100517
518template (value) GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi) :=
519 ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, {
520 valueof(ts_GSUP_IE_IMSI(imsi)) });
521
Harald Welte6ff81902018-01-21 19:09:08 +0100522template GSUP_PDU tr_GSUP_ISD_RES(template hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100523 tr_GSUP_IMSI(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, imsi);
Harald Weltedf327232017-12-28 22:51:51 +0100524
Harald Weltec638f4d2018-01-24 22:00:36 +0100525template GSUP_PDU tr_GSUP_AUTH_FAIL_IND(hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100526 tr_GSUP_IMSI(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT, imsi);
Harald Weltedf327232017-12-28 22:51:51 +0100527
Harald Welte167458a2018-01-27 15:58:16 +0100528template (value) GSUP_PDU ts_GSUP_CL_REQ(hexstring imsi, GSUP_CancelType ctype) :=
529 ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST, {
530 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CancelType(ctype)) });
531
532template GSUP_PDU tr_GSUP_CL_RES(template hexstring imsi) :=
533 tr_GSUP_IMSI(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, imsi);
534
535template GSUP_PDU tr_GSUP_CL_ERR(template hexstring imsi, template integer cause := ?) :=
536 tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR, {
Alexander Couzens4cfff3a2018-05-22 17:08:36 +0200537 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause), * });
Harald Welte167458a2018-01-27 15:58:16 +0100538
Harald Welte958f8b42018-03-01 23:40:17 +0100539template (value) GSUP_PDU ts_GSUP_PURGE_MS_REQ(hexstring imsi, GSUP_CnDomain dom) :=
540 ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, {
541 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) });
542
Harald Welte6abb9fe2018-02-17 15:24:48 +0100543template GSUP_PDU tr_GSUP_PURGE_MS_REQ(template hexstring imsi, template GSUP_CnDomain dom := ?) :=
544 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, {
545 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_CnDomain(dom) });
546
547template (value) GSUP_PDU ts_GSUP_PURGE_MS_RES(hexstring imsi) :=
548 ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, {
549 valueof(ts_GSUP_IE_IMSI(imsi)) });
550
Harald Welte958f8b42018-03-01 23:40:17 +0100551template GSUP_PDU tr_GSUP_PURGE_MS_RES(template hexstring imsi) :=
552 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, {
553 tr_GSUP_IE_IMSI(imsi), * });
554
555template GSUP_PDU tr_GSUP_PURGE_MS_ERR(template hexstring imsi, template integer cause) :=
556 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_ERROR, {
557 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
558
Oliver Smith936dbe62019-06-04 15:54:17 +0200559template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_REQ(hexstring imsi, hexstring imei) :=
560 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, {
561 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI(imei)) });
562
Oliver Smith1d118ff2019-07-03 10:57:35 +0200563template GSUP_PDU tr_GSUP_CHECK_IMEI_REQ(
564 template hexstring imsi,
565 template hexstring imei
566) := tr_GSUP(
567 OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST,
568 {
569 tr_GSUP_IE_IMSI(imsi),
570 tr_GSUP_IE_IMEI(imei),
571 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT)
572 }
573);
574
575template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_RES(hexstring imsi, GSUP_IMEIResult result) :=
576 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
577 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI_Result(result)) });
578
Oliver Smith936dbe62019-06-04 15:54:17 +0200579template GSUP_PDU tr_GSUP_CHECK_IMEI_RES(template hexstring imsi, template GSUP_IMEIResult result) :=
580 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
581 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_IMEI_Result(result) });
582
Oliver Smith1d118ff2019-07-03 10:57:35 +0200583template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_ERR(hexstring imsi, integer cause) :=
584 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
585 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
586
Oliver Smith936dbe62019-06-04 15:54:17 +0200587template GSUP_PDU tr_GSUP_CHECK_IMEI_ERR(template hexstring imsi, template integer cause) :=
588 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
589 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
590
Harald Welte167458a2018-01-27 15:58:16 +0100591
592template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := {
593 tag := OSMO_GSUP_CANCEL_TYPE_IE,
594 len := 0, /* overwritten */
595 val := {
596 cancel_type := ctype
597 }
598}
599
600template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) :=
601 tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype});
602
Harald Welte6abb9fe2018-02-17 15:24:48 +0100603template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) :=
604 tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain});
605
Harald Weltedf327232017-12-28 22:51:51 +0100606template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := {
607 tag := iei,
608 len := ?,
609 val := val
610}
611
612template (value) GSUP_IE ts_GSUP_IE_IMSI(hexstring imsi) := {
613 tag := OSMO_GSUP_IMSI_IE,
614 len := 0, /* overwritten */
615 val := {
616 imsi := imsi
617 }
618}
619
620template GSUP_IE tr_GSUP_IE_IMSI(template hexstring imsi) := {
621 tag := OSMO_GSUP_IMSI_IE,
622 len := ?,
623 val := {
624 imsi := imsi
625 }
626}
627
Harald Welte6ff81902018-01-21 19:09:08 +0100628template (value) GSUP_IE ts_GSUP_IE_MSISDN(hexstring msisdn) := {
629 tag := OSMO_GSUP_MSISDN_IE,
630 len := 0, /* overwritten */
631 val := {
Harald Welte3f95be82018-01-27 00:48:13 +0100632 msisdn := ts_GSUP_MSISDN(msisdn)
Harald Welte6ff81902018-01-21 19:09:08 +0100633 }
634}
635
636template GSUP_IE tr_GSUP_IE_MSISDN(template hexstring msisdn) := {
637 tag := OSMO_GSUP_MSISDN_IE,
638 len := ?,
639 val := {
Harald Welte3f95be82018-01-27 00:48:13 +0100640 msisdn := tr_GSUP_MSISDN(msisdn)
Harald Welte6ff81902018-01-21 19:09:08 +0100641 }
642}
643
644
Harald Weltedf327232017-12-28 22:51:51 +0100645template (value) GSUP_IE ts_GSUP_IE_Cause(integer cause) := {
646 tag := OSMO_GSUP_CAUSE_IE,
647 len := 0, /* overwritten */
648 val := {
649 cause := cause
650 }
651}
652
653template GSUP_IE tr_GSUP_IE_Cause(template integer cause) := {
654 tag := OSMO_GSUP_CAUSE_IE,
655 len := ?,
656 val := {
657 cause := cause
658 }
659}
660
661template (value) GSUP_IE ts_GSUP_IE_AUTS(octetstring auts) := {
662 tag := OSMO_GSUP_AUTS_IE,
663 len := 0, /* overwritten */
664 val := {
665 auts := auts
666 }
667}
668
Alexander Couzensd24973d2018-09-04 16:10:14 +0200669template GSUP_IE tr_GSUP_IE_AUTS(template octetstring auts) := {
670 tag := OSMO_GSUP_AUTS_IE,
671 len := ?,
672 val := {
673 auts := auts
674 }
675}
676
Harald Weltedf327232017-12-28 22:51:51 +0100677template (value) GSUP_IE ts_GSUP_IE_RAND(octetstring rand) := {
678 tag := OSMO_GSUP_RAND_IE,
679 len := 0, /* overwritten */
680 val := {
681 rand := rand
682 }
683}
684
Alexander Couzensd24973d2018-09-04 16:10:14 +0200685template GSUP_IE tr_GSUP_IE_RAND(template octetstring rand) := {
686 tag := OSMO_GSUP_RAND_IE,
687 len := ?,
688 val := {
689 rand := rand
690 }
691}
692
Harald Welte77a8eba2018-01-22 21:22:32 +0100693template (value) GSUP_IE ts_GSUP_IE_SRES(octetstring sres) := {
694 tag := OSMO_GSUP_SRES_IE,
695 len := 0, /* overwritten */
696 val := {
697 sres := sres
698 }
699}
700
701template (value) GSUP_IE ts_GSUP_IE_Kc(octetstring kc) := {
702 tag := OSMO_GSUP_KC_IE,
703 len := 0, /* overwritten */
704 val := {
705 kc := kc
706 }
707}
708
709template (value) GSUP_IE ts_GSUP_IE_IK(octetstring ik) := {
710 tag := OSMO_GSUP_IK_IE,
711 len := 0, /* overwritten */
712 val := {
713 ik := ik
714 }
715}
716
717template (value) GSUP_IE ts_GSUP_IE_CK(octetstring ck) := {
718 tag := OSMO_GSUP_CK_IE,
719 len := 0, /* overwritten */
720 val := {
721 ck := ck
722 }
723}
724
725template (value) GSUP_IE ts_GSUP_IE_AUTN(octetstring autn) := {
726 tag := OSMO_GSUP_AUTN_IE,
727 len := 0, /* overwritten */
728 val := {
729 autn := autn
730 }
731}
732
733template (value) GSUP_IE ts_GSUP_IE_RES(octetstring res) := {
734 tag := OSMO_GSUP_RES_IE,
735 len := 0, /* overwritten */
736 val := {
737 res := res
738 }
739}
Harald Weltedf327232017-12-28 22:51:51 +0100740
Harald Welteeded9ad2018-02-17 20:57:34 +0100741template (value) GSUP_IE ts_GSUP_IE_APN(octetstring apn) := {
742 tag := OSMO_GSUP_ACCESS_POINT_NAME_IE,
743 len := 0, /* overwritten */
744 val := {
745 apn := apn
746 }
747}
748
Harald Welte958f8b42018-03-01 23:40:17 +0100749template (value) GSUP_IE ts_GSUP_IE_CnDomain(GSUP_CnDomain dom) := {
750 tag := OSMO_GSUP_CN_DOMAIN_IE,
751 len := 0, /* overwritten */
752 val := {
753 cn_domain := dom
754 }
755}
Harald Weltedf327232017-12-28 22:51:51 +0100756
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700757template (value) GSUP_IE ts_GSUP_IE_SessionId(OCT4 sid) := {
758 tag := OSMO_GSUP_SESSION_ID_IE,
759 len := 0, /* overwritten */
760 val := {
761 session_id := sid
762 }
763}
764template GSUP_IE tr_GSUP_IE_SessionId(template OCT4 sid) := {
765 tag := OSMO_GSUP_SESSION_ID_IE,
766 len := ?,
767 val := {
768 session_id := sid
769 }
770}
771
772template (value) GSUP_IE ts_GSUP_IE_SessionState(GSUP_SessionState state) := {
773 tag := OSMO_GSUP_SESSION_STATE_IE,
774 len := 0, /* overwritten */
775 val := {
776 session_state := state
777 }
778}
779template GSUP_IE tr_GSUP_IE_SessionState(template GSUP_SessionState state) := {
780 tag := OSMO_GSUP_SESSION_STATE_IE,
781 len := ?,
782 val := {
783 session_state := state
784 }
785}
786
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700787template (value) GSUP_IE ts_GSUP_IE_SM_RP_MR(OCT1 ref) := {
788 tag := OSMO_GSUP_SM_RP_MR_IE,
789 len := 0, /* overwritten */
790 val := {
791 sm_rp_mr := ref
792 }
793}
794template GSUP_IE tr_GSUP_IE_SM_RP_MR(template OCT1 ref) := {
795 tag := OSMO_GSUP_SM_RP_MR_IE,
796 len := ?,
797 val := {
798 sm_rp_mr := ref
799 }
800}
801
802template (value) GSUP_IE ts_GSUP_IE_SM_RP_CAUSE(OCT1 cause) := {
803 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
804 len := 0, /* overwritten */
805 val := {
806 sm_rp_cause := cause
807 }
808}
809template GSUP_IE tr_GSUP_IE_SM_RP_CAUSE(template OCT1 cause) := {
810 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
811 len := ?,
812 val := {
813 sm_rp_cause := cause
814 }
815}
816
817template (value) GSUP_IE ts_GSUP_IE_SM_RP_MMS(OCT1 mms) := {
818 tag := OSMO_GSUP_SM_RP_MMS_IE,
819 len := 0, /* overwritten */
820 val := {
821 sm_rp_mms := mms
822 }
823}
824template GSUP_IE tr_GSUP_IE_SM_RP_MMS(template OCT1 mms) := {
825 tag := OSMO_GSUP_SM_RP_MMS_IE,
826 len := ?,
827 val := {
828 sm_rp_mms := mms
829 }
830}
831
Oliver Smith936dbe62019-06-04 15:54:17 +0200832template (value) GSUP_IE ts_GSUP_IE_IMEI(hexstring imei) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100833 tag := OSMO_GSUP_IMEI_IE,
834 len := 0, /* overwritten */
835 val := {
Oliver Smith936dbe62019-06-04 15:54:17 +0200836 imei := ts_GSUP_IMEI(imei)
Oliver Smithc5748292019-02-22 15:02:48 +0100837 }
838}
Oliver Smith936dbe62019-06-04 15:54:17 +0200839template GSUP_IE tr_GSUP_IE_IMEI(template hexstring imei) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100840 tag := OSMO_GSUP_IMEI_IE,
841 len := ?,
842 val := {
Oliver Smith936dbe62019-06-04 15:54:17 +0200843 imei := tr_GSUP_IMEI(imei)
Oliver Smithc5748292019-02-22 15:02:48 +0100844 }
845}
846
Oliver Smith936dbe62019-06-04 15:54:17 +0200847template (value) GSUP_IE ts_GSUP_IE_IMEI_Result(GSUP_IMEIResult result) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100848 tag := OSMO_GSUP_IMEI_RESULT_IE,
849 len := 0, /* overwritten */
850 val := {
851 imei_result := result
852 }
853}
Oliver Smith936dbe62019-06-04 15:54:17 +0200854template GSUP_IE tr_GSUP_IE_IMEI_Result(template GSUP_IMEIResult result) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100855 tag := OSMO_GSUP_IMEI_RESULT_IE,
856 len := ?,
857 val := {
858 imei_result := result
859 }
860}
861
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700862/* Possible identity types for SM-RP-{OA|DA} IEs */
863type enumerated GSUP_SM_RP_ODA_IdType {
864 OSMO_GSUP_SM_RP_ODA_ID_NONE ('00'O),
865 OSMO_GSUP_SM_RP_ODA_ID_IMSI ('01'O),
866 OSMO_GSUP_SM_RP_ODA_ID_MSISDN ('02'O),
867 OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR ('03'O),
868 /* Special value for noSM-RP-DA and noSM-RP-OA */
869 OSMO_GSUP_SM_RP_ODA_ID_NULL ('FF'O)
870} with { variant "FIELDLENGTH(8)" };
871
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900872/* See 3GPP TS 24.011, figures 8.5 and 8.6 */
873type record GSUP_SM_RP_Addr {
874 BIT1 ext, /* Extension? */
875 BIT3 ton, /* Type of Number */
876 BIT4 npi, /* Numbering Plan Identification */
877 hexstring number length (1..20)
878} with {
879 variant "PADDING(yes)";
880 variant "PADDING_PATTERN('1111'B)"
881};
882
883private function f_pad_SM_RP_Addr(template hexstring number)
884return template hexstring {
885 if (isvalue(number) and not istemplatekind(number, "omit")) {
886 return f_pad_bcd_number(valueof(number));
887 } else {
888 return number;
889 }
890}
891
892template GSUP_SM_RP_Addr t_GSUP_SM_RP_Addr(template hexstring number,
893 template BIT4 npi := '0001'B,
894 template BIT3 ton := '001'B,
895 template BIT1 ext := '1'B) := {
896 ext := ext,
897 ton := ton,
898 npi := npi,
899 /* Work around TITAN's padding problems: encoding works fine,
900 * but it does not consider 'F'H as padding in decoded data. */
901 number := f_pad_SM_RP_Addr(number)
902}
903
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700904/**
905 * SM-RP-DA represents the SM Destination Address, see 7.6.8.1.
906 * It can be either of the following:
907 * - IMSI
908 * - LMSI (not implemented)
909 * - MSISDN
910 * - roaming number (not implemented)
911 * - service centre address
912 */
913type union GSUP_SM_RP_DA_ID {
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900914 hexstring imsi,
915 GSUP_SM_RP_Addr msisdn,
916 GSUP_SM_RP_Addr smsc_addr
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700917};
918
919type record GSUP_SM_RP_DA {
920 GSUP_SM_RP_ODA_IdType id_type,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700921 GSUP_SM_RP_DA_ID id_enc optional
Vadim Yanitskiyf1f39bd2018-12-14 08:00:33 +0700922} with { variant (id_enc) "CROSSTAG(
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700923 imsi, id_type = OSMO_GSUP_SM_RP_ODA_ID_IMSI;
924 msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN;
925 smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR;
926 /* FIXME: how to handle noSM-RP-DA? */
927 )"
928};
929
930template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_IMSI(hexstring imsi) := {
931 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700932 id_enc := { imsi := imsi }
933}
934template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_IMSI(template hexstring imsi) := {
935 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700936 id_enc := { imsi := imsi }
937}
938
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900939template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_MSISDN(GSUP_SM_RP_Addr msisdn) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700940 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700941 id_enc := { msisdn := msisdn }
942}
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900943template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_MSISDN(template GSUP_SM_RP_Addr msisdn) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700944 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700945 id_enc := { msisdn := msisdn }
946}
947
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900948template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_SMSC_ADDR(GSUP_SM_RP_Addr smsc_addr) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700949 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700950 id_enc := { smsc_addr := smsc_addr }
951}
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900952template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_SMSC_ADDR(template GSUP_SM_RP_Addr smsc_addr) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700953 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700954 id_enc := { smsc_addr := smsc_addr }
955}
956
957template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_NULL := {
958 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700959 id_enc := omit
960}
961template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_NULL := {
962 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700963 id_enc := omit
964}
965
966template (value) GSUP_IE ts_GSUP_IE_SM_RP_DA(GSUP_SM_RP_DA val) := {
967 tag := OSMO_GSUP_SM_RP_DA_IE,
968 len := 0, /* overwritten */
969 val := {
970 sm_rp_da := val
971 }
972}
973template GSUP_IE tr_GSUP_IE_SM_RP_DA(template GSUP_SM_RP_DA val) := {
974 tag := OSMO_GSUP_SM_RP_DA_IE,
975 len := ?,
976 val := {
977 sm_rp_da := val
978 }
979}
980
981/**
982 * SM-RP-OA represents the SM Originating Address, see 7.6.8.2.
983 * It can be either of the following:
984 * - MSISDN
985 * - service centre address
986 */
987type union GSUP_SM_RP_OA_ID {
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900988 GSUP_SM_RP_Addr msisdn,
989 GSUP_SM_RP_Addr smsc_addr
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700990};
991
992type record GSUP_SM_RP_OA {
993 GSUP_SM_RP_ODA_IdType id_type,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700994 GSUP_SM_RP_OA_ID id_enc optional
Vadim Yanitskiyf1f39bd2018-12-14 08:00:33 +0700995} with { variant (id_enc) "CROSSTAG(
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700996 msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN;
997 smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR;
998 /* FIXME: how to handle noSM-RP-OA? */
999 )"
1000};
1001
Vadim Yanitskiya52347c2019-12-12 17:32:33 +09001002template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_MSISDN(GSUP_SM_RP_Addr msisdn) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001003 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001004 id_enc := { msisdn := msisdn }
1005}
Vadim Yanitskiya52347c2019-12-12 17:32:33 +09001006template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_MSISDN(template GSUP_SM_RP_Addr msisdn) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001007 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001008 id_enc := { msisdn := msisdn }
1009}
1010
Vadim Yanitskiya52347c2019-12-12 17:32:33 +09001011template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_SMSC_ADDR(GSUP_SM_RP_Addr smsc_addr) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001012 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001013 id_enc := { smsc_addr := smsc_addr }
1014}
Vadim Yanitskiya52347c2019-12-12 17:32:33 +09001015template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_SMSC_ADDR(template GSUP_SM_RP_Addr smsc_addr) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001016 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001017 id_enc := { smsc_addr := smsc_addr }
1018}
1019
1020template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_NULL := {
1021 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001022 id_enc := omit
1023}
1024template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_NULL := {
1025 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001026 id_enc := omit
1027}
1028
1029template (value) GSUP_IE ts_GSUP_IE_SM_RP_OA(GSUP_SM_RP_OA val) := {
1030 tag := OSMO_GSUP_SM_RP_OA_IE,
1031 len := 0, /* overwritten */
1032 val := {
1033 sm_rp_oa := val
1034 }
1035}
1036template GSUP_IE tr_GSUP_IE_SM_RP_OA(template GSUP_SM_RP_OA val) := {
1037 tag := OSMO_GSUP_SM_RP_OA_IE,
1038 len := ?,
1039 val := {
1040 sm_rp_oa := val
1041 }
1042}
1043
1044/* SM-RP-UI represents the SM TPDU, see 7.6.8.4 */
1045template (value) GSUP_IE ts_GSUP_IE_SM_RP_UI(octetstring val) := {
1046 tag := OSMO_GSUP_SM_RP_UI_IE,
1047 len := 0, /* overwritten */
1048 val := {
1049 sm_rp_ui := val
1050 }
1051}
1052template GSUP_IE tr_GSUP_IE_SM_RP_UI(template octetstring val) := {
1053 tag := OSMO_GSUP_SM_RP_UI_IE,
1054 len := ?,
1055 val := {
1056 sm_rp_ui := val
1057 }
1058}
1059
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001060/* SM Alert Reason types, see 7.6.8.8 */
1061type enumerated GSUP_SM_ALERT_RSN_Type {
1062 GSUP_SM_ALERT_RSN_TYPE_NONE ('00'O),
1063 GSUP_SM_ALERT_RSN_TYPE_MS_PRESENT ('01'O),
1064 GSUP_SM_ALERT_RSN_TYPE_MEM_AVAIL ('02'O)
1065} with { variant "FIELDLENGTH(8)" };
1066
1067/* SM Alert Reason IE (used in READY-FOR-SM), see 7.6.8.8 */
1068template (value) GSUP_IE ts_GSUP_IE_SM_ALERT_RSN(GSUP_SM_ALERT_RSN_Type rsn) := {
1069 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
1070 len := 0, /* overwritten */
1071 val := {
1072 sm_alert_rsn := rsn
1073 }
1074}
1075template GSUP_IE tr_GSUP_IE_SM_ALERT_RSN(template GSUP_SM_ALERT_RSN_Type rsn) := {
1076 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
1077 len := ?,
1078 val := {
1079 sm_alert_rsn := rsn
1080 }
1081}
1082
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001083template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := {
1084 tag := OSMO_GSUP_SS_INFO_IE,
1085 len := 0, /* overwritten */
1086 val := {
1087 ss_info := ss
1088 }
1089}
1090template GSUP_IE tr_GSUP_IE_SSInfo(template octetstring ss) := {
1091 tag := OSMO_GSUP_SS_INFO_IE,
1092 len := ?,
1093 val := {
1094 ss_info := ss
1095 }
1096}
1097
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001098template GSUP_IE tr_GSUP_IE_Message_Class(template GSUP_Message_Class val) := {
1099 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1100 len := ?,
1101 val := {
1102 message_class := val
1103 }
1104}
1105
1106template (value) GSUP_IE ts_GSUP_IE_Message_Class(GSUP_Message_Class val) := {
1107 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1108 len := 0, /* overwritten */
1109 val := {
1110 message_class := val
1111 }
1112}
1113
1114template GSUP_IE tr_GSUP_IE_Source_Name(template octetstring name) := {
1115 tag := OSMO_GSUP_SOURCE_NAME_IE,
1116 len := ?,
1117 val := {
1118 source_name := name
1119 }
1120}
1121
1122template (value) GSUP_IE ts_GSUP_IE_Source_Name(octetstring name) := {
1123 tag := OSMO_GSUP_SOURCE_NAME_IE,
1124 len := 0, /* overwritten */
1125 val := {
1126 source_name := name
1127 }
1128}
1129
1130template GSUP_IE tr_GSUP_IE_Destination_Name(template octetstring name) := {
1131 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1132 len := ?,
1133 val := {
1134 destination_name := name
1135 }
1136}
1137
1138template (value) GSUP_IE ts_GSUP_IE_Destination_Name(octetstring name) := {
1139 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1140 len := 0, /* overwritten */
1141 val := {
1142 destination_name := name
1143 }
1144}
1145
1146template GSUP_IE tr_GSUP_IE_AN_APDU(template GSUP_AN_APDU an_apdu) := {
1147 tag := OSMO_GSUP_AN_APDU_IE,
1148 len := ?,
1149 val := {
1150 an_apdu := an_apdu
1151 }
1152}
1153
1154template (value) GSUP_IE ts_GSUP_IE_AN_APDU(GSUP_AN_APDU an_apdu) := {
1155 tag := OSMO_GSUP_AN_APDU_IE,
1156 len := 0, /* overwritten */
1157 val := {
1158 an_apdu := an_apdu
1159 }
1160}
1161
Harald Welte0a1fd0e2019-12-03 20:01:08 +01001162template (present) GSUP_IE tr_GSUP_IE_SUPPORTED_RAT_TYPES(template (present) GSUP_RatTypes ratt) := {
1163 tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE,
Harald Welte8eebb6c2019-08-22 12:40:03 +02001164 len := ?,
1165 val := {
Harald Welte0a1fd0e2019-12-03 20:01:08 +01001166 supported_rat_types := ratt
Harald Welte8eebb6c2019-08-22 12:40:03 +02001167 }
1168}
Harald Welte0a1fd0e2019-12-03 20:01:08 +01001169template (value) GSUP_IE ts_GSUP_IE_SUPPORTED_RAT_TYPES(GSUP_RatTypes ratt) := {
1170 tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE,
Harald Welte8eebb6c2019-08-22 12:40:03 +02001171 len := 0, /* overwritten */
1172 val := {
Harald Welte0a1fd0e2019-12-03 20:01:08 +01001173 supported_rat_types := ratt
1174 }
1175}
1176
1177template (present) GSUP_IE tr_GSUP_IE_CURRENT_RAT_TYPE(template (present) GSUP_RatType ratt) := {
1178 tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE,
1179 len := ?,
1180 val := {
1181 current_rat_type := ratt
1182 }
1183}
1184template (value) GSUP_IE ts_GSUP_IE_CURRENT_RAT_TYPE(GSUP_RatType ratt) := {
1185 tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE,
1186 len := 0, /* overwritten */
1187 val := {
1188 current_rat_type := ratt
Harald Welte8eebb6c2019-08-22 12:40:03 +02001189 }
1190}
1191
1192
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001193private function f_gen_ts_ss_ies(
1194 hexstring imsi,
1195 OCT4 sid,
1196 GSUP_SessionState state,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001197 template (omit) octetstring ss := omit,
1198 template (omit) integer cause := omit
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001199) return GSUP_IEs {
1200 /* Mandatory IEs */
1201 var GSUP_IEs ies := {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001202 valueof(ts_GSUP_IE_IMSI(imsi))
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001203 };
1204
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001205 /* Cause IE is needed for PROC_SS_ERR */
1206 if (isvalue(cause)) {
1207 ies := ies & { valueof(ts_GSUP_IE_Cause(valueof(cause))) };
1208 }
1209
1210 /* Mandatory session IEs */
1211 ies := ies & { valueof(ts_GSUP_IE_SessionId(sid)) };
1212 ies := ies & { valueof(ts_GSUP_IE_SessionState(state)) };
1213
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001214 /* Optional SS payload */
1215 if (isvalue(ss)) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001216 ies := ies & { valueof(ts_GSUP_IE_SSInfo(valueof(ss))) };
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001217 }
1218
1219 return ies;
1220}
1221private function f_gen_tr_ss_ies(
1222 template hexstring imsi,
1223 template OCT4 sid := ?,
1224 template GSUP_SessionState state := ?,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001225 template octetstring ss := omit,
1226 template integer cause := omit
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001227) return template GSUP_IEs {
1228 /* Mandatory IEs */
1229 var template GSUP_IEs ies := {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001230 tr_GSUP_IE_IMSI(imsi)
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001231 };
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001232 var integer idx := 1;
1233
1234 /* Cause IE is needed for PROC_SS_ERR */
1235 if (istemplatekind(cause, "*")) {
1236 ies[idx] := *;
1237 idx := idx + 1;
1238 } else if (not istemplatekind(cause, "omit")) {
1239 ies[idx] := tr_GSUP_IE_Cause(cause);
1240 idx := idx + 1;
1241 }
1242
1243 /* Mandatory session IEs */
1244 ies[idx] := tr_GSUP_IE_SessionId(sid);
1245 ies[idx + 1] := tr_GSUP_IE_SessionState(state);
1246 idx := idx + 2;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001247
1248 /* Optional SS payload */
1249 if (istemplatekind(ss, "*")) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001250 ies[idx] := *;
1251 idx := idx + 1;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001252 } else if (not istemplatekind(ss, "omit")) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001253 ies[idx] := tr_GSUP_IE_SSInfo(ss);
1254 idx := idx + 1;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001255 }
1256
Harald Welte0622a9f2019-05-11 10:58:15 +02001257 /* the GSUP Message Class IE is optional, as old implementations don't have it yet */
1258 var template GSUP_IEs ies2 := ies;
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001259 ies2[idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD);
1260 idx := idx + 1;
Harald Welte0622a9f2019-05-11 10:58:15 +02001261
1262 return (ies, ies2);
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001263}
1264
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001265template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ(
1266 hexstring imsi,
1267 OCT4 sid,
1268 GSUP_SessionState state,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001269 template (omit) octetstring ss := omit
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001270) := ts_GSUP(
1271 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001272 f_gen_ts_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001273);
1274template GSUP_PDU tr_GSUP_PROC_SS_REQ(
1275 template hexstring imsi,
1276 template OCT4 sid := ?,
1277 template GSUP_SessionState state := ?,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001278 template octetstring ss := *
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001279) := tr_GSUP(
1280 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001281 f_gen_tr_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001282);
1283
1284template (value) GSUP_PDU ts_GSUP_PROC_SS_RES(
1285 hexstring imsi,
1286 OCT4 sid,
1287 GSUP_SessionState state,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001288 template (omit) octetstring ss := omit
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001289) := ts_GSUP(
1290 OSMO_GSUP_MSGT_PROC_SS_RESULT,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001291 f_gen_ts_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001292);
1293template GSUP_PDU tr_GSUP_PROC_SS_RES(
1294 template hexstring imsi,
1295 template OCT4 sid := ?,
1296 template GSUP_SessionState state := ?,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001297 template octetstring ss := *
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001298) := tr_GSUP(
1299 OSMO_GSUP_MSGT_PROC_SS_RESULT,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001300 f_gen_tr_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001301);
1302
1303template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR(
1304 hexstring imsi,
1305 OCT4 sid,
Vadim Yanitskiy21c42332018-11-29 00:18:05 +07001306 GSUP_SessionState state,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001307 integer cause
1308) := ts_GSUP(
1309 OSMO_GSUP_MSGT_PROC_SS_ERROR,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001310 f_gen_ts_ss_ies(imsi, sid, state, cause := cause)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001311);
1312template GSUP_PDU tr_GSUP_PROC_SS_ERR(
1313 template hexstring imsi,
1314 template OCT4 sid := ?,
Vadim Yanitskiy21c42332018-11-29 00:18:05 +07001315 template GSUP_SessionState state := ?,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001316 template integer cause := ?
1317) := tr_GSUP(
1318 OSMO_GSUP_MSGT_PROC_SS_ERROR,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001319 f_gen_tr_ss_ies(imsi, sid, state, cause := cause)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001320);
Harald Weltedf327232017-12-28 22:51:51 +01001321
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001322template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_REQ(
1323 hexstring imsi,
1324 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1325 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1326 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1327 octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1328) := ts_GSUP(
1329 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1330 {
1331 valueof(ts_GSUP_IE_IMSI(imsi)),
1332 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1333 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1334 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1335 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui))
1336 }
1337);
1338template GSUP_PDU tr_GSUP_MO_FORWARD_SM_REQ(
1339 template hexstring imsi := ?,
1340 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1341 template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1342 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1343 template octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1344) := tr_GSUP(
1345 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1346 {
1347 tr_GSUP_IE_IMSI(imsi),
1348 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1349 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1350 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001351 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
1352 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001353 }
1354);
1355
1356template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_RES(
1357 hexstring imsi,
1358 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1359) := ts_GSUP(
1360 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1361 {
1362 valueof(ts_GSUP_IE_IMSI(imsi)),
1363 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1364 }
1365);
1366template GSUP_PDU tr_GSUP_MO_FORWARD_SM_RES(
1367 template hexstring imsi := ?,
1368 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1369) := tr_GSUP(
1370 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1371 {
1372 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001373 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1374 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001375 }
1376);
1377
1378template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_ERR(
1379 hexstring imsi,
1380 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1381 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1382) := ts_GSUP(
1383 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1384 {
1385 valueof(ts_GSUP_IE_IMSI(imsi)),
1386 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1387 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1388 }
1389);
1390template GSUP_PDU tr_GSUP_MO_FORWARD_SM_ERR(
1391 template hexstring imsi := ?,
1392 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1393 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1394) := tr_GSUP(
1395 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1396 {
1397 tr_GSUP_IE_IMSI(imsi),
1398 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001399 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1400 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001401 }
1402);
1403
1404template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_REQ(
1405 hexstring imsi,
1406 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1407 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1408 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1409 octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1410 OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1411) := ts_GSUP(
1412 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1413 {
1414 /**
1415 * TODO: add MT-specific fields (and IEs):
1416 * - smDeliveryTimer
1417 * - smDeliveryStartTime
1418 */
1419 valueof(ts_GSUP_IE_IMSI(imsi)),
1420 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1421 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1422 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1423 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)),
1424 valueof(ts_GSUP_IE_SM_RP_MMS(sm_rp_mms))
1425 }
1426);
1427template GSUP_PDU tr_GSUP_MT_FORWARD_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_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1431 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1432 template octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1433 template OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1434) := tr_GSUP(
1435 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1436 {
1437 /**
1438 * TODO: add MT-specific fields (and IEs):
1439 * - smDeliveryTimer
1440 * - smDeliveryStartTime
1441 */
1442 tr_GSUP_IE_IMSI(imsi),
1443 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1444 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1445 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
1446 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001447 tr_GSUP_IE_SM_RP_MMS(sm_rp_mms),
1448 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001449 }
1450);
1451
1452template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_RES(
1453 hexstring imsi,
1454 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1455) := ts_GSUP(
1456 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1457 {
1458 valueof(ts_GSUP_IE_IMSI(imsi)),
1459 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1460 }
1461);
1462template GSUP_PDU tr_GSUP_MT_FORWARD_SM_RES(
1463 template hexstring imsi := ?,
1464 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1465) := tr_GSUP(
1466 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1467 {
1468 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001469 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1470 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001471 }
1472);
1473
1474template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_ERR(
1475 hexstring imsi,
1476 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1477 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1478) := ts_GSUP(
1479 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1480 {
1481 valueof(ts_GSUP_IE_IMSI(imsi)),
1482 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1483 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1484 }
1485);
1486template GSUP_PDU tr_GSUP_MT_FORWARD_SM_ERR(
1487 template hexstring imsi := ?,
1488 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1489 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1490) := tr_GSUP(
1491 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1492 {
1493 tr_GSUP_IE_IMSI(imsi),
1494 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001495 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1496 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001497 }
1498);
1499
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001500template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_REQ(
1501 hexstring imsi,
1502 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1503 GSUP_SM_ALERT_RSN_Type sm_alert_rsn /* SM Alert Reason, see 7.6.8.8 */
1504) := ts_GSUP(
1505 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1506 {
1507 valueof(ts_GSUP_IE_IMSI(imsi)),
1508 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1509 valueof(ts_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn))
1510 }
1511);
1512template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_REQ(
1513 template hexstring imsi := ?,
1514 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1515 template GSUP_SM_ALERT_RSN_Type sm_alert_rsn := ? /* SM Alert Reason, see 7.6.8.8 */
1516) := tr_GSUP(
1517 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1518 {
1519 tr_GSUP_IE_IMSI(imsi),
1520 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001521 tr_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn),
1522 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001523 }
1524);
1525
1526template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_RES(
1527 hexstring imsi,
1528 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1529) := ts_GSUP(
1530 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1531 {
1532 valueof(ts_GSUP_IE_IMSI(imsi)),
1533 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1534 }
1535);
1536template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_RES(
1537 template hexstring imsi := ?,
1538 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1539) := tr_GSUP(
1540 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1541 {
1542 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001543 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1544 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001545 }
1546);
1547
1548template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_ERR(
1549 hexstring imsi,
1550 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1551 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1552) := ts_GSUP(
1553 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1554 {
1555 valueof(ts_GSUP_IE_IMSI(imsi)),
1556 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1557 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1558 }
1559);
1560template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_ERR(
1561 template hexstring imsi := ?,
1562 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1563 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1564) := tr_GSUP(
1565 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1566 {
1567 tr_GSUP_IE_IMSI(imsi),
1568 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001569 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1570 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001571 }
1572);
1573
Harald Welte8eebb6c2019-08-22 12:40:03 +02001574function f_gsup_find_nested_ie(GSUP_IEs ies, GSUP_IEI iei, out GSUP_IeValue ret) return boolean {
1575 for (var integer i := 0; i < sizeof(ies); i := i+1) {
1576 if (ies[i].tag == iei) {
1577 ret := ies[i].val;
Harald Weltef9d449e2018-06-24 22:27:47 +02001578 return true;
1579 }
1580 }
Harald Welte8eebb6c2019-08-22 12:40:03 +02001581 return false;
1582}
1583
1584function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) return boolean {
1585 return f_gsup_find_nested_ie(msg.ies, iei, ret);
Harald Weltef9d449e2018-06-24 22:27:47 +02001586}
1587
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001588template GSUP_AN_APDU t_GSUP_AN_APDU(
1589 template GSUP_AN_PROTO an_proto := ?,
1590 template octetstring pdu := ?
1591) := {
1592 proto := an_proto,
1593 pdu := pdu
1594};
1595
1596template GSUP_PDU tr_GSUP_E_AN_APDU(
1597 template GSUP_MessageType msgt,
1598 template hexstring imsi := ?,
1599 template octetstring source_name := ?,
1600 template octetstring destination_name := ?,
1601 template GSUP_AN_APDU an_apdu := ?
1602) := tr_GSUP(
1603 msgt,
1604 {
1605 tr_GSUP_IE_IMSI(imsi),
1606 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1607 tr_GSUP_IE_Source_Name(source_name),
1608 tr_GSUP_IE_Destination_Name(destination_name),
1609 tr_GSUP_IE_AN_APDU(an_apdu)
1610 }
1611);
1612
1613template GSUP_PDU tr_GSUP_E_NO_PDU(
1614 template GSUP_MessageType msgt,
1615 template hexstring imsi := ?,
1616 template octetstring source_name := ?,
1617 template octetstring destination_name := ?
1618) := tr_GSUP(
1619 msgt,
1620 {
1621 tr_GSUP_IE_IMSI(imsi),
1622 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1623 tr_GSUP_IE_Source_Name(source_name),
1624 tr_GSUP_IE_Destination_Name(destination_name)
1625 }
1626);
1627
1628template (value) GSUP_PDU ts_GSUP_E_AN_APDU(
1629 GSUP_MessageType msgt,
1630 hexstring imsi,
1631 octetstring source_name,
1632 octetstring destination_name,
1633 GSUP_AN_APDU an_apdu
1634) := ts_GSUP(
1635 msgt,
1636 {
1637 valueof(ts_GSUP_IE_IMSI(imsi)),
1638 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1639 valueof(ts_GSUP_IE_Source_Name(source_name)),
1640 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1641 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1642 }
1643);
1644
1645template (value) GSUP_PDU ts_GSUP_E_PrepareHandoverResult(
1646 hexstring imsi,
1647 hexstring msisdn,
1648 octetstring source_name,
1649 octetstring destination_name,
1650 GSUP_AN_APDU an_apdu
1651) := ts_GSUP(
1652 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT,
1653 {
1654 valueof(ts_GSUP_IE_IMSI(imsi)),
1655 valueof(ts_GSUP_IE_MSISDN(msisdn)),
1656 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1657 valueof(ts_GSUP_IE_Source_Name(source_name)),
1658 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1659 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1660 }
1661);
Harald Weltef9d449e2018-06-24 22:27:47 +02001662
Harald Weltedf327232017-12-28 22:51:51 +01001663} with { encode "RAW"; variant "FIELDORDER(msb)" }