blob: 880a6ad048ea2c894d5c9d2ab88be11dde9111e7 [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),
Alexander Couzens752f86b2020-01-10 07:56:31 +010064 OSMO_GSUP_NUM_VECTORS_REQ_IE ('52'O),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +020065
66 OSMO_GSUP_MESSAGE_CLASS_IE ('0a'O),
67
68 OSMO_GSUP_SOURCE_NAME_IE ('60'O),
69 OSMO_GSUP_DESTINATION_NAME_IE ('61'O),
70 OSMO_GSUP_AN_APDU_IE ('62'O),
71 OSMO_GSUP_CAUSE_RR_IE ('63'O),
72 OSMO_GSUP_CAUSE_BSSAP_IE ('64'O),
73 OSMO_GSUP_CAUSE_SM_IE ('65'O)
Harald Weltedf327232017-12-28 22:51:51 +010074} with { variant "FIELDLENGTH(8)" };
75
76type enumerated GSUP_MessageType {
77 OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST ('00000100'B),
78 OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR ('00000101'B),
79 OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT ('00000110'B),
80
81 OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST ('00001000'B),
82 OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR ('00001001'B),
83 OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT ('00001010'B),
84
85 OSMO_GSUP_MSGT_AUTH_FAIL_REPORT ('00001011'B),
86
87 OSMO_GSUP_MSGT_PURGE_MS_REQUEST ('00001100'B),
88 OSMO_GSUP_MSGT_PURGE_MS_ERROR ('00001101'B),
89 OSMO_GSUP_MSGT_PURGE_MS_RESULT ('00001110'B),
90
91 OSMO_GSUP_MSGT_INSERT_DATA_REQUEST ('00010000'B),
92 OSMO_GSUP_MSGT_INSERT_DATA_ERROR ('00010001'B),
93 OSMO_GSUP_MSGT_INSERT_DATA_RESULT ('00010010'B),
94
95 OSMO_GSUP_MSGT_DELETE_DATA_REQUEST ('00010100'B),
96 OSMO_GSUP_MSGT_DELETE_DATA_ERROR ('00010101'B),
97 OSMO_GSUP_MSGT_DELETE_DATA_RESULT ('00010110'B),
98
99 OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST ('00011100'B),
100 OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR ('00011101'B),
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700101 OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT ('00011110'B),
102
103 OSMO_GSUP_MSGT_PROC_SS_REQUEST ('00100000'B),
104 OSMO_GSUP_MSGT_PROC_SS_ERROR ('00100001'B),
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700105 OSMO_GSUP_MSGT_PROC_SS_RESULT ('00100010'B),
106
107 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST ('00100100'B),
108 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR ('00100101'B),
109 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT ('00100110'B),
110
111 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST ('00101000'B),
112 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR ('00101001'B),
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700113 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT ('00101010'B),
114
115 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST ('00101100'B),
116 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR ('00101101'B),
Oliver Smithc5748292019-02-22 15:02:48 +0100117 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT ('00101110'B),
118
119 OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST ('00110000'B),
120 OSMO_GSUP_MSGT_CHECK_IMEI_ERROR ('00110001'B),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200121 OSMO_GSUP_MSGT_CHECK_IMEI_RESULT ('00110010'B),
122
123 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_REQUEST ('00110100'B),
124 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_ERROR ('00110101'B),
125 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT ('00110110'B),
126
127 OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_REQUEST ('00111000'B),
128 OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_ERROR ('00111001'B),
129 OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_RESULT ('00111010'B),
130
131 OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_REQUEST ('00111100'B),
132 OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_ERROR ('00111101'B),
133 OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_RESULT ('00111110'B),
134
135 OSMO_GSUP_MSGT_E_PROCESS_ACCESS_SIGNALLING_REQUEST ('01000000'B),
136 OSMO_GSUP_MSGT_E_FORWARD_ACCESS_SIGNALLING_REQUEST ('01000100'B),
137
138 OSMO_GSUP_MSGT_E_CLOSE ('01000111'B),
139 OSMO_GSUP_MSGT_E_ABORT ('01001011'B),
140
141 OSMO_GSUP_MSGT_E_ROUTING_ERROR ('01001110'B)
Harald Weltedf327232017-12-28 22:51:51 +0100142} with { variant "FIELDLENGTH(8)" };
143
144type enumerated GSUP_CancelType {
Alexander Couzens4786b3f2018-09-16 03:33:30 +0200145 OSMO_GSUP_CANCEL_TYPE_UPDATE (0),
146 OSMO_GSUP_CANCEL_TYPE_WITHDRAW (1)
Harald Weltedf327232017-12-28 22:51:51 +0100147} with { variant "FIELDLENGTH(8)" };
148
149type enumerated GSUP_CnDomain {
150 OSMO_GSUP_CN_DOMAIN_PS (1),
151 OSMO_GSUP_CN_DOMAIN_CS (2)
152} with { variant "FIELDLENGTH(8)" };
153
Oliver Smithc5748292019-02-22 15:02:48 +0100154type enumerated GSUP_IMEIResult {
155 OSMO_GSUP_IMEI_RESULT_ACK (0),
156 OSMO_GSUP_IMEI_RESULT_NACK (1)
157} with { variant "FIELDLENGTH(8)" };
158
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700159type enumerated GSUP_SessionState {
160 OSMO_GSUP_SESSION_STATE_NONE (0),
161 OSMO_GSUP_SESSION_STATE_BEGIN (1),
162 OSMO_GSUP_SESSION_STATE_CONTINUE (2),
163 OSMO_GSUP_SESSION_STATE_END (3)
164} with { variant "FIELDLENGTH(8)" };
165
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200166type enumerated GSUP_Message_Class {
167 OSMO_GSUP_MESSAGE_CLASS_UNSET (0),
168 OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT (1),
169 OSMO_GSUP_MESSAGE_CLASS_SMS (2),
170 OSMO_GSUP_MESSAGE_CLASS_USSD (3),
171 OSMO_GSUP_MESSAGE_CLASS_INTER_MSC (4)
172} with { variant "FIELDLENGTH(8)" };
173
Harald Welte3f95be82018-01-27 00:48:13 +0100174type record GSUP_MSISDN {
175 uint8_t len,
176 hexstring digits optional
177} with { variant (len) "LENGTHTO(digits)" };
178
Oliver Smithc5748292019-02-22 15:02:48 +0100179type record GSUP_IMEI {
180 uint8_t len,
181 hexstring digits optional
182} with { variant (len) "LENGTHTO(digits)" };
183
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200184type enumerated GSUP_AN_PROTO {
185 OSMO_GSUP_AN_PROTO_48006 (1),
186 OSMO_GSUP_AN_PROTO_25413 (2)
187} with { variant "FIELDLENGTH(8)" };
188
189type record GSUP_AN_APDU {
190 GSUP_AN_PROTO proto,
191 octetstring pdu
192};
193
Harald Weltedf327232017-12-28 22:51:51 +0100194type record GSUP_IE {
195 GSUP_IEI tag,
196 uint8_t len,
197 GSUP_IeValue val
198} with { variant (len) "LENGTHTO(val)"
199 variant (val) "CROSSTAG(imsi, tag = OSMO_GSUP_IMSI_IE;
200 cause, tag = OSMO_GSUP_CAUSE_IE;
201 cancel_type, tag = OSMO_GSUP_CANCEL_TYPE_IE;
Harald Welte77a8eba2018-01-22 21:22:32 +0100202 auth_tuple, tag = OSMO_GSUP_AUTH_TUPLE_IE;
Harald Weltedf327232017-12-28 22:51:51 +0100203 auts, tag = OSMO_GSUP_AUTS_IE;
204 rand, tag = OSMO_GSUP_RAND_IE;
Harald Welte77a8eba2018-01-22 21:22:32 +0100205 sres, tag = OSMO_GSUP_SRES_IE;
206 kc, tag = OSMO_GSUP_KC_IE;
207 ik, tag = OSMO_GSUP_IK_IE;
208 ck, tag = OSMO_GSUP_CK_IE;
209 autn, tag = OSMO_GSUP_AUTN_IE;
210 res, tag = OSMO_GSUP_RES_IE;
Harald Weltedf327232017-12-28 22:51:51 +0100211 msisdn, tag = OSMO_GSUP_MSISDN_IE;
212 hlr_number, tag = OSMO_GSUP_HLR_NUMBER_IE;
213 cn_domain, tag = OSMO_GSUP_CN_DOMAIN_IE;
Harald Welteeded9ad2018-02-17 20:57:34 +0100214 pdp_info, tag = OSMO_GSUP_PDP_INFO_IE;
215 apn, tag = OSMO_GSUP_ACCESS_POINT_NAME_IE;
216 pdp_qos, tag = OSMO_GSUP_PDP_QOS_IE;
217 pdp_type, tag = OSMO_GSUP_PDP_TYPE_IE;
218 charg_char, tag = OSMO_GSUP_CHARG_CHAR_IE;
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700219 session_state, tag = OSMO_GSUP_SESSION_STATE_IE;
220 session_id, tag = OSMO_GSUP_SESSION_ID_IE;
221 ss_info, tag = OSMO_GSUP_SS_INFO_IE;
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700222 sm_rp_mr, tag = OSMO_GSUP_SM_RP_MR_IE;
223 sm_rp_da, tag = OSMO_GSUP_SM_RP_DA_IE;
224 sm_rp_oa, tag = OSMO_GSUP_SM_RP_OA_IE;
225 sm_rp_ui, tag = OSMO_GSUP_SM_RP_UI_IE;
226 sm_rp_cause, tag = OSMO_GSUP_SM_RP_CAUSE_IE;
227 sm_rp_mms, tag = OSMO_GSUP_SM_RP_MMS_IE;
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700228 sm_alert_rsn, tag = OSMO_GSUP_SM_ALERT_RSN_IE;
Oliver Smithc5748292019-02-22 15:02:48 +0100229 imei, tag = OSMO_GSUP_IMEI_IE;
230 imei_result, tag = OSMO_GSUP_IMEI_RESULT_IE;
Alexander Couzens752f86b2020-01-10 07:56:31 +0100231 num_auth_vectors, tag = OSMO_GSUP_NUM_VECTORS_REQ_IE;
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200232 message_class, tag = OSMO_GSUP_MESSAGE_CLASS_IE;
233 source_name, tag = OSMO_GSUP_SOURCE_NAME_IE;
234 destination_name, tag = OSMO_GSUP_DESTINATION_NAME_IE;
235 an_apdu, tag = OSMO_GSUP_AN_APDU_IE;
236 cause_rr, tag = OSMO_GSUP_CAUSE_RR_IE;
237 cause_bssap, tag = OSMO_GSUP_CAUSE_BSSAP_IE;
238 cause_sm, tag = OSMO_GSUP_CAUSE_SM_IE;
Harald Welte0a1fd0e2019-12-03 20:01:08 +0100239 supported_rat_types, tag = OSMO_GSUP_SUPPORTED_RAT_TYPES_IE;
240 current_rat_type, tag = OSMO_GSUP_CURRENT_RAT_TYPE_IE;
Harald Welteeded9ad2018-02-17 20:57:34 +0100241 )"
Harald Weltedf327232017-12-28 22:51:51 +0100242};
243
244type record of GSUP_IE GSUP_IEs;
245
Harald Welte8eebb6c2019-08-22 12:40:03 +0200246type enumerated GSUP_RatType {
247 RAT_TYPE_UNKNOWN (0),
248 RAT_TYPE_GERAN_A (1),
249 RAT_TYPE_UTRAN_Iu (2),
250 RAT_TYPE_EUTRAN_SGs (3)
251} with { variant "FIELDLENGTH(8)" };
252
253type record of GSUP_RatType GSUP_RatTypes;
254
Harald Weltedf327232017-12-28 22:51:51 +0100255type union GSUP_IeValue {
256 hexstring imsi,
257 integer cause,
258 GSUP_CancelType cancel_type,
259 //boolean pdp_info_compl,
260 //boolean freeze_ptmsi,
Harald Weltedf327232017-12-28 22:51:51 +0100261 GSUP_IEs auth_tuple,
262 octetstring auts,
263 octetstring rand,
Harald Welte77a8eba2018-01-22 21:22:32 +0100264 octetstring sres,
265 octetstring kc,
266 octetstring ik,
267 octetstring ck,
268 octetstring autn,
269 octetstring res,
Harald Welte3f95be82018-01-27 00:48:13 +0100270 GSUP_MSISDN msisdn,
Harald Weltedf327232017-12-28 22:51:51 +0100271 octetstring hlr_number,
272 GSUP_CnDomain cn_domain,
Harald Welteeded9ad2018-02-17 20:57:34 +0100273 /* PDP context + nested IEs */
274 GSUP_IEs pdp_info,
275 octetstring apn,
276 octetstring pdp_qos,
277 OCT2 pdp_type,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700278 octetstring charg_char,
279 /* Session information */
280 GSUP_SessionState session_state,
281 OCT4 session_id,
282 /* Supplementary Services */
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700283 octetstring ss_info,
284 /* Short Message Service */
285 OCT1 sm_rp_mr,
286 GSUP_SM_RP_DA sm_rp_da,
287 GSUP_SM_RP_OA sm_rp_oa,
288 octetstring sm_rp_ui,
289 OCT1 sm_rp_cause,
Vadim Yanitskiy88e23232018-11-13 03:04:02 +0700290 OCT1 sm_rp_mms,
Oliver Smithc5748292019-02-22 15:02:48 +0100291 GSUP_SM_ALERT_RSN_Type sm_alert_rsn,
292
293 GSUP_IMEI imei,
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200294 GSUP_IMEIResult imei_result,
Alexander Couzens752f86b2020-01-10 07:56:31 +0100295 OCT1 num_auth_vectors,
Neels Hofmeyr0ac63152019-05-07 01:20:17 +0200296
297 GSUP_Message_Class message_class,
298
299 octetstring source_name,
300 octetstring destination_name,
301
302 GSUP_AN_APDU an_apdu,
303
304 OCT1 cause_rr,
305 OCT1 cause_bssap,
Harald Welte8eebb6c2019-08-22 12:40:03 +0200306 OCT1 cause_sm,
307
Harald Welte0a1fd0e2019-12-03 20:01:08 +0100308 GSUP_RatTypes supported_rat_types,
309 GSUP_RatType current_rat_type
Harald Weltedf327232017-12-28 22:51:51 +0100310};
311
312type record GSUP_PDU {
313 GSUP_MessageType msg_type,
314 GSUP_IEs ies
315};
316
317external function enc_GSUP_PDU(in GSUP_PDU msg) return octetstring
318 with { extension "prototype(convert) encode(RAW)" };
319
320external function dec_GSUP_PDU(in octetstring msg) return GSUP_PDU
321 with { extension "prototype(convert) decode(RAW)" };
322
Harald Welte2f562b12018-01-24 20:52:38 +0100323function f_gsup_postprocess_decoded(inout GSUP_PDU gsup) {
324 if (gsup.ies[0].tag == OSMO_GSUP_IMSI_IE) {
325 /* if last digit is 'F', then there's an odd number of digits and we must strip the F */
326 var integer num_digits := lengthof(gsup.ies[0].val.imsi);
327 if (gsup.ies[0].val.imsi[num_digits-1] == 'F'H) {
328 gsup.ies[0].val.imsi := substr(gsup.ies[0].val.imsi, 0, num_digits-1);
329 }
330 }
331}
332
333function f_gsup_preprocess_encoded(inout GSUP_PDU gsup) {
334 if (ischosen(gsup.ies[0].val.imsi)) {
335 /* if number of digits is odd, add a 'F' as padding at the end */
336 var integer num_digits := lengthof(gsup.ies[0].val.imsi);
337 if (num_digits rem 2 == 1) {
338 gsup.ies[0].val.imsi := gsup.ies[0].val.imsi & 'F'H;
339 }
340 }
341}
342
Harald Welte3f95be82018-01-27 00:48:13 +0100343template (value) GSUP_MSISDN ts_GSUP_MSISDN(hexstring digits,
344 BIT3 ton := '000'B,
345 BIT4 npi := '0000'B) := {
346 len := 0, /* overwritten */
347 /* numberingPlanIdentification := npi,
348 typeOfNumber := ton,
349 ext1 := '0'B, */
350 digits := digits
351}
352
353template GSUP_MSISDN tr_GSUP_MSISDN(template hexstring digits,
354 template BIT3 ton := ?,
355 template BIT4 npi := ?) := {
356 len := ?,
357 /* numberingPlanIdentification := npi,
358 typeOfNumber := ton,
359 ext1 := '0'B, */
360 digits := digits
361}
362
363
Harald Weltedf327232017-12-28 22:51:51 +0100364
Harald Welte77a8eba2018-01-22 21:22:32 +0100365template GSUP_IE ts_GSUP_IE_AuthTuple2G(octetstring rand, octetstring sres,
366 octetstring kc) := {
367 tag := OSMO_GSUP_AUTH_TUPLE_IE,
368 len := 0, /* overwritten */
369 val := {
370 auth_tuple := {
371 valueof(ts_GSUP_IE_RAND(rand)),
372 valueof(ts_GSUP_IE_SRES(sres)),
373 valueof(ts_GSUP_IE_Kc(kc))
374 }
375 }
376}
377
378template GSUP_IE ts_GSUP_IE_AuthTuple2G3G(octetstring rand, octetstring sres,
379 octetstring kc, octetstring ik,
380 octetstring ck, octetstring autn,
381 octetstring res) := {
382 tag := OSMO_GSUP_AUTH_TUPLE_IE,
383 len := 0, /* overwritten */
384 val := {
385 auth_tuple := {
386 valueof(ts_GSUP_IE_RAND(rand)),
387 valueof(ts_GSUP_IE_SRES(sres)),
388 valueof(ts_GSUP_IE_Kc(kc)),
389 valueof(ts_GSUP_IE_IK(ik)),
390 valueof(ts_GSUP_IE_CK(ck)),
391 valueof(ts_GSUP_IE_AUTN(autn)),
392 valueof(ts_GSUP_IE_RES(res))
393 }
394 }
395}
396
Harald Welteeded9ad2018-02-17 20:57:34 +0100397template GSUP_IE ts_GSUP_IE_PdpInfo(octetstring apn, octetstring pdp_type, octetstring pdp_qos) := {
398 tag := OSMO_GSUP_PDP_INFO_IE,
399 len := 0, /* overwritten */
400 val := {
401 pdp_info := {
402 valueof(ts_GSUP_IE_APN(apn)),
403 valueof(ts_GSUP_IE_PDP_TYPE(pdp_type)),
404 valueof(ts_GSUP_IE_PDP_QOS(pdp_qos))
405 }
406 }
407}
408
409template (value) GSUP_IE ts_GSUP_IE_PDP_TYPE(OCT2 pdp_type) := {
410 tag := OSMO_GSUP_PDP_TYPE_IE,
411 len := 0,
412 val := {
413 pdp_type := pdp_type
414 }
415}
416
417template (value) GSUP_IE ts_GSUP_IE_PDP_QOS(octetstring pdp_qos) := {
418 tag := OSMO_GSUP_PDP_QOS_IE,
419 len := 0,
420 val := {
421 pdp_qos := pdp_qos
422 }
423}
424
425
Harald Weltedf327232017-12-28 22:51:51 +0100426template GSUP_PDU tr_GSUP(template GSUP_MessageType msgt := ?, template GSUP_IEs ies := *) := {
427 msg_type := msgt,
428 ies := ies
429}
430
Harald Welte8a1dd532018-01-27 15:38:18 +0100431template GSUP_PDU tr_GSUP_IMSI(template GSUP_MessageType msgt := ?, template hexstring imsi) := {
432 msg_type := msgt,
433 ies := { tr_GSUP_IE_IMSI(imsi), * }
434}
435
Harald Weltedf327232017-12-28 22:51:51 +0100436template GSUP_PDU ts_GSUP(GSUP_MessageType msgt, GSUP_IEs ies := {}) := {
437 msg_type := msgt,
438 ies := ies
439}
440
Oliver Smith936dbe62019-06-04 15:54:17 +0200441template (value) GSUP_IMEI ts_GSUP_IMEI(hexstring digits) := {
442 len := 0, /* overwritten */
443 digits := digits
444}
445
446template GSUP_IMEI tr_GSUP_IMEI(template hexstring digits) := {
447 len := ?,
448 digits := digits
449}
450
451
Harald Welte6aa04e32018-01-27 15:35:19 +0100452template (value) GSUP_PDU ts_GSUP_SAI_REQ(hexstring imsi) :=
Harald Weltedf327232017-12-28 22:51:51 +0100453 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { valueof(ts_GSUP_IE_IMSI(imsi)) });
454
Harald Welte8eebb6c2019-08-22 12:40:03 +0200455template (value) GSUP_PDU ts_GSUP_SAI_REQ_EPS(hexstring imsi) :=
456 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
457 valueof(ts_GSUP_IE_IMSI(imsi)),
Harald Welte0a1fd0e2019-12-03 20:01:08 +0100458 valueof(ts_GSUP_IE_CURRENT_RAT_TYPE(RAT_TYPE_EUTRAN_SGs))
Harald Welte8eebb6c2019-08-22 12:40:03 +0200459 });
460
Alexander Couzens752f86b2020-01-10 07:56:31 +0100461template (value) GSUP_PDU ts_GSUP_SAI_REQ_NUM_AUTH(hexstring imsi, OCT1 num_auth_vectors) :=
462 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
463 valueof(ts_GSUP_IE_IMSI(imsi)),
464 valueof(ts_GSUP_IE_NUM_VECTORS_REQ(num_auth_vectors))
465 });
466
Harald Welteef9fa872018-01-22 03:00:17 +0100467template GSUP_PDU tr_GSUP_SAI_REQ(template hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100468 tr_GSUP_IMSI(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, imsi);
Harald Welteef9fa872018-01-22 03:00:17 +0100469
Alexander Couzensd24973d2018-09-04 16:10:14 +0200470template GSUP_PDU tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC(
471 template hexstring imsi,
472 template octetstring auts,
473 template octetstring rand) :=
474 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
475 tr_GSUP_IE_IMSI(imsi),
476 tr_GSUP_IE_AUTS(auts),
477 tr_GSUP_IE_RAND(rand),
478 *
479 });
480
Harald Welte77a8eba2018-01-22 21:22:32 +0100481template (value) GSUP_PDU ts_GSUP_SAI_RES(hexstring imsi, GSUP_IE auth_tuple) :=
482 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, {
483 valueof(ts_GSUP_IE_IMSI(imsi)), auth_tuple });
484
Harald Weltedf327232017-12-28 22:51:51 +0100485template GSUP_PDU tr_GSUP_SAI_ERR(template hexstring imsi, template integer cause) :=
Harald Welte071ed732018-01-23 19:53:52 +0100486 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, {
Harald Weltedf327232017-12-28 22:51:51 +0100487 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
488
Harald Welte6aa04e32018-01-27 15:35:19 +0100489template (value) GSUP_PDU ts_GSUP_SAI_ERR(hexstring imsi, integer cause) :=
490 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, {
491 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
Harald Welte071ed732018-01-23 19:53:52 +0100492
493
Harald Weltedf327232017-12-28 22:51:51 +0100494template GSUP_PDU tr_GSUP_SAI_RES(template hexstring imsi) :=
Harald Weltec2c52552018-03-01 21:20:39 +0100495 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, {
Harald Weltedf327232017-12-28 22:51:51 +0100496 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE(OSMO_GSUP_AUTH_TUPLE_IE), * });
497
Harald Weltec2c52552018-03-01 21:20:39 +0100498template (value) GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi) :=
499 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, {
500 valueof(ts_GSUP_IE_IMSI(imsi)) });
501
Harald Weltedfe94dd2018-01-21 13:55:22 +0100502template GSUP_PDU tr_GSUP_UL_REQ(template hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100503 tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, imsi);
Harald Weltedfe94dd2018-01-21 13:55:22 +0100504
Harald Welte6aa04e32018-01-27 15:35:19 +0100505template (value) GSUP_PDU ts_GSUP_UL_RES(hexstring imsi) :=
Harald Weltedfe94dd2018-01-21 13:55:22 +0100506 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, { valueof(ts_GSUP_IE_IMSI(imsi)) });
507
Harald Weltec2c52552018-03-01 21:20:39 +0100508template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi) :=
509 tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, imsi);
510
Harald Welte6aa04e32018-01-27 15:35:19 +0100511template (value) GSUP_PDU ts_GSUP_UL_ERR(hexstring imsi, integer cause) :=
Harald Welte6ff81902018-01-21 19:09:08 +0100512 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, {
513 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
514
Harald Weltec2c52552018-03-01 21:20:39 +0100515template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?) :=
516 tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, {
517 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
518
Harald Welte6aa04e32018-01-27 15:35:19 +0100519template (value) GSUP_PDU ts_GSUP_ISD_REQ(hexstring imsi, hexstring msisdn) :=
Harald Welte6ff81902018-01-21 19:09:08 +0100520 ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, {
521 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_MSISDN(msisdn)) });
522
Harald Weltec2c52552018-03-01 21:20:39 +0100523template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?) :=
524 tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, {
Harald Welte8f6ac162018-03-01 22:43:28 +0100525 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_MSISDN(msisdn), * });
Harald Weltec2c52552018-03-01 21:20:39 +0100526
527template (value) GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi) :=
528 ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, {
529 valueof(ts_GSUP_IE_IMSI(imsi)) });
530
Harald Welte6ff81902018-01-21 19:09:08 +0100531template GSUP_PDU tr_GSUP_ISD_RES(template hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100532 tr_GSUP_IMSI(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, imsi);
Harald Weltedf327232017-12-28 22:51:51 +0100533
Harald Weltec638f4d2018-01-24 22:00:36 +0100534template GSUP_PDU tr_GSUP_AUTH_FAIL_IND(hexstring imsi) :=
Harald Welte8a1dd532018-01-27 15:38:18 +0100535 tr_GSUP_IMSI(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT, imsi);
Harald Weltedf327232017-12-28 22:51:51 +0100536
Harald Welte167458a2018-01-27 15:58:16 +0100537template (value) GSUP_PDU ts_GSUP_CL_REQ(hexstring imsi, GSUP_CancelType ctype) :=
538 ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST, {
539 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CancelType(ctype)) });
540
541template GSUP_PDU tr_GSUP_CL_RES(template hexstring imsi) :=
542 tr_GSUP_IMSI(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, imsi);
543
544template GSUP_PDU tr_GSUP_CL_ERR(template hexstring imsi, template integer cause := ?) :=
545 tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR, {
Alexander Couzens4cfff3a2018-05-22 17:08:36 +0200546 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause), * });
Harald Welte167458a2018-01-27 15:58:16 +0100547
Harald Welte958f8b42018-03-01 23:40:17 +0100548template (value) GSUP_PDU ts_GSUP_PURGE_MS_REQ(hexstring imsi, GSUP_CnDomain dom) :=
549 ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, {
550 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) });
551
Harald Welte6abb9fe2018-02-17 15:24:48 +0100552template GSUP_PDU tr_GSUP_PURGE_MS_REQ(template hexstring imsi, template GSUP_CnDomain dom := ?) :=
553 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, {
554 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_CnDomain(dom) });
555
556template (value) GSUP_PDU ts_GSUP_PURGE_MS_RES(hexstring imsi) :=
557 ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, {
558 valueof(ts_GSUP_IE_IMSI(imsi)) });
559
Harald Welte958f8b42018-03-01 23:40:17 +0100560template GSUP_PDU tr_GSUP_PURGE_MS_RES(template hexstring imsi) :=
561 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, {
562 tr_GSUP_IE_IMSI(imsi), * });
563
564template GSUP_PDU tr_GSUP_PURGE_MS_ERR(template hexstring imsi, template integer cause) :=
565 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_ERROR, {
566 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
567
Oliver Smith936dbe62019-06-04 15:54:17 +0200568template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_REQ(hexstring imsi, hexstring imei) :=
569 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, {
570 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI(imei)) });
571
Oliver Smith1d118ff2019-07-03 10:57:35 +0200572template GSUP_PDU tr_GSUP_CHECK_IMEI_REQ(
573 template hexstring imsi,
574 template hexstring imei
575) := tr_GSUP(
576 OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST,
577 {
578 tr_GSUP_IE_IMSI(imsi),
579 tr_GSUP_IE_IMEI(imei),
580 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT)
581 }
582);
583
584template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_RES(hexstring imsi, GSUP_IMEIResult result) :=
585 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
586 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI_Result(result)) });
587
Oliver Smith936dbe62019-06-04 15:54:17 +0200588template GSUP_PDU tr_GSUP_CHECK_IMEI_RES(template hexstring imsi, template GSUP_IMEIResult result) :=
589 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
590 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_IMEI_Result(result) });
591
Oliver Smith1d118ff2019-07-03 10:57:35 +0200592template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_ERR(hexstring imsi, integer cause) :=
593 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
594 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
595
Oliver Smith936dbe62019-06-04 15:54:17 +0200596template GSUP_PDU tr_GSUP_CHECK_IMEI_ERR(template hexstring imsi, template integer cause) :=
597 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
598 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
599
Harald Welte167458a2018-01-27 15:58:16 +0100600
601template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := {
602 tag := OSMO_GSUP_CANCEL_TYPE_IE,
603 len := 0, /* overwritten */
604 val := {
605 cancel_type := ctype
606 }
607}
608
609template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) :=
610 tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype});
611
Harald Welte6abb9fe2018-02-17 15:24:48 +0100612template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) :=
613 tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain});
614
Harald Weltedf327232017-12-28 22:51:51 +0100615template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := {
616 tag := iei,
617 len := ?,
618 val := val
619}
620
621template (value) GSUP_IE ts_GSUP_IE_IMSI(hexstring imsi) := {
622 tag := OSMO_GSUP_IMSI_IE,
623 len := 0, /* overwritten */
624 val := {
625 imsi := imsi
626 }
627}
628
629template GSUP_IE tr_GSUP_IE_IMSI(template hexstring imsi) := {
630 tag := OSMO_GSUP_IMSI_IE,
631 len := ?,
632 val := {
633 imsi := imsi
634 }
635}
636
Harald Welte6ff81902018-01-21 19:09:08 +0100637template (value) GSUP_IE ts_GSUP_IE_MSISDN(hexstring msisdn) := {
638 tag := OSMO_GSUP_MSISDN_IE,
639 len := 0, /* overwritten */
640 val := {
Harald Welte3f95be82018-01-27 00:48:13 +0100641 msisdn := ts_GSUP_MSISDN(msisdn)
Harald Welte6ff81902018-01-21 19:09:08 +0100642 }
643}
644
645template GSUP_IE tr_GSUP_IE_MSISDN(template hexstring msisdn) := {
646 tag := OSMO_GSUP_MSISDN_IE,
647 len := ?,
648 val := {
Harald Welte3f95be82018-01-27 00:48:13 +0100649 msisdn := tr_GSUP_MSISDN(msisdn)
Harald Welte6ff81902018-01-21 19:09:08 +0100650 }
651}
652
653
Harald Weltedf327232017-12-28 22:51:51 +0100654template (value) GSUP_IE ts_GSUP_IE_Cause(integer cause) := {
655 tag := OSMO_GSUP_CAUSE_IE,
656 len := 0, /* overwritten */
657 val := {
658 cause := cause
659 }
660}
661
662template GSUP_IE tr_GSUP_IE_Cause(template integer cause) := {
663 tag := OSMO_GSUP_CAUSE_IE,
664 len := ?,
665 val := {
666 cause := cause
667 }
668}
669
670template (value) GSUP_IE ts_GSUP_IE_AUTS(octetstring auts) := {
671 tag := OSMO_GSUP_AUTS_IE,
672 len := 0, /* overwritten */
673 val := {
674 auts := auts
675 }
676}
677
Alexander Couzensd24973d2018-09-04 16:10:14 +0200678template GSUP_IE tr_GSUP_IE_AUTS(template octetstring auts) := {
679 tag := OSMO_GSUP_AUTS_IE,
680 len := ?,
681 val := {
682 auts := auts
683 }
684}
685
Harald Weltedf327232017-12-28 22:51:51 +0100686template (value) GSUP_IE ts_GSUP_IE_RAND(octetstring rand) := {
687 tag := OSMO_GSUP_RAND_IE,
688 len := 0, /* overwritten */
689 val := {
690 rand := rand
691 }
692}
693
Alexander Couzensd24973d2018-09-04 16:10:14 +0200694template GSUP_IE tr_GSUP_IE_RAND(template octetstring rand) := {
695 tag := OSMO_GSUP_RAND_IE,
696 len := ?,
697 val := {
698 rand := rand
699 }
700}
701
Harald Welte77a8eba2018-01-22 21:22:32 +0100702template (value) GSUP_IE ts_GSUP_IE_SRES(octetstring sres) := {
703 tag := OSMO_GSUP_SRES_IE,
704 len := 0, /* overwritten */
705 val := {
706 sres := sres
707 }
708}
709
710template (value) GSUP_IE ts_GSUP_IE_Kc(octetstring kc) := {
711 tag := OSMO_GSUP_KC_IE,
712 len := 0, /* overwritten */
713 val := {
714 kc := kc
715 }
716}
717
718template (value) GSUP_IE ts_GSUP_IE_IK(octetstring ik) := {
719 tag := OSMO_GSUP_IK_IE,
720 len := 0, /* overwritten */
721 val := {
722 ik := ik
723 }
724}
725
726template (value) GSUP_IE ts_GSUP_IE_CK(octetstring ck) := {
727 tag := OSMO_GSUP_CK_IE,
728 len := 0, /* overwritten */
729 val := {
730 ck := ck
731 }
732}
733
734template (value) GSUP_IE ts_GSUP_IE_AUTN(octetstring autn) := {
735 tag := OSMO_GSUP_AUTN_IE,
736 len := 0, /* overwritten */
737 val := {
738 autn := autn
739 }
740}
741
742template (value) GSUP_IE ts_GSUP_IE_RES(octetstring res) := {
743 tag := OSMO_GSUP_RES_IE,
744 len := 0, /* overwritten */
745 val := {
746 res := res
747 }
748}
Harald Weltedf327232017-12-28 22:51:51 +0100749
Harald Welteeded9ad2018-02-17 20:57:34 +0100750template (value) GSUP_IE ts_GSUP_IE_APN(octetstring apn) := {
751 tag := OSMO_GSUP_ACCESS_POINT_NAME_IE,
752 len := 0, /* overwritten */
753 val := {
754 apn := apn
755 }
756}
757
Harald Welte958f8b42018-03-01 23:40:17 +0100758template (value) GSUP_IE ts_GSUP_IE_CnDomain(GSUP_CnDomain dom) := {
759 tag := OSMO_GSUP_CN_DOMAIN_IE,
760 len := 0, /* overwritten */
761 val := {
762 cn_domain := dom
763 }
764}
Harald Weltedf327232017-12-28 22:51:51 +0100765
Vadim Yanitskiyb761d142018-06-02 21:05:04 +0700766template (value) GSUP_IE ts_GSUP_IE_SessionId(OCT4 sid) := {
767 tag := OSMO_GSUP_SESSION_ID_IE,
768 len := 0, /* overwritten */
769 val := {
770 session_id := sid
771 }
772}
773template GSUP_IE tr_GSUP_IE_SessionId(template OCT4 sid) := {
774 tag := OSMO_GSUP_SESSION_ID_IE,
775 len := ?,
776 val := {
777 session_id := sid
778 }
779}
780
781template (value) GSUP_IE ts_GSUP_IE_SessionState(GSUP_SessionState state) := {
782 tag := OSMO_GSUP_SESSION_STATE_IE,
783 len := 0, /* overwritten */
784 val := {
785 session_state := state
786 }
787}
788template GSUP_IE tr_GSUP_IE_SessionState(template GSUP_SessionState state) := {
789 tag := OSMO_GSUP_SESSION_STATE_IE,
790 len := ?,
791 val := {
792 session_state := state
793 }
794}
795
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700796template (value) GSUP_IE ts_GSUP_IE_SM_RP_MR(OCT1 ref) := {
797 tag := OSMO_GSUP_SM_RP_MR_IE,
798 len := 0, /* overwritten */
799 val := {
800 sm_rp_mr := ref
801 }
802}
803template GSUP_IE tr_GSUP_IE_SM_RP_MR(template OCT1 ref) := {
804 tag := OSMO_GSUP_SM_RP_MR_IE,
805 len := ?,
806 val := {
807 sm_rp_mr := ref
808 }
809}
810
811template (value) GSUP_IE ts_GSUP_IE_SM_RP_CAUSE(OCT1 cause) := {
812 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
813 len := 0, /* overwritten */
814 val := {
815 sm_rp_cause := cause
816 }
817}
818template GSUP_IE tr_GSUP_IE_SM_RP_CAUSE(template OCT1 cause) := {
819 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
820 len := ?,
821 val := {
822 sm_rp_cause := cause
823 }
824}
825
826template (value) GSUP_IE ts_GSUP_IE_SM_RP_MMS(OCT1 mms) := {
827 tag := OSMO_GSUP_SM_RP_MMS_IE,
828 len := 0, /* overwritten */
829 val := {
830 sm_rp_mms := mms
831 }
832}
833template GSUP_IE tr_GSUP_IE_SM_RP_MMS(template OCT1 mms) := {
834 tag := OSMO_GSUP_SM_RP_MMS_IE,
835 len := ?,
836 val := {
837 sm_rp_mms := mms
838 }
839}
840
Oliver Smith936dbe62019-06-04 15:54:17 +0200841template (value) GSUP_IE ts_GSUP_IE_IMEI(hexstring imei) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100842 tag := OSMO_GSUP_IMEI_IE,
843 len := 0, /* overwritten */
844 val := {
Oliver Smith936dbe62019-06-04 15:54:17 +0200845 imei := ts_GSUP_IMEI(imei)
Oliver Smithc5748292019-02-22 15:02:48 +0100846 }
847}
Oliver Smith936dbe62019-06-04 15:54:17 +0200848template GSUP_IE tr_GSUP_IE_IMEI(template hexstring imei) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100849 tag := OSMO_GSUP_IMEI_IE,
850 len := ?,
851 val := {
Oliver Smith936dbe62019-06-04 15:54:17 +0200852 imei := tr_GSUP_IMEI(imei)
Oliver Smithc5748292019-02-22 15:02:48 +0100853 }
854}
855
Oliver Smith936dbe62019-06-04 15:54:17 +0200856template (value) GSUP_IE ts_GSUP_IE_IMEI_Result(GSUP_IMEIResult result) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100857 tag := OSMO_GSUP_IMEI_RESULT_IE,
858 len := 0, /* overwritten */
859 val := {
860 imei_result := result
861 }
862}
Oliver Smith936dbe62019-06-04 15:54:17 +0200863template GSUP_IE tr_GSUP_IE_IMEI_Result(template GSUP_IMEIResult result) := {
Oliver Smithc5748292019-02-22 15:02:48 +0100864 tag := OSMO_GSUP_IMEI_RESULT_IE,
865 len := ?,
866 val := {
867 imei_result := result
868 }
869}
870
Alexander Couzens752f86b2020-01-10 07:56:31 +0100871template (value) GSUP_IE ts_GSUP_IE_NUM_VECTORS_REQ(OCT1 num) := {
872 tag := OSMO_GSUP_NUM_VECTORS_REQ_IE,
873 len := 0, /* overwritten */
874 val := {
875 num_auth_vectors := num
876 }
877}
878template GSUP_IE tr_GSUP_IE_NUM_VECTORS_REQ(template OCT1 num) := {
879 tag := OSMO_GSUP_NUM_VECTORS_REQ_IE,
880 len := ?,
881 val := {
882 num_auth_vectors := num
883 }
884}
885
886
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700887/* Possible identity types for SM-RP-{OA|DA} IEs */
888type enumerated GSUP_SM_RP_ODA_IdType {
889 OSMO_GSUP_SM_RP_ODA_ID_NONE ('00'O),
890 OSMO_GSUP_SM_RP_ODA_ID_IMSI ('01'O),
891 OSMO_GSUP_SM_RP_ODA_ID_MSISDN ('02'O),
892 OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR ('03'O),
893 /* Special value for noSM-RP-DA and noSM-RP-OA */
894 OSMO_GSUP_SM_RP_ODA_ID_NULL ('FF'O)
895} with { variant "FIELDLENGTH(8)" };
896
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900897/* See 3GPP TS 24.011, figures 8.5 and 8.6 */
898type record GSUP_SM_RP_Addr {
899 BIT1 ext, /* Extension? */
900 BIT3 ton, /* Type of Number */
901 BIT4 npi, /* Numbering Plan Identification */
902 hexstring number length (1..20)
903} with {
904 variant "PADDING(yes)";
905 variant "PADDING_PATTERN('1111'B)"
906};
907
908private function f_pad_SM_RP_Addr(template hexstring number)
909return template hexstring {
910 if (isvalue(number) and not istemplatekind(number, "omit")) {
911 return f_pad_bcd_number(valueof(number));
912 } else {
913 return number;
914 }
915}
916
917template GSUP_SM_RP_Addr t_GSUP_SM_RP_Addr(template hexstring number,
918 template BIT4 npi := '0001'B,
919 template BIT3 ton := '001'B,
920 template BIT1 ext := '1'B) := {
921 ext := ext,
922 ton := ton,
923 npi := npi,
924 /* Work around TITAN's padding problems: encoding works fine,
925 * but it does not consider 'F'H as padding in decoded data. */
926 number := f_pad_SM_RP_Addr(number)
927}
928
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700929/**
930 * SM-RP-DA represents the SM Destination Address, see 7.6.8.1.
931 * It can be either of the following:
932 * - IMSI
933 * - LMSI (not implemented)
934 * - MSISDN
935 * - roaming number (not implemented)
936 * - service centre address
937 */
938type union GSUP_SM_RP_DA_ID {
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900939 hexstring imsi,
940 GSUP_SM_RP_Addr msisdn,
941 GSUP_SM_RP_Addr smsc_addr
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700942};
943
944type record GSUP_SM_RP_DA {
945 GSUP_SM_RP_ODA_IdType id_type,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700946 GSUP_SM_RP_DA_ID id_enc optional
Vadim Yanitskiyf1f39bd2018-12-14 08:00:33 +0700947} with { variant (id_enc) "CROSSTAG(
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700948 imsi, id_type = OSMO_GSUP_SM_RP_ODA_ID_IMSI;
949 msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN;
950 smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR;
951 /* FIXME: how to handle noSM-RP-DA? */
952 )"
953};
954
955template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_IMSI(hexstring imsi) := {
956 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700957 id_enc := { imsi := imsi }
958}
959template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_IMSI(template hexstring imsi) := {
960 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700961 id_enc := { imsi := imsi }
962}
963
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900964template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_MSISDN(GSUP_SM_RP_Addr msisdn) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700965 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700966 id_enc := { msisdn := msisdn }
967}
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900968template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_MSISDN(template GSUP_SM_RP_Addr msisdn) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700969 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700970 id_enc := { msisdn := msisdn }
971}
972
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900973template (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 +0700974 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700975 id_enc := { smsc_addr := smsc_addr }
976}
Vadim Yanitskiya52347c2019-12-12 17:32:33 +0900977template 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 +0700978 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700979 id_enc := { smsc_addr := smsc_addr }
980}
981
982template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_NULL := {
983 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700984 id_enc := omit
985}
986template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_NULL := {
987 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +0700988 id_enc := omit
989}
990
991template (value) GSUP_IE ts_GSUP_IE_SM_RP_DA(GSUP_SM_RP_DA val) := {
992 tag := OSMO_GSUP_SM_RP_DA_IE,
993 len := 0, /* overwritten */
994 val := {
995 sm_rp_da := val
996 }
997}
998template GSUP_IE tr_GSUP_IE_SM_RP_DA(template GSUP_SM_RP_DA val) := {
999 tag := OSMO_GSUP_SM_RP_DA_IE,
1000 len := ?,
1001 val := {
1002 sm_rp_da := val
1003 }
1004}
1005
1006/**
1007 * SM-RP-OA represents the SM Originating Address, see 7.6.8.2.
1008 * It can be either of the following:
1009 * - MSISDN
1010 * - service centre address
1011 */
1012type union GSUP_SM_RP_OA_ID {
Vadim Yanitskiya52347c2019-12-12 17:32:33 +09001013 GSUP_SM_RP_Addr msisdn,
1014 GSUP_SM_RP_Addr smsc_addr
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001015};
1016
1017type record GSUP_SM_RP_OA {
1018 GSUP_SM_RP_ODA_IdType id_type,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001019 GSUP_SM_RP_OA_ID id_enc optional
Vadim Yanitskiyf1f39bd2018-12-14 08:00:33 +07001020} with { variant (id_enc) "CROSSTAG(
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001021 msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN;
1022 smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR;
1023 /* FIXME: how to handle noSM-RP-OA? */
1024 )"
1025};
1026
Vadim Yanitskiya52347c2019-12-12 17:32:33 +09001027template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_MSISDN(GSUP_SM_RP_Addr msisdn) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001028 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001029 id_enc := { msisdn := msisdn }
1030}
Vadim Yanitskiya52347c2019-12-12 17:32:33 +09001031template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_MSISDN(template GSUP_SM_RP_Addr msisdn) := {
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001032 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001033 id_enc := { msisdn := msisdn }
1034}
1035
Vadim Yanitskiya52347c2019-12-12 17:32:33 +09001036template (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 +07001037 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001038 id_enc := { smsc_addr := smsc_addr }
1039}
Vadim Yanitskiya52347c2019-12-12 17:32:33 +09001040template 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 +07001041 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001042 id_enc := { smsc_addr := smsc_addr }
1043}
1044
1045template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_NULL := {
1046 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001047 id_enc := omit
1048}
1049template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_NULL := {
1050 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001051 id_enc := omit
1052}
1053
1054template (value) GSUP_IE ts_GSUP_IE_SM_RP_OA(GSUP_SM_RP_OA val) := {
1055 tag := OSMO_GSUP_SM_RP_OA_IE,
1056 len := 0, /* overwritten */
1057 val := {
1058 sm_rp_oa := val
1059 }
1060}
1061template GSUP_IE tr_GSUP_IE_SM_RP_OA(template GSUP_SM_RP_OA val) := {
1062 tag := OSMO_GSUP_SM_RP_OA_IE,
1063 len := ?,
1064 val := {
1065 sm_rp_oa := val
1066 }
1067}
1068
1069/* SM-RP-UI represents the SM TPDU, see 7.6.8.4 */
1070template (value) GSUP_IE ts_GSUP_IE_SM_RP_UI(octetstring val) := {
1071 tag := OSMO_GSUP_SM_RP_UI_IE,
1072 len := 0, /* overwritten */
1073 val := {
1074 sm_rp_ui := val
1075 }
1076}
1077template GSUP_IE tr_GSUP_IE_SM_RP_UI(template octetstring val) := {
1078 tag := OSMO_GSUP_SM_RP_UI_IE,
1079 len := ?,
1080 val := {
1081 sm_rp_ui := val
1082 }
1083}
1084
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001085/* SM Alert Reason types, see 7.6.8.8 */
1086type enumerated GSUP_SM_ALERT_RSN_Type {
1087 GSUP_SM_ALERT_RSN_TYPE_NONE ('00'O),
1088 GSUP_SM_ALERT_RSN_TYPE_MS_PRESENT ('01'O),
1089 GSUP_SM_ALERT_RSN_TYPE_MEM_AVAIL ('02'O)
1090} with { variant "FIELDLENGTH(8)" };
1091
1092/* SM Alert Reason IE (used in READY-FOR-SM), see 7.6.8.8 */
1093template (value) GSUP_IE ts_GSUP_IE_SM_ALERT_RSN(GSUP_SM_ALERT_RSN_Type rsn) := {
1094 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
1095 len := 0, /* overwritten */
1096 val := {
1097 sm_alert_rsn := rsn
1098 }
1099}
1100template GSUP_IE tr_GSUP_IE_SM_ALERT_RSN(template GSUP_SM_ALERT_RSN_Type rsn) := {
1101 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
1102 len := ?,
1103 val := {
1104 sm_alert_rsn := rsn
1105 }
1106}
1107
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001108template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := {
1109 tag := OSMO_GSUP_SS_INFO_IE,
1110 len := 0, /* overwritten */
1111 val := {
1112 ss_info := ss
1113 }
1114}
1115template GSUP_IE tr_GSUP_IE_SSInfo(template octetstring ss) := {
1116 tag := OSMO_GSUP_SS_INFO_IE,
1117 len := ?,
1118 val := {
1119 ss_info := ss
1120 }
1121}
1122
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001123template GSUP_IE tr_GSUP_IE_Message_Class(template GSUP_Message_Class val) := {
1124 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1125 len := ?,
1126 val := {
1127 message_class := val
1128 }
1129}
1130
1131template (value) GSUP_IE ts_GSUP_IE_Message_Class(GSUP_Message_Class val) := {
1132 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1133 len := 0, /* overwritten */
1134 val := {
1135 message_class := val
1136 }
1137}
1138
1139template GSUP_IE tr_GSUP_IE_Source_Name(template octetstring name) := {
1140 tag := OSMO_GSUP_SOURCE_NAME_IE,
1141 len := ?,
1142 val := {
1143 source_name := name
1144 }
1145}
1146
1147template (value) GSUP_IE ts_GSUP_IE_Source_Name(octetstring name) := {
1148 tag := OSMO_GSUP_SOURCE_NAME_IE,
1149 len := 0, /* overwritten */
1150 val := {
1151 source_name := name
1152 }
1153}
1154
1155template GSUP_IE tr_GSUP_IE_Destination_Name(template octetstring name) := {
1156 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1157 len := ?,
1158 val := {
1159 destination_name := name
1160 }
1161}
1162
1163template (value) GSUP_IE ts_GSUP_IE_Destination_Name(octetstring name) := {
1164 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1165 len := 0, /* overwritten */
1166 val := {
1167 destination_name := name
1168 }
1169}
1170
1171template GSUP_IE tr_GSUP_IE_AN_APDU(template GSUP_AN_APDU an_apdu) := {
1172 tag := OSMO_GSUP_AN_APDU_IE,
1173 len := ?,
1174 val := {
1175 an_apdu := an_apdu
1176 }
1177}
1178
1179template (value) GSUP_IE ts_GSUP_IE_AN_APDU(GSUP_AN_APDU an_apdu) := {
1180 tag := OSMO_GSUP_AN_APDU_IE,
1181 len := 0, /* overwritten */
1182 val := {
1183 an_apdu := an_apdu
1184 }
1185}
1186
Harald Welte0a1fd0e2019-12-03 20:01:08 +01001187template (present) GSUP_IE tr_GSUP_IE_SUPPORTED_RAT_TYPES(template (present) GSUP_RatTypes ratt) := {
1188 tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE,
Harald Welte8eebb6c2019-08-22 12:40:03 +02001189 len := ?,
1190 val := {
Harald Welte0a1fd0e2019-12-03 20:01:08 +01001191 supported_rat_types := ratt
Harald Welte8eebb6c2019-08-22 12:40:03 +02001192 }
1193}
Harald Welte0a1fd0e2019-12-03 20:01:08 +01001194template (value) GSUP_IE ts_GSUP_IE_SUPPORTED_RAT_TYPES(GSUP_RatTypes ratt) := {
1195 tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE,
Harald Welte8eebb6c2019-08-22 12:40:03 +02001196 len := 0, /* overwritten */
1197 val := {
Harald Welte0a1fd0e2019-12-03 20:01:08 +01001198 supported_rat_types := ratt
1199 }
1200}
1201
1202template (present) GSUP_IE tr_GSUP_IE_CURRENT_RAT_TYPE(template (present) GSUP_RatType ratt) := {
1203 tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE,
1204 len := ?,
1205 val := {
1206 current_rat_type := ratt
1207 }
1208}
1209template (value) GSUP_IE ts_GSUP_IE_CURRENT_RAT_TYPE(GSUP_RatType ratt) := {
1210 tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE,
1211 len := 0, /* overwritten */
1212 val := {
1213 current_rat_type := ratt
Harald Welte8eebb6c2019-08-22 12:40:03 +02001214 }
1215}
1216
1217
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001218private function f_gen_ts_ss_ies(
1219 hexstring imsi,
1220 OCT4 sid,
1221 GSUP_SessionState state,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001222 template (omit) octetstring ss := omit,
1223 template (omit) integer cause := omit
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001224) return GSUP_IEs {
1225 /* Mandatory IEs */
1226 var GSUP_IEs ies := {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001227 valueof(ts_GSUP_IE_IMSI(imsi))
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001228 };
1229
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001230 /* Cause IE is needed for PROC_SS_ERR */
1231 if (isvalue(cause)) {
1232 ies := ies & { valueof(ts_GSUP_IE_Cause(valueof(cause))) };
1233 }
1234
1235 /* Mandatory session IEs */
1236 ies := ies & { valueof(ts_GSUP_IE_SessionId(sid)) };
1237 ies := ies & { valueof(ts_GSUP_IE_SessionState(state)) };
1238
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001239 /* Optional SS payload */
1240 if (isvalue(ss)) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001241 ies := ies & { valueof(ts_GSUP_IE_SSInfo(valueof(ss))) };
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001242 }
1243
1244 return ies;
1245}
1246private function f_gen_tr_ss_ies(
1247 template hexstring imsi,
1248 template OCT4 sid := ?,
1249 template GSUP_SessionState state := ?,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001250 template octetstring ss := omit,
1251 template integer cause := omit
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001252) return template GSUP_IEs {
1253 /* Mandatory IEs */
1254 var template GSUP_IEs ies := {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001255 tr_GSUP_IE_IMSI(imsi)
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001256 };
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001257 var integer idx := 1;
1258
1259 /* Cause IE is needed for PROC_SS_ERR */
1260 if (istemplatekind(cause, "*")) {
1261 ies[idx] := *;
1262 idx := idx + 1;
1263 } else if (not istemplatekind(cause, "omit")) {
1264 ies[idx] := tr_GSUP_IE_Cause(cause);
1265 idx := idx + 1;
1266 }
1267
1268 /* Mandatory session IEs */
1269 ies[idx] := tr_GSUP_IE_SessionId(sid);
1270 ies[idx + 1] := tr_GSUP_IE_SessionState(state);
1271 idx := idx + 2;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001272
1273 /* Optional SS payload */
1274 if (istemplatekind(ss, "*")) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001275 ies[idx] := *;
1276 idx := idx + 1;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001277 } else if (not istemplatekind(ss, "omit")) {
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001278 ies[idx] := tr_GSUP_IE_SSInfo(ss);
1279 idx := idx + 1;
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001280 }
1281
Harald Welte0622a9f2019-05-11 10:58:15 +02001282 /* the GSUP Message Class IE is optional, as old implementations don't have it yet */
1283 var template GSUP_IEs ies2 := ies;
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001284 ies2[idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD);
1285 idx := idx + 1;
Harald Welte0622a9f2019-05-11 10:58:15 +02001286
1287 return (ies, ies2);
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001288}
1289
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001290template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ(
1291 hexstring imsi,
1292 OCT4 sid,
1293 GSUP_SessionState state,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001294 template (omit) octetstring ss := omit
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001295) := ts_GSUP(
1296 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001297 f_gen_ts_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001298);
1299template GSUP_PDU tr_GSUP_PROC_SS_REQ(
1300 template hexstring imsi,
1301 template OCT4 sid := ?,
1302 template GSUP_SessionState state := ?,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001303 template octetstring ss := *
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001304) := tr_GSUP(
1305 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001306 f_gen_tr_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001307);
1308
1309template (value) GSUP_PDU ts_GSUP_PROC_SS_RES(
1310 hexstring imsi,
1311 OCT4 sid,
1312 GSUP_SessionState state,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001313 template (omit) octetstring ss := omit
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001314) := ts_GSUP(
1315 OSMO_GSUP_MSGT_PROC_SS_RESULT,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001316 f_gen_ts_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001317);
1318template GSUP_PDU tr_GSUP_PROC_SS_RES(
1319 template hexstring imsi,
1320 template OCT4 sid := ?,
1321 template GSUP_SessionState state := ?,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001322 template octetstring ss := *
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001323) := tr_GSUP(
1324 OSMO_GSUP_MSGT_PROC_SS_RESULT,
Vadim Yanitskiy911257e2018-06-21 04:18:54 +07001325 f_gen_tr_ss_ies(imsi, sid, state, ss)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001326);
1327
1328template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR(
1329 hexstring imsi,
1330 OCT4 sid,
Vadim Yanitskiy21c42332018-11-29 00:18:05 +07001331 GSUP_SessionState state,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001332 integer cause
1333) := ts_GSUP(
1334 OSMO_GSUP_MSGT_PROC_SS_ERROR,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001335 f_gen_ts_ss_ies(imsi, sid, state, cause := cause)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001336);
1337template GSUP_PDU tr_GSUP_PROC_SS_ERR(
1338 template hexstring imsi,
1339 template OCT4 sid := ?,
Vadim Yanitskiy21c42332018-11-29 00:18:05 +07001340 template GSUP_SessionState state := ?,
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001341 template integer cause := ?
1342) := tr_GSUP(
1343 OSMO_GSUP_MSGT_PROC_SS_ERROR,
Vadim Yanitskiy6c9fafc2019-06-15 02:51:22 +07001344 f_gen_tr_ss_ies(imsi, sid, state, cause := cause)
Vadim Yanitskiyb761d142018-06-02 21:05:04 +07001345);
Harald Weltedf327232017-12-28 22:51:51 +01001346
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001347template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_REQ(
1348 hexstring imsi,
1349 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1350 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1351 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1352 octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1353) := ts_GSUP(
1354 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1355 {
1356 valueof(ts_GSUP_IE_IMSI(imsi)),
1357 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1358 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1359 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1360 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui))
1361 }
1362);
1363template GSUP_PDU tr_GSUP_MO_FORWARD_SM_REQ(
1364 template hexstring imsi := ?,
1365 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1366 template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1367 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1368 template octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1369) := tr_GSUP(
1370 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1371 {
1372 tr_GSUP_IE_IMSI(imsi),
1373 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1374 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1375 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001376 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
1377 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001378 }
1379);
1380
1381template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_RES(
1382 hexstring imsi,
1383 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1384) := ts_GSUP(
1385 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1386 {
1387 valueof(ts_GSUP_IE_IMSI(imsi)),
1388 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1389 }
1390);
1391template GSUP_PDU tr_GSUP_MO_FORWARD_SM_RES(
1392 template hexstring imsi := ?,
1393 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1394) := tr_GSUP(
1395 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1396 {
1397 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001398 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1399 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001400 }
1401);
1402
1403template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_ERR(
1404 hexstring imsi,
1405 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1406 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1407) := ts_GSUP(
1408 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1409 {
1410 valueof(ts_GSUP_IE_IMSI(imsi)),
1411 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1412 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1413 }
1414);
1415template GSUP_PDU tr_GSUP_MO_FORWARD_SM_ERR(
1416 template hexstring imsi := ?,
1417 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1418 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1419) := tr_GSUP(
1420 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1421 {
1422 tr_GSUP_IE_IMSI(imsi),
1423 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001424 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1425 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001426 }
1427);
1428
1429template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_REQ(
1430 hexstring imsi,
1431 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1432 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1433 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1434 octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1435 OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1436) := ts_GSUP(
1437 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1438 {
1439 /**
1440 * TODO: add MT-specific fields (and IEs):
1441 * - smDeliveryTimer
1442 * - smDeliveryStartTime
1443 */
1444 valueof(ts_GSUP_IE_IMSI(imsi)),
1445 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1446 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1447 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1448 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)),
1449 valueof(ts_GSUP_IE_SM_RP_MMS(sm_rp_mms))
1450 }
1451);
1452template GSUP_PDU tr_GSUP_MT_FORWARD_SM_REQ(
1453 template hexstring imsi := ?,
1454 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1455 template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1456 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1457 template octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1458 template OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1459) := tr_GSUP(
1460 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1461 {
1462 /**
1463 * TODO: add MT-specific fields (and IEs):
1464 * - smDeliveryTimer
1465 * - smDeliveryStartTime
1466 */
1467 tr_GSUP_IE_IMSI(imsi),
1468 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1469 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1470 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
1471 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001472 tr_GSUP_IE_SM_RP_MMS(sm_rp_mms),
1473 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001474 }
1475);
1476
1477template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_RES(
1478 hexstring imsi,
1479 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1480) := ts_GSUP(
1481 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1482 {
1483 valueof(ts_GSUP_IE_IMSI(imsi)),
1484 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1485 }
1486);
1487template GSUP_PDU tr_GSUP_MT_FORWARD_SM_RES(
1488 template hexstring imsi := ?,
1489 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1490) := tr_GSUP(
1491 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1492 {
1493 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001494 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1495 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001496 }
1497);
1498
1499template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_ERR(
1500 hexstring imsi,
1501 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1502 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1503) := ts_GSUP(
1504 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1505 {
1506 valueof(ts_GSUP_IE_IMSI(imsi)),
1507 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1508 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1509 }
1510);
1511template GSUP_PDU tr_GSUP_MT_FORWARD_SM_ERR(
1512 template hexstring imsi := ?,
1513 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1514 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1515) := tr_GSUP(
1516 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1517 {
1518 tr_GSUP_IE_IMSI(imsi),
1519 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001520 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1521 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy8a1d4b62018-09-23 20:28:23 +07001522 }
1523);
1524
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001525template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_REQ(
1526 hexstring imsi,
1527 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1528 GSUP_SM_ALERT_RSN_Type sm_alert_rsn /* SM Alert Reason, see 7.6.8.8 */
1529) := ts_GSUP(
1530 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1531 {
1532 valueof(ts_GSUP_IE_IMSI(imsi)),
1533 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1534 valueof(ts_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn))
1535 }
1536);
1537template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_REQ(
1538 template hexstring imsi := ?,
1539 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1540 template GSUP_SM_ALERT_RSN_Type sm_alert_rsn := ? /* SM Alert Reason, see 7.6.8.8 */
1541) := tr_GSUP(
1542 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1543 {
1544 tr_GSUP_IE_IMSI(imsi),
1545 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001546 tr_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn),
1547 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001548 }
1549);
1550
1551template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_RES(
1552 hexstring imsi,
1553 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1554) := ts_GSUP(
1555 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1556 {
1557 valueof(ts_GSUP_IE_IMSI(imsi)),
1558 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr))
1559 }
1560);
1561template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_RES(
1562 template hexstring imsi := ?,
1563 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1564) := tr_GSUP(
1565 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1566 {
1567 tr_GSUP_IE_IMSI(imsi),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001568 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1569 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001570 }
1571);
1572
1573template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_ERR(
1574 hexstring imsi,
1575 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1576 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1577) := ts_GSUP(
1578 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1579 {
1580 valueof(ts_GSUP_IE_IMSI(imsi)),
1581 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1582 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause))
1583 }
1584);
1585template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_ERR(
1586 template hexstring imsi := ?,
1587 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1588 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1589) := tr_GSUP(
1590 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1591 {
1592 tr_GSUP_IE_IMSI(imsi),
1593 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001594 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1595 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)
Vadim Yanitskiy88e23232018-11-13 03:04:02 +07001596 }
1597);
1598
Harald Welte8eebb6c2019-08-22 12:40:03 +02001599function f_gsup_find_nested_ie(GSUP_IEs ies, GSUP_IEI iei, out GSUP_IeValue ret) return boolean {
1600 for (var integer i := 0; i < sizeof(ies); i := i+1) {
1601 if (ies[i].tag == iei) {
1602 ret := ies[i].val;
Harald Weltef9d449e2018-06-24 22:27:47 +02001603 return true;
1604 }
1605 }
Harald Welte8eebb6c2019-08-22 12:40:03 +02001606 return false;
1607}
1608
1609function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) return boolean {
1610 return f_gsup_find_nested_ie(msg.ies, iei, ret);
Harald Weltef9d449e2018-06-24 22:27:47 +02001611}
1612
Neels Hofmeyr0ac63152019-05-07 01:20:17 +02001613template GSUP_AN_APDU t_GSUP_AN_APDU(
1614 template GSUP_AN_PROTO an_proto := ?,
1615 template octetstring pdu := ?
1616) := {
1617 proto := an_proto,
1618 pdu := pdu
1619};
1620
1621template GSUP_PDU tr_GSUP_E_AN_APDU(
1622 template GSUP_MessageType msgt,
1623 template hexstring imsi := ?,
1624 template octetstring source_name := ?,
1625 template octetstring destination_name := ?,
1626 template GSUP_AN_APDU an_apdu := ?
1627) := tr_GSUP(
1628 msgt,
1629 {
1630 tr_GSUP_IE_IMSI(imsi),
1631 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1632 tr_GSUP_IE_Source_Name(source_name),
1633 tr_GSUP_IE_Destination_Name(destination_name),
1634 tr_GSUP_IE_AN_APDU(an_apdu)
1635 }
1636);
1637
1638template GSUP_PDU tr_GSUP_E_NO_PDU(
1639 template GSUP_MessageType msgt,
1640 template hexstring imsi := ?,
1641 template octetstring source_name := ?,
1642 template octetstring destination_name := ?
1643) := tr_GSUP(
1644 msgt,
1645 {
1646 tr_GSUP_IE_IMSI(imsi),
1647 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1648 tr_GSUP_IE_Source_Name(source_name),
1649 tr_GSUP_IE_Destination_Name(destination_name)
1650 }
1651);
1652
1653template (value) GSUP_PDU ts_GSUP_E_AN_APDU(
1654 GSUP_MessageType msgt,
1655 hexstring imsi,
1656 octetstring source_name,
1657 octetstring destination_name,
1658 GSUP_AN_APDU an_apdu
1659) := ts_GSUP(
1660 msgt,
1661 {
1662 valueof(ts_GSUP_IE_IMSI(imsi)),
1663 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1664 valueof(ts_GSUP_IE_Source_Name(source_name)),
1665 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1666 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1667 }
1668);
1669
1670template (value) GSUP_PDU ts_GSUP_E_PrepareHandoverResult(
1671 hexstring imsi,
1672 hexstring msisdn,
1673 octetstring source_name,
1674 octetstring destination_name,
1675 GSUP_AN_APDU an_apdu
1676) := ts_GSUP(
1677 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT,
1678 {
1679 valueof(ts_GSUP_IE_IMSI(imsi)),
1680 valueof(ts_GSUP_IE_MSISDN(msisdn)),
1681 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1682 valueof(ts_GSUP_IE_Source_Name(source_name)),
1683 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1684 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1685 }
1686);
Harald Weltef9d449e2018-06-24 22:27:47 +02001687
Harald Weltedf327232017-12-28 22:51:51 +01001688} with { encode "RAW"; variant "FIELDORDER(msb)" }