blob: 0907c5e4fac1ae077989be2567359c37d94b7cb7 [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,
344 template (value) BIT3 gea := '000'B) := {
345 type_gtpc := '81'O,
346 context := {
347 mmcontGSM := {
348 lengthf := 0, /* overwritten */
349 cksn := cksn,
Vadim Yanitskiy95fb6292024-04-19 01:17:48 +0700350 spare := '11111'B,
Vadim Yanitskiyfdde1682024-04-06 05:34:24 +0700351 usedCipher := gea,
Vadim Yanitskiy95fb6292024-04-19 01:17:48 +0700352 noofVectors := 0, /* overwritten */
353 security := '01'B, /* GSM key and triplets */
Vadim Yanitskiyfdde1682024-04-06 05:34:24 +0700354 kc := kc,
355 triplet := ''O,
356 drx_par := '0000'O,
357 msNetW_cap_length := 0, /* overwritten */
358 msNetw_cap := omit,
359 containerLength := 0, /* overwritten */
360 container := omit,
361 access_restriction_data_length := 0,
362 access_restriction_data := omit
363 }
364 }
365 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100366 template (value) MM_Context ts_MM_ContextUMTS(template (value) OCT16 ck,
367 template (value) OCT16 ik) := {
368 type_gtpc := '81'O,
369 context := {
370 mmcontUMTS := {
371 lengthf := 0, /* overwritten */
372 ksi := '001'B,
373 usedGPRSIntegrityAlgorithm := '000'B,
374 ugipai := '1'B, /* Integrity Protection not required */
375 gupii := '1'B, /* Ignore "Used GPRS integrity protection algorithm" field" */
Vadim Yanitskiy95fb6292024-04-19 01:17:48 +0700376 spare1 := '111'B,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100377 noofVectors := 0, /* TODO: fill quintpuplets*/
Vadim Yanitskiy95fb6292024-04-19 01:17:48 +0700378 security := '10'B, /* UMTS key and quintuplets */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100379 ck := ck,
380 ik := ik,
381 quintupletlength := 0, /* overwritten */
382 quintuplet := ''O,
383 drx_par := '0000'O,
384 msNetW_cap_length := 0, /* overwritten */
385 msNetw_cap := omit,
386 containerLength := 0, /* overwritten */
387 container := omit,
388 access_restriction_data_length := 0, /* overwritten */
389 access_restriction_data := omit
390 }
391 }
392 }
393
394 /* 7.7.29 PDP Context */
395 template (value) PDP_Context_GTPC ts_PDP_Context_GTPC(template (value) octetstring pdp_addr,
396 template (value) octetstring ggsn_gsn_addr,
397 template (value) octetstring apn,
398 template (value) OCT4 ggsn_teic := '12345678'O,
399 template (value) OCT4 ggsn_teid := '87654321'O) := {
400 type_gtpc := '82'O,
401 lengthf := 0, /* overwritten */
402 nsapi := '0101'B,
403 order := '0'B,
404 asi := '0'B,
405 vaa := '0'B,
406 ea := '0'B,
407 sapi := '0011'B,
408 spare1 := '0000'B,
409 qos_subLength := 0, /* overwritten */
410 qos_sub := ts_QosProfileValueDefault,
411 qos_reqLength := 0, /* overwritten */
412 qos_req := ts_QosProfileValueDefault,
413 qos_negLength := 0, /* overwritten */
414 qos_neg := ts_QosProfileValueDefault,
415 snd := '0000'O,
416 snu := '0000'O,
417 sendNPDUnum := '00'O,
418 receiveNPDUnum := '00'O,
419 uteidControlPlane := ggsn_teic,
420 uteidData1 := ggsn_teid,
421 pdpcontext := '00'O,
422 pdp_typeorg := '0001'B, /* IETF */
423 spare2 := '1111'B,
424 pdp_typenum := '21'O, /* IETF IPV4 */
425 pdp_addressLength := 0, /* overwritten */
426 pdp_address := pdp_addr,
427 ggsn_addressControlPlaneLength := 0, /* overwritten */
428 ggsn_addressControlPlane := ggsn_gsn_addr,
429 ggsn_addressUserPlaneLength := 0, /* overwritten */
430 ggsn_addressUserPlane := ggsn_gsn_addr,
431 apnLength := 0, /* overwritten */
432 apn := apn,
433 transactionId := '0001'B,
434 spare3 := '0000'B,
435 transactionID_cont := '00'O,
436 pdp_typenum2 := omit,
437 pdp_addresslength2 := omit,
438 pdp_Address2 := omit
439 }
440
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200441
Philipp Maier1c0c7262023-07-24 10:51:53 +0200442 /* template matching reception of GTP-C unit-data */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100443 template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) Gtp1cPeer peer,
Philipp Maier57889492023-08-07 12:10:03 +0200444 template (present) OCT1 msg_type,
445 template (present) OCT4 teid,
446 template (present) GTPC_PDUs pdus := ?) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100447 peer := peer,
448 gtpc := tr_GTP1C_PDU(msg_type, teid, pdus)
449 }
450
451 /* template matching reception of GTP-C echo-request */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100452 template (present) Gtp1cUnitdata tr_GTPC_PING(template (present) Gtp1cPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
Harald Weltec69cf4e2018-02-17 20:57:02 +0100453
Philipp Maier57889492023-08-07 12:10:03 +0200454 template (present) GTPC_PDUs tr_EchoRespPDU(template (present) OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100455 echoResponse := {
456 recovery := tr_Recovery(restart_counter),
457 private_extension_gtpc := *
458 }
459 }
460
461 /* template matching reception of GTP-C echo-response */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100462 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 +0100463
Philipp Maier57889492023-08-07 12:10:03 +0200464 template (value) GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100465 echoResponse := {
466 recovery := ts_Recovery(restart_counter),
467 private_extension_gtpc := omit
468 }
469 }
470
471 /* master template for senidng a GTP-C echo response */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100472 template (value) Gtp1cUnitdata ts_GTPC_PONG(Gtp1cPeer peer, uint16_t seq, OCT1 rest_ctr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100473 peer := peer,
474 gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq)
475 }
476
Philipp Maier57889492023-08-07 12:10:03 +0200477 template (value) GTPC_PDUs ts_EchoReqPDU := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100478 echoRequest := {
479 private_extension_gtpc := omit
480 }
481 }
482
483 /* master template for sending a GTP-C echo request */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100484 template (value) Gtp1cUnitdata ts_GTPC_PING(Gtp1cPeer peer, uint16_t seq) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100485 peer := peer,
486 gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq)
487 }
488
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200489 private function f_eua_ipv4_len(template OCT4 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100490 if (istemplatekind(ip_addr, "omit")) {
491 return 2;
492 } else if (istemplatekind(ip_addr, "*")) {
493 return ?;
494 } else if (istemplatekind(ip_addr, "?")) {
495 return 6;
496 }
497 return 6;
498 }
499
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200500 private function f_eua_ipv6_len(template OCT16 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100501 if (istemplatekind(ip_addr, "omit")) {
502 return 2;
503 } else if (istemplatekind(ip_addr, "*")) {
504 return ?;
505 } else if (istemplatekind(ip_addr, "?")) {
506 return 18;
507 }
508 return 18;
509 }
510
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200511 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 +0100512 var integer len := 2;
513 if (istemplatekind(ip_addr4, "*") or
514 istemplatekind(ip_addr6, "*")) {
515 return ?;
516 }
517 if (not istemplatekind(ip_addr4, "omit")) {
518 len := len + 4;
519 }
520 if (not istemplatekind(ip_addr6, "omit")) {
521 len := len + 16;
522 }
523 return len;
524 }
525
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200526 template (present) EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100527 type_gtpc := '80'O,
528 endUserAddress := {
529 endUserAddressIPv4 := {
530 lengthf := 2,
531 pdp_typeorg := '0001'B,
532 spare := '1111'B,
533 pdp_typenum := '21'O,
534 ipv4_address := ip_addr
535 }
536 }
537 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200538 template (present) EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200539 template (present) EndUserAddress tr_EuaIPv4(template (present) OCT4 ip_addr) modifies t_EuaIPv4 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100540 endUserAddress := {
541 endUserAddressIPv4 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100542 lengthf := f_eua_ipv4_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100543 }
544 }
545 }
546
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200547 template (present) EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100548 type_gtpc := '80'O,
549 endUserAddress := {
550 endUserAddressIPv6 := {
551 lengthf := 2,
552 pdp_typeorg := '0001'B,
553 spare := '1111'B,
554 pdp_typenum := '57'O,
555 ipv6_address := ip_addr
556 }
557 }
558 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200559 template (present) EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200560 template (present) EndUserAddress tr_EuaIPv6(template (present) OCT16 ip_addr) modifies t_EuaIPv6 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100561 endUserAddress := {
562 endUserAddressIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100563 lengthf := f_eua_ipv6_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100564 }
565 }
566 }
567
Oliver Smithee6a0882019-03-08 11:05:46 +0100568 /* 3GPP TS 29.060 Figure 37A: End User Address Information Element for IPv4v6 (both static) */
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200569 template (present) EndUserAddress t_EuaIPv4v6(template OCT4 ip_addr4, template OCT16 ip_addr6) := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100570 type_gtpc := '80'O,
571 endUserAddress := {
572 endUserAddressIPv4andIPv6 := {
573 lengthf := 2,
574 pdp_typeorg := '0001'B,
575 spare := '1111'B,
576 pdp_typenum := '8D'O,
577 ipv4_address := ip_addr4,
578 ipv6_address := ip_addr6
579 }
580 }
581 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200582 template (present) EndUserAddress t_EuaIPv4Dynv6Dyn := t_EuaIPv4v6(omit, omit);
Philipp Maier57889492023-08-07 12:10:03 +0200583 template (present) EndUserAddress tr_EuaIPv4v6(template (present) OCT4 ip_addr4,
584 template (present) OCT16 ip_addr6) modifies t_EuaIPv4v6 := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100585 endUserAddress := {
586 endUserAddressIPv4andIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100587 lengthf := f_eua_ipv4v6_len(ip_addr4, ip_addr6)
Oliver Smithee6a0882019-03-08 11:05:46 +0100588 }
589 }
590 }
591
Philipp Maier57889492023-08-07 12:10:03 +0200592 template (value) AccessPointName ts_APN(octetstring apn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100593 type_gtpc := '83'O,
594 lengthf := lengthof(apn),
595 apn_value := apn
596 }
597
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100598 template (value) GSN_Address_GTPC ts_GsnAddr(template (value) octetstring ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100599 type_gtpc := '85'O,
600 lengthf := lengthof(ip_addr),
601 addressf := ip_addr
602 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100603 template (present) GSN_Address_GTPC tr_GsnAddr(template (present) octetstring ip_addr := ?) := {
604 type_gtpc := '85'O,
605 lengthf := ?,
606 addressf := ip_addr
607 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100608
Philipp Maier57889492023-08-07 12:10:03 +0200609 template (value) MSISDN ts_Msisdn(octetstring msisdn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100610 type_gtpc := '86'O,
611 lengthf := lengthof(msisdn),
612 msisdn := msisdn
613 }
614
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100615 template (value) QoSV_GTPC ts_QosValueDefault := {
616 reliabilityClass := '011'B,
617 delayClass := '001'B,
618 spare1 := '00'B,
619 precedenceClass := '010'B,
620 spare2 := '0'B,
621 peakThroughput := '1001'B,
622 meanThroughput := '11111'B,
623 spare3 := '000'B,
624 deliverErroneusSDU := '010'B, /* Erroneus SDU are delivered */
625 deliveryOrder := '10'B, /* Without delivery order */
626 trafficClass := '100'B, /* Background */
627 maxSDUSize := '96'O, /* 1500 octets */
628 maxBitrateUplink := 'FE'O, /* 8640, continues in extended octet */
629 maxBitrateDownlink := 'FE'O, /* 8640, continues in extended octet */
630 sduErrorRatio := '0100'B, /* 1x10^-4 */
631 residualBER := '0101'B, /* 1x10^-3 */
632 trafficHandlingPriority := '01'B, /* prio 1 */
633 transferDelay := '000001'B, /* 10 ms */
634 guaranteedBitRateUplink := 'FE'O, /* 8640, continues in extended octet */
635 guaranteedBitRateDownlink := 'FE'O, /* 8640, continues in extended octet */
636 sourceStatisticsDescriptor := '0000'B, /* unknown */
637 signallingIndication := '0'B, /* Not optimized */
638 spare4 := '000'B,
639 maxBitrateDownlinkExt := '5B'O, /* 33 mbps */
640 guaranteedBitRateDownlinkExt := '5B'O, /* 33 mbps */
641 maxBitrateUplinkExt := '6e'O, /* 52 mbps */
642 guaranteedBitRateUplinkExt := '6e'O /* 52 mbps */
643 }
644
645 template (value) QualityOfServiceProfile_Value ts_QosProfileValueDefault := {
646 allocRetensionPrio := '00'O,
647 qos_ProfileValue := ts_QosValueDefault
648 }
649
Philipp Maier57889492023-08-07 12:10:03 +0200650 template (value) QualityOfServiceProfile ts_QosDefault := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100651 type_gtpc := '87'O,
Pau Espin Pedrol7d58b082022-06-07 13:30:03 +0200652 lengthf := 17,
Harald Weltec69cf4e2018-02-17 20:57:02 +0100653 allocRetensionPrio := '00'O,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100654 qos_ProfileValue := ts_QosValueDefault
Harald Weltec69cf4e2018-02-17 20:57:02 +0100655 }
656
Philipp Maier57889492023-08-07 12:10:03 +0200657 template (value) IMSI_gtpc ts_Imsi(hexstring digits) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100658 type_gtpc := '02'O,
659 digits := digits,
660 padding := 'F'H
661 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100662 function f_ts_Imsi(template (omit) hexstring digits := omit) return template (omit) IMSI_gtpc {
663 var template (omit) IMSI_gtpc imsi;
664 if (istemplatekind(digits, "omit")) {
665 imsi := omit;
666 } else {
667 imsi := ts_Imsi(valueof(digits));
668 }
669 return imsi;
670 }
671 template (present) IMSI_gtpc tr_Imsi(template (present) hexstring digits) := {
672 type_gtpc := '02'O,
673 digits := digits,
674 padding := 'F'H
675 }
676 function f_tr_Imsi(template hexstring digits := *) return template IMSI_gtpc {
677 if (istemplatekind(digits, "omit")) {
678 return omit;
679 } else if (istemplatekind(digits, "*")) {
680 return *;
681 } else {
682 return tr_Imsi(digits);
683 }
684 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100685
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100686 /* 7.7.50 RAT Type */
687 type enumerated GTP_RATType {
688 GTP_RAT_TYPE_RESERVED (0),
689 GTP_RAT_TYPE_UTRAN (1),
690 GTP_RAT_TYPE_GERAN (2),
691 GTP_RAT_TYPE_WLAN (3),
692 GTP_RAT_TYPE_GAN (4),
693 GTP_RAT_TYPE_HSPA_E (5),
694 GTP_RAT_TYPE_EUTRAN (6)
695 };
696 template (value) RATType ts_RATType(template (value) OCT1 rat_type) := {
697 type_gtpc := '97'O,
698 lengthf := 1,
699 ratTypeValue := rat_type
700 }
701 function f_ts_RATType(template (omit) OCT1 rat_type := omit) return template (omit) RATType {
702 if (istemplatekind(rat_type, "omit")) {
703 return omit;
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100704 } else {
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100705 return ts_RATType(rat_type);
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100706 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100707 }
708 template (present) RATType tr_RATType(template (present) OCT1 rat_type) := {
709 type_gtpc := '97'O,
710 lengthf := 1,
711 ratTypeValue := rat_type
712 }
713 function f_tr_RATType(template OCT1 rat_type := *) return template RATType {
714 if (istemplatekind(rat_type, "omit")) {
715 return omit;
716 } else if (istemplatekind(rat_type, "*")) {
717 return *;
718 } else {
719 return tr_RATType(rat_type);
720 }
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100721 }
722
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100723 template (value) RoutingAreaIdentity ts_RoutingAreaIdentity(template (value) hexstring mcc_digits,
724 template (value) hexstring mnc_digits,
725 template (value) OCT2 lac,
726 template (value) OCT1 rac) := {
727 type_gtpc := '03'O,
728 mcc_digits := mcc_digits,
729 mnc_digits := mnc_digits,
730 lac := lac,
731 rac := rac
732 }
733
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100734 template (value) GeographicLocationCGI
735 ts_GeographicLocationCGI(template (value) hexstring mcc,
Philipp Maier57889492023-08-07 12:10:03 +0200736 template (value) hexstring mnc,
737 template (value) OCT2 lac,
738 template (value) OCT2 cI_value) :=
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100739 {
740 mccDigit1 := mcc[0],
741 mccDigit2 := mcc[1],
742 mccDigit3 := mcc[2],
743 mncDigit3 := mnc[2], /* 'F'H for 2 digit MNC */
744 mncDigit1 := mnc[0],
745 mncDigit2 := mnc[1],
746 lac := lac,
747 cI_value := cI_value
748 }
749
Philipp Maier57889492023-08-07 12:10:03 +0200750 template (value) GTPC_PDUs ts_CreatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
751 BIT4 nsapi, EndUserAddress eua, octetstring apn,
752 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
753 octetstring msisdn, template (omit) ProtConfigOptions pco := omit,
754 template (omit) OCT1 ratType := omit,
755 template (omit) UserLocationInformation uli := omit,
756 template (omit) OCT2 charging_char := omit,
757 template (omit) OCT8 imeisv := omit,
758 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100759 createPDPContextRequest := {
760 imsi := ts_Imsi(imsi),
761 rai := omit,
762 recovery := ts_Recovery(restart_ctr),
763 selectionMode := {
764 type_gtpc := '0F'O,
765 selectModeValue := '00'B,
766 spare := '111111'B
767 },
768 teidDataI := {
769 type_gtpc := '00'O,
770 teidDataI := teid_data
771 },
772 teidControlPlane := {
773 type_gtpc := '00'O,
774 teidControlPlane := teid_ctrl
775 },
776 nsapi := {
777 type_gtpc := '00'O,
778 nsapi := nsapi,
779 unused := '0000'B
780 },
781 linked_nsapi := omit,
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200782 charging_char := f_ts_ChargingCharacteristics(charging_char),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100783 trace_ref := omit,
784 trace_type := omit,
785 endUserAddress := eua,
786 accessPointName := ts_APN(apn),
787 protConfigOptions := pco,
788 sgsn_addr_signalling := ts_GsnAddr(sgsn_ip_sign),
789 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
790 msisdn := ts_Msisdn(msisdn),
791 qualityOfServiceProfile := ts_QosDefault,
792 tft := omit,
793 triggerId := omit,
794 omcId := omit,
795 commonFlags := omit,
796 aPN_Restriction := omit,
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100797 ratType := f_ts_RATType(ratType),
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100798 userLocationInformation := uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200799 mS_TimeZone := ms_tz,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200800 imeisv := f_ts_IMEISV(imeisv),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100801 camelChargingInformationContainer := omit,
802 additionalTraceInfo := omit,
803 correlationID := omit,
804 evolvedAllocationRetentionPriorityI := omit,
805 extendedCommonFlags := omit,
806 userCSGInformation := omit,
807 aPN_AMBR := omit,
808 signallingPriorityIndication := omit,
809 cN_OperatorSelectionEntity := omit,
810 private_extension_gtpc := omit
811 }
812 }
813
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100814 template (value) Gtp1cUnitdata ts_GTPC_CreatePDP(Gtp1cPeer peer, uint16_t seq, hexstring imsi,
Philipp Maier57889492023-08-07 12:10:03 +0200815 OCT1 restart_ctr, OCT4 teid_data,
816 OCT4 teid_ctrl, BIT4 nsapi, EndUserAddress eua,
817 octetstring apn, octetstring sgsn_ip_sign,
818 octetstring sgsn_ip_data, octetstring msisdn,
819 template (omit) ProtConfigOptions pco := omit,
820 template (omit) OCT1 ratType := omit,
821 template (omit) UserLocationInformation uli := omit,
822 template (omit) OCT2 charging_char := omit,
823 template (omit) OCT8 imeisv := omit,
824 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100825 peer := peer,
826 gtpc := ts_GTP1C_PDU(createPDPContextRequest, '00000000'O,
827 valueof(ts_CreatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
828 nsapi, eua, apn, sgsn_ip_sign,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200829 sgsn_ip_data, msisdn, pco, ratType, uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200830 charging_char, imeisv, ms_tz)), seq)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100831 }
832
Harald Welteeded9ad2018-02-17 20:57:34 +0100833
Philipp Maier57889492023-08-07 12:10:03 +0200834 template (value) GTPC_PDUs ts_UpdatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
835 BIT4 nsapi,
836 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
837 template (omit) ProtConfigOptions pco := omit,
838 template (omit) OCT1 ratType := omit,
839 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100840 updatePDPContextRequest := {
841 updatePDPContextRequestSGSN := {
842 imsi := ts_Imsi(imsi),
843 rai := omit,
844 recovery := ts_Recovery(restart_ctr),
845 teidDataI := {
846 type_gtpc := '00'O,
847 teidDataI := teid_data
848 },
849 teidControlPlane := {
850 type_gtpc := '00'O,
851 teidControlPlane := teid_ctrl
852 },
853 nsapi := {
854 type_gtpc := '00'O,
855 nsapi := nsapi,
856 unused := '0000'B
857 },
858 trace_ref := omit,
859 trace_type := omit,
860 protConfigOptions := pco,
861 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_ip_sign),
862 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
863 alt_ggsn_addr_controlPane := omit,
864 alt_ggsn_addr_traffic := omit,
865 qualityOfServiceProfile := ts_QosDefault,
866 tft := omit,
867 triggerId := omit,
868 omcId := omit,
869 commonFlags := omit,
870 ratType := f_ts_RATType(ratType),
871 userLocationInformation := uli,
872 mS_TimeZone := omit,
873 additionalTraceInfo := omit,
874 directTunnelFlags := omit,
875 evolvedAllocationRetentionPriorityI := omit,
876 extendedCommonFlags := omit,
877 userCSGInformation := omit,
878 aPN_AMBR := omit,
879 signallingPriorityIndication := omit,
880 cN_OperatorSelectionEntity := omit,
881 private_extension_gtpc := omit
882 }
883 }
884 }
885
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100886 template (value) Gtp1cUnitdata ts_GTPC_UpdatePDP(Gtp1cPeer peer, OCT4 teid, uint16_t seq, hexstring imsi,
Philipp Maier57889492023-08-07 12:10:03 +0200887 OCT1 restart_ctr, OCT4 teid_data,
888 OCT4 teid_ctrl, BIT4 nsapi, octetstring sgsn_ip_sign,
889 octetstring sgsn_ip_data,
890 template (omit) ProtConfigOptions pco := omit,
891 template (omit) OCT1 ratType := omit,
892 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100893 peer := peer,
894 gtpc := ts_GTP1C_PDU(updatePDPContextRequest, teid,
895 valueof(ts_UpdatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
896 nsapi, sgsn_ip_sign,
897 sgsn_ip_data, pco, ratType, uli)), seq)
898 }
899
900
Philipp Maier57889492023-08-07 12:10:03 +0200901 template (value) NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100902 type_gtpc := '14'O,
903 nsapi := nsapi,
904 unused := '0000'B
905 }
906
Philipp Maier57889492023-08-07 12:10:03 +0200907 template (value) ReorderingRequired ts_ReorderReq(boolean req := false) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100908 type_gtpc := '08'O,
909 reordreq := bool2bit(req),
910 spare := '0000000'B
911 }
912
Philipp Maier57889492023-08-07 12:10:03 +0200913 template (value) GTPC_PDUs ts_CreatePdpRespPDU(OCT1 cause, OCT4 teid_data, OCT4 teid_ctrl, BIT4 nsapi,
914 octetstring ggsn_ip_sign, octetstring ggsn_ip_data,
915 OCT4 chg_id, template (omit) EndUserAddress eua := omit,
916 template (omit) Recovery_gtpc recovery := omit,
917 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100918 createPDPContextResponse := {
919 cause := { '00'O, cause },
920 reorderingRequired := ts_ReorderReq(false),
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200921 recovery := recovery,
Harald Welteeded9ad2018-02-17 20:57:34 +0100922 teidDataI := {
923 type_gtpc := '00'O,
924 teidDataI := teid_data
925 },
926 teidControlPlane := {
927 type_gtpc := '00'O,
928 teidControlPlane := teid_ctrl
929 },
930 nsapi := ts_NSAPI(nsapi),
Harald Welte7aff2ca2018-02-18 15:34:50 +0100931 chargingID := {
932 type_gtpc := '7F'O,
933 chargingID := chg_id
934 },
Harald Welteeded9ad2018-02-17 20:57:34 +0100935 endUserAddress := eua,
936 protConfigOptions := pco,
937 ggsn_addr_controlPlane := ts_GsnAddr(ggsn_ip_sign),
938 ggsn_addr_traffic := ts_GsnAddr(ggsn_ip_data),
939 alt_ggsn_addr_controlPane := omit,
940 alt_ggsn_addr_traffic := omit,
941 qualityOfServiceProfile := ts_QosDefault,
942 commonFlags := omit,
943 aPN_Restriction := omit,
944 mS_InfoChangeReportingAction := omit,
945 bearerControlMode := omit,
946 evolvedAllocationRetentionPriorityI := omit,
947 extendedCommonFlag := omit,
948 csg_information_reporting_action := omit,
949 aPN_AMBR := omit,
950 gGSN_BackOffTime := omit,
951 private_extension_gtpc := omit
952 }
953 }
954
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100955 template (value) Gtp1cUnitdata ts_GTPC_CreatePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +0200956 OCT1 cause,
957 OCT4 teid_ctrl, OCT4 teid_data,
958 BIT4 nsapi, octetstring ggsn_ip_sign,
959 octetstring ggsn_ip_data, OCT4 chg_id,
960 template (omit) EndUserAddress eua := omit,
961 template (omit) Recovery_gtpc recovery := omit,
962 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100963 peer := peer,
964 gtpc := ts_GTP1C_PDU(createPDPContextResponse, teid,
965 valueof(ts_CreatePdpRespPDU(cause, teid_data, teid_ctrl, nsapi,
Harald Welte7aff2ca2018-02-18 15:34:50 +0100966 ggsn_ip_sign, ggsn_ip_data, chg_id,
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200967 eua, recovery, pco)), seq)
Harald Welteeded9ad2018-02-17 20:57:34 +0100968 }
969
Harald Weltec69cf4e2018-02-17 20:57:02 +0100970 /* PCO send base template */
Philipp Maier57889492023-08-07 12:10:03 +0200971 template (value) ProtConfigOptions ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100972 type_gtpc := '84'O,
973 lengthf := 0,
974 configProtocol := '000'B,
975 spare := '0000'B,
976 extension0 := '1'B,
977 protocols := {}
978 }
979 /* PCO receive base template */
Philipp Maier57889492023-08-07 12:10:03 +0200980 template (present) ProtConfigOptions tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100981 type_gtpc := '84'O,
982 lengthf := ?,
983 configProtocol := '000'B,
984 spare := ?,
985 extension0 := '1'B,
986 protocols := {}
987 }
988
Philipp Maier57889492023-08-07 12:10:03 +0200989 template (value) ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100990 protocols := {
991 { protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O }
992 }
993 }
Philipp Maier57889492023-08-07 12:10:03 +0200994 template (present) ProtConfigOptions tr_PCO_IPv6_DNS_resp(template (present) OCT16 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100995 protocols := {
996 *, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, *
997 }
998 }
999
Pau Espin Pedrolcff72f82024-01-26 16:58:48 +01001000 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP(uint8_t ipcp_req_id := 0) modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001001 protocols := {
1002 /* dummy PAP entry to check if our parser in the GGSN can properly iterate over
1003 * the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */
1004 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1005 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
Pau Espin Pedrolcff72f82024-01-26 16:58:48 +01001006 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS(ipcp_req_id))) }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001007 }
1008 }
1009
Philipp Maier57889492023-08-07 12:10:03 +02001010 template (value) ProtConfigOptions ts_PCO_IPv4_PRI_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001011 protocols := {
1012 /* dummy PAP entry to check if our parser can cope with a single primary DNS entry
1013 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
1014 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1015 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1016 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) }
1017 }
1018 }
Philipp Maier57889492023-08-07 12:10:03 +02001019 template (value) ProtConfigOptions ts_PCO_IPv4_SEC_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001020 protocols := {
1021 /* dummy PAP entry to check if our parser can cope with a single secondary DNS entry
1022 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
1023 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1024 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1025 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1026 }
1027 }
Philipp Maier57889492023-08-07 12:10:03 +02001028 template (value) ProtConfigOptions ts_PCO_IPv4_SEPARATE_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001029 protocols := {
1030 /* dummy PAP entry to check if our parser can cope with a primary and secondary DNS
1031 * in separate IPCP containers OS#3381 */
1032 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1033 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1034 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) },
1035 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1036 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1037 }
1038 }
1039
Philipp Maier57889492023-08-07 12:10:03 +02001040 template (present) ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001041 protocolID := prot_id,
1042 lengthProtoID := ?,
1043 protoIDContents := ?
1044 }
Philipp Maier57889492023-08-07 12:10:03 +02001045 template (value) ProtocolElement ts_PCOelem_PAP_broken := {
Harald Weltef8298542019-04-10 10:15:28 +02001046 protocolID := 'C023'O,
1047 lengthProtoID := 60,
1048 /* PPP Password Authentication Protocol containing incorrect Peer-Id-Length set to 4 (6-7 should be the valid one), see OS#3914. */
1049 protoIDContents := '0100003c'O & '0444435338323700bc1c08087c1508083e00790000150808fd06000001000000000000000000000000000000000000000000000000000000'O
1050 }
Philipp Maier57889492023-08-07 12:10:03 +02001051 template (value) ProtConfigOptions ts_PCO_PAP_IPv4_DNS modifies ts_PCO := {
Harald Weltef8298542019-04-10 10:15:28 +02001052 protocols := {
1053 ts_PCOelem_PAP_broken,
1054 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
1055 }
1056 }
Philipp Maier57889492023-08-07 12:10:03 +02001057 template (present) ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001058 protocols := { *, tr_PCO_Proto(prot_id), * }
1059 }
1060
Philipp Maier57889492023-08-07 12:10:03 +02001061 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001062 protocols := {
1063 { protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
1064 }
1065 }
Philipp Maier57889492023-08-07 12:10:03 +02001066 template (present) ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template (present) OCT4 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001067 protocols := {
1068 *, { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }, *
1069 }
1070 }
1071
1072 /* extract a given protocol payload from PCO */
1073 function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring {
1074 var integer i;
1075 var integer num_matches := 0;
1076 for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
1077 if (pco.protocols[i].protocolID == protocol) {
1078 num_matches := num_matches + 1;
1079 if (num_matches == nth_match) {
1080 return pco.protocols[i].protoIDContents;
1081 }
1082 }
1083 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +02001084 setverdict(fail, "Could not extract protocol payload from protocol ", protocol);
1085 mtc.stop;
Harald Weltec69cf4e2018-02-17 20:57:02 +01001086 return ''O;
1087 }
1088
Philipp Maier57889492023-08-07 12:10:03 +02001089 template (present) IpcpPacket tr_IPCP(template (present) LcpCode code, template (present)uint8_t identifier,
1090 template (present) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001091 code := code,
1092 identifier := identifier,
1093 len := ?,
1094 options := opts
1095 }
Philipp Maier57889492023-08-07 12:10:03 +02001096 template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001097 code := IPCP_OPT_PrimaryDNS,
1098 len := 6,
1099 data := addr
1100 }
Philipp Maier57889492023-08-07 12:10:03 +02001101 template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001102 code := IPCP_OPT_SecondaryDNS,
1103 len := 6,
1104 data := addr
1105 }
Philipp Maier57889492023-08-07 12:10:03 +02001106 template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?,
1107 template (present) OCT4 dns1 := ?,
1108 template (present) OCT4 dns2 := ?) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001109 tr_IPCP(LCP_Configure_Ack, identifier,
1110 { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
1111
Philipp Maier57889492023-08-07 12:10:03 +02001112 template (value) IpcpPacket ts_IPCP(LcpCode code, uint8_t identifier, template (value) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001113 code := code,
1114 identifier := identifier,
1115 len := 0, /* overwritten */
1116 options := opts
1117 }
Philipp Maier57889492023-08-07 12:10:03 +02001118 template (value) IpcpPacket ts_IPCP_ReqDNS(uint8_t identifier := 0) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001119 ts_IPCP(LCP_Configure_Request, identifier,
1120 { tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) });
1121
Philipp Maier57889492023-08-07 12:10:03 +02001122 template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001123 ts_IPCP(LCP_Configure_Request, identifier,
1124 { tr_IPCP_PrimaryDns('00000000'O) });
Philipp Maier57889492023-08-07 12:10:03 +02001125 template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001126 ts_IPCP(LCP_Configure_Request, identifier,
1127 { tr_IPCP_SecondaryDns('00000000'O) });
1128
Harald Welte57b9b7f2018-02-18 22:28:13 +01001129 function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd {
1130 if (istemplatekind(ind, "omit")) {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001131 return omit;
1132 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001133 var TearDownInd ret := {
1134 type_gtpc := '13'O,
1135 tdInd := valueof(ind),
1136 spare:= '0000000'B
1137 }
1138 return ret;
1139 }
1140
Philipp Maier57889492023-08-07 12:10:03 +02001141 template (value) GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001142 deletePDPContextRequest := {
1143 cause := omit,
1144 tearDownIndicator := f_teardown_ind_IE(teardown_ind),
1145 nsapi := {
1146 type_gtpc := '14'O,
1147 nsapi := nsapi,
1148 unused := '0000'B
1149 },
1150 protConfigOptions := omit,
1151 userLocationInformation := omit,
1152 mS_TimeZone := omit,
1153 extendedCommonFlags := omit,
1154 uLI_Timestamp := omit,
1155 private_extension_gtpc := omit
1156 }
1157 }
1158
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001159 template (value) Gtp1cUnitdata ts_GTPC_DeletePDP(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +02001160 BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001161 peer := peer,
1162 gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid,
1163 valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq)
1164 }
1165
Philipp Maier57889492023-08-07 12:10:03 +02001166 template (value) GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause,
1167 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001168 deletePDPContextResponse := {
1169 cause := { '00'O, cause },
1170 protConfigOptions := pco,
1171 userLocationInformation := omit,
1172 mS_TimeZone := omit,
1173 uLI_Timestamp := omit,
1174 private_extension_gtpc := omit
1175 }
1176 }
1177
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001178 template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +02001179 OCT1 cause,
1180 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001181 peer := peer,
1182 gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid,
1183 valueof(ts_DeletePdpRespPDU(cause, pco)), seq)
1184 }
1185
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001186 /* SGSN Context Request - 7.5.3 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001187 template (present) GTPC_PDUs tr_SGSNContextReqPDU(template (present) RoutingAreaIdentity rai := ?,
1188 template (present) OCT4 teic := ?,
1189 template (present) octetstring sgsn_addr_control := ?,
1190 template hexstring imsi := *,
1191 template BIT1 msValidated := *,
1192 template TLLI tlli := *,
1193 template PacketTMSI ptmsi := *,
1194 template PTMSI_Signature ptmsi_sig := *,
1195 template OCT1 rat_type := *) := {
1196 sgsn_ContextRequest := {
1197 imsi := f_tr_Imsi(imsi),
1198 routingAreaIdentity := rai,
1199 tlli := tlli,
1200 packetTMSI := ptmsi,
1201 ptmsi_Signature := ptmsi_sig,
1202 ms_Validated := f_tr_MS_Validated(msValidated),
1203 teidControlPlane := {
1204 type_gtpc := '11'O,
1205 teidControlPlane := teic
1206 },
1207 sgsn_addr_controlPlane := tr_GsnAddr(sgsn_addr_control),
1208 alternative_sgsn_addr_controlPlane := *,
1209 sGSN_Number := *,
1210 ratType := f_tr_RATType(rat_type),
1211 hopCounter := *,
1212 private_extension_gtpc := *
1213 }
1214 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001215 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextReq(template (present) Gtp1cPeer peer,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001216 template (present) GTPC_PDUs SGSNContextReqPDU) := {
1217 peer := peer,
1218 gtpc := tr_GTP1C_PDU(sgsnContextRequest, '00000000'O, SGSNContextReqPDU)
1219 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001220 template (value) GTPC_PDUs ts_SGSNContextReqPDU(template (value) RoutingAreaIdentity rai,
1221 template (value) OCT4 teic,
1222 template (value) octetstring sgsn_addr_control,
1223 template (omit) hexstring imsi := omit,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001224 template (omit) BIT1 msValidated := '0'B,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001225 template (omit) TLLI tlli := omit,
1226 template (omit) PacketTMSI ptmsi := omit,
1227 template (omit) PTMSI_Signature ptmsi_sig := omit,
1228 template (omit) OCT1 rat_type := omit) := {
1229 sgsn_ContextRequest := {
1230 imsi := f_ts_Imsi(imsi),
1231 routingAreaIdentity := rai,
1232 tlli := tlli,
1233 packetTMSI := ptmsi,
1234 ptmsi_Signature := ptmsi_sig,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001235 ms_Validated := f_ts_MS_Validated(msValidated),
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001236 teidControlPlane := {
1237 type_gtpc := '11'O,
1238 teidControlPlane := teic
1239 },
1240 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1241 alternative_sgsn_addr_controlPlane := omit,
1242 sGSN_Number := omit,
1243 ratType := f_ts_RATType(rat_type),
1244 hopCounter := omit,
1245 private_extension_gtpc := omit
1246 }
1247 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001248 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextReq(Gtp1cPeer peer, uint16_t seq,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001249 template (value) GTPC_PDUs SGSNContextReqPDU) := {
1250 peer := peer,
1251 gtpc := ts_GTP1C_PDU(sgsnContextRequest, '00000000'O, valueof(SGSNContextReqPDU), seq)
1252 }
1253
1254 /* SGSN Context Response - 7.5.4 */
1255 template (present) GTPC_PDUs tr_SGSNContextRespPDU(template (present) GTP_Cause cause := ?,
1256 template hexstring imsi := *) := {
1257 sgsn_ContextResponse := {
1258 cause := tr_Cause_gtpc(cause),
1259 imsi := f_tr_Imsi(imsi),
1260 teidControlPlane := *,
1261 rabContext := *,
1262 radioPrioritySMS := *,
1263 radioPriority := *,
1264 packetFlowID := *,
1265 charging_char := *,
1266 mm_Context := *,
1267 pdp_Context := *,
1268 sgsn_addr_controlPlane := *,
1269 pdpContextPriorization := *,
1270 radioPriority_LCS := *,
1271 mBMS_UE_Context := *,
1272 subscribedRFSP_Index := *,
1273 rFSP_IndexInUse := *,
1274 colocatedGGSN_PGW_FQDN := *,
1275 evolvedAllocationRetentionPriorityII := *,
1276 extendedCommonFlags := *,
1277 ue_network_capability := *,
1278 ue_ambr := *,
1279 apn_ambr_nsapi := *,
1280 signallingPriorityIndication_nsapi := *,
1281 higher_bitrates_than_16mbps_flag := *,
1282 selectionMode_nsapi := *,
1283 localHomeNetworkID_nsapi := *,
1284 uE_UsageType := *,
1285 extendedCommonFlagsII := *,
1286 private_extension_gtpc := *
1287 }
1288 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001289 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextResp(template (present) Gtp1cPeer peer := ?,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001290 template (present) OCT4 teid := ?,
1291 template (present) GTPC_PDUs SGSNContextRespPDU := ?)
1292 := tr_GTPC_MsgType(peer, sgsnContextResponse, teid, SGSNContextRespPDU);
1293
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001294 template (value) GTPC_PDUs ts_SGSNContextRespPDU(template (value) GTP_Cause cause,
1295 template (omit) hexstring imsi := omit,
1296 template (omit) OCT4 teic := omit,
1297 template (omit) octetstring sgsn_addr_control := omit,
1298 template (omit) MM_Context mm_context := omit,
1299 template (omit) PDP_Context_GTPC_List pdp_ctx_list := omit) := {
1300 sgsn_ContextResponse := {
1301 cause := ts_Cause_gtpc(cause),
1302 imsi := f_ts_Imsi(imsi),
1303 teidControlPlane := f_ts_TEIC(teic),
1304 rabContext := omit,
1305 radioPrioritySMS := omit,
1306 radioPriority := omit,
1307 packetFlowID := omit,
1308 charging_char := omit,
1309 mm_Context := mm_context,
1310 pdp_Context := pdp_ctx_list,
1311 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1312 pdpContextPriorization := omit,
1313 radioPriority_LCS := omit,
1314 mBMS_UE_Context := omit,
1315 subscribedRFSP_Index := omit,
1316 rFSP_IndexInUse := omit,
1317 colocatedGGSN_PGW_FQDN := omit,
1318 evolvedAllocationRetentionPriorityII := omit,
1319 extendedCommonFlags := omit,
1320 ue_network_capability := omit,
1321 ue_ambr := omit,
1322 apn_ambr_nsapi := omit,
1323 signallingPriorityIndication_nsapi := omit,
1324 higher_bitrates_than_16mbps_flag := omit,
1325 selectionMode_nsapi := omit,
1326 localHomeNetworkID_nsapi := omit,
1327 uE_UsageType := omit,
1328 extendedCommonFlagsII := omit,
1329 private_extension_gtpc := omit
1330 }
1331 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001332 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextResp(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001333 template (value) GTPC_PDUs SGSNContextRespPDU) := {
1334 peer := peer,
1335 gtpc := ts_GTP1C_PDU(sgsnContextResponse, teid, valueof(SGSNContextRespPDU), seq)
1336 }
1337
1338
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001339 /* SGSN Context Acknowledge - 7.5.5 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001340 template (present) GTPC_PDUs tr_SGSNContextAckPDU(template (present) GTP_Cause cause := ?) := {
1341 sgsn_ContextAcknowledge := {
1342 cause := tr_Cause_gtpc(cause),
1343 teidDataII := *,
1344 sgsn_AddressForUserTraffic := *,
1345 sgsn_Number := *,
1346 nodeIdentifier := *,
1347 private_extension_gtpc := *
1348 }
1349 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001350 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextAck(template (present) Gtp1cPeer peer := ?,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001351 template (present) OCT4 teid := ?,
1352 template (present) GTPC_PDUs SGSNContextAckPDU := ?)
1353 := tr_GTPC_MsgType(peer, sgsnContextAcknowledge, teid, SGSNContextAckPDU);
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001354 template (value) GTPC_PDUs ts_SGSNContextAckPDU(template (value) GTP_Cause cause := GTP_CAUSE_REQUEST_ACCEPTED) := {
1355 sgsn_ContextAcknowledge := {
1356 cause := ts_Cause_gtpc(cause),
1357 teidDataII := omit,
1358 sgsn_AddressForUserTraffic := omit,
1359 sgsn_Number := omit,
1360 nodeIdentifier := omit,
1361 private_extension_gtpc := omit
1362 }
1363 }
Vadim Yanitskiy061c36d2024-04-19 02:07:52 +07001364
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001365 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextAck(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
Vadim Yanitskiy061c36d2024-04-19 02:07:52 +07001366 template (value) GTPC_PDUs SGSNContextAckPDU := ts_SGSNContextAckPDU) := {
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001367 peer := peer,
Pau Espin Pedrolca651b52023-12-20 18:37:39 +01001368 gtpc := ts_GTP1C_PDU(sgsnContextAcknowledge, teid, valueof(SGSNContextAckPDU), seq)
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001369 }
Harald Welte6f203162018-02-18 22:04:55 +01001370
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001371 /* GTP-C RIM */
1372
1373 template (value) RIM_Application_Identity_GTPC ts_GTPC_RIM_Application_Identity(OCT1 app_id) := {
1374 iEI := '4B'O,
1375 ext := '1'B,
1376 lengthIndicator := {
1377 length1 := 1
1378 },
1379 rIMApplicationIdentity := app_id
1380 }
1381 /* 3GPP TS 48.018 11.3.62 */
1382 template (value) RIM_Sequence_Number_GTPC ts_GTPC_RIM_Sequence_Number(integer seq) := {
1383 iEI := '4C'O,
1384 ext := '1'B,
1385 lengthIndicator := {
1386 length1 := 4
1387 },
1388 rIMSequenceNumber := int2oct(seq, 4)
1389 }
1390 template (value) RIM_PDU_Indications_GTPC ts_GTPC_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
1391 iEI := '4F'O,
1392 ext := '1'B,
1393 lengthIndicator := {
1394 length1 := 1
1395 },
1396 ack := bool2bit(ack),
1397 pDU_Type_Extension := type_ext,
1398 reserved := '0000'B
1399 }
1400 /* 3GPP TS 48.018 11.3.67 */
1401 template (value) RIM_Protocol_Version_Number_GTPC ts_GTPC_RIM_Protocol_Version_Number(integer ver) := {
1402 iEI := '55'O,
1403 ext := '1'B,
1404 lengthIndicator := {
1405 length1 := 1
1406 },
1407 rIMProtocolVersionNumber := int2oct(ver, 1)
1408 }
Philipp Maier57889492023-08-07 12:10:03 +02001409 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 +02001410 var template Cell_Identifier_V_GTPC ret := {
1411 mccDigit1 := ?,
1412 mccDigit2 := ?,
1413 mccDigit3 := ?,
1414 mncDigit3 := ?,
1415 mncDigit1 := ?,
1416 mncDigit2 := ?,
1417 lac := ?,
1418 rac := ?,
1419 cI_value := ?
1420 }
Philipp Maier57889492023-08-07 12:10:03 +02001421 if (istemplatekind(cid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001422 return ?;
1423 }
1424 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1425 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1426 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1427 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1428 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1429 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1430 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1431 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1432 }
1433 if (isvalue(cid.ra_id.lai.lac)) {
1434 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
1435 }
1436 }
1437 if (isvalue(cid) and isvalue(cid.ra_id)) {
1438 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
1439 }
1440 if (isvalue(cid)) {
1441 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
1442 }
1443 return ret;
1444 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001445 template (value) Cell_Identifier_V_GTPC ts_GTPC_Cell_Identifier_V(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001446 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1447 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1448 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1449 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1450 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1451 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1452 lac := int2oct(cid.ra_id.lai.lac, 2),
1453 rac := int2oct(cid.ra_id.rac, 1),
1454 cI_value := int2oct(cid.cell_id, 2)
1455 }
Philipp Maier57889492023-08-07 12:10:03 +02001456 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_cid(GTP_CellId cid) := {
1457 cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001458 }
Philipp Maier57889492023-08-07 12:10:03 +02001459 function tr_GTPC_ENB_Identifier(template (present) GTP_CellId cid,
1460 template (present) integer tac,
1461 template (present) octetstring gnbid) return template (present) ENB_Identifier {
1462 var template (present) ENB_Identifier ret := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001463 mccDigit1 := ?,
1464 mccDigit2 := ?,
1465 mccDigit3 := ?,
1466 mncDigit3 := ?,
1467 mncDigit1 := ?,
1468 mncDigit2 := ?,
1469 tAC := ?,
1470 globalENB_ID := ?
1471 }
Philipp Maier57889492023-08-07 12:10:03 +02001472 if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001473 return ?;
1474 }
1475 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1476 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1477 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1478 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1479 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1480 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1481 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1482 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1483 }
1484 }
1485 if (isvalue(tac)) {
1486 ret.tAC := int2oct(valueof(tac), 2);
1487 }
1488 if (isvalue(gnbid)) {
1489 ret.globalENB_ID := gnbid;
1490 }
1491
1492 return ret;
1493 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001494 template (value) ENB_Identifier ts_GTPC_ENB_Identifier(GTP_CellId cid, integer tac, octetstring gnbid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001495 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1496 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1497 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1498 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1499 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1500 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1501 tAC := int2oct(tac, 2),
1502 globalENB_ID := gnbid
1503 }
Philipp Maier57889492023-08-07 12:10:03 +02001504 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_enbid(GTP_CellId cid, integer tac, octetstring gnbid) := {
1505 eNB_Identifier := ts_GTPC_ENB_Identifier(cid, tac, gnbid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001506 }
Philipp Maier57889492023-08-07 12:10:03 +02001507 template (present) RIM_Routing_Information_GTPC
1508 tr_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (present) RIM_Routing_Address_GTPC addr) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001509 iEI := '54'O,
1510 ext := '1'B,
1511 lengthIndicator := {
1512 length1 := ?
1513 },
1514 rIMRoutingAddressDiscriminator := addr_discr,
1515 spare := '0'H,
1516 rIM_Routing_Address := addr
1517 }
1518 template (value) RIM_Routing_Information_GTPC
1519 ts_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address_GTPC addr) := {
1520 iEI := '54'O,
1521 ext := '1'B,
1522 lengthIndicator := {
1523 length1 := 0 /* overwritten */
1524 },
1525 rIMRoutingAddressDiscriminator := addr_discr,
1526 spare := '0'H,
1527 rIM_Routing_Address := addr
1528 }
1529 /* 3GPP TS 48.018 11.3.63.1.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001530 template (present) RAN_Information_Request_Application_Container_NACC_GTPC
1531 tr_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001532 iEI := '4D'O,
1533 ext := '1'B,
1534 lengthIndicator := {
1535 length1 := ?
1536 },
1537 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid)
1538 }
1539 template (value) RAN_Information_Request_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001540 ts_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001541 iEI := '4D'O,
1542 ext := '1'B,
1543 lengthIndicator := {
1544 length1 := 0 /* overwritten */
1545 },
1546 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
1547 }
1548 /* 3GPP TS 48.018 11.3.63.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001549 template (present) RAN_Information_Request_Application_Container_GTPC
1550 tru_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001551 nacc := tr_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1552 }
1553 template (value) RAN_Information_Request_Application_Container_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001554 tsu_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001555 nacc := ts_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1556 }
1557 /* 3GPP TS 48.018 11.3.63.2.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001558 template (present) RAN_Information_Application_Container_NACC_GTPC
1559 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 +02001560 iEI := '4E'O,
1561 ext := '1'B,
1562 lengthIndicator := {
1563 length1 := ?
1564 },
1565 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid),
1566 typeBit := bool2bit(psi_type),
1567 number_of_SI_PSI := int2bit(si_psi_num, 7),
1568 sI_PSI := si_psi
1569 }
1570 template (value) RAN_Information_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001571 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 +02001572 iEI := '4E'O,
1573 ext := '1'B,
1574 lengthIndicator := {
1575 length1 := 0 /* overwritten */
1576 },
1577 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid),
1578 typeBit := bool2bit(psi_type),
1579 number_of_SI_PSI := int2bit(si_psi_num, 7),
1580 sI_PSI := si_psi
1581 }
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001582 external function enc_RIM_Routing_Address_GTPC(in RIM_Routing_Address_GTPC ra) return octetstring
1583 with { extension "prototype(convert) encode(RAW)" };
Philipp Maier21bac7a2023-08-24 12:40:17 +02001584 external function dec_RIM_Routing_Address_GTPC(in octetstring stream) return RIM_Routing_Address_GTPC
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001585 with { extension "prototype(convert) decode(RAW)" };
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001586
1587 /* RAN_Information_Request */
1588 template (value) RAN_Information_Request_RIM_Container_GTPC
1589 ts_GTPC_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1590 template (value) RIM_Sequence_Number_GTPC seq,
1591 template (value) RIM_PDU_Indications_GTPC ind,
1592 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1593 template (omit) RAN_Information_Request_Application_Container_GTPC app_cont := omit,
1594 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1595 iEI := '57'O,
1596 ext := '1'B,
1597 lengthIndicator := {
1598 length1 := 0 /* overwritten */
1599 },
1600 rIM_Application_Identity := app_id,
1601 rIM_Sequence_Number := seq,
1602 rIM_PDU_Indications := ind,
1603 rIM_Protocol_Version_Number := ver,
1604 application_Container := app_cont,
1605 sON_TransferApplicationIdentity := son_app_id
1606 }
1607 template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1608 ts_GTPC_RAN_Information_Request(template (value) RIM_Routing_Information_GTPC dest,
1609 template (value) RIM_Routing_Information_GTPC src,
Philipp Maier6cef1c32023-07-24 11:01:52 +02001610 template (value) RAN_Information_Request_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001611 bssgpPduType := '71'O,
1612 destination_Cell_Identifier := dest,
1613 source_Cell_Identifier := src,
1614 rIM_Container := cont
1615 }
Philipp Maier57889492023-08-07 12:10:03 +02001616 template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1617 tr_GTPC_RAN_Information_Request(template (present) RIM_Routing_Information_GTPC dest := ?,
1618 template (present) RIM_Routing_Information_GTPC src := ?,
1619 template (present) RAN_Information_Request_RIM_Container_GTPC cont := ?) := {
Philipp Maier4b81c6e2023-07-24 11:03:15 +02001620 bssgpPduType := '71'O,
1621 destination_Cell_Identifier := dest,
1622 source_Cell_Identifier := src,
1623 rIM_Container := cont
1624 }
1625
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001626 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO_REQ(template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu) := {
1627 type_gtpc := '90'O,
1628 lengthf := 0, /* FIXME */
1629 rANTransparentContainerField := {
1630 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1631 }
1632 }
Philipp Maier57889492023-08-07 12:10:03 +02001633 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO_REQ(template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu := ?) := {
Philipp Maieredce92f2023-07-26 11:02:10 +02001634 type_gtpc := '90'O,
1635 lengthf := ?,
1636 rANTransparentContainerField := {
1637 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1638 }
1639 }
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001640
1641 /* RAN_Information */
Philipp Maier57889492023-08-07 12:10:03 +02001642 template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001643 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 +02001644 application_Container := tr_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1645 }
1646 template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001647 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 +02001648 application_Container := ts_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1649 }
Philipp Maier57889492023-08-07 12:10:03 +02001650 template (present) ApplContainer_or_ApplErrContainer_GTPC
1651 tru_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001652 nacc := cont
1653 }
1654 template (value) ApplContainer_or_ApplErrContainer_GTPC
1655 tsu_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
1656 nacc := cont
1657 }
Philipp Maier57889492023-08-07 12:10:03 +02001658 template (present) RAN_Information_RIM_Container_GTPC
1659 tr_GTPC_RAN_Information_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id,
1660 template (present) RIM_Sequence_Number_GTPC seq,
1661 template (present) RIM_PDU_Indications_GTPC ind,
1662 template RIM_Protocol_Version_Number_GTPC ver := *,
1663 template ApplContainer_or_ApplErrContainer_GTPC app_cont := *,
1664 template SON_TransferApplicationIdentity son_app_id := *) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001665 iEI := '58'O,
1666 ext := '1'B,
1667 lengthIndicator := {
1668 length1 := ?
1669 },
1670 rIM_Application_Identity := app_id,
1671 rIM_Sequence_Number := seq,
1672 rIM_PDU_Indications := ind,
1673 rIM_Protocol_Version_Number := ver,
1674 applContainer_or_ApplErrContainer := app_cont,
1675 sON_TransferApplicationIdentity := son_app_id
1676 }
1677 template (value) RAN_Information_RIM_Container_GTPC
1678 ts_GTPC_RAN_Information_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1679 template (value) RIM_Sequence_Number_GTPC seq,
1680 template (value) RIM_PDU_Indications_GTPC ind,
1681 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1682 template (omit) ApplContainer_or_ApplErrContainer_GTPC app_cont := omit,
1683 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1684 iEI := '58'O,
1685 ext := '1'B,
1686 lengthIndicator := {
1687 length1 := 0 /* overwritten */
1688 },
1689 rIM_Application_Identity := app_id,
1690 rIM_Sequence_Number := seq,
1691 rIM_PDU_Indications := ind,
1692 rIM_Protocol_Version_Number := ver,
1693 applContainer_or_ApplErrContainer := app_cont,
1694 sON_TransferApplicationIdentity := son_app_id
1695 }
Philipp Maier57889492023-08-07 12:10:03 +02001696 template (present) PDU_BSSGP_RAN_INFORMATION_GTPC
1697 tr_GTPC_RAN_Information(template (present) RIM_Routing_Information_GTPC dest,
1698 template (present) RIM_Routing_Information_GTPC src,
1699 template (present) RAN_Information_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001700 bssgpPduType := '70'O,
1701 destination_Cell_Identifier := dest,
1702 source_Cell_Identifier := src,
1703 rIM_Container := cont
1704 }
1705 template (value) PDU_BSSGP_RAN_INFORMATION_GTPC
1706 ts_GTPC_RAN_Information(template (value) RIM_Routing_Information_GTPC dest,
1707 template (value) RIM_Routing_Information_GTPC src,
1708 template (value) RAN_Information_RIM_Container_GTPC cont) := {
1709 bssgpPduType := '70'O,
1710 destination_Cell_Identifier := dest,
1711 source_Cell_Identifier := src,
1712 rIM_Container := cont
1713 }
Philipp Maier57889492023-08-07 12:10:03 +02001714 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO(template (present) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001715 type_gtpc := '90'O,
1716 lengthf := ?,
1717 rANTransparentContainerField := {
1718 pDU_BSSGP_RAN_INFORMATION := pdu
1719 }
1720 }
1721 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO(template (value) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
1722 type_gtpc := '90'O,
1723 lengthf := 0, /* overwritten */
1724 rANTransparentContainerField := {
1725 pDU_BSSGP_RAN_INFORMATION := pdu
1726 }
1727 }
1728
Philipp Maier57889492023-08-07 12:10:03 +02001729 template (present) RANTransparentContainer tr_RANTransparentContainer(template (present) RANTransparentContainerField rANTransparentContainerField) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001730 type_gtpc := '90'O,
1731 lengthf := ?,
1732 rANTransparentContainerField := rANTransparentContainerField
1733 }
1734 template (value) RANTransparentContainer ts_RANTransparentContainer(template (value) RANTransparentContainerField rANTransparentContainerField) := {
1735 type_gtpc := '90'O,
1736 lengthf := 0, /* overwritten */
1737 rANTransparentContainerField := rANTransparentContainerField
1738 }
Philipp Maier57889492023-08-07 12:10:03 +02001739 template (present) GTPC_PDUs tr_RANInfoRelay(template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001740 ranInformationRelay := {
1741 transparentContainer := transparentContainer,
1742 rIM_RoutingAddress := *,
1743 rIM_RoutingAddress_Discriminator := *,
1744 private_extension_gtpc := *
1745 }
1746 }
Philipp Maier05ad55c2023-07-24 10:56:46 +02001747 template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer,
1748 template (omit) RIM_RoutingAddress ra := omit,
1749 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001750 ranInformationRelay := {
1751 transparentContainer := transparentContainer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001752 rIM_RoutingAddress := ra,
1753 rIM_RoutingAddress_Discriminator := ra_discr,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001754 private_extension_gtpc := omit
1755 }
1756 }
Philipp Maier57889492023-08-07 12:10:03 +02001757 template (present) Gtp1cUnitdata
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001758 tr_GTPC_RANInfoRelay(template (present) Gtp1cPeer peer,
Philipp Maier57889492023-08-07 12:10:03 +02001759 template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001760 peer := peer,
1761 gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer))
1762 }
1763 template (value) Gtp1cUnitdata
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001764 ts_GTPC_RANInfoRelay(template (value) Gtp1cPeer peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001765 template (value) RANTransparentContainer transparentContainer,
1766 template (omit) RIM_RoutingAddress ra := omit,
1767 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001768 peer := peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001769 gtpc := ts_GTP1C_PDU(rANInformationRelay, '00000000'O, valueof(ts_RANInfoRelay(transparentContainer, ra, ra_discr)), 0)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001770 }
1771
1772
Philipp Maier57889492023-08-07 12:10:03 +02001773 template (present) RAN_Information_Request_RIM_Container_GTPC
1774 tr_GTPC_RAN_Information_Request_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id := ?,
1775 template (present) RIM_Sequence_Number_GTPC seq := ?,
1776 template (present) RIM_PDU_Indications_GTPC ind := ?,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001777 template RIM_Protocol_Version_Number_GTPC ver := *,
1778 template RAN_Information_Request_Application_Container_GTPC app_cont := *,
1779 template SON_TransferApplicationIdentity son_app_id := *) := {
1780 iEI := '57'O,
1781 ext := '1'B,
1782 lengthIndicator := {
1783 length1 := ?
1784 },
1785 rIM_Application_Identity := app_id,
1786 rIM_Sequence_Number := seq,
1787 rIM_PDU_Indications := ind,
1788 rIM_Protocol_Version_Number := ver,
1789 application_Container := app_cont,
1790 sON_TransferApplicationIdentity := son_app_id
1791 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001792
Philipp Maier653a0142023-08-04 15:22:37 +02001793 /* 3GPP TS 29.060, section 7.7.57 */
1794 template (value) RIM_RoutingAddress ts_RIM_RoutingAddress(octetstring addr_value) := {
1795 type_gtpc := '9F'O,
1796 lengthf := 0, /* we assume encoder overwrites this */
1797 rIM_RoutingAddressValue := addr_value
1798 }
1799 template (present) RIM_RoutingAddress tr_RIM_RoutingAddress(template (present) octetstring addr_value := ?) := {
1800 type_gtpc := '9F'O,
1801 lengthf := ?,
1802 rIM_RoutingAddressValue := addr_value
1803 }
1804
1805 /* 3GPP TS 29.060, section 7.7.77 */
1806 template (value) RIM_RoutingAddress_Discriminator ts_RIM_RoutingAddress_Discriminator(bitstring addr_discr) := {
1807 type_gtpc := 'B2'O,
1808 lengthf := 0, /* we assume encoder overwrites this */
1809 rra_discriminator := addr_discr,
1810 spare := '0000'B
1811 }
1812 template (present) RIM_RoutingAddress_Discriminator tr_RIM_RoutingAddress_Discriminator(template (present) bitstring addr_discr := ?) := {
1813 type_gtpc := 'B2'O,
1814 lengthf := ?,
1815 rra_discriminator := addr_discr,
1816 spare := '0000'B
1817 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001818}