blob: 2eb1d7eaf99c1072be0a30097092d0dc9d1fe5eb [file] [log] [blame]
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001/* GTPv1-C Templates in TTCN-3
Harald Welte34b5a952019-05-27 11:54:11 +02002 * (C) 2018 Harald Welte <laforge@gnumonks.org>
3 * contributions by sysmocom - s.f.m.c. GmbH
4 * All rights reserved.
5 *
6 * Released under the terms of GNU General Public License, Version 2 or
7 * (at your option) any later version.
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +010012module GTPv1C_Templates {
Harald Weltec69cf4e2018-02-17 20:57:02 +010013
14 import from General_Types all;
15 import from Osmocom_Types all;
16 import from GTPC_Types all;
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +010017 import from GTPv1C_CodecPort all;
Harald Weltec69cf4e2018-02-17 20:57:02 +010018 import from IPCP_Types all;
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +010019 import from GSM_Types all; // RoutingAreaIdentification, CellIdentity
20
Pau Espin Pedrolbbff8b72024-01-15 18:45:35 +010021 template (present) OCT1 gtp1_requests := (
22 '10'O, /* createPDPContextRequest */
23 '12'O, /* updatePDPContextRequest */
24 '14'O, /* */
25 '16'O, /* deletePDPContextRequest */
26 '1B'O, /* pdu_NotificationRequest */
27 '1D'O, /* pdu_NotificationRejectRequest */
28 '1F'O, /* supportedExtensionHeadersNotification */
29 '20'O, /* sendRouteingInformationForGPRSRequest */
30 '22'O, /* failureReportRequest */
31 '24'O, /* noteMS_GPRSPresentRequest */
32 '30'O, /* identificationRequest */
33 '32'O, /* sgsn_ContextRequest */
34 '35'O, /* forwardRelocationRequest */
35 '38'O, /* relocationCancelRequest */
36 '3A'O, /* forwardSRNSContext */
37 '3D'O, /* uERegistrationQueryRequest */
38 '46'O, /* ranInformationRelay */
39 '60'O, /* mBMSNotificationRequest */
40 '62'O, /* mBMSNotificationRejectRequest */
41 '64'O, /* createMBMSContextRequest */
42 '66'O, /* updateMBMSContextRequest */
43 '68'O, /* deleteMBMSContextRequest */
44 '70'O, /* mBMSRegistrationRequest */
45 '72'O, /* mBMSDeRegistrationRequest */
46 '74'O, /* mBMSSessionStartRequest */
47 '76'O, /* mBMSSessionStopRequest */
48 '78'O, /* mBMSSessionUpdateRequest */
49 '80'O /* mS_InfoChangeNotificationRequest */
50 );
51
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +010052 type record GTP_CellId {
53 RoutingAreaIdentification ra_id,
54 CellIdentity cell_id
55 } with { encode "RAW" };
56
57 template (value) GTP_CellId ts_GTP_CellId(template (value) RoutingAreaIdentification rai, CellIdentity cell_id) := {
58 ra_id := rai,
59 cell_id := cell_id
60 };
Harald Weltec69cf4e2018-02-17 20:57:02 +010061
Harald Welte3b4c3562018-03-01 10:01:58 +010062 /* Table 38 of 3GPP TS 29.060 */
63 type enumerated GTP_Cause {
64 GTP_CAUSE_REQUEST_IMEI (1),
65 GTP_CAUSE_REQUEST_IMSI_AND_IMEI (2),
66 GTP_CAUSE_NO_IDENTITY_NEDED (3),
67 GTP_CAUSE_MS_REFUSES (4),
68 GTP_CAUSE_MS_IS_NOT_GPRS_RESPONDING (5),
69 /* reserved */
Vadim Yanitskiyacd0b392024-04-06 05:38:35 +070070 GTP_CAUSE_REQUEST_ACCEPTED (128),
71 GTP_CAUSE_INVALID_MSG_FORMAT (193)
Harald Welte3b4c3562018-03-01 10:01:58 +010072 /* FIXME */
73 };
74
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +010075 template (value) Cause_gtpc ts_Cause_gtpc(template (value) GTP_Cause cause) := {
76 type_gtpc := '01'O,
77 causevalue := enum2oct1_Cause_gtpc_tmpl(cause)
78 }
79 private function enum2oct1_Cause_gtpc_tmpl(template GTP_Cause inp) return template OCT1
80 {
81 if (istemplatekind(inp, "omit")) {
82 return omit;
83 } else if (istemplatekind(inp, "*")) {
84 return *;
85 } else if (istemplatekind(inp, "?")) {
86 return ?;
87 } else {
88 return int2oct(enum2int(valueof(inp)), 1);
89 }
90 }
91 template (present) Cause_gtpc tr_Cause_gtpc(template (present) GTP_Cause cause) := {
92 type_gtpc := '01'O,
93 causevalue := enum2oct1_Cause_gtpc_tmpl(cause)
94 }
95 function f_tr_Cause_gtpc(template GTP_Cause cause) return
96 template Cause_gtpc {
97 if (istemplatekind(cause, "omit")) {
98 return omit;
99 } else if (istemplatekind(cause, "*")) {
100 return *;
101 } else {
102 return tr_Cause_gtpc(cause);
103 }
104 }
105
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +0200106 private function f_oct_or_wc(template integer inp, integer len) return template octetstring {
107 if (istemplatekind(inp, "omit")) {
108 return omit;
109 } else if (istemplatekind(inp, "*")) {
110 return *;
111 } else if (istemplatekind(inp, "?")) {
112 return ?;
113 }
114 return int2oct(valueof(inp), len);
115 }
116
117 private function f_hex_or_wc(template integer inp, integer len) return template hexstring {
118 if (istemplatekind(inp, "omit")) {
119 return omit;
120 } else if (istemplatekind(inp, "*")) {
121 return *;
122 } else if (istemplatekind(inp, "?")) {
123 return ?;
124 }
125 return int2hex(valueof(inp), len);
126 }
127
Harald Weltec69cf4e2018-02-17 20:57:02 +0100128 /* generalized GTP-C receive template */
Philipp Maier57889492023-08-07 12:10:03 +0200129 template (present) PDU_GTPC tr_GTP1C_PDU(template (present) OCT1 msg_type, template (present) OCT4 teid, template (present) GTPC_PDUs pdu := ?) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100130 /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
131 * error if this flag is set to '1'. */
132 pn_bit := '0'B,
133 /* Sequence number flag (S) shall be set to '1'. */
134 s_bit := '1'B,
135 e_bit := ?,
136 spare := ?,
137 /* Protocol Type flag (PT) shall be set to '1'.*/
138 pt := '1'B,
139 /* Version shall be set to decimal 1 ('001'). */
140 version := '001'B,
141 messageType := msg_type,
142 lengthf := ?,
143 teid := teid,
144 opt_part := *,
145 gtpc_pdu := pdu
146 }
147
148 /* generalized GTP-C send template */
Philipp Maier57889492023-08-07 12:10:03 +0200149 template (value) PDU_GTPC ts_GTP1C_PDU(OCT1 msg_type, OCT4 teid, GTPC_PDUs pdu, uint16_t seq_nr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100150 /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
151 * error if this flag is set to '1'. */
152 pn_bit := '0'B,
153 /* Sequence number flag (S) shall be set to '1'. */
154 s_bit := '1'B,
155 e_bit := '0'B,
156 spare := '0'B,
157 /* Protocol Type flag (PT) shall be set to '1'.*/
158 pt := '1'B,
159 /* Version shall be set to decimal 1 ('001'). */
160 version := '001'B,
161 messageType := msg_type,
162 lengthf := 0, /* we assume encoder overwrites this */
163 teid := teid,
164 opt_part := {
165 sequenceNumber := int2oct(seq_nr, 2),
166 npduNumber := '00'O,
167 nextExtHeader := '00'O,
168 gTPC_extensionHeader_List := omit
169 },
170 gtpc_pdu := pdu
171 }
172
173 /* recovery IE */
Philipp Maier57889492023-08-07 12:10:03 +0200174 template (value) Recovery_gtpc ts_Recovery(OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100175 type_gtpc := '0E'O,
176 restartCounter := restart_counter
177 }
178
Philipp Maier57889492023-08-07 12:10:03 +0200179 template (present) Recovery_gtpc tr_Recovery(template (present) OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100180 type_gtpc := '0E'O,
181 restartCounter := restart_counter
182 }
183
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100184 /* Packet TMSI - 7.7.5 */
185 template (value) PacketTMSI ts_PTMSI(OCT4 ptmsi) := {
186 type_gtpc := '05'O,
187 p_tmsi := ptmsi
188 }
189
190 /* PTMSI Signature - 7.7.9 */
191 template (value) PTMSI_Signature ts_PTMSI_sig(OCT3 ptmsi_sig) := {
192 type_gtpc := '0C'O,
193 ptmsi_Signature := ptmsi_sig
194 }
195
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100196 /* MS Validated - 7.7.10 */
197 template (value) MS_Validated ts_MS_Validated(template (value) BIT1 msValidated) := {
198 type_gtpc := '0D'O,
199 msValidated := msValidated,
200 spare := '1111111'B
201 }
202 template (present) MS_Validated tr_MS_Validated(template (present) BIT1 msValidated := ?) := {
203 type_gtpc := '0D'O,
204 msValidated := msValidated,
205 spare := '1111111'B
206 }
207 function f_tr_MS_Validated(template BIT1 msValidated := *) return template MS_Validated {
208 if (istemplatekind(msValidated, "omit")) {
209 return omit;
210 } else if (istemplatekind(msValidated, "*")) {
211 return *;
212 } else {
213 return tr_MS_Validated(msValidated);
214 }
215 }
216 private function f_ts_MS_Validated(template (omit) BIT1 msValidated)
217 return template (omit) MS_Validated {
218 if (istemplatekind(msValidated, "omit")) {
219 return omit;
220 }
221 return ts_MS_Validated(msValidated);
222 }
223
224 /* 7.7.13 TEI Data I */
225 template (value) TeidDataI ts_TeidDataI(template (value) OCT4 teid) := {
226 type_gtpc := '10'O,
227 teidDataI := teid
228 }
229 template (present) TeidDataI tr_TeidDataI(template (present) OCT4 teid := ?) := {
230 type_gtpc := '10'O,
231 teidDataI := teid
232 }
233
234 /* 7.7.14 TEI Control Plane */
235 template (value) TeidControlPlane ts_TEIC(template (value) OCT4 teic) := {
236 type_gtpc := '11'O,
237 teidControlPlane := teic
238 }
239 template (present) TeidControlPlane tr_TEIC(template (present) OCT4 teic := ?) := {
240 type_gtpc := '11'O,
241 teidControlPlane := teic
242 }
243 private function f_ts_TEIC(template (omit) OCT4 teic)
244 return template (omit) TeidControlPlane {
245 if (istemplatekind(teic, "omit")) {
246 return omit;
247 }
248 return ts_TEIC(teic);
249 }
250
251 /* 7.7.15 Tunnel Endpoint Identifier Data II */
252 template (value) TeidDataII ts_TeidDataII(template (value) BIT4 nsapi,
253 template (value) OCT4 teid) := {
254 type_gtpc := '12'O,
255 nsapi := nsapi,
256 unused := '0000'B,
257 teidDataII := teid
258 }
259 template (present) TeidDataII tr_TeidDataII(template (present) BIT4 nsapi := ?,
260 template (present) OCT4 teid := ?) := {
261 type_gtpc := '12'O,
262 nsapi := nsapi,
263 unused := '0000'B,
264 teidDataII := teid
265 }
266
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200267 /* IMEI(SV) IE TS 29.060 7.7.53 */
Philipp Maier57889492023-08-07 12:10:03 +0200268 template (value) IMEISV_gtpc ts_IMEISV(template (value) OCT8 imeisv) := {
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200269 type_gtpc := '9A'O,
270 lengthf := 8,
271 imeisv := imeisv
272 }
273 private function f_ts_IMEISV(template (omit) OCT8 imeisv)
274 return template (omit) IMEISV_gtpc {
275 if (istemplatekind(imeisv, "omit")) {
276 return omit;
277 }
278 return ts_IMEISV(imeisv);
279 }
280
Philipp Maier57889492023-08-07 12:10:03 +0200281 template (present) IMEISV_gtpc tr_IMEISV(template (present) OCT8 imeisv) := {
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200282 type_gtpc := '9A'O,
283 lengthf := 8,
284 imeisv := imeisv
285 }
286
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200287 // MS Time Zone - 7.7.52
288 template (value) MS_TimeZone ts_MS_TimeZone(template (value) OCT1 timeZone := '00'O,
289 template (value) BIT2 daylightSavingTime := '00'B) := {
290 type_gtpc := '99'O,
291 lengthf := 2,
292 timeZone := timeZone,
293 daylightSavingTime := daylightSavingTime,
294 spare1 := '000'B,
295 sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */
296 spare2 := '00'B
297 }
298 function f_ts_MS_TimeZone(template (omit) OCT1 timeZone, template (omit) BIT2 daylightSavingTime)
299 return template (omit) MS_TimeZone {
300 if (istemplatekind(timeZone, "omit") and istemplatekind(daylightSavingTime, "omit")) {
301 return omit;
302 }
303 if (istemplatekind(timeZone, "omit")) {
304 return ts_MS_TimeZone(daylightSavingTime := daylightSavingTime);
305 }
306 if (istemplatekind(daylightSavingTime, "omit")) {
307 return ts_MS_TimeZone(timeZone);
308 }
309 return ts_MS_TimeZone(timeZone, daylightSavingTime);
310 }
311
312 template (present) MS_TimeZone tr_MS_TimeZone(template (present) OCT1 timeZone := ?,
313 template (present) BIT2 daylightSavingTime := ?) := {
314 type_gtpc := '99'O,
315 lengthf := 2,
316 timeZone := timeZone,
317 daylightSavingTime := daylightSavingTime,
318 spare1 := '000'B,
319 sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */
320 spare2 := '00'B
321 }
322
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200323 /* Charging Characteristics IE TS 29.060 7.7.23 */
Philipp Maier57889492023-08-07 12:10:03 +0200324 template (value) ChargingCharacteristics_GTPC ts_ChargingCharacteristics(template (value) OCT2 chargingChar) := {
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200325 type_gtpc := '1A'O,
326 chargingChar := chargingChar
327 }
328 private function f_ts_ChargingCharacteristics(template (omit) OCT2 chargingChar)
329 return template (omit) ChargingCharacteristics_GTPC {
330 if (istemplatekind(chargingChar, "omit")) {
331 return omit;
332 }
333 return ts_ChargingCharacteristics(chargingChar);
334 }
335
Philipp Maier57889492023-08-07 12:10:03 +0200336 template (present) ChargingCharacteristics_GTPC tr_ChargingCharacteristics(template (present) OCT2 chargingChar) := {
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200337 type_gtpc := '1A'O,
338 chargingChar := chargingChar
339 }
340
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100341 /* 7.7.28 MM Context */
Vadim Yanitskiyfdde1682024-04-06 05:34:24 +0700342 template (value) MM_Context ts_MM_ContextGSM(template (value) OCT8 kc,
343 template (value) BIT3 cksn := '000'B,
Vadim Yanitskiy74b12c72024-04-19 01:46:07 +0700344 template (value) BIT3 gea := '000'B,
345 template (value) octetstring triplet := ''O) := {
Vadim Yanitskiyfdde1682024-04-06 05:34:24 +0700346 type_gtpc := '81'O,
347 context := {
348 mmcontGSM := {
349 lengthf := 0, /* overwritten */
350 cksn := cksn,
Vadim Yanitskiy95fb6292024-04-19 01:17:48 +0700351 spare := '11111'B,
Vadim Yanitskiyfdde1682024-04-06 05:34:24 +0700352 usedCipher := gea,
Vadim Yanitskiy95fb6292024-04-19 01:17:48 +0700353 noofVectors := 0, /* overwritten */
354 security := '01'B, /* GSM key and triplets */
Vadim Yanitskiyfdde1682024-04-06 05:34:24 +0700355 kc := kc,
Vadim Yanitskiy74b12c72024-04-19 01:46:07 +0700356 triplet := triplet,
Vadim Yanitskiyfdde1682024-04-06 05:34:24 +0700357 drx_par := '0000'O,
358 msNetW_cap_length := 0, /* overwritten */
359 msNetw_cap := omit,
360 containerLength := 0, /* overwritten */
361 container := omit,
362 access_restriction_data_length := 0,
363 access_restriction_data := omit
364 }
365 }
366 }
Vadim Yanitskiy74b12c72024-04-19 01:46:07 +0700367 template (present) MM_Context tr_MM_ContextGSM(template (present) OCT8 kc := ?,
368 template (present) BIT3 cksn := ?,
369 template (present) BIT3 gea := ?,
370 template (present) octetstring triplet := ?) := {
371 type_gtpc := '81'O,
372 context := {
373 mmcontGSM := {
374 lengthf := ?,
375 cksn := cksn,
376 spare := ?,
377 usedCipher := gea,
378 noofVectors := ?,
379 security := '01'B, /* GSM key and triplets */
380 kc := kc,
381 triplet := triplet,
382 drx_par := ?,
383 msNetW_cap_length := ?,
384 msNetw_cap := *,
385 containerLength := ?,
386 container := *,
387 access_restriction_data_length := ?,
388 access_restriction_data := *
389 }
390 }
391 }
392
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100393 template (value) MM_Context ts_MM_ContextUMTS(template (value) OCT16 ck,
394 template (value) OCT16 ik) := {
395 type_gtpc := '81'O,
396 context := {
397 mmcontUMTS := {
398 lengthf := 0, /* overwritten */
399 ksi := '001'B,
400 usedGPRSIntegrityAlgorithm := '000'B,
401 ugipai := '1'B, /* Integrity Protection not required */
402 gupii := '1'B, /* Ignore "Used GPRS integrity protection algorithm" field" */
Vadim Yanitskiy95fb6292024-04-19 01:17:48 +0700403 spare1 := '111'B,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100404 noofVectors := 0, /* TODO: fill quintpuplets*/
Vadim Yanitskiy95fb6292024-04-19 01:17:48 +0700405 security := '10'B, /* UMTS key and quintuplets */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100406 ck := ck,
407 ik := ik,
408 quintupletlength := 0, /* overwritten */
409 quintuplet := ''O,
410 drx_par := '0000'O,
411 msNetW_cap_length := 0, /* overwritten */
412 msNetw_cap := omit,
413 containerLength := 0, /* overwritten */
414 container := omit,
415 access_restriction_data_length := 0, /* overwritten */
416 access_restriction_data := omit
417 }
418 }
419 }
420
421 /* 7.7.29 PDP Context */
422 template (value) PDP_Context_GTPC ts_PDP_Context_GTPC(template (value) octetstring pdp_addr,
423 template (value) octetstring ggsn_gsn_addr,
424 template (value) octetstring apn,
425 template (value) OCT4 ggsn_teic := '12345678'O,
426 template (value) OCT4 ggsn_teid := '87654321'O) := {
427 type_gtpc := '82'O,
428 lengthf := 0, /* overwritten */
429 nsapi := '0101'B,
430 order := '0'B,
431 asi := '0'B,
432 vaa := '0'B,
433 ea := '0'B,
434 sapi := '0011'B,
435 spare1 := '0000'B,
436 qos_subLength := 0, /* overwritten */
437 qos_sub := ts_QosProfileValueDefault,
438 qos_reqLength := 0, /* overwritten */
439 qos_req := ts_QosProfileValueDefault,
440 qos_negLength := 0, /* overwritten */
441 qos_neg := ts_QosProfileValueDefault,
442 snd := '0000'O,
443 snu := '0000'O,
444 sendNPDUnum := '00'O,
445 receiveNPDUnum := '00'O,
446 uteidControlPlane := ggsn_teic,
447 uteidData1 := ggsn_teid,
448 pdpcontext := '00'O,
449 pdp_typeorg := '0001'B, /* IETF */
450 spare2 := '1111'B,
451 pdp_typenum := '21'O, /* IETF IPV4 */
452 pdp_addressLength := 0, /* overwritten */
453 pdp_address := pdp_addr,
454 ggsn_addressControlPlaneLength := 0, /* overwritten */
455 ggsn_addressControlPlane := ggsn_gsn_addr,
456 ggsn_addressUserPlaneLength := 0, /* overwritten */
457 ggsn_addressUserPlane := ggsn_gsn_addr,
458 apnLength := 0, /* overwritten */
459 apn := apn,
460 transactionId := '0001'B,
461 spare3 := '0000'B,
462 transactionID_cont := '00'O,
463 pdp_typenum2 := omit,
464 pdp_addresslength2 := omit,
465 pdp_Address2 := omit
466 }
467
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200468
Philipp Maier1c0c7262023-07-24 10:51:53 +0200469 /* template matching reception of GTP-C unit-data */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100470 template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) Gtp1cPeer peer,
Philipp Maier57889492023-08-07 12:10:03 +0200471 template (present) OCT1 msg_type,
472 template (present) OCT4 teid,
473 template (present) GTPC_PDUs pdus := ?) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100474 peer := peer,
475 gtpc := tr_GTP1C_PDU(msg_type, teid, pdus)
476 }
477
478 /* template matching reception of GTP-C echo-request */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100479 template (present) Gtp1cUnitdata tr_GTPC_PING(template (present) Gtp1cPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
Harald Weltec69cf4e2018-02-17 20:57:02 +0100480
Philipp Maier57889492023-08-07 12:10:03 +0200481 template (present) GTPC_PDUs tr_EchoRespPDU(template (present) OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100482 echoResponse := {
483 recovery := tr_Recovery(restart_counter),
484 private_extension_gtpc := *
485 }
486 }
487
488 /* template matching reception of GTP-C echo-response */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100489 template (present) Gtp1cUnitdata tr_GTPC_PONG(template (present) Gtp1cPeer peer) := tr_GTPC_MsgType(peer, echoResponse, '00000000'O, tr_EchoRespPDU(?));
Harald Weltec69cf4e2018-02-17 20:57:02 +0100490
Philipp Maier57889492023-08-07 12:10:03 +0200491 template (value) GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100492 echoResponse := {
493 recovery := ts_Recovery(restart_counter),
494 private_extension_gtpc := omit
495 }
496 }
497
498 /* master template for senidng a GTP-C echo response */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100499 template (value) Gtp1cUnitdata ts_GTPC_PONG(Gtp1cPeer peer, uint16_t seq, OCT1 rest_ctr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100500 peer := peer,
501 gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq)
502 }
503
Philipp Maier57889492023-08-07 12:10:03 +0200504 template (value) GTPC_PDUs ts_EchoReqPDU := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100505 echoRequest := {
506 private_extension_gtpc := omit
507 }
508 }
509
510 /* master template for sending a GTP-C echo request */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100511 template (value) Gtp1cUnitdata ts_GTPC_PING(Gtp1cPeer peer, uint16_t seq) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100512 peer := peer,
513 gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq)
514 }
515
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200516 private function f_eua_ipv4_len(template OCT4 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100517 if (istemplatekind(ip_addr, "omit")) {
518 return 2;
519 } else if (istemplatekind(ip_addr, "*")) {
520 return ?;
521 } else if (istemplatekind(ip_addr, "?")) {
522 return 6;
523 }
524 return 6;
525 }
526
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200527 private function f_eua_ipv6_len(template OCT16 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100528 if (istemplatekind(ip_addr, "omit")) {
529 return 2;
530 } else if (istemplatekind(ip_addr, "*")) {
531 return ?;
532 } else if (istemplatekind(ip_addr, "?")) {
533 return 18;
534 }
535 return 18;
536 }
537
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200538 private function f_eua_ipv4v6_len(template OCT4 ip_addr4, template OCT16 ip_addr6) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100539 var integer len := 2;
540 if (istemplatekind(ip_addr4, "*") or
541 istemplatekind(ip_addr6, "*")) {
542 return ?;
543 }
544 if (not istemplatekind(ip_addr4, "omit")) {
545 len := len + 4;
546 }
547 if (not istemplatekind(ip_addr6, "omit")) {
548 len := len + 16;
549 }
550 return len;
551 }
552
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200553 template (present) EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100554 type_gtpc := '80'O,
555 endUserAddress := {
556 endUserAddressIPv4 := {
557 lengthf := 2,
558 pdp_typeorg := '0001'B,
559 spare := '1111'B,
560 pdp_typenum := '21'O,
561 ipv4_address := ip_addr
562 }
563 }
564 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200565 template (present) EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200566 template (present) EndUserAddress tr_EuaIPv4(template (present) OCT4 ip_addr) modifies t_EuaIPv4 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100567 endUserAddress := {
568 endUserAddressIPv4 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100569 lengthf := f_eua_ipv4_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100570 }
571 }
572 }
573
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200574 template (present) EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100575 type_gtpc := '80'O,
576 endUserAddress := {
577 endUserAddressIPv6 := {
578 lengthf := 2,
579 pdp_typeorg := '0001'B,
580 spare := '1111'B,
581 pdp_typenum := '57'O,
582 ipv6_address := ip_addr
583 }
584 }
585 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200586 template (present) EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200587 template (present) EndUserAddress tr_EuaIPv6(template (present) OCT16 ip_addr) modifies t_EuaIPv6 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100588 endUserAddress := {
589 endUserAddressIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100590 lengthf := f_eua_ipv6_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100591 }
592 }
593 }
594
Oliver Smithee6a0882019-03-08 11:05:46 +0100595 /* 3GPP TS 29.060 Figure 37A: End User Address Information Element for IPv4v6 (both static) */
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200596 template (present) EndUserAddress t_EuaIPv4v6(template OCT4 ip_addr4, template OCT16 ip_addr6) := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100597 type_gtpc := '80'O,
598 endUserAddress := {
599 endUserAddressIPv4andIPv6 := {
600 lengthf := 2,
601 pdp_typeorg := '0001'B,
602 spare := '1111'B,
603 pdp_typenum := '8D'O,
604 ipv4_address := ip_addr4,
605 ipv6_address := ip_addr6
606 }
607 }
608 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200609 template (present) EndUserAddress t_EuaIPv4Dynv6Dyn := t_EuaIPv4v6(omit, omit);
Philipp Maier57889492023-08-07 12:10:03 +0200610 template (present) EndUserAddress tr_EuaIPv4v6(template (present) OCT4 ip_addr4,
611 template (present) OCT16 ip_addr6) modifies t_EuaIPv4v6 := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100612 endUserAddress := {
613 endUserAddressIPv4andIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100614 lengthf := f_eua_ipv4v6_len(ip_addr4, ip_addr6)
Oliver Smithee6a0882019-03-08 11:05:46 +0100615 }
616 }
617 }
618
Philipp Maier57889492023-08-07 12:10:03 +0200619 template (value) AccessPointName ts_APN(octetstring apn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100620 type_gtpc := '83'O,
621 lengthf := lengthof(apn),
622 apn_value := apn
623 }
624
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100625 template (value) GSN_Address_GTPC ts_GsnAddr(template (value) octetstring ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100626 type_gtpc := '85'O,
627 lengthf := lengthof(ip_addr),
628 addressf := ip_addr
629 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100630 template (present) GSN_Address_GTPC tr_GsnAddr(template (present) octetstring ip_addr := ?) := {
631 type_gtpc := '85'O,
632 lengthf := ?,
633 addressf := ip_addr
634 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100635
Philipp Maier57889492023-08-07 12:10:03 +0200636 template (value) MSISDN ts_Msisdn(octetstring msisdn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100637 type_gtpc := '86'O,
638 lengthf := lengthof(msisdn),
639 msisdn := msisdn
640 }
641
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100642 template (value) QoSV_GTPC ts_QosValueDefault := {
643 reliabilityClass := '011'B,
644 delayClass := '001'B,
645 spare1 := '00'B,
646 precedenceClass := '010'B,
647 spare2 := '0'B,
648 peakThroughput := '1001'B,
649 meanThroughput := '11111'B,
650 spare3 := '000'B,
651 deliverErroneusSDU := '010'B, /* Erroneus SDU are delivered */
652 deliveryOrder := '10'B, /* Without delivery order */
653 trafficClass := '100'B, /* Background */
654 maxSDUSize := '96'O, /* 1500 octets */
655 maxBitrateUplink := 'FE'O, /* 8640, continues in extended octet */
656 maxBitrateDownlink := 'FE'O, /* 8640, continues in extended octet */
657 sduErrorRatio := '0100'B, /* 1x10^-4 */
658 residualBER := '0101'B, /* 1x10^-3 */
659 trafficHandlingPriority := '01'B, /* prio 1 */
660 transferDelay := '000001'B, /* 10 ms */
661 guaranteedBitRateUplink := 'FE'O, /* 8640, continues in extended octet */
662 guaranteedBitRateDownlink := 'FE'O, /* 8640, continues in extended octet */
663 sourceStatisticsDescriptor := '0000'B, /* unknown */
664 signallingIndication := '0'B, /* Not optimized */
665 spare4 := '000'B,
666 maxBitrateDownlinkExt := '5B'O, /* 33 mbps */
667 guaranteedBitRateDownlinkExt := '5B'O, /* 33 mbps */
668 maxBitrateUplinkExt := '6e'O, /* 52 mbps */
669 guaranteedBitRateUplinkExt := '6e'O /* 52 mbps */
670 }
671
672 template (value) QualityOfServiceProfile_Value ts_QosProfileValueDefault := {
673 allocRetensionPrio := '00'O,
674 qos_ProfileValue := ts_QosValueDefault
675 }
676
Philipp Maier57889492023-08-07 12:10:03 +0200677 template (value) QualityOfServiceProfile ts_QosDefault := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100678 type_gtpc := '87'O,
Pau Espin Pedrol7d58b082022-06-07 13:30:03 +0200679 lengthf := 17,
Harald Weltec69cf4e2018-02-17 20:57:02 +0100680 allocRetensionPrio := '00'O,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100681 qos_ProfileValue := ts_QosValueDefault
Harald Weltec69cf4e2018-02-17 20:57:02 +0100682 }
683
Philipp Maier57889492023-08-07 12:10:03 +0200684 template (value) IMSI_gtpc ts_Imsi(hexstring digits) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100685 type_gtpc := '02'O,
686 digits := digits,
687 padding := 'F'H
688 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100689 function f_ts_Imsi(template (omit) hexstring digits := omit) return template (omit) IMSI_gtpc {
690 var template (omit) IMSI_gtpc imsi;
691 if (istemplatekind(digits, "omit")) {
692 imsi := omit;
693 } else {
694 imsi := ts_Imsi(valueof(digits));
695 }
696 return imsi;
697 }
698 template (present) IMSI_gtpc tr_Imsi(template (present) hexstring digits) := {
699 type_gtpc := '02'O,
700 digits := digits,
701 padding := 'F'H
702 }
703 function f_tr_Imsi(template hexstring digits := *) return template IMSI_gtpc {
704 if (istemplatekind(digits, "omit")) {
705 return omit;
706 } else if (istemplatekind(digits, "*")) {
707 return *;
708 } else {
709 return tr_Imsi(digits);
710 }
711 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100712
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100713 /* 7.7.50 RAT Type */
714 type enumerated GTP_RATType {
715 GTP_RAT_TYPE_RESERVED (0),
716 GTP_RAT_TYPE_UTRAN (1),
717 GTP_RAT_TYPE_GERAN (2),
718 GTP_RAT_TYPE_WLAN (3),
719 GTP_RAT_TYPE_GAN (4),
720 GTP_RAT_TYPE_HSPA_E (5),
721 GTP_RAT_TYPE_EUTRAN (6)
722 };
723 template (value) RATType ts_RATType(template (value) OCT1 rat_type) := {
724 type_gtpc := '97'O,
725 lengthf := 1,
726 ratTypeValue := rat_type
727 }
728 function f_ts_RATType(template (omit) OCT1 rat_type := omit) return template (omit) RATType {
729 if (istemplatekind(rat_type, "omit")) {
730 return omit;
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100731 } else {
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100732 return ts_RATType(rat_type);
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100733 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100734 }
735 template (present) RATType tr_RATType(template (present) OCT1 rat_type) := {
736 type_gtpc := '97'O,
737 lengthf := 1,
738 ratTypeValue := rat_type
739 }
740 function f_tr_RATType(template OCT1 rat_type := *) return template RATType {
741 if (istemplatekind(rat_type, "omit")) {
742 return omit;
743 } else if (istemplatekind(rat_type, "*")) {
744 return *;
745 } else {
746 return tr_RATType(rat_type);
747 }
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100748 }
749
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100750 template (value) RoutingAreaIdentity ts_RoutingAreaIdentity(template (value) hexstring mcc_digits,
751 template (value) hexstring mnc_digits,
752 template (value) OCT2 lac,
753 template (value) OCT1 rac) := {
754 type_gtpc := '03'O,
755 mcc_digits := mcc_digits,
756 mnc_digits := mnc_digits,
757 lac := lac,
758 rac := rac
759 }
760
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100761 template (value) GeographicLocationCGI
762 ts_GeographicLocationCGI(template (value) hexstring mcc,
Philipp Maier57889492023-08-07 12:10:03 +0200763 template (value) hexstring mnc,
764 template (value) OCT2 lac,
765 template (value) OCT2 cI_value) :=
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100766 {
767 mccDigit1 := mcc[0],
768 mccDigit2 := mcc[1],
769 mccDigit3 := mcc[2],
770 mncDigit3 := mnc[2], /* 'F'H for 2 digit MNC */
771 mncDigit1 := mnc[0],
772 mncDigit2 := mnc[1],
773 lac := lac,
774 cI_value := cI_value
775 }
776
Philipp Maier57889492023-08-07 12:10:03 +0200777 template (value) GTPC_PDUs ts_CreatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
778 BIT4 nsapi, EndUserAddress eua, octetstring apn,
779 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
780 octetstring msisdn, template (omit) ProtConfigOptions pco := omit,
781 template (omit) OCT1 ratType := omit,
782 template (omit) UserLocationInformation uli := omit,
783 template (omit) OCT2 charging_char := omit,
784 template (omit) OCT8 imeisv := omit,
785 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100786 createPDPContextRequest := {
787 imsi := ts_Imsi(imsi),
788 rai := omit,
789 recovery := ts_Recovery(restart_ctr),
790 selectionMode := {
791 type_gtpc := '0F'O,
792 selectModeValue := '00'B,
793 spare := '111111'B
794 },
795 teidDataI := {
796 type_gtpc := '00'O,
797 teidDataI := teid_data
798 },
799 teidControlPlane := {
800 type_gtpc := '00'O,
801 teidControlPlane := teid_ctrl
802 },
803 nsapi := {
804 type_gtpc := '00'O,
805 nsapi := nsapi,
806 unused := '0000'B
807 },
808 linked_nsapi := omit,
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200809 charging_char := f_ts_ChargingCharacteristics(charging_char),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100810 trace_ref := omit,
811 trace_type := omit,
812 endUserAddress := eua,
813 accessPointName := ts_APN(apn),
814 protConfigOptions := pco,
815 sgsn_addr_signalling := ts_GsnAddr(sgsn_ip_sign),
816 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
817 msisdn := ts_Msisdn(msisdn),
818 qualityOfServiceProfile := ts_QosDefault,
819 tft := omit,
820 triggerId := omit,
821 omcId := omit,
822 commonFlags := omit,
823 aPN_Restriction := omit,
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100824 ratType := f_ts_RATType(ratType),
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100825 userLocationInformation := uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200826 mS_TimeZone := ms_tz,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200827 imeisv := f_ts_IMEISV(imeisv),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100828 camelChargingInformationContainer := omit,
829 additionalTraceInfo := omit,
830 correlationID := omit,
831 evolvedAllocationRetentionPriorityI := omit,
832 extendedCommonFlags := omit,
833 userCSGInformation := omit,
834 aPN_AMBR := omit,
835 signallingPriorityIndication := omit,
836 cN_OperatorSelectionEntity := omit,
837 private_extension_gtpc := omit
838 }
839 }
840
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100841 template (value) Gtp1cUnitdata ts_GTPC_CreatePDP(Gtp1cPeer peer, uint16_t seq, hexstring imsi,
Philipp Maier57889492023-08-07 12:10:03 +0200842 OCT1 restart_ctr, OCT4 teid_data,
843 OCT4 teid_ctrl, BIT4 nsapi, EndUserAddress eua,
844 octetstring apn, octetstring sgsn_ip_sign,
845 octetstring sgsn_ip_data, octetstring msisdn,
846 template (omit) ProtConfigOptions pco := omit,
847 template (omit) OCT1 ratType := omit,
848 template (omit) UserLocationInformation uli := omit,
849 template (omit) OCT2 charging_char := omit,
850 template (omit) OCT8 imeisv := omit,
851 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100852 peer := peer,
853 gtpc := ts_GTP1C_PDU(createPDPContextRequest, '00000000'O,
854 valueof(ts_CreatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
855 nsapi, eua, apn, sgsn_ip_sign,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200856 sgsn_ip_data, msisdn, pco, ratType, uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200857 charging_char, imeisv, ms_tz)), seq)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100858 }
859
Harald Welteeded9ad2018-02-17 20:57:34 +0100860
Philipp Maier57889492023-08-07 12:10:03 +0200861 template (value) GTPC_PDUs ts_UpdatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
862 BIT4 nsapi,
863 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
864 template (omit) ProtConfigOptions pco := omit,
865 template (omit) OCT1 ratType := omit,
866 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100867 updatePDPContextRequest := {
868 updatePDPContextRequestSGSN := {
869 imsi := ts_Imsi(imsi),
870 rai := omit,
871 recovery := ts_Recovery(restart_ctr),
872 teidDataI := {
873 type_gtpc := '00'O,
874 teidDataI := teid_data
875 },
876 teidControlPlane := {
877 type_gtpc := '00'O,
878 teidControlPlane := teid_ctrl
879 },
880 nsapi := {
881 type_gtpc := '00'O,
882 nsapi := nsapi,
883 unused := '0000'B
884 },
885 trace_ref := omit,
886 trace_type := omit,
887 protConfigOptions := pco,
888 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_ip_sign),
889 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
890 alt_ggsn_addr_controlPane := omit,
891 alt_ggsn_addr_traffic := omit,
892 qualityOfServiceProfile := ts_QosDefault,
893 tft := omit,
894 triggerId := omit,
895 omcId := omit,
896 commonFlags := omit,
897 ratType := f_ts_RATType(ratType),
898 userLocationInformation := uli,
899 mS_TimeZone := omit,
900 additionalTraceInfo := omit,
901 directTunnelFlags := omit,
902 evolvedAllocationRetentionPriorityI := omit,
903 extendedCommonFlags := omit,
904 userCSGInformation := omit,
905 aPN_AMBR := omit,
906 signallingPriorityIndication := omit,
907 cN_OperatorSelectionEntity := omit,
908 private_extension_gtpc := omit
909 }
910 }
911 }
912
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100913 template (value) Gtp1cUnitdata ts_GTPC_UpdatePDP(Gtp1cPeer peer, OCT4 teid, uint16_t seq, hexstring imsi,
Philipp Maier57889492023-08-07 12:10:03 +0200914 OCT1 restart_ctr, OCT4 teid_data,
915 OCT4 teid_ctrl, BIT4 nsapi, octetstring sgsn_ip_sign,
916 octetstring sgsn_ip_data,
917 template (omit) ProtConfigOptions pco := omit,
918 template (omit) OCT1 ratType := omit,
919 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100920 peer := peer,
921 gtpc := ts_GTP1C_PDU(updatePDPContextRequest, teid,
922 valueof(ts_UpdatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
923 nsapi, sgsn_ip_sign,
924 sgsn_ip_data, pco, ratType, uli)), seq)
925 }
926
927
Philipp Maier57889492023-08-07 12:10:03 +0200928 template (value) NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100929 type_gtpc := '14'O,
930 nsapi := nsapi,
931 unused := '0000'B
932 }
933
Philipp Maier57889492023-08-07 12:10:03 +0200934 template (value) ReorderingRequired ts_ReorderReq(boolean req := false) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100935 type_gtpc := '08'O,
936 reordreq := bool2bit(req),
937 spare := '0000000'B
938 }
939
Philipp Maier57889492023-08-07 12:10:03 +0200940 template (value) GTPC_PDUs ts_CreatePdpRespPDU(OCT1 cause, OCT4 teid_data, OCT4 teid_ctrl, BIT4 nsapi,
941 octetstring ggsn_ip_sign, octetstring ggsn_ip_data,
942 OCT4 chg_id, template (omit) EndUserAddress eua := omit,
943 template (omit) Recovery_gtpc recovery := omit,
944 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100945 createPDPContextResponse := {
946 cause := { '00'O, cause },
947 reorderingRequired := ts_ReorderReq(false),
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200948 recovery := recovery,
Harald Welteeded9ad2018-02-17 20:57:34 +0100949 teidDataI := {
950 type_gtpc := '00'O,
951 teidDataI := teid_data
952 },
953 teidControlPlane := {
954 type_gtpc := '00'O,
955 teidControlPlane := teid_ctrl
956 },
957 nsapi := ts_NSAPI(nsapi),
Harald Welte7aff2ca2018-02-18 15:34:50 +0100958 chargingID := {
959 type_gtpc := '7F'O,
960 chargingID := chg_id
961 },
Harald Welteeded9ad2018-02-17 20:57:34 +0100962 endUserAddress := eua,
963 protConfigOptions := pco,
964 ggsn_addr_controlPlane := ts_GsnAddr(ggsn_ip_sign),
965 ggsn_addr_traffic := ts_GsnAddr(ggsn_ip_data),
966 alt_ggsn_addr_controlPane := omit,
967 alt_ggsn_addr_traffic := omit,
968 qualityOfServiceProfile := ts_QosDefault,
969 commonFlags := omit,
970 aPN_Restriction := omit,
971 mS_InfoChangeReportingAction := omit,
972 bearerControlMode := omit,
973 evolvedAllocationRetentionPriorityI := omit,
974 extendedCommonFlag := omit,
975 csg_information_reporting_action := omit,
976 aPN_AMBR := omit,
977 gGSN_BackOffTime := omit,
978 private_extension_gtpc := omit
979 }
980 }
981
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100982 template (value) Gtp1cUnitdata ts_GTPC_CreatePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +0200983 OCT1 cause,
984 OCT4 teid_ctrl, OCT4 teid_data,
985 BIT4 nsapi, octetstring ggsn_ip_sign,
986 octetstring ggsn_ip_data, OCT4 chg_id,
987 template (omit) EndUserAddress eua := omit,
988 template (omit) Recovery_gtpc recovery := omit,
989 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100990 peer := peer,
991 gtpc := ts_GTP1C_PDU(createPDPContextResponse, teid,
992 valueof(ts_CreatePdpRespPDU(cause, teid_data, teid_ctrl, nsapi,
Harald Welte7aff2ca2018-02-18 15:34:50 +0100993 ggsn_ip_sign, ggsn_ip_data, chg_id,
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200994 eua, recovery, pco)), seq)
Harald Welteeded9ad2018-02-17 20:57:34 +0100995 }
996
Harald Weltec69cf4e2018-02-17 20:57:02 +0100997 /* PCO send base template */
Philipp Maier57889492023-08-07 12:10:03 +0200998 template (value) ProtConfigOptions ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100999 type_gtpc := '84'O,
1000 lengthf := 0,
1001 configProtocol := '000'B,
1002 spare := '0000'B,
1003 extension0 := '1'B,
1004 protocols := {}
1005 }
1006 /* PCO receive base template */
Philipp Maier57889492023-08-07 12:10:03 +02001007 template (present) ProtConfigOptions tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001008 type_gtpc := '84'O,
1009 lengthf := ?,
1010 configProtocol := '000'B,
1011 spare := ?,
1012 extension0 := '1'B,
1013 protocols := {}
1014 }
1015
Philipp Maier57889492023-08-07 12:10:03 +02001016 template (value) ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001017 protocols := {
1018 { protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O }
1019 }
1020 }
Philipp Maier57889492023-08-07 12:10:03 +02001021 template (present) ProtConfigOptions tr_PCO_IPv6_DNS_resp(template (present) OCT16 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001022 protocols := {
1023 *, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, *
1024 }
1025 }
1026
Pau Espin Pedrolcff72f82024-01-26 16:58:48 +01001027 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP(uint8_t ipcp_req_id := 0) modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001028 protocols := {
1029 /* dummy PAP entry to check if our parser in the GGSN can properly iterate over
1030 * the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */
1031 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1032 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
Pau Espin Pedrolcff72f82024-01-26 16:58:48 +01001033 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS(ipcp_req_id))) }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001034 }
1035 }
1036
Philipp Maier57889492023-08-07 12:10:03 +02001037 template (value) ProtConfigOptions ts_PCO_IPv4_PRI_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001038 protocols := {
1039 /* dummy PAP entry to check if our parser can cope with a single primary DNS entry
1040 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
1041 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1042 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1043 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) }
1044 }
1045 }
Philipp Maier57889492023-08-07 12:10:03 +02001046 template (value) ProtConfigOptions ts_PCO_IPv4_SEC_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001047 protocols := {
1048 /* dummy PAP entry to check if our parser can cope with a single secondary DNS entry
1049 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
1050 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1051 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1052 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1053 }
1054 }
Philipp Maier57889492023-08-07 12:10:03 +02001055 template (value) ProtConfigOptions ts_PCO_IPv4_SEPARATE_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001056 protocols := {
1057 /* dummy PAP entry to check if our parser can cope with a primary and secondary DNS
1058 * in separate IPCP containers OS#3381 */
1059 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1060 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1061 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) },
1062 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1063 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1064 }
1065 }
1066
Philipp Maier57889492023-08-07 12:10:03 +02001067 template (present) ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001068 protocolID := prot_id,
1069 lengthProtoID := ?,
1070 protoIDContents := ?
1071 }
Philipp Maier57889492023-08-07 12:10:03 +02001072 template (value) ProtocolElement ts_PCOelem_PAP_broken := {
Harald Weltef8298542019-04-10 10:15:28 +02001073 protocolID := 'C023'O,
1074 lengthProtoID := 60,
1075 /* PPP Password Authentication Protocol containing incorrect Peer-Id-Length set to 4 (6-7 should be the valid one), see OS#3914. */
1076 protoIDContents := '0100003c'O & '0444435338323700bc1c08087c1508083e00790000150808fd06000001000000000000000000000000000000000000000000000000000000'O
1077 }
Philipp Maier57889492023-08-07 12:10:03 +02001078 template (value) ProtConfigOptions ts_PCO_PAP_IPv4_DNS modifies ts_PCO := {
Harald Weltef8298542019-04-10 10:15:28 +02001079 protocols := {
1080 ts_PCOelem_PAP_broken,
1081 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
1082 }
1083 }
Philipp Maier57889492023-08-07 12:10:03 +02001084 template (present) ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001085 protocols := { *, tr_PCO_Proto(prot_id), * }
1086 }
1087
Philipp Maier57889492023-08-07 12:10:03 +02001088 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001089 protocols := {
1090 { protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
1091 }
1092 }
Philipp Maier57889492023-08-07 12:10:03 +02001093 template (present) ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template (present) OCT4 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001094 protocols := {
1095 *, { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }, *
1096 }
1097 }
1098
1099 /* extract a given protocol payload from PCO */
1100 function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring {
1101 var integer i;
1102 var integer num_matches := 0;
1103 for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
1104 if (pco.protocols[i].protocolID == protocol) {
1105 num_matches := num_matches + 1;
1106 if (num_matches == nth_match) {
1107 return pco.protocols[i].protoIDContents;
1108 }
1109 }
1110 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +02001111 setverdict(fail, "Could not extract protocol payload from protocol ", protocol);
1112 mtc.stop;
Harald Weltec69cf4e2018-02-17 20:57:02 +01001113 return ''O;
1114 }
1115
Philipp Maier57889492023-08-07 12:10:03 +02001116 template (present) IpcpPacket tr_IPCP(template (present) LcpCode code, template (present)uint8_t identifier,
1117 template (present) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001118 code := code,
1119 identifier := identifier,
1120 len := ?,
1121 options := opts
1122 }
Philipp Maier57889492023-08-07 12:10:03 +02001123 template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001124 code := IPCP_OPT_PrimaryDNS,
1125 len := 6,
1126 data := addr
1127 }
Philipp Maier57889492023-08-07 12:10:03 +02001128 template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001129 code := IPCP_OPT_SecondaryDNS,
1130 len := 6,
1131 data := addr
1132 }
Philipp Maier57889492023-08-07 12:10:03 +02001133 template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?,
1134 template (present) OCT4 dns1 := ?,
1135 template (present) OCT4 dns2 := ?) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001136 tr_IPCP(LCP_Configure_Ack, identifier,
1137 { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
1138
Philipp Maier57889492023-08-07 12:10:03 +02001139 template (value) IpcpPacket ts_IPCP(LcpCode code, uint8_t identifier, template (value) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001140 code := code,
1141 identifier := identifier,
1142 len := 0, /* overwritten */
1143 options := opts
1144 }
Philipp Maier57889492023-08-07 12:10:03 +02001145 template (value) IpcpPacket ts_IPCP_ReqDNS(uint8_t identifier := 0) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001146 ts_IPCP(LCP_Configure_Request, identifier,
1147 { tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) });
1148
Philipp Maier57889492023-08-07 12:10:03 +02001149 template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001150 ts_IPCP(LCP_Configure_Request, identifier,
1151 { tr_IPCP_PrimaryDns('00000000'O) });
Philipp Maier57889492023-08-07 12:10:03 +02001152 template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001153 ts_IPCP(LCP_Configure_Request, identifier,
1154 { tr_IPCP_SecondaryDns('00000000'O) });
1155
Harald Welte57b9b7f2018-02-18 22:28:13 +01001156 function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd {
1157 if (istemplatekind(ind, "omit")) {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001158 return omit;
1159 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001160 var TearDownInd ret := {
1161 type_gtpc := '13'O,
1162 tdInd := valueof(ind),
1163 spare:= '0000000'B
1164 }
1165 return ret;
1166 }
1167
Philipp Maier57889492023-08-07 12:10:03 +02001168 template (value) GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001169 deletePDPContextRequest := {
1170 cause := omit,
1171 tearDownIndicator := f_teardown_ind_IE(teardown_ind),
1172 nsapi := {
1173 type_gtpc := '14'O,
1174 nsapi := nsapi,
1175 unused := '0000'B
1176 },
1177 protConfigOptions := omit,
1178 userLocationInformation := omit,
1179 mS_TimeZone := omit,
1180 extendedCommonFlags := omit,
1181 uLI_Timestamp := omit,
1182 private_extension_gtpc := omit
1183 }
1184 }
1185
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001186 template (value) Gtp1cUnitdata ts_GTPC_DeletePDP(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +02001187 BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001188 peer := peer,
1189 gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid,
1190 valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq)
1191 }
1192
Philipp Maier57889492023-08-07 12:10:03 +02001193 template (value) GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause,
1194 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001195 deletePDPContextResponse := {
1196 cause := { '00'O, cause },
1197 protConfigOptions := pco,
1198 userLocationInformation := omit,
1199 mS_TimeZone := omit,
1200 uLI_Timestamp := omit,
1201 private_extension_gtpc := omit
1202 }
1203 }
1204
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001205 template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +02001206 OCT1 cause,
1207 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001208 peer := peer,
1209 gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid,
1210 valueof(ts_DeletePdpRespPDU(cause, pco)), seq)
1211 }
1212
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001213 /* SGSN Context Request - 7.5.3 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001214 template (present) GTPC_PDUs tr_SGSNContextReqPDU(template (present) RoutingAreaIdentity rai := ?,
1215 template (present) OCT4 teic := ?,
1216 template (present) octetstring sgsn_addr_control := ?,
1217 template hexstring imsi := *,
1218 template BIT1 msValidated := *,
1219 template TLLI tlli := *,
1220 template PacketTMSI ptmsi := *,
1221 template PTMSI_Signature ptmsi_sig := *,
1222 template OCT1 rat_type := *) := {
1223 sgsn_ContextRequest := {
1224 imsi := f_tr_Imsi(imsi),
1225 routingAreaIdentity := rai,
1226 tlli := tlli,
1227 packetTMSI := ptmsi,
1228 ptmsi_Signature := ptmsi_sig,
1229 ms_Validated := f_tr_MS_Validated(msValidated),
1230 teidControlPlane := {
1231 type_gtpc := '11'O,
1232 teidControlPlane := teic
1233 },
1234 sgsn_addr_controlPlane := tr_GsnAddr(sgsn_addr_control),
1235 alternative_sgsn_addr_controlPlane := *,
1236 sGSN_Number := *,
1237 ratType := f_tr_RATType(rat_type),
1238 hopCounter := *,
1239 private_extension_gtpc := *
1240 }
1241 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001242 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextReq(template (present) Gtp1cPeer peer,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001243 template (present) GTPC_PDUs SGSNContextReqPDU) := {
1244 peer := peer,
1245 gtpc := tr_GTP1C_PDU(sgsnContextRequest, '00000000'O, SGSNContextReqPDU)
1246 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001247 template (value) GTPC_PDUs ts_SGSNContextReqPDU(template (value) RoutingAreaIdentity rai,
1248 template (value) OCT4 teic,
1249 template (value) octetstring sgsn_addr_control,
1250 template (omit) hexstring imsi := omit,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001251 template (omit) BIT1 msValidated := '0'B,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001252 template (omit) TLLI tlli := omit,
1253 template (omit) PacketTMSI ptmsi := omit,
1254 template (omit) PTMSI_Signature ptmsi_sig := omit,
1255 template (omit) OCT1 rat_type := omit) := {
1256 sgsn_ContextRequest := {
1257 imsi := f_ts_Imsi(imsi),
1258 routingAreaIdentity := rai,
1259 tlli := tlli,
1260 packetTMSI := ptmsi,
1261 ptmsi_Signature := ptmsi_sig,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001262 ms_Validated := f_ts_MS_Validated(msValidated),
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001263 teidControlPlane := {
1264 type_gtpc := '11'O,
1265 teidControlPlane := teic
1266 },
1267 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1268 alternative_sgsn_addr_controlPlane := omit,
1269 sGSN_Number := omit,
1270 ratType := f_ts_RATType(rat_type),
1271 hopCounter := omit,
1272 private_extension_gtpc := omit
1273 }
1274 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001275 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextReq(Gtp1cPeer peer, uint16_t seq,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001276 template (value) GTPC_PDUs SGSNContextReqPDU) := {
1277 peer := peer,
1278 gtpc := ts_GTP1C_PDU(sgsnContextRequest, '00000000'O, valueof(SGSNContextReqPDU), seq)
1279 }
1280
1281 /* SGSN Context Response - 7.5.4 */
1282 template (present) GTPC_PDUs tr_SGSNContextRespPDU(template (present) GTP_Cause cause := ?,
1283 template hexstring imsi := *) := {
1284 sgsn_ContextResponse := {
1285 cause := tr_Cause_gtpc(cause),
1286 imsi := f_tr_Imsi(imsi),
1287 teidControlPlane := *,
1288 rabContext := *,
1289 radioPrioritySMS := *,
1290 radioPriority := *,
1291 packetFlowID := *,
1292 charging_char := *,
1293 mm_Context := *,
1294 pdp_Context := *,
1295 sgsn_addr_controlPlane := *,
1296 pdpContextPriorization := *,
1297 radioPriority_LCS := *,
1298 mBMS_UE_Context := *,
1299 subscribedRFSP_Index := *,
1300 rFSP_IndexInUse := *,
1301 colocatedGGSN_PGW_FQDN := *,
1302 evolvedAllocationRetentionPriorityII := *,
1303 extendedCommonFlags := *,
1304 ue_network_capability := *,
1305 ue_ambr := *,
1306 apn_ambr_nsapi := *,
1307 signallingPriorityIndication_nsapi := *,
1308 higher_bitrates_than_16mbps_flag := *,
1309 selectionMode_nsapi := *,
1310 localHomeNetworkID_nsapi := *,
1311 uE_UsageType := *,
1312 extendedCommonFlagsII := *,
1313 private_extension_gtpc := *
1314 }
1315 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001316 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextResp(template (present) Gtp1cPeer peer := ?,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001317 template (present) OCT4 teid := ?,
1318 template (present) GTPC_PDUs SGSNContextRespPDU := ?)
1319 := tr_GTPC_MsgType(peer, sgsnContextResponse, teid, SGSNContextRespPDU);
1320
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001321 template (value) GTPC_PDUs ts_SGSNContextRespPDU(template (value) GTP_Cause cause,
1322 template (omit) hexstring imsi := omit,
1323 template (omit) OCT4 teic := omit,
1324 template (omit) octetstring sgsn_addr_control := omit,
1325 template (omit) MM_Context mm_context := omit,
1326 template (omit) PDP_Context_GTPC_List pdp_ctx_list := omit) := {
1327 sgsn_ContextResponse := {
1328 cause := ts_Cause_gtpc(cause),
1329 imsi := f_ts_Imsi(imsi),
1330 teidControlPlane := f_ts_TEIC(teic),
1331 rabContext := omit,
1332 radioPrioritySMS := omit,
1333 radioPriority := omit,
1334 packetFlowID := omit,
1335 charging_char := omit,
1336 mm_Context := mm_context,
1337 pdp_Context := pdp_ctx_list,
1338 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1339 pdpContextPriorization := omit,
1340 radioPriority_LCS := omit,
1341 mBMS_UE_Context := omit,
1342 subscribedRFSP_Index := omit,
1343 rFSP_IndexInUse := omit,
1344 colocatedGGSN_PGW_FQDN := omit,
1345 evolvedAllocationRetentionPriorityII := omit,
1346 extendedCommonFlags := omit,
1347 ue_network_capability := omit,
1348 ue_ambr := omit,
1349 apn_ambr_nsapi := omit,
1350 signallingPriorityIndication_nsapi := omit,
1351 higher_bitrates_than_16mbps_flag := omit,
1352 selectionMode_nsapi := omit,
1353 localHomeNetworkID_nsapi := omit,
1354 uE_UsageType := omit,
1355 extendedCommonFlagsII := omit,
1356 private_extension_gtpc := omit
1357 }
1358 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001359 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextResp(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001360 template (value) GTPC_PDUs SGSNContextRespPDU) := {
1361 peer := peer,
1362 gtpc := ts_GTP1C_PDU(sgsnContextResponse, teid, valueof(SGSNContextRespPDU), seq)
1363 }
1364
1365
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001366 /* SGSN Context Acknowledge - 7.5.5 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001367 template (present) GTPC_PDUs tr_SGSNContextAckPDU(template (present) GTP_Cause cause := ?) := {
1368 sgsn_ContextAcknowledge := {
1369 cause := tr_Cause_gtpc(cause),
1370 teidDataII := *,
1371 sgsn_AddressForUserTraffic := *,
1372 sgsn_Number := *,
1373 nodeIdentifier := *,
1374 private_extension_gtpc := *
1375 }
1376 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001377 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextAck(template (present) Gtp1cPeer peer := ?,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001378 template (present) OCT4 teid := ?,
1379 template (present) GTPC_PDUs SGSNContextAckPDU := ?)
1380 := tr_GTPC_MsgType(peer, sgsnContextAcknowledge, teid, SGSNContextAckPDU);
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001381 template (value) GTPC_PDUs ts_SGSNContextAckPDU(template (value) GTP_Cause cause := GTP_CAUSE_REQUEST_ACCEPTED) := {
1382 sgsn_ContextAcknowledge := {
1383 cause := ts_Cause_gtpc(cause),
1384 teidDataII := omit,
1385 sgsn_AddressForUserTraffic := omit,
1386 sgsn_Number := omit,
1387 nodeIdentifier := omit,
1388 private_extension_gtpc := omit
1389 }
1390 }
Vadim Yanitskiy061c36d2024-04-19 02:07:52 +07001391
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001392 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextAck(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
Vadim Yanitskiy061c36d2024-04-19 02:07:52 +07001393 template (value) GTPC_PDUs SGSNContextAckPDU := ts_SGSNContextAckPDU) := {
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001394 peer := peer,
Pau Espin Pedrolca651b52023-12-20 18:37:39 +01001395 gtpc := ts_GTP1C_PDU(sgsnContextAcknowledge, teid, valueof(SGSNContextAckPDU), seq)
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001396 }
Harald Welte6f203162018-02-18 22:04:55 +01001397
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001398 /* GTP-C RIM */
1399
1400 template (value) RIM_Application_Identity_GTPC ts_GTPC_RIM_Application_Identity(OCT1 app_id) := {
1401 iEI := '4B'O,
1402 ext := '1'B,
1403 lengthIndicator := {
1404 length1 := 1
1405 },
1406 rIMApplicationIdentity := app_id
1407 }
1408 /* 3GPP TS 48.018 11.3.62 */
1409 template (value) RIM_Sequence_Number_GTPC ts_GTPC_RIM_Sequence_Number(integer seq) := {
1410 iEI := '4C'O,
1411 ext := '1'B,
1412 lengthIndicator := {
1413 length1 := 4
1414 },
1415 rIMSequenceNumber := int2oct(seq, 4)
1416 }
1417 template (value) RIM_PDU_Indications_GTPC ts_GTPC_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
1418 iEI := '4F'O,
1419 ext := '1'B,
1420 lengthIndicator := {
1421 length1 := 1
1422 },
1423 ack := bool2bit(ack),
1424 pDU_Type_Extension := type_ext,
1425 reserved := '0000'B
1426 }
1427 /* 3GPP TS 48.018 11.3.67 */
1428 template (value) RIM_Protocol_Version_Number_GTPC ts_GTPC_RIM_Protocol_Version_Number(integer ver) := {
1429 iEI := '55'O,
1430 ext := '1'B,
1431 lengthIndicator := {
1432 length1 := 1
1433 },
1434 rIMProtocolVersionNumber := int2oct(ver, 1)
1435 }
Philipp Maier57889492023-08-07 12:10:03 +02001436 function tr_GTPC_Cell_Identifier_V(template (present) GTP_CellId cid) return template (present) Cell_Identifier_V_GTPC {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001437 var template Cell_Identifier_V_GTPC ret := {
1438 mccDigit1 := ?,
1439 mccDigit2 := ?,
1440 mccDigit3 := ?,
1441 mncDigit3 := ?,
1442 mncDigit1 := ?,
1443 mncDigit2 := ?,
1444 lac := ?,
1445 rac := ?,
1446 cI_value := ?
1447 }
Philipp Maier57889492023-08-07 12:10:03 +02001448 if (istemplatekind(cid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001449 return ?;
1450 }
1451 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1452 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1453 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1454 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1455 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1456 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1457 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1458 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1459 }
1460 if (isvalue(cid.ra_id.lai.lac)) {
1461 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
1462 }
1463 }
1464 if (isvalue(cid) and isvalue(cid.ra_id)) {
1465 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
1466 }
1467 if (isvalue(cid)) {
1468 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
1469 }
1470 return ret;
1471 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001472 template (value) Cell_Identifier_V_GTPC ts_GTPC_Cell_Identifier_V(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001473 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1474 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1475 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1476 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1477 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1478 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1479 lac := int2oct(cid.ra_id.lai.lac, 2),
1480 rac := int2oct(cid.ra_id.rac, 1),
1481 cI_value := int2oct(cid.cell_id, 2)
1482 }
Philipp Maier57889492023-08-07 12:10:03 +02001483 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_cid(GTP_CellId cid) := {
1484 cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001485 }
Philipp Maier57889492023-08-07 12:10:03 +02001486 function tr_GTPC_ENB_Identifier(template (present) GTP_CellId cid,
1487 template (present) integer tac,
1488 template (present) octetstring gnbid) return template (present) ENB_Identifier {
1489 var template (present) ENB_Identifier ret := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001490 mccDigit1 := ?,
1491 mccDigit2 := ?,
1492 mccDigit3 := ?,
1493 mncDigit3 := ?,
1494 mncDigit1 := ?,
1495 mncDigit2 := ?,
1496 tAC := ?,
1497 globalENB_ID := ?
1498 }
Philipp Maier57889492023-08-07 12:10:03 +02001499 if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001500 return ?;
1501 }
1502 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1503 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1504 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1505 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1506 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1507 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1508 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1509 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1510 }
1511 }
1512 if (isvalue(tac)) {
1513 ret.tAC := int2oct(valueof(tac), 2);
1514 }
1515 if (isvalue(gnbid)) {
1516 ret.globalENB_ID := gnbid;
1517 }
1518
1519 return ret;
1520 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001521 template (value) ENB_Identifier ts_GTPC_ENB_Identifier(GTP_CellId cid, integer tac, octetstring gnbid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001522 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1523 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1524 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1525 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1526 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1527 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1528 tAC := int2oct(tac, 2),
1529 globalENB_ID := gnbid
1530 }
Philipp Maier57889492023-08-07 12:10:03 +02001531 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_enbid(GTP_CellId cid, integer tac, octetstring gnbid) := {
1532 eNB_Identifier := ts_GTPC_ENB_Identifier(cid, tac, gnbid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001533 }
Philipp Maier57889492023-08-07 12:10:03 +02001534 template (present) RIM_Routing_Information_GTPC
1535 tr_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (present) RIM_Routing_Address_GTPC addr) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001536 iEI := '54'O,
1537 ext := '1'B,
1538 lengthIndicator := {
1539 length1 := ?
1540 },
1541 rIMRoutingAddressDiscriminator := addr_discr,
1542 spare := '0'H,
1543 rIM_Routing_Address := addr
1544 }
1545 template (value) RIM_Routing_Information_GTPC
1546 ts_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address_GTPC addr) := {
1547 iEI := '54'O,
1548 ext := '1'B,
1549 lengthIndicator := {
1550 length1 := 0 /* overwritten */
1551 },
1552 rIMRoutingAddressDiscriminator := addr_discr,
1553 spare := '0'H,
1554 rIM_Routing_Address := addr
1555 }
1556 /* 3GPP TS 48.018 11.3.63.1.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001557 template (present) RAN_Information_Request_Application_Container_NACC_GTPC
1558 tr_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001559 iEI := '4D'O,
1560 ext := '1'B,
1561 lengthIndicator := {
1562 length1 := ?
1563 },
1564 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid)
1565 }
1566 template (value) RAN_Information_Request_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001567 ts_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001568 iEI := '4D'O,
1569 ext := '1'B,
1570 lengthIndicator := {
1571 length1 := 0 /* overwritten */
1572 },
1573 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
1574 }
1575 /* 3GPP TS 48.018 11.3.63.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001576 template (present) RAN_Information_Request_Application_Container_GTPC
1577 tru_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001578 nacc := tr_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1579 }
1580 template (value) RAN_Information_Request_Application_Container_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001581 tsu_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001582 nacc := ts_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1583 }
1584 /* 3GPP TS 48.018 11.3.63.2.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001585 template (present) RAN_Information_Application_Container_NACC_GTPC
1586 tr_GTPC_RAN_Information_Application_Container_NACC(template (present) GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001587 iEI := '4E'O,
1588 ext := '1'B,
1589 lengthIndicator := {
1590 length1 := ?
1591 },
1592 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid),
1593 typeBit := bool2bit(psi_type),
1594 number_of_SI_PSI := int2bit(si_psi_num, 7),
1595 sI_PSI := si_psi
1596 }
1597 template (value) RAN_Information_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001598 ts_GTPC_RAN_Information_Application_Container_NACC(GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001599 iEI := '4E'O,
1600 ext := '1'B,
1601 lengthIndicator := {
1602 length1 := 0 /* overwritten */
1603 },
1604 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid),
1605 typeBit := bool2bit(psi_type),
1606 number_of_SI_PSI := int2bit(si_psi_num, 7),
1607 sI_PSI := si_psi
1608 }
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001609 external function enc_RIM_Routing_Address_GTPC(in RIM_Routing_Address_GTPC ra) return octetstring
1610 with { extension "prototype(convert) encode(RAW)" };
Philipp Maier21bac7a2023-08-24 12:40:17 +02001611 external function dec_RIM_Routing_Address_GTPC(in octetstring stream) return RIM_Routing_Address_GTPC
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001612 with { extension "prototype(convert) decode(RAW)" };
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001613
1614 /* RAN_Information_Request */
1615 template (value) RAN_Information_Request_RIM_Container_GTPC
1616 ts_GTPC_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1617 template (value) RIM_Sequence_Number_GTPC seq,
1618 template (value) RIM_PDU_Indications_GTPC ind,
1619 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1620 template (omit) RAN_Information_Request_Application_Container_GTPC app_cont := omit,
1621 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1622 iEI := '57'O,
1623 ext := '1'B,
1624 lengthIndicator := {
1625 length1 := 0 /* overwritten */
1626 },
1627 rIM_Application_Identity := app_id,
1628 rIM_Sequence_Number := seq,
1629 rIM_PDU_Indications := ind,
1630 rIM_Protocol_Version_Number := ver,
1631 application_Container := app_cont,
1632 sON_TransferApplicationIdentity := son_app_id
1633 }
1634 template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1635 ts_GTPC_RAN_Information_Request(template (value) RIM_Routing_Information_GTPC dest,
1636 template (value) RIM_Routing_Information_GTPC src,
Philipp Maier6cef1c32023-07-24 11:01:52 +02001637 template (value) RAN_Information_Request_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001638 bssgpPduType := '71'O,
1639 destination_Cell_Identifier := dest,
1640 source_Cell_Identifier := src,
1641 rIM_Container := cont
1642 }
Philipp Maier57889492023-08-07 12:10:03 +02001643 template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1644 tr_GTPC_RAN_Information_Request(template (present) RIM_Routing_Information_GTPC dest := ?,
1645 template (present) RIM_Routing_Information_GTPC src := ?,
1646 template (present) RAN_Information_Request_RIM_Container_GTPC cont := ?) := {
Philipp Maier4b81c6e2023-07-24 11:03:15 +02001647 bssgpPduType := '71'O,
1648 destination_Cell_Identifier := dest,
1649 source_Cell_Identifier := src,
1650 rIM_Container := cont
1651 }
1652
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001653 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO_REQ(template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu) := {
1654 type_gtpc := '90'O,
1655 lengthf := 0, /* FIXME */
1656 rANTransparentContainerField := {
1657 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1658 }
1659 }
Philipp Maier57889492023-08-07 12:10:03 +02001660 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO_REQ(template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu := ?) := {
Philipp Maieredce92f2023-07-26 11:02:10 +02001661 type_gtpc := '90'O,
1662 lengthf := ?,
1663 rANTransparentContainerField := {
1664 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1665 }
1666 }
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001667
1668 /* RAN_Information */
Philipp Maier57889492023-08-07 12:10:03 +02001669 template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001670 tru_GTPC_ApplContainer_NACC(GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001671 application_Container := tr_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1672 }
1673 template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001674 tsu_GTPC_ApplContainer_NACC(GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001675 application_Container := ts_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1676 }
Philipp Maier57889492023-08-07 12:10:03 +02001677 template (present) ApplContainer_or_ApplErrContainer_GTPC
1678 tru_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001679 nacc := cont
1680 }
1681 template (value) ApplContainer_or_ApplErrContainer_GTPC
1682 tsu_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
1683 nacc := cont
1684 }
Philipp Maier57889492023-08-07 12:10:03 +02001685 template (present) RAN_Information_RIM_Container_GTPC
1686 tr_GTPC_RAN_Information_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id,
1687 template (present) RIM_Sequence_Number_GTPC seq,
1688 template (present) RIM_PDU_Indications_GTPC ind,
1689 template RIM_Protocol_Version_Number_GTPC ver := *,
1690 template ApplContainer_or_ApplErrContainer_GTPC app_cont := *,
1691 template SON_TransferApplicationIdentity son_app_id := *) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001692 iEI := '58'O,
1693 ext := '1'B,
1694 lengthIndicator := {
1695 length1 := ?
1696 },
1697 rIM_Application_Identity := app_id,
1698 rIM_Sequence_Number := seq,
1699 rIM_PDU_Indications := ind,
1700 rIM_Protocol_Version_Number := ver,
1701 applContainer_or_ApplErrContainer := app_cont,
1702 sON_TransferApplicationIdentity := son_app_id
1703 }
1704 template (value) RAN_Information_RIM_Container_GTPC
1705 ts_GTPC_RAN_Information_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1706 template (value) RIM_Sequence_Number_GTPC seq,
1707 template (value) RIM_PDU_Indications_GTPC ind,
1708 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1709 template (omit) ApplContainer_or_ApplErrContainer_GTPC app_cont := omit,
1710 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1711 iEI := '58'O,
1712 ext := '1'B,
1713 lengthIndicator := {
1714 length1 := 0 /* overwritten */
1715 },
1716 rIM_Application_Identity := app_id,
1717 rIM_Sequence_Number := seq,
1718 rIM_PDU_Indications := ind,
1719 rIM_Protocol_Version_Number := ver,
1720 applContainer_or_ApplErrContainer := app_cont,
1721 sON_TransferApplicationIdentity := son_app_id
1722 }
Philipp Maier57889492023-08-07 12:10:03 +02001723 template (present) PDU_BSSGP_RAN_INFORMATION_GTPC
1724 tr_GTPC_RAN_Information(template (present) RIM_Routing_Information_GTPC dest,
1725 template (present) RIM_Routing_Information_GTPC src,
1726 template (present) RAN_Information_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001727 bssgpPduType := '70'O,
1728 destination_Cell_Identifier := dest,
1729 source_Cell_Identifier := src,
1730 rIM_Container := cont
1731 }
1732 template (value) PDU_BSSGP_RAN_INFORMATION_GTPC
1733 ts_GTPC_RAN_Information(template (value) RIM_Routing_Information_GTPC dest,
1734 template (value) RIM_Routing_Information_GTPC src,
1735 template (value) RAN_Information_RIM_Container_GTPC cont) := {
1736 bssgpPduType := '70'O,
1737 destination_Cell_Identifier := dest,
1738 source_Cell_Identifier := src,
1739 rIM_Container := cont
1740 }
Philipp Maier57889492023-08-07 12:10:03 +02001741 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO(template (present) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001742 type_gtpc := '90'O,
1743 lengthf := ?,
1744 rANTransparentContainerField := {
1745 pDU_BSSGP_RAN_INFORMATION := pdu
1746 }
1747 }
1748 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO(template (value) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
1749 type_gtpc := '90'O,
1750 lengthf := 0, /* overwritten */
1751 rANTransparentContainerField := {
1752 pDU_BSSGP_RAN_INFORMATION := pdu
1753 }
1754 }
1755
Philipp Maier57889492023-08-07 12:10:03 +02001756 template (present) RANTransparentContainer tr_RANTransparentContainer(template (present) RANTransparentContainerField rANTransparentContainerField) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001757 type_gtpc := '90'O,
1758 lengthf := ?,
1759 rANTransparentContainerField := rANTransparentContainerField
1760 }
1761 template (value) RANTransparentContainer ts_RANTransparentContainer(template (value) RANTransparentContainerField rANTransparentContainerField) := {
1762 type_gtpc := '90'O,
1763 lengthf := 0, /* overwritten */
1764 rANTransparentContainerField := rANTransparentContainerField
1765 }
Philipp Maier57889492023-08-07 12:10:03 +02001766 template (present) GTPC_PDUs tr_RANInfoRelay(template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001767 ranInformationRelay := {
1768 transparentContainer := transparentContainer,
1769 rIM_RoutingAddress := *,
1770 rIM_RoutingAddress_Discriminator := *,
1771 private_extension_gtpc := *
1772 }
1773 }
Philipp Maier05ad55c2023-07-24 10:56:46 +02001774 template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer,
1775 template (omit) RIM_RoutingAddress ra := omit,
1776 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001777 ranInformationRelay := {
1778 transparentContainer := transparentContainer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001779 rIM_RoutingAddress := ra,
1780 rIM_RoutingAddress_Discriminator := ra_discr,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001781 private_extension_gtpc := omit
1782 }
1783 }
Philipp Maier57889492023-08-07 12:10:03 +02001784 template (present) Gtp1cUnitdata
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001785 tr_GTPC_RANInfoRelay(template (present) Gtp1cPeer peer,
Philipp Maier57889492023-08-07 12:10:03 +02001786 template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001787 peer := peer,
1788 gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer))
1789 }
1790 template (value) Gtp1cUnitdata
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001791 ts_GTPC_RANInfoRelay(template (value) Gtp1cPeer peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001792 template (value) RANTransparentContainer transparentContainer,
1793 template (omit) RIM_RoutingAddress ra := omit,
1794 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001795 peer := peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001796 gtpc := ts_GTP1C_PDU(rANInformationRelay, '00000000'O, valueof(ts_RANInfoRelay(transparentContainer, ra, ra_discr)), 0)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001797 }
1798
1799
Philipp Maier57889492023-08-07 12:10:03 +02001800 template (present) RAN_Information_Request_RIM_Container_GTPC
1801 tr_GTPC_RAN_Information_Request_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id := ?,
1802 template (present) RIM_Sequence_Number_GTPC seq := ?,
1803 template (present) RIM_PDU_Indications_GTPC ind := ?,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001804 template RIM_Protocol_Version_Number_GTPC ver := *,
1805 template RAN_Information_Request_Application_Container_GTPC app_cont := *,
1806 template SON_TransferApplicationIdentity son_app_id := *) := {
1807 iEI := '57'O,
1808 ext := '1'B,
1809 lengthIndicator := {
1810 length1 := ?
1811 },
1812 rIM_Application_Identity := app_id,
1813 rIM_Sequence_Number := seq,
1814 rIM_PDU_Indications := ind,
1815 rIM_Protocol_Version_Number := ver,
1816 application_Container := app_cont,
1817 sON_TransferApplicationIdentity := son_app_id
1818 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001819
Philipp Maier653a0142023-08-04 15:22:37 +02001820 /* 3GPP TS 29.060, section 7.7.57 */
1821 template (value) RIM_RoutingAddress ts_RIM_RoutingAddress(octetstring addr_value) := {
1822 type_gtpc := '9F'O,
1823 lengthf := 0, /* we assume encoder overwrites this */
1824 rIM_RoutingAddressValue := addr_value
1825 }
1826 template (present) RIM_RoutingAddress tr_RIM_RoutingAddress(template (present) octetstring addr_value := ?) := {
1827 type_gtpc := '9F'O,
1828 lengthf := ?,
1829 rIM_RoutingAddressValue := addr_value
1830 }
1831
1832 /* 3GPP TS 29.060, section 7.7.77 */
1833 template (value) RIM_RoutingAddress_Discriminator ts_RIM_RoutingAddress_Discriminator(bitstring addr_discr) := {
1834 type_gtpc := 'B2'O,
1835 lengthf := 0, /* we assume encoder overwrites this */
1836 rra_discriminator := addr_discr,
1837 spare := '0000'B
1838 }
1839 template (present) RIM_RoutingAddress_Discriminator tr_RIM_RoutingAddress_Discriminator(template (present) bitstring addr_discr := ?) := {
1840 type_gtpc := 'B2'O,
1841 lengthf := ?,
1842 rra_discriminator := addr_discr,
1843 spare := '0000'B
1844 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001845}