blob: 9daf9c04cc5b293e6aed9c2a685a54b52da8ee33 [file] [log] [blame]
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001module GSUP_Templates {
2
3/* GSUP_Templates, defining TTCN-3 templates 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 *
8 * (C) 2017-2019 by Harald Welte <laforge@gnumonks.org>
9 * contributions by sysmocom - s.f.m.c. GmbH
10 * All rights reserved.
11 *
12 * Released under the terms of GNU General Public License, Version 2 or
13 * (at your option) any later version.
14 *
15 * SPDX-License-Identifier: GPL-2.0-or-later
16 */
17
18import from General_Types all;
19import from Osmocom_Types all;
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +010020import from PCO_Types all;
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +010021import from GSUP_Types all;
22
23function f_gsup_postprocess_decoded(inout GSUP_PDU gsup) {
24 if (gsup.ies[0].tag == OSMO_GSUP_IMSI_IE) {
25 /* if last digit is 'F', then there's an odd number of digits and we must strip the F */
26 var integer num_digits := lengthof(gsup.ies[0].val.imsi);
27 if (gsup.ies[0].val.imsi[num_digits-1] == 'F'H) {
28 gsup.ies[0].val.imsi := substr(gsup.ies[0].val.imsi, 0, num_digits-1);
29 }
30 }
31}
32
33function f_gsup_preprocess_encoded(inout GSUP_PDU gsup) {
34 if (ischosen(gsup.ies[0].val.imsi)) {
35 /* if number of digits is odd, add a 'F' as padding at the end */
36 var integer num_digits := lengthof(gsup.ies[0].val.imsi);
37 if (num_digits rem 2 == 1) {
38 gsup.ies[0].val.imsi := gsup.ies[0].val.imsi & 'F'H;
39 }
40 }
41}
42
43template (value) GSUP_MSISDN ts_GSUP_MSISDN(hexstring digits,
44 BIT3 ton := '000'B,
45 BIT4 npi := '0000'B) := {
46 len := 0, /* overwritten */
47 /* numberingPlanIdentification := npi,
48 typeOfNumber := ton,
49 ext1 := '0'B, */
50 digits := digits
51}
52
53template GSUP_MSISDN tr_GSUP_MSISDN(template hexstring digits,
54 template BIT3 ton := ?,
55 template BIT4 npi := ?) := {
56 len := ?,
57 /* numberingPlanIdentification := npi,
58 typeOfNumber := ton,
59 ext1 := '0'B, */
60 digits := digits
61}
62
Pau Espin Pedrol7b7a1e82024-01-19 20:49:28 +010063template (value) GSUP_PDP_Address ts_GSUP_PDP_Address_IPv4(template (omit) OCT4 ip_addr) := {
64 ipv4 := {
Pau Espin Pedrol7b7a1e82024-01-19 20:49:28 +010065 spare := '1111'B,
Pau Espin Pedrola518d052024-01-30 12:35:33 +010066 pdp_typeorg := '0001'B,
Pau Espin Pedrol7b7a1e82024-01-19 20:49:28 +010067 pdp_typenum := '21'O,
68 ipv4_address := ip_addr
69 }
70}
71template (value) GSUP_PDP_Address ts_EuaIPv4Dyn := ts_GSUP_PDP_Address_IPv4(omit);
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +010072
Pau Espin Pedrol78598b52024-02-14 19:21:42 +010073template (present) GSUP_PDP_Address tr_GSUP_PDP_Address_IPv4(template OCT4 ip_addr) := {
74 ipv4 := {
75 spare := ?,
76 pdp_typeorg := '0001'B,
77 pdp_typenum := '21'O,
78 ipv4_address := ip_addr
79 }
80}
81
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +010082template GSUP_IE ts_GSUP_IE_AuthTuple2G(octetstring rand, octetstring sres,
83 octetstring kc) := {
84 tag := OSMO_GSUP_AUTH_TUPLE_IE,
85 len := 0, /* overwritten */
86 val := {
87 auth_tuple := {
88 valueof(ts_GSUP_IE_RAND(rand)),
89 valueof(ts_GSUP_IE_SRES(sres)),
90 valueof(ts_GSUP_IE_Kc(kc))
91 }
92 }
93}
94
95template GSUP_IE tr_GSUP_IE_AuthTuple3G(
96 template (present) octetstring rand := ?,
97 template (present) octetstring ik := ?,
98 template (present) octetstring ck := ?,
99 template (present) octetstring autn := ?,
100 template (present) octetstring res := ?) := {
101 tag := OSMO_GSUP_AUTH_TUPLE_IE,
102 len := ?,
103 val := {
104 auth_tuple := {
105 tr_GSUP_IE_RAND(rand),
106 tr_GSUP_IE_IK(ik),
107 tr_GSUP_IE_CK(ck),
108 tr_GSUP_IE_AUTN(autn),
109 tr_GSUP_IE_RES(res)
110 }
111 }
112}
113
114template GSUP_IE ts_GSUP_IE_AuthTuple3G(octetstring rand, octetstring ik,
115 octetstring ck, octetstring autn,
116 octetstring res) := {
117 tag := OSMO_GSUP_AUTH_TUPLE_IE,
118 len := 0, /* overwritten */
119 val := {
120 auth_tuple := {
121 valueof(ts_GSUP_IE_RAND(rand)),
122 valueof(ts_GSUP_IE_IK(ik)),
123 valueof(ts_GSUP_IE_CK(ck)),
124 valueof(ts_GSUP_IE_AUTN(autn)),
125 valueof(ts_GSUP_IE_RES(res))
126 }
127 }
128}
129
130template GSUP_IE tr_GSUP_IE_AuthTuple2G3G(
131 template (present) octetstring rand := ?,
132 template (present) octetstring sres := ?,
133 template (present) octetstring kc := ?,
134 template (present) octetstring ik := ?,
135 template (present) octetstring ck := ?,
136 template (present) octetstring autn := ?,
137 template (present) octetstring res := ?) := {
138 tag := OSMO_GSUP_AUTH_TUPLE_IE,
139 len := ?,
140 val := {
141 auth_tuple := {
142 tr_GSUP_IE_RAND(rand),
143 tr_GSUP_IE_SRES(sres),
144 tr_GSUP_IE_Kc(kc),
145 tr_GSUP_IE_IK(ik),
146 tr_GSUP_IE_CK(ck),
147 tr_GSUP_IE_AUTN(autn),
148 tr_GSUP_IE_RES(res)
149 }
150 }
151}
152
153template GSUP_IE ts_GSUP_IE_AuthTuple2G3G(octetstring rand, octetstring sres,
154 octetstring kc, octetstring ik,
155 octetstring ck, octetstring autn,
156 octetstring res) := {
157 tag := OSMO_GSUP_AUTH_TUPLE_IE,
158 len := 0, /* overwritten */
159 val := {
160 auth_tuple := {
161 valueof(ts_GSUP_IE_RAND(rand)),
162 valueof(ts_GSUP_IE_SRES(sres)),
163 valueof(ts_GSUP_IE_Kc(kc)),
164 valueof(ts_GSUP_IE_IK(ik)),
165 valueof(ts_GSUP_IE_CK(ck)),
166 valueof(ts_GSUP_IE_AUTN(autn)),
167 valueof(ts_GSUP_IE_RES(res))
168 }
169 }
170}
171
Pau Espin Pedrolbb76d7a2024-01-22 19:56:13 +0100172template (value) GSUP_IE ts_GSUP_IE_PdpInfoCompl := {
173 tag := OSMO_GSUP_PDP_INFO_COMPL_IE,
174 len := 0, /* overwritten */
175 val := {
176 pdp_info_compl := ''O
177 }
178}
179
180template (present) GSUP_IE tr_GSUP_IE_PdpInfoCompl := {
181 tag := OSMO_GSUP_PDP_INFO_COMPL_IE,
182 len := 0, /* overwritten */
183 val := {
184 pdp_info_compl := ''O
185 }
186}
187
Pau Espin Pedrolc63fa8e2024-01-22 19:58:09 +0100188template (value) GSUP_IE ts_GSUP_IE_PdpInfo(template (value) OCT1 ctx_id,
189 template (value) octetstring apn,
190 template (value) GSUP_PDP_Address pdp_address,
191 template (value) octetstring pdp_qos) := {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100192 tag := OSMO_GSUP_PDP_INFO_IE,
193 len := 0, /* overwritten */
194 val := {
195 pdp_info := {
Pau Espin Pedrolc63fa8e2024-01-22 19:58:09 +0100196 valueof(ts_GSUP_IE_PDP_CONTEXT_ID(ctx_id)),
Pau Espin Pedrol7b7a1e82024-01-19 20:49:28 +0100197 valueof(ts_GSUP_IE_PDP_ADDRESS(pdp_address)),
Pau Espin Pedrolc63fa8e2024-01-22 19:58:09 +0100198 valueof(ts_GSUP_IE_APN(apn)),
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100199 valueof(ts_GSUP_IE_PDP_QOS(pdp_qos))
200 }
201 }
202}
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +0100203template (value) GSUP_IE ts_GSUP_IE_PdpInfo_ie(template (value) GSUP_IEs pdp_info) := {
204 tag := OSMO_GSUP_PDP_INFO_IE,
205 len := 0, /* overwritten */
206 val := {
207 pdp_info := pdp_info
208 }
209}
210
211template (present) GSUP_IE tr_GSUP_IE_PdpInfo(template (present) OCT1 ctx_id,
212 template (present) octetstring apn,
213 template (present) GSUP_PDP_Address pdp_address) := {
214 tag := OSMO_GSUP_PDP_INFO_IE,
215 len := ?,
216 val := {
217 pdp_info := {
218 tr_GSUP_IE_PDP_CONTEXT_ID(ctx_id),
219 tr_GSUP_IE_PDP_ADDRESS(pdp_address),
220 tr_GSUP_IE_APN(apn)
221 }
222 }
223}
224template (present) GSUP_IE tr_GSUP_IE_PdpInfo_ie(template (present) GSUP_IEs pdp_info := ?) := {
225 tag := OSMO_GSUP_PDP_INFO_IE,
226 len := ?,
227 val := {
228 pdp_info := pdp_info
229 }
230}
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100231
Pau Espin Pedrolc63fa8e2024-01-22 19:58:09 +0100232template (value) GSUP_IE ts_GSUP_IE_PDP_CONTEXT_ID(template (value) OCT1 ctx_id) := {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100233 tag := OSMO_GSUP_PDP_CONTEXT_ID_IE,
234 len := 0,
235 val := {
236 pdp_ctx_id := ctx_id
237 }
238}
239
Pau Espin Pedrolc63fa8e2024-01-22 19:58:09 +0100240template (present) GSUP_IE tr_GSUP_IE_PDP_CONTEXT_ID(template OCT1 ctx_id) := {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100241 tag := OSMO_GSUP_PDP_CONTEXT_ID_IE,
242 len := ?,
243 val := {
244 pdp_ctx_id := ctx_id
245 }
246}
247
Pau Espin Pedrol7b7a1e82024-01-19 20:49:28 +0100248template (value) GSUP_IE ts_GSUP_IE_PDP_ADDRESS(template (value) GSUP_PDP_Address pdp_address) := {
249 tag := OSMO_GSUP_PDP_ADDRESS_IE,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100250 len := 0,
251 val := {
Pau Espin Pedrol7b7a1e82024-01-19 20:49:28 +0100252 pdp_address := pdp_address
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100253 }
254}
255
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +0100256template (present) GSUP_IE tr_GSUP_IE_PDP_ADDRESS(template (present) GSUP_PDP_Address pdp_address := ?) := {
257 tag := OSMO_GSUP_PDP_ADDRESS_IE,
258 len := ?,
259 val := {
260 pdp_address := pdp_address
261 }
262}
263
Pau Espin Pedrol7b7a1e82024-01-19 20:49:28 +0100264template (value) GSUP_IE ts_GSUP_IE_PDP_QOS(template (value) octetstring pdp_qos) := {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100265 tag := OSMO_GSUP_PDP_QOS_IE,
266 len := 0,
267 val := {
268 pdp_qos := pdp_qos
269 }
270}
271
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +0100272template (present) GSUP_IE tr_GSUP_IE_PDP_QOS(template (present) octetstring pdp_qos := ?) := {
273 tag := OSMO_GSUP_PDP_QOS_IE,
274 len := ?,
275 val := {
276 pdp_qos := pdp_qos
277 }
278}
279
280template (value) GSUP_IE ts_GSUP_IE_Charging_Characteristics(template (value) octetstring charg_char) := {
281 tag := OSMO_GSUP_CHARG_CHAR_IE,
282 len := 0,
283 val := {
284 charg_char := charg_char
285 }
286}
287
288template (present) GSUP_IE tr_GSUP_IE_Charging_Characteristics(template (present) octetstring charg_char := ?) := {
289 tag := OSMO_GSUP_CHARG_CHAR_IE,
290 len := ?,
291 val := {
292 charg_char := charg_char
293 }
294}
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100295
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +0100296template (value) GSUP_IE ts_GSUP_IE_PCO(template (value) PCO_DATA pco) := {
297 tag := OSMO_GSUP_PCO_IE,
298 len := 0,
299 val := {
300 pco := pco
301 }
302}
303
Pau Espin Pedrolf2925862024-02-22 20:12:30 +0100304template (present) GSUP_IE tr_GSUP_IE_PCO(template (present) PCO_DATA pco := ?) := {
305 tag := OSMO_GSUP_PCO_IE,
306 len := ?,
307 val := {
308 pco := pco
309 }
310}
311
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100312template GSUP_PDU tr_GSUP(template GSUP_MessageType msgt := ?, template GSUP_IEs ies := *) := {
313 msg_type := msgt,
314 ies := ies
315}
316
317template (present) GSUP_PDU tr_GSUP_IMSI(template (present) GSUP_MessageType msgt := ?, template (present) hexstring imsi := ?) := {
318 msg_type := msgt,
319 ies := { tr_GSUP_IE_IMSI(imsi), * }
320}
321
322template GSUP_PDU ts_GSUP(GSUP_MessageType msgt, GSUP_IEs ies := {}) := {
323 msg_type := msgt,
324 ies := ies
325}
326
327template (value) GSUP_IMEI ts_GSUP_IMEI(hexstring digits) := {
328 len := 0, /* overwritten */
329 digits := digits
330}
331
332template GSUP_IMEI tr_GSUP_IMEI(template hexstring digits) := {
333 len := ?,
334 digits := digits
335}
336
337
338template (value) GSUP_PDU ts_GSUP_SAI_REQ(hexstring imsi) :=
339 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { valueof(ts_GSUP_IE_IMSI(imsi)) });
340
341template (value) GSUP_PDU ts_GSUP_SAI_REQ_EPS(hexstring imsi) :=
342 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
343 valueof(ts_GSUP_IE_IMSI(imsi)),
344 valueof(ts_GSUP_IE_CURRENT_RAT_TYPE(RAT_TYPE_EUTRAN_SGs))
345 });
346
347template (value) GSUP_PDU ts_GSUP_SAI_REQ_NUM_AUTH(hexstring imsi, OCT1 num_auth_vectors) :=
348 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
349 valueof(ts_GSUP_IE_IMSI(imsi)),
350 valueof(ts_GSUP_IE_NUM_VECTORS_REQ(num_auth_vectors))
351 });
352
Pau Espin Pedrolc2cfd552024-02-07 17:51:55 +0100353template (value) GSUP_PDU ts_GSUP_SAI_REQ_PDP_INFO(hexstring imsi, template (value) GSUP_IEs pdp_info) :=
354 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
355 valueof(ts_GSUP_IE_IMSI(imsi)),
356 valueof(ts_GSUP_IE_PdpInfo_ie(pdp_info))
357 });
358
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100359template GSUP_PDU tr_GSUP_SAI_REQ(template hexstring imsi) :=
360 tr_GSUP_IMSI(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, imsi);
361
362template GSUP_PDU tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC(
363 template hexstring imsi,
364 template octetstring auts,
365 template octetstring rand) :=
366 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, {
367 tr_GSUP_IE_IMSI(imsi),
368 tr_GSUP_IE_AUTS(auts),
369 tr_GSUP_IE_RAND(rand),
370 *
371 });
372
373template (value) GSUP_PDU ts_GSUP_SAI_RES(hexstring imsi, GSUP_IE auth_tuple) :=
374 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, {
375 valueof(ts_GSUP_IE_IMSI(imsi)), auth_tuple });
376
377template GSUP_PDU tr_GSUP_SAI_ERR(template hexstring imsi, template integer cause) :=
378 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, {
379 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
380
381template (value) GSUP_PDU ts_GSUP_SAI_ERR(hexstring imsi, integer cause) :=
382 ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, {
383 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
384
385
386template GSUP_PDU tr_GSUP_SAI_RES(template (present) hexstring imsi,
387 template (present) GSUP_IE auth_tuple_ie := tr_GSUP_IE(OSMO_GSUP_AUTH_TUPLE_IE)) :=
388 tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, {
389 tr_GSUP_IE_IMSI(imsi), *, auth_tuple_ie, * });
390
391template GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi, GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS,
392 template octetstring source_name := omit) :=
393 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, f_gen_ts_ies(imsi, dom := dom,
394 source_name := source_name));
395
396template GSUP_PDU tr_GSUP_UL_REQ(template hexstring imsi) :=
397 tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, imsi);
398
399template (value) GSUP_PDU ts_GSUP_UL_RES(hexstring imsi, octetstring destination_name := ''O) :=
400 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, { valueof(ts_GSUP_IE_IMSI(imsi)),
401 valueof(ts_GSUP_IE_Destination_Name(destination_name))});
402
403template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi, template octetstring destination_name := omit) :=
404 tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, f_gen_tr_ies(imsi, destination_name := destination_name));
405
406template (value) GSUP_PDU ts_GSUP_UL_ERR(hexstring imsi, integer cause) :=
407 ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, {
408 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
409
410template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?,
411 template octetstring destination_name := omit) :=
412 tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR,
413 f_gen_tr_ies(imsi, cause := cause, destination_name := destination_name));
414
415template (value) GSUP_PDU ts_GSUP_ISD_REQ(hexstring imsi, hexstring msisdn, octetstring destination_name := ''O) :=
416 ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, {
417 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_MSISDN(msisdn)),
418 valueof(ts_GSUP_IE_Destination_Name(destination_name))});
419
420template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?,
421 template octetstring destination_name := omit) :=
422 tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST,
423 f_gen_tr_ies(imsi, msisdn := msisdn, destination_name := destination_name));
424
425template GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi,
426 template octetstring source_name := omit,
427 template octetstring destination_name := omit) :=
428 ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT,
429 f_gen_ts_ies(imsi, source_name := source_name,
430 destination_name := destination_name));
431
432template GSUP_PDU tr_GSUP_ISD_RES(template hexstring imsi) :=
433 tr_GSUP_IMSI(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, imsi);
434
435template GSUP_PDU tr_GSUP_AUTH_FAIL_IND(hexstring imsi) :=
436 tr_GSUP_IMSI(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT, imsi);
437
Pau Espin Pedrolcbe6eba2024-02-06 12:53:14 +0100438template (present) GSUP_PDU tr_GSUP_CL_REQ(template (present) hexstring imsi := ?,
439 template GSUP_CnDomain dom := omit,
440 template GSUP_CancelType ctype := omit) :=
441 tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST,
442 f_gen_tr_ies(imsi,
443 cancel_type := ctype,
444 cn_domain := dom));
445
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100446template (value) GSUP_PDU ts_GSUP_CL_REQ(hexstring imsi, GSUP_CancelType ctype) :=
447 ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST, {
448 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CancelType(ctype)) });
449
450template GSUP_PDU tr_GSUP_CL_RES(template hexstring imsi) :=
451 tr_GSUP_IMSI(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, imsi);
452
Pau Espin Pedrolcbe6eba2024-02-06 12:53:14 +0100453template (value) GSUP_PDU ts_GSUP_CL_RES(template (value) hexstring imsi) :=
454 ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, {valueof(ts_GSUP_IE_IMSI(imsi))});
455
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100456template GSUP_PDU tr_GSUP_CL_ERR(template hexstring imsi, template integer cause := ?) :=
457 tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR, {
458 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause), * });
459
460template (value) GSUP_PDU ts_GSUP_PURGE_MS_REQ(hexstring imsi, GSUP_CnDomain dom) :=
461 ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, {
462 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) });
463
464template GSUP_PDU tr_GSUP_PURGE_MS_REQ(template hexstring imsi, template GSUP_CnDomain dom := ?) :=
465 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, {
466 tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_CnDomain(dom) });
467
468template (value) GSUP_PDU ts_GSUP_PURGE_MS_RES(hexstring imsi) :=
469 ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, {
470 valueof(ts_GSUP_IE_IMSI(imsi)) });
471
472template GSUP_PDU tr_GSUP_PURGE_MS_RES(template hexstring imsi) :=
473 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, {
474 tr_GSUP_IE_IMSI(imsi), * });
475
476template GSUP_PDU tr_GSUP_PURGE_MS_ERR(template hexstring imsi, template integer cause) :=
477 tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_ERROR, {
478 tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) });
479
480template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_REQ(hexstring imsi, hexstring imei,
481 template (omit) octetstring source_name := omit) :=
482 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, f_gen_ts_ies(imsi, imei := imei, source_name := source_name));
483
484template GSUP_PDU tr_GSUP_CHECK_IMEI_REQ(
485 template hexstring imsi,
486 template hexstring imei
487) := tr_GSUP(
488 OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST,
489 {
490 tr_GSUP_IE_IMSI(imsi),
491 tr_GSUP_IE_IMEI(imei),
492 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT)
493 }
494);
495
496template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_RES(hexstring imsi, GSUP_IMEIResult result) :=
497 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, {
498 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI_Result(result)) });
499
500template GSUP_PDU tr_GSUP_CHECK_IMEI_RES(template hexstring imsi, template GSUP_IMEIResult result,
501 template octetstring destination_name := omit) :=
502 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT,
503 f_gen_tr_ies(imsi, imei_result := result, destination_name := destination_name));
504
505template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_ERR(hexstring imsi, integer cause) :=
506 ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, {
507 valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) });
508
509template GSUP_PDU tr_GSUP_CHECK_IMEI_ERR(template hexstring imsi, template integer cause,
510 template octetstring destination_name := omit) :=
511 tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, f_gen_tr_ies(imsi, cause := cause, destination_name := destination_name));
512
513
514/* EPDG Tunnel */
515template (value) GSUP_PDU ts_GSUP_EPDGTunnel_REQ(hexstring imsi,
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +0100516 template (value) PCO_DATA pco,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100517 GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG,
518 GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS,
519 template (omit) octetstring source_name := omit) :=
520 ts_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_REQUEST, f_gen_ts_ies(imsi,
521 message_class := message_class,
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +0100522 pco := pco,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100523 dom := dom,
524 source_name := source_name));
525
526template (present) GSUP_PDU tr_GSUP_EPDGTunnel_REQ(template (present) hexstring imsi := ?,
527 template (present) GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG) :=
528 tr_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_REQUEST,
529 f_gen_tr_ies(imsi,
530 message_class := message_class));
531
532
533template (value) GSUP_PDU ts_GSUP_EPDGTunnel_RES(hexstring imsi,
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +0100534 template (value) GSUP_IEs pdp_info,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100535 GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG,
536 octetstring destination_name := ''O) :=
537 ts_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_RESULT, {
538 valueof(ts_GSUP_IE_IMSI(imsi)),
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +0100539 valueof(ts_GSUP_IE_PdpInfoCompl),
540 valueof(ts_GSUP_IE_PdpInfo_ie(pdp_info)),
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100541 valueof(ts_GSUP_IE_Message_Class(message_class)),
542 valueof(ts_GSUP_IE_Destination_Name(destination_name))
543 });
544
545template (present) GSUP_PDU tr_GSUP_EPDGTunnel_RES(template (present) hexstring imsi,
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +0100546 template (present) GSUP_IEs pdp_info,
Pau Espin Pedrolf2925862024-02-22 20:12:30 +0100547 template (present) PCO_DATA pco := ?,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100548 template (present) GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG,
549 template octetstring destination_name := omit) :=
550 tr_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_RESULT,
551 f_gen_tr_ies(imsi,
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +0100552 pdp_info_compl := true,
553 pdp_info := pdp_info,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100554 message_class := message_class,
Pau Espin Pedrolf2925862024-02-22 20:12:30 +0100555 pco := pco,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100556 destination_name := destination_name));
557
558template (value) GSUP_PDU ts_GSUP_EPDGTunnel_ERR(hexstring imsi,
559 GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG,
560 integer cause := 0) :=
561 ts_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_ERROR, {
562 valueof(ts_GSUP_IE_IMSI(imsi)),
563 valueof(ts_GSUP_IE_Cause(cause)),
564 valueof(ts_GSUP_IE_Message_Class(message_class))
565 });
566
567template (present) GSUP_PDU tr_GSUP_EPDGTunnel_ERR(template (present) hexstring imsi,
568 template (present) GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG,
569 template (present) integer cause := ?,
570 template octetstring destination_name := omit) :=
571 tr_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_ERROR,
572 f_gen_tr_ies(imsi,
573 message_class := message_class,
574 cause := cause,
575 destination_name := destination_name));
576
577
578template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := {
579 tag := OSMO_GSUP_CANCEL_TYPE_IE,
580 len := 0, /* overwritten */
581 val := {
582 cancel_type := ctype
583 }
584}
585
586template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) :=
587 tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype});
588
589template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) :=
590 tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain});
591
592template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := {
593 tag := iei,
594 len := ?,
595 val := val
596}
597
Pau Espin Pedrolcbe6eba2024-02-06 12:53:14 +0100598template (value) GSUP_IE ts_GSUP_IE_IMSI(template (value) hexstring imsi) := {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100599 tag := OSMO_GSUP_IMSI_IE,
600 len := 0, /* overwritten */
601 val := {
602 imsi := imsi
603 }
604}
605
606template (present) GSUP_IE tr_GSUP_IE_IMSI(template (present) hexstring imsi := ?) := {
607 tag := OSMO_GSUP_IMSI_IE,
608 len := ?,
609 val := {
610 imsi := imsi
611 }
612}
613
614template (value) GSUP_IE ts_GSUP_IE_MSISDN(hexstring msisdn) := {
615 tag := OSMO_GSUP_MSISDN_IE,
616 len := 0, /* overwritten */
617 val := {
618 msisdn := ts_GSUP_MSISDN(msisdn)
619 }
620}
621
622template GSUP_IE tr_GSUP_IE_MSISDN(template hexstring msisdn) := {
623 tag := OSMO_GSUP_MSISDN_IE,
624 len := ?,
625 val := {
626 msisdn := tr_GSUP_MSISDN(msisdn)
627 }
628}
629
630
631template (value) GSUP_IE ts_GSUP_IE_Cause(integer cause) := {
632 tag := OSMO_GSUP_CAUSE_IE,
633 len := 0, /* overwritten */
634 val := {
635 cause := cause
636 }
637}
638
639template GSUP_IE tr_GSUP_IE_Cause(template integer cause) := {
640 tag := OSMO_GSUP_CAUSE_IE,
641 len := ?,
642 val := {
643 cause := cause
644 }
645}
646
647template (value) GSUP_IE ts_GSUP_IE_AUTS(octetstring auts) := {
648 tag := OSMO_GSUP_AUTS_IE,
649 len := 0, /* overwritten */
650 val := {
651 auts := auts
652 }
653}
654
655template GSUP_IE tr_GSUP_IE_AUTS(template octetstring auts) := {
656 tag := OSMO_GSUP_AUTS_IE,
657 len := ?,
658 val := {
659 auts := auts
660 }
661}
662
663template (value) GSUP_IE ts_GSUP_IE_RAND(octetstring rand) := {
664 tag := OSMO_GSUP_RAND_IE,
665 len := 0, /* overwritten */
666 val := {
667 rand := rand
668 }
669}
670
671template GSUP_IE tr_GSUP_IE_RAND(template octetstring rand := ?) := {
672 tag := OSMO_GSUP_RAND_IE,
673 len := ?,
674 val := {
675 rand := rand
676 }
677}
678
679template (present) GSUP_IE tr_GSUP_IE_SRES(template (present) octetstring sres := ?) := {
680 tag := OSMO_GSUP_SRES_IE,
681 len := ?,
682 val := {
683 sres := sres
684 }
685}
686
687template (value) GSUP_IE ts_GSUP_IE_SRES(octetstring sres) := {
688 tag := OSMO_GSUP_SRES_IE,
689 len := 0, /* overwritten */
690 val := {
691 sres := sres
692 }
693}
694
695template (present) GSUP_IE tr_GSUP_IE_Kc(template (present) octetstring kc := ?) := {
696 tag := OSMO_GSUP_KC_IE,
697 len := ?,
698 val := {
699 kc := kc
700 }
701}
702
703template (value) GSUP_IE ts_GSUP_IE_Kc(octetstring kc) := {
704 tag := OSMO_GSUP_KC_IE,
705 len := 0, /* overwritten */
706 val := {
707 kc := kc
708 }
709}
710
711template (present) GSUP_IE tr_GSUP_IE_IK(template (present) octetstring ik := ?) := {
712 tag := OSMO_GSUP_IK_IE,
713 len := ?,
714 val := {
715 ik := ik
716 }
717}
718
719template (value) GSUP_IE ts_GSUP_IE_IK(octetstring ik) := {
720 tag := OSMO_GSUP_IK_IE,
721 len := 0, /* overwritten */
722 val := {
723 ik := ik
724 }
725}
726
727template (present) GSUP_IE tr_GSUP_IE_CK(template (present) octetstring ck := ?) := {
728 tag := OSMO_GSUP_CK_IE,
729 len := ?,
730 val := {
731 ck := ck
732 }
733}
734
735template (value) GSUP_IE ts_GSUP_IE_CK(octetstring ck) := {
736 tag := OSMO_GSUP_CK_IE,
737 len := 0, /* overwritten */
738 val := {
739 ck := ck
740 }
741}
742
743template (present) GSUP_IE tr_GSUP_IE_AUTN(template (present) octetstring autn := ?) := {
744 tag := OSMO_GSUP_AUTN_IE,
745 len := ?,
746 val := {
747 autn := autn
748 }
749}
750
751template (value) GSUP_IE ts_GSUP_IE_AUTN(octetstring autn) := {
752 tag := OSMO_GSUP_AUTN_IE,
753 len := 0, /* overwritten */
754 val := {
755 autn := autn
756 }
757}
758
759template (present) GSUP_IE tr_GSUP_IE_RES(template (present) octetstring res := ?) := {
760 tag := OSMO_GSUP_RES_IE,
761 len := ?,
762 val := {
763 res := res
764 }
765}
766
767template (value) GSUP_IE ts_GSUP_IE_RES(octetstring res) := {
768 tag := OSMO_GSUP_RES_IE,
769 len := 0, /* overwritten */
770 val := {
771 res := res
772 }
773}
774
Pau Espin Pedrol7b7a1e82024-01-19 20:49:28 +0100775template (value) GSUP_IE ts_GSUP_IE_APN(template (value) octetstring apn) := {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +0100776 tag := OSMO_GSUP_ACCESS_POINT_NAME_IE,
777 len := 0, /* overwritten */
778 val := {
779 apn := apn
780 }
781}
782
783template GSUP_IE tr_GSUP_IE_APN(template octetstring apn) := {
784 tag := OSMO_GSUP_ACCESS_POINT_NAME_IE,
785 len := ?,
786 val := {
787 apn := apn
788 }
789}
790
791template GSUP_IE ts_GSUP_IE_CnDomain(template GSUP_CnDomain dom) := {
792 tag := OSMO_GSUP_CN_DOMAIN_IE,
793 len := 0, /* overwritten */
794 val := {
795 cn_domain := dom
796 }
797}
798
799template (value) GSUP_IE ts_GSUP_IE_SessionId(OCT4 sid) := {
800 tag := OSMO_GSUP_SESSION_ID_IE,
801 len := 0, /* overwritten */
802 val := {
803 session_id := sid
804 }
805}
806template GSUP_IE tr_GSUP_IE_SessionId(template OCT4 sid) := {
807 tag := OSMO_GSUP_SESSION_ID_IE,
808 len := ?,
809 val := {
810 session_id := sid
811 }
812}
813
814template (value) GSUP_IE ts_GSUP_IE_SessionState(GSUP_SessionState state) := {
815 tag := OSMO_GSUP_SESSION_STATE_IE,
816 len := 0, /* overwritten */
817 val := {
818 session_state := state
819 }
820}
821template GSUP_IE tr_GSUP_IE_SessionState(template GSUP_SessionState state) := {
822 tag := OSMO_GSUP_SESSION_STATE_IE,
823 len := ?,
824 val := {
825 session_state := state
826 }
827}
828
829template (value) GSUP_IE ts_GSUP_IE_SM_RP_MR(OCT1 ref) := {
830 tag := OSMO_GSUP_SM_RP_MR_IE,
831 len := 0, /* overwritten */
832 val := {
833 sm_rp_mr := ref
834 }
835}
836template GSUP_IE tr_GSUP_IE_SM_RP_MR(template OCT1 ref) := {
837 tag := OSMO_GSUP_SM_RP_MR_IE,
838 len := ?,
839 val := {
840 sm_rp_mr := ref
841 }
842}
843
844template (value) GSUP_IE ts_GSUP_IE_SM_RP_CAUSE(OCT1 cause) := {
845 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
846 len := 0, /* overwritten */
847 val := {
848 sm_rp_cause := cause
849 }
850}
851template GSUP_IE tr_GSUP_IE_SM_RP_CAUSE(template OCT1 cause) := {
852 tag := OSMO_GSUP_SM_RP_CAUSE_IE,
853 len := ?,
854 val := {
855 sm_rp_cause := cause
856 }
857}
858
859template (value) GSUP_IE ts_GSUP_IE_SM_RP_MMS(OCT1 mms) := {
860 tag := OSMO_GSUP_SM_RP_MMS_IE,
861 len := 0, /* overwritten */
862 val := {
863 sm_rp_mms := mms
864 }
865}
866template GSUP_IE tr_GSUP_IE_SM_RP_MMS(template OCT1 mms) := {
867 tag := OSMO_GSUP_SM_RP_MMS_IE,
868 len := ?,
869 val := {
870 sm_rp_mms := mms
871 }
872}
873
874template (value) GSUP_IE ts_GSUP_IE_IMEI(hexstring imei) := {
875 tag := OSMO_GSUP_IMEI_IE,
876 len := 0, /* overwritten */
877 val := {
878 imei := ts_GSUP_IMEI(imei)
879 }
880}
881template GSUP_IE tr_GSUP_IE_IMEI(template hexstring imei) := {
882 tag := OSMO_GSUP_IMEI_IE,
883 len := ?,
884 val := {
885 imei := tr_GSUP_IMEI(imei)
886 }
887}
888
889template (value) GSUP_IE ts_GSUP_IE_IMEI_Result(GSUP_IMEIResult result) := {
890 tag := OSMO_GSUP_IMEI_RESULT_IE,
891 len := 0, /* overwritten */
892 val := {
893 imei_result := result
894 }
895}
896template GSUP_IE tr_GSUP_IE_IMEI_Result(template GSUP_IMEIResult result) := {
897 tag := OSMO_GSUP_IMEI_RESULT_IE,
898 len := ?,
899 val := {
900 imei_result := result
901 }
902}
903
904template (value) GSUP_IE ts_GSUP_IE_NUM_VECTORS_REQ(OCT1 num) := {
905 tag := OSMO_GSUP_NUM_VECTORS_REQ_IE,
906 len := 0, /* overwritten */
907 val := {
908 num_auth_vectors := num
909 }
910}
911template GSUP_IE tr_GSUP_IE_NUM_VECTORS_REQ(template OCT1 num) := {
912 tag := OSMO_GSUP_NUM_VECTORS_REQ_IE,
913 len := ?,
914 val := {
915 num_auth_vectors := num
916 }
917}
918
919/* See 3GPP TS 24.011, figures 8.5 and 8.6 */
920private function f_pad_SM_RP_Addr(template hexstring number)
921return template hexstring {
922 if (isvalue(number) and not istemplatekind(number, "omit")) {
923 return f_pad_bcd_number(valueof(number));
924 } else {
925 return number;
926 }
927}
928
929template GSUP_SM_RP_Addr t_GSUP_SM_RP_Addr(template hexstring number,
930 template BIT4 npi := '0001'B,
931 template BIT3 ton := '001'B,
932 template BIT1 ext := '1'B) := {
933 ext := ext,
934 ton := ton,
935 npi := npi,
936 /* Work around TITAN's padding problems: encoding works fine,
937 * but it does not consider 'F'H as padding in decoded data. */
938 number := f_pad_SM_RP_Addr(number)
939}
940
941/**
942 * SM-RP-DA represents the SM Destination Address, see 7.6.8.1.
943 * It can be either of the following:
944 * - IMSI
945 * - LMSI (not implemented)
946 * - MSISDN
947 * - roaming number (not implemented)
948 * - service centre address
949 */
950template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_IMSI(hexstring imsi) := {
951 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
952 id_enc := { imsi := imsi }
953}
954template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_IMSI(template hexstring imsi) := {
955 id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI,
956 id_enc := { imsi := imsi }
957}
958
959template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_MSISDN(GSUP_SM_RP_Addr msisdn) := {
960 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
961 id_enc := { msisdn := msisdn }
962}
963template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_MSISDN(template GSUP_SM_RP_Addr msisdn) := {
964 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
965 id_enc := { msisdn := msisdn }
966}
967
968template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_SMSC_ADDR(GSUP_SM_RP_Addr smsc_addr) := {
969 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
970 id_enc := { smsc_addr := smsc_addr }
971}
972template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_SMSC_ADDR(template GSUP_SM_RP_Addr smsc_addr) := {
973 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
974 id_enc := { smsc_addr := smsc_addr }
975}
976
977template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_NULL := {
978 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
979 id_enc := omit
980}
981template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_NULL := {
982 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
983 id_enc := omit
984}
985
986template (value) GSUP_IE ts_GSUP_IE_SM_RP_DA(GSUP_SM_RP_DA val) := {
987 tag := OSMO_GSUP_SM_RP_DA_IE,
988 len := 0, /* overwritten */
989 val := {
990 sm_rp_da := val
991 }
992}
993template GSUP_IE tr_GSUP_IE_SM_RP_DA(template GSUP_SM_RP_DA val) := {
994 tag := OSMO_GSUP_SM_RP_DA_IE,
995 len := ?,
996 val := {
997 sm_rp_da := val
998 }
999}
1000
1001/**
1002 * SM-RP-OA represents the SM Originating Address, see 7.6.8.2.
1003 * It can be either of the following:
1004 * - MSISDN
1005 * - service centre address
1006 */
1007template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_MSISDN(GSUP_SM_RP_Addr msisdn) := {
1008 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
1009 id_enc := { msisdn := msisdn }
1010}
1011template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_MSISDN(template GSUP_SM_RP_Addr msisdn) := {
1012 id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN,
1013 id_enc := { msisdn := msisdn }
1014}
1015
1016template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_SMSC_ADDR(GSUP_SM_RP_Addr smsc_addr) := {
1017 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
1018 id_enc := { smsc_addr := smsc_addr }
1019}
1020template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_SMSC_ADDR(template GSUP_SM_RP_Addr smsc_addr) := {
1021 id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR,
1022 id_enc := { smsc_addr := smsc_addr }
1023}
1024
1025template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_NULL := {
1026 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
1027 id_enc := omit
1028}
1029template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_NULL := {
1030 id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL,
1031 id_enc := omit
1032}
1033
1034template (value) GSUP_IE ts_GSUP_IE_SM_RP_OA(GSUP_SM_RP_OA val) := {
1035 tag := OSMO_GSUP_SM_RP_OA_IE,
1036 len := 0, /* overwritten */
1037 val := {
1038 sm_rp_oa := val
1039 }
1040}
1041template GSUP_IE tr_GSUP_IE_SM_RP_OA(template GSUP_SM_RP_OA val) := {
1042 tag := OSMO_GSUP_SM_RP_OA_IE,
1043 len := ?,
1044 val := {
1045 sm_rp_oa := val
1046 }
1047}
1048
1049/* SM-RP-UI represents the SM TPDU, see 7.6.8.4 */
1050template (value) GSUP_IE ts_GSUP_IE_SM_RP_UI(octetstring val) := {
1051 tag := OSMO_GSUP_SM_RP_UI_IE,
1052 len := 0, /* overwritten */
1053 val := {
1054 sm_rp_ui := val
1055 }
1056}
1057template GSUP_IE tr_GSUP_IE_SM_RP_UI(template octetstring val) := {
1058 tag := OSMO_GSUP_SM_RP_UI_IE,
1059 len := ?,
1060 val := {
1061 sm_rp_ui := val
1062 }
1063}
1064
1065/* SM Alert Reason IE (used in READY-FOR-SM), see 7.6.8.8 */
1066template (value) GSUP_IE ts_GSUP_IE_SM_ALERT_RSN(GSUP_SM_ALERT_RSN_Type rsn) := {
1067 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
1068 len := 0, /* overwritten */
1069 val := {
1070 sm_alert_rsn := rsn
1071 }
1072}
1073template GSUP_IE tr_GSUP_IE_SM_ALERT_RSN(template GSUP_SM_ALERT_RSN_Type rsn) := {
1074 tag := OSMO_GSUP_SM_ALERT_RSN_IE,
1075 len := ?,
1076 val := {
1077 sm_alert_rsn := rsn
1078 }
1079}
1080
1081template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := {
1082 tag := OSMO_GSUP_SS_INFO_IE,
1083 len := 0, /* overwritten */
1084 val := {
1085 ss_info := ss
1086 }
1087}
1088template GSUP_IE tr_GSUP_IE_SSInfo(template octetstring ss) := {
1089 tag := OSMO_GSUP_SS_INFO_IE,
1090 len := ?,
1091 val := {
1092 ss_info := ss
1093 }
1094}
1095
1096template GSUP_IE tr_GSUP_IE_Message_Class(template GSUP_Message_Class val) := {
1097 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1098 len := ?,
1099 val := {
1100 message_class := val
1101 }
1102}
1103
1104template (value) GSUP_IE ts_GSUP_IE_Message_Class(GSUP_Message_Class val) := {
1105 tag := OSMO_GSUP_MESSAGE_CLASS_IE,
1106 len := 0, /* overwritten */
1107 val := {
1108 message_class := val
1109 }
1110}
1111
1112template GSUP_IE tr_GSUP_IE_Source_Name(template octetstring name) := {
1113 tag := OSMO_GSUP_SOURCE_NAME_IE,
1114 len := ?,
1115 val := {
1116 source_name := name
1117 }
1118}
1119
1120template (value) GSUP_IE ts_GSUP_IE_Source_Name(octetstring name) := {
1121 tag := OSMO_GSUP_SOURCE_NAME_IE,
1122 len := 0, /* overwritten */
1123 val := {
1124 source_name := name
1125 }
1126}
1127
1128template GSUP_IE tr_GSUP_IE_Destination_Name(template octetstring name) := {
1129 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1130 len := ?,
1131 val := {
1132 destination_name := name
1133 }
1134}
1135
1136template (value) GSUP_IE ts_GSUP_IE_Destination_Name(octetstring name) := {
1137 tag := OSMO_GSUP_DESTINATION_NAME_IE,
1138 len := 0, /* overwritten */
1139 val := {
1140 destination_name := name
1141 }
1142}
1143
1144template GSUP_IE tr_GSUP_IE_AN_APDU(template GSUP_AN_APDU an_apdu) := {
1145 tag := OSMO_GSUP_AN_APDU_IE,
1146 len := ?,
1147 val := {
1148 an_apdu := an_apdu
1149 }
1150}
1151
1152template (value) GSUP_IE ts_GSUP_IE_AN_APDU(GSUP_AN_APDU an_apdu) := {
1153 tag := OSMO_GSUP_AN_APDU_IE,
1154 len := 0, /* overwritten */
1155 val := {
1156 an_apdu := an_apdu
1157 }
1158}
1159
1160template (present) GSUP_IE tr_GSUP_IE_SUPPORTED_RAT_TYPES(template (present) GSUP_RatTypes ratt) := {
1161 tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE,
1162 len := ?,
1163 val := {
1164 supported_rat_types := ratt
1165 }
1166}
1167template (value) GSUP_IE ts_GSUP_IE_SUPPORTED_RAT_TYPES(GSUP_RatTypes ratt) := {
1168 tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE,
1169 len := 0, /* overwritten */
1170 val := {
1171 supported_rat_types := ratt
1172 }
1173}
1174
1175template (present) GSUP_IE tr_GSUP_IE_CURRENT_RAT_TYPE(template (present) GSUP_RatType ratt) := {
1176 tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE,
1177 len := ?,
1178 val := {
1179 current_rat_type := ratt
1180 }
1181}
1182template (value) GSUP_IE ts_GSUP_IE_CURRENT_RAT_TYPE(GSUP_RatType ratt) := {
1183 tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE,
1184 len := 0, /* overwritten */
1185 val := {
1186 current_rat_type := ratt
1187 }
1188}
1189
1190private function f_gen_ts_ies(hexstring imsi,
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001191 template (omit) boolean pdp_info_compl := omit,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001192 template (omit) GSUP_Message_Class message_class := omit,
1193 template (omit) hexstring imei := omit,
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +01001194 template (omit) PCO_DATA pco := omit,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001195 template (omit) GSUP_CnDomain dom := omit,
1196 template (omit) octetstring source_name := omit,
1197 template (omit) octetstring destination_name := omit
1198 ) return GSUP_IEs {
1199 var GSUP_IEs ies := {
1200 valueof(ts_GSUP_IE_IMSI(imsi))
1201 };
1202
1203 if (isvalue(dom)) {
1204 ies := ies & { valueof(ts_GSUP_IE_CnDomain(dom)) };
1205 }
1206
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001207 if (isvalue(pdp_info_compl) and valueof(pdp_info_compl)) {
1208 ies := ies & { valueof(ts_GSUP_IE_PdpInfoCompl) };
1209 }
1210
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001211 if (isvalue(imei)) {
1212 ies := ies & { valueof(ts_GSUP_IE_IMEI(valueof(imei))) };
1213 }
1214
Pau Espin Pedrolce1d3cb2024-02-21 17:40:59 +01001215 if (isvalue(pco)) {
1216 ies := ies & { valueof(ts_GSUP_IE_PCO(valueof(pco))) };
1217 }
1218
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001219 if (isvalue(message_class)) {
1220 ies := ies & { valueof(ts_GSUP_IE_Message_Class(valueof(message_class))) };
1221 }
1222
1223 if (isvalue(source_name)) {
1224 ies := ies & { valueof(ts_GSUP_IE_Source_Name(valueof(source_name))) };
1225 }
1226
1227 if (isvalue(destination_name)) {
1228 ies := ies & { valueof(ts_GSUP_IE_Destination_Name(valueof(destination_name))) };
1229 }
1230
1231 return ies;
1232}
1233
1234private function f_gen_tr_ies(template hexstring imsi,
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001235 template boolean pdp_info_compl := omit,
1236 template GSUP_IEs pdp_info := omit,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001237 template GSUP_Message_Class message_class := omit,
1238 template integer cause := omit,
Pau Espin Pedrolcbe6eba2024-02-06 12:53:14 +01001239 template GSUP_CancelType cancel_type := omit,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001240 template hexstring msisdn := omit,
1241 template GSUP_IMEIResult imei_result := omit,
Pau Espin Pedrolf2925862024-02-22 20:12:30 +01001242 template PCO_DATA pco := omit,
Pau Espin Pedrolcbe6eba2024-02-06 12:53:14 +01001243 template GSUP_CnDomain cn_domain := omit,
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001244 template octetstring source_name := omit,
1245 template octetstring destination_name := omit
1246 ) return template GSUP_IEs {
1247 var template GSUP_IEs ies := {
1248 tr_GSUP_IE_IMSI(imsi)
1249 };
1250 var integer idx := 1;
1251
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001252 if (not istemplatekind(msisdn, "omit")) {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001253 ies[idx] := tr_GSUP_IE_MSISDN(msisdn);
1254 idx := idx + 1;
1255 }
1256
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001257 if (not istemplatekind(cause, "omit")) {
1258 ies[idx] := tr_GSUP_IE_Cause(cause);
1259 idx := idx + 1;
1260 }
1261
Pau Espin Pedrolcbe6eba2024-02-06 12:53:14 +01001262 if (not istemplatekind(cancel_type, "omit")) {
1263 ies[idx] := tr_GSUP_IE_CancelType(cancel_type);
1264 idx := idx + 1;
1265 }
1266
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001267 if (not istemplatekind(pdp_info_compl, "omit")) {
1268 ies[idx] := tr_GSUP_IE_PdpInfoCompl;
1269 idx := idx + 1;
1270 }
1271
1272 if (not istemplatekind(pdp_info, "omit")) {
1273 ies[idx] := tr_GSUP_IE_PdpInfo_ie(pdp_info);
1274 idx := idx + 1;
1275 }
1276
Pau Espin Pedrolcbe6eba2024-02-06 12:53:14 +01001277 if (not istemplatekind(cn_domain, "omit")) {
1278 ies[idx] := tr_GSUP_IE_CnDomain(cn_domain);
1279 idx := idx + 1;
1280 }
1281
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001282 if (not istemplatekind(imei_result, "omit")) {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001283 ies[idx] := tr_GSUP_IE_IMEI_Result(imei_result);
1284 idx := idx + 1;
1285 }
1286
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001287 if (not istemplatekind(message_class, "omit")) {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001288 ies[idx] := tr_GSUP_IE_Message_Class(message_class);
1289 idx := idx + 1;
1290 }
1291
Pau Espin Pedrolf2925862024-02-22 20:12:30 +01001292 if (not istemplatekind(pco, "omit")) {
1293 ies[idx] := tr_GSUP_IE_PCO(pco);
1294 idx := idx + 1;
1295 }
1296
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001297 if (not istemplatekind(source_name, "omit")) {
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001298 ies[idx] := tr_GSUP_IE_Source_Name(source_name);
1299 idx := idx + 1;
1300 }
1301
1302 ies[idx] := *;
1303 idx := idx + 1;
1304
Pau Espin Pedrola6b0c1c2024-01-22 20:02:06 +01001305 if (not istemplatekind(destination_name, "omit")) {
1306 if (istemplatekind(destination_name, "*")) {
1307 ies[idx] := *;
1308 } else {
1309 ies[idx] := tr_GSUP_IE_Destination_Name(destination_name);
1310 }
Pau Espin Pedrol8f1403a2024-01-18 20:08:43 +01001311 idx := idx + 1;
1312 }
1313
1314 return ies;
1315}
1316
1317private function f_gen_ts_ss_ies(
1318 hexstring imsi,
1319 OCT4 sid,
1320 GSUP_SessionState state,
1321 template (omit) octetstring ss := omit,
1322 template (omit) integer cause := omit,
1323 template octetstring source_name := omit
1324) return GSUP_IEs {
1325 /* Mandatory IEs */
1326 var GSUP_IEs ies := {
1327 valueof(ts_GSUP_IE_IMSI(imsi))
1328 };
1329
1330 /* Cause IE is needed for PROC_SS_ERR */
1331 if (isvalue(cause)) {
1332 ies := ies & { valueof(ts_GSUP_IE_Cause(valueof(cause))) };
1333 }
1334
1335 /* Mandatory session IEs */
1336 ies := ies & { valueof(ts_GSUP_IE_SessionId(sid)) };
1337 ies := ies & { valueof(ts_GSUP_IE_SessionState(state)) };
1338
1339 /* Optional SS payload */
1340 if (isvalue(ss)) {
1341 ies := ies & { valueof(ts_GSUP_IE_SSInfo(valueof(ss))) };
1342 }
1343
1344 if (isvalue(source_name)) {
1345 ies := ies & { valueof(ts_GSUP_IE_Source_Name(valueof(source_name))) };
1346 }
1347
1348 return ies;
1349}
1350private function f_gen_tr_ss_ies(
1351 template hexstring imsi,
1352 template OCT4 sid := ?,
1353 template GSUP_SessionState state := ?,
1354 template octetstring ss := omit,
1355 template integer cause := omit,
1356 template octetstring destination_name := omit
1357) return template GSUP_IEs {
1358 /* Mandatory IEs */
1359 var template GSUP_IEs ies := {
1360 tr_GSUP_IE_IMSI(imsi)
1361 };
1362 var integer idx := 1;
1363
1364 /* Cause IE is needed for PROC_SS_ERR */
1365 if (istemplatekind(cause, "*")) {
1366 ies[idx] := *;
1367 idx := idx + 1;
1368 } else if (not istemplatekind(cause, "omit")) {
1369 ies[idx] := tr_GSUP_IE_Cause(cause);
1370 idx := idx + 1;
1371 }
1372
1373 /* Mandatory session IEs */
1374 ies[idx] := tr_GSUP_IE_SessionId(sid);
1375 ies[idx + 1] := tr_GSUP_IE_SessionState(state);
1376 idx := idx + 2;
1377
1378 /* Optional SS payload */
1379 if (istemplatekind(ss, "*")) {
1380 ies[idx] := *;
1381 idx := idx + 1;
1382 } else if (not istemplatekind(ss, "omit")) {
1383 ies[idx] := tr_GSUP_IE_SSInfo(ss);
1384 idx := idx + 1;
1385 }
1386
1387 if (isvalue(destination_name)) {
1388 ies[idx] := tr_GSUP_IE_Destination_Name(destination_name);
1389 idx := idx + 1;
1390 }
1391
1392 /* the GSUP Message Class IE is optional, as old implementations don't have it yet */
1393 var template GSUP_IEs ies2 := ies;
1394 ies2[idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD);
1395 idx := idx + 1;
1396
1397 return (ies, ies2);
1398}
1399
1400template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ(
1401 hexstring imsi,
1402 OCT4 sid,
1403 GSUP_SessionState state,
1404 template (omit) octetstring ss := omit,
1405 template (omit) octetstring source_name := omit
1406) := ts_GSUP(
1407 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
1408 f_gen_ts_ss_ies(imsi, sid, state, ss, source_name := source_name)
1409);
1410template GSUP_PDU tr_GSUP_PROC_SS_REQ(
1411 template hexstring imsi,
1412 template OCT4 sid := ?,
1413 template GSUP_SessionState state := ?,
1414 template octetstring ss := *
1415) := tr_GSUP(
1416 OSMO_GSUP_MSGT_PROC_SS_REQUEST,
1417 f_gen_tr_ss_ies(imsi, sid, state, ss)
1418);
1419
1420template (value) GSUP_PDU ts_GSUP_PROC_SS_RES(
1421 hexstring imsi,
1422 OCT4 sid,
1423 GSUP_SessionState state,
1424 template (omit) octetstring ss := omit
1425) := ts_GSUP(
1426 OSMO_GSUP_MSGT_PROC_SS_RESULT,
1427 f_gen_ts_ss_ies(imsi, sid, state, ss)
1428);
1429template GSUP_PDU tr_GSUP_PROC_SS_RES(
1430 template hexstring imsi,
1431 template OCT4 sid := ?,
1432 template GSUP_SessionState state := ?,
1433 template octetstring ss := *,
1434 template octetstring destination_name := omit
1435) := tr_GSUP(
1436 OSMO_GSUP_MSGT_PROC_SS_RESULT,
1437 f_gen_tr_ss_ies(imsi, sid, state, ss, destination_name := destination_name)
1438);
1439
1440template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR(
1441 hexstring imsi,
1442 OCT4 sid,
1443 GSUP_SessionState state,
1444 integer cause
1445) := ts_GSUP(
1446 OSMO_GSUP_MSGT_PROC_SS_ERROR,
1447 f_gen_ts_ss_ies(imsi, sid, state, cause := cause)
1448);
1449template GSUP_PDU tr_GSUP_PROC_SS_ERR(
1450 template hexstring imsi,
1451 template OCT4 sid := ?,
1452 template GSUP_SessionState state := ?,
1453 template integer cause := ?
1454) := tr_GSUP(
1455 OSMO_GSUP_MSGT_PROC_SS_ERROR,
1456 f_gen_tr_ss_ies(imsi, sid, state, cause := cause)
1457);
1458
1459template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_REQ(
1460 hexstring imsi,
1461 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1462 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1463 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1464 octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1465) := ts_GSUP(
1466 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1467 {
1468 valueof(ts_GSUP_IE_IMSI(imsi)),
1469 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1470 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1471 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1472 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)),
1473 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS))
1474 }
1475);
1476template GSUP_PDU tr_GSUP_MO_FORWARD_SM_REQ(
1477 template hexstring imsi := ?,
1478 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1479 template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1480 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1481 template octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */
1482) := tr_GSUP(
1483 OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST,
1484 {
1485 tr_GSUP_IE_IMSI(imsi),
1486 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1487 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1488 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
1489 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
1490 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS),
1491 tr_GSUP_IE_Source_Name(?)
1492 }
1493);
1494
1495template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_RES(
1496 hexstring imsi,
1497 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1498) := ts_GSUP(
1499 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1500 {
1501 valueof(ts_GSUP_IE_IMSI(imsi)),
1502 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1503 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS))
1504 }
1505);
1506template GSUP_PDU tr_GSUP_MO_FORWARD_SM_RES(
1507 template hexstring imsi := ?,
1508 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1509) := tr_GSUP(
1510 OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT,
1511 {
1512 tr_GSUP_IE_IMSI(imsi),
1513 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1514 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS),
1515 tr_GSUP_IE_Source_Name(?)
1516 }
1517);
1518
1519template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_ERR(
1520 hexstring imsi,
1521 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1522 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1523) := ts_GSUP(
1524 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1525 {
1526 valueof(ts_GSUP_IE_IMSI(imsi)),
1527 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1528 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)),
1529 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS))
1530 }
1531);
1532template GSUP_PDU tr_GSUP_MO_FORWARD_SM_ERR(
1533 template hexstring imsi := ?,
1534 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1535 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1536) := tr_GSUP(
1537 OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR,
1538 {
1539 tr_GSUP_IE_IMSI(imsi),
1540 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1541 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1542 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS),
1543 tr_GSUP_IE_Source_Name(?)
1544 }
1545);
1546
1547template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_REQ(
1548 hexstring imsi,
1549 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1550 GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1551 GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1552 octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1553 OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1554) := ts_GSUP(
1555 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1556 {
1557 /**
1558 * TODO: add MT-specific fields (and IEs):
1559 * - smDeliveryTimer
1560 * - smDeliveryStartTime
1561 */
1562 valueof(ts_GSUP_IE_IMSI(imsi)),
1563 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1564 valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)),
1565 valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)),
1566 valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)),
1567 valueof(ts_GSUP_IE_SM_RP_MMS(sm_rp_mms)),
1568 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS))
1569 }
1570);
1571template GSUP_PDU tr_GSUP_MT_FORWARD_SM_REQ(
1572 template hexstring imsi := ?,
1573 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1574 template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */
1575 template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */
1576 template octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */
1577 template OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */
1578) := tr_GSUP(
1579 OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST,
1580 {
1581 /**
1582 * TODO: add MT-specific fields (and IEs):
1583 * - smDeliveryTimer
1584 * - smDeliveryStartTime
1585 */
1586 tr_GSUP_IE_IMSI(imsi),
1587 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1588 tr_GSUP_IE_SM_RP_DA(sm_rp_da),
1589 tr_GSUP_IE_SM_RP_OA(sm_rp_oa),
1590 tr_GSUP_IE_SM_RP_UI(sm_rp_ui),
1591 tr_GSUP_IE_SM_RP_MMS(sm_rp_mms),
1592 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS),
1593 tr_GSUP_IE_Source_Name(?)
1594 }
1595);
1596
1597template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_RES(
1598 hexstring imsi,
1599 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1600) := ts_GSUP(
1601 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1602 {
1603 valueof(ts_GSUP_IE_IMSI(imsi)),
1604 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1605 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS))
1606 }
1607);
1608template GSUP_PDU tr_GSUP_MT_FORWARD_SM_RES(
1609 template hexstring imsi := ?,
1610 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1611) := tr_GSUP(
1612 OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT,
1613 {
1614 tr_GSUP_IE_IMSI(imsi),
1615 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1616 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS),
1617 tr_GSUP_IE_Source_Name(?)
1618 }
1619);
1620
1621template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_ERR(
1622 hexstring imsi,
1623 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1624 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1625) := ts_GSUP(
1626 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1627 {
1628 valueof(ts_GSUP_IE_IMSI(imsi)),
1629 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1630 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)),
1631 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS))
1632 }
1633);
1634template GSUP_PDU tr_GSUP_MT_FORWARD_SM_ERR(
1635 template hexstring imsi := ?,
1636 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1637 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1638) := tr_GSUP(
1639 OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR,
1640 {
1641 tr_GSUP_IE_IMSI(imsi),
1642 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1643 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1644 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS),
1645 tr_GSUP_IE_Source_Name(?)
1646 }
1647);
1648
1649template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_REQ(
1650 hexstring imsi,
1651 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1652 GSUP_SM_ALERT_RSN_Type sm_alert_rsn /* SM Alert Reason, see 7.6.8.8 */
1653) := ts_GSUP(
1654 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1655 {
1656 valueof(ts_GSUP_IE_IMSI(imsi)),
1657 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1658 valueof(ts_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn)),
1659 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS))
1660 }
1661);
1662template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_REQ(
1663 template hexstring imsi := ?,
1664 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1665 template GSUP_SM_ALERT_RSN_Type sm_alert_rsn := ? /* SM Alert Reason, see 7.6.8.8 */
1666) := tr_GSUP(
1667 OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST,
1668 {
1669 tr_GSUP_IE_IMSI(imsi),
1670 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1671 tr_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn),
1672 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS),
1673 tr_GSUP_IE_Source_Name(?)
1674 }
1675);
1676
1677template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_RES(
1678 hexstring imsi,
1679 OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */
1680) := ts_GSUP(
1681 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1682 {
1683 valueof(ts_GSUP_IE_IMSI(imsi)),
1684 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1685 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS))
1686 }
1687);
1688template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_RES(
1689 template hexstring imsi := ?,
1690 template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */
1691) := tr_GSUP(
1692 OSMO_GSUP_MSGT_READY_FOR_SM_RESULT,
1693 {
1694 tr_GSUP_IE_IMSI(imsi),
1695 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1696 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS),
1697 tr_GSUP_IE_Source_Name(?)
1698 }
1699);
1700
1701template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_ERR(
1702 hexstring imsi,
1703 OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1704 OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1705) := ts_GSUP(
1706 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1707 {
1708 valueof(ts_GSUP_IE_IMSI(imsi)),
1709 valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)),
1710 valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)),
1711 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS))
1712 }
1713);
1714template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_ERR(
1715 template hexstring imsi := ?,
1716 template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */
1717 template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */
1718) := tr_GSUP(
1719 OSMO_GSUP_MSGT_READY_FOR_SM_ERROR,
1720 {
1721 tr_GSUP_IE_IMSI(imsi),
1722 tr_GSUP_IE_SM_RP_MR(sm_rp_mr),
1723 tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause),
1724 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS),
1725 tr_GSUP_IE_Source_Name(?)
1726 }
1727);
1728
1729function f_gsup_find_nested_ie_multiple(GSUP_IEs ies, GSUP_IEI iei, integer nth, out GSUP_IeValue ret) return boolean {
1730 var integer current := 0;
1731 for (var integer i := 0; i < sizeof(ies); i := i+1) {
1732 if (ies[i].tag == iei) {
1733 if (current == nth) {
1734 ret := ies[i].val;
1735 return true;
1736 } else {
1737 current := current + 1;
1738 }
1739 }
1740 }
1741 return false;
1742}
1743
1744function f_gsup_find_nested_ie(GSUP_IEs ies, GSUP_IEI iei, out GSUP_IeValue ret) return boolean {
1745 for (var integer i := 0; i < sizeof(ies); i := i+1) {
1746 if (ies[i].tag == iei) {
1747 ret := ies[i].val;
1748 return true;
1749 }
1750 }
1751 return false;
1752}
1753
1754function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) return boolean {
1755 return f_gsup_find_nested_ie(msg.ies, iei, ret);
1756}
1757
1758template GSUP_AN_APDU t_GSUP_AN_APDU(
1759 template GSUP_AN_PROTO an_proto := ?,
1760 template octetstring pdu := ?
1761) := {
1762 proto := an_proto,
1763 pdu := pdu
1764};
1765
1766template GSUP_PDU tr_GSUP_E_AN_APDU(
1767 template GSUP_MessageType msgt,
1768 template hexstring imsi := ?,
1769 template octetstring source_name := ?,
1770 template octetstring destination_name := ?,
1771 template GSUP_AN_APDU an_apdu := ?
1772) := tr_GSUP(
1773 msgt,
1774 {
1775 tr_GSUP_IE_IMSI(imsi),
1776 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1777 tr_GSUP_IE_Source_Name(source_name),
1778 tr_GSUP_IE_Destination_Name(destination_name),
1779 tr_GSUP_IE_AN_APDU(an_apdu)
1780 }
1781);
1782
1783template GSUP_PDU tr_GSUP_E_NO_PDU(
1784 template GSUP_MessageType msgt,
1785 template hexstring imsi := ?,
1786 template octetstring source_name := ?,
1787 template octetstring destination_name := ?
1788) := tr_GSUP(
1789 msgt,
1790 {
1791 tr_GSUP_IE_IMSI(imsi),
1792 tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC),
1793 tr_GSUP_IE_Source_Name(source_name),
1794 tr_GSUP_IE_Destination_Name(destination_name)
1795 }
1796);
1797
1798template (value) GSUP_PDU ts_GSUP_E_AN_APDU(
1799 GSUP_MessageType msgt,
1800 hexstring imsi,
1801 octetstring source_name,
1802 octetstring destination_name,
1803 GSUP_AN_APDU an_apdu
1804) := ts_GSUP(
1805 msgt,
1806 {
1807 valueof(ts_GSUP_IE_IMSI(imsi)),
1808 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1809 valueof(ts_GSUP_IE_Source_Name(source_name)),
1810 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1811 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1812 }
1813);
1814
1815template (value) GSUP_PDU ts_GSUP_E_PrepareHandoverResult(
1816 hexstring imsi,
1817 hexstring msisdn,
1818 octetstring source_name,
1819 octetstring destination_name,
1820 GSUP_AN_APDU an_apdu
1821) := ts_GSUP(
1822 OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT,
1823 {
1824 valueof(ts_GSUP_IE_IMSI(imsi)),
1825 valueof(ts_GSUP_IE_MSISDN(msisdn)),
1826 valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)),
1827 valueof(ts_GSUP_IE_Source_Name(source_name)),
1828 valueof(ts_GSUP_IE_Destination_Name(destination_name)),
1829 valueof(ts_GSUP_IE_AN_APDU(an_apdu))
1830 }
1831);
1832
1833} with { encode "RAW"; variant "FIELDORDER(msb)" }