blob: 3788725fbf1e36cf11d62a8dc6b785b4f0387f5f [file] [log] [blame]
Harald Welte34b5a952019-05-27 11:54:11 +02001/* GTP Templates in TTCN-3
2 * (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
Harald Weltec69cf4e2018-02-17 20:57:02 +010012module GTP_Templates {
13
14 import from General_Types all;
15 import from Osmocom_Types all;
16 import from GTPC_Types all;
17 import from GTPU_Types all;
18 import from GTP_CodecPort all;
19 import from IPCP_Types all;
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +010020 import from GSM_Types all; // RoutingAreaIdentification, CellIdentity
21
Pau Espin Pedrolbbff8b72024-01-15 18:45:35 +010022 template (present) OCT1 gtp1_requests := (
23 '10'O, /* createPDPContextRequest */
24 '12'O, /* updatePDPContextRequest */
25 '14'O, /* */
26 '16'O, /* deletePDPContextRequest */
27 '1B'O, /* pdu_NotificationRequest */
28 '1D'O, /* pdu_NotificationRejectRequest */
29 '1F'O, /* supportedExtensionHeadersNotification */
30 '20'O, /* sendRouteingInformationForGPRSRequest */
31 '22'O, /* failureReportRequest */
32 '24'O, /* noteMS_GPRSPresentRequest */
33 '30'O, /* identificationRequest */
34 '32'O, /* sgsn_ContextRequest */
35 '35'O, /* forwardRelocationRequest */
36 '38'O, /* relocationCancelRequest */
37 '3A'O, /* forwardSRNSContext */
38 '3D'O, /* uERegistrationQueryRequest */
39 '46'O, /* ranInformationRelay */
40 '60'O, /* mBMSNotificationRequest */
41 '62'O, /* mBMSNotificationRejectRequest */
42 '64'O, /* createMBMSContextRequest */
43 '66'O, /* updateMBMSContextRequest */
44 '68'O, /* deleteMBMSContextRequest */
45 '70'O, /* mBMSRegistrationRequest */
46 '72'O, /* mBMSDeRegistrationRequest */
47 '74'O, /* mBMSSessionStartRequest */
48 '76'O, /* mBMSSessionStopRequest */
49 '78'O, /* mBMSSessionUpdateRequest */
50 '80'O /* mS_InfoChangeNotificationRequest */
51 );
52
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +010053 type record GTP_CellId {
54 RoutingAreaIdentification ra_id,
55 CellIdentity cell_id
56 } with { encode "RAW" };
57
58 template (value) GTP_CellId ts_GTP_CellId(template (value) RoutingAreaIdentification rai, CellIdentity cell_id) := {
59 ra_id := rai,
60 cell_id := cell_id
61 };
Harald Weltec69cf4e2018-02-17 20:57:02 +010062
Harald Welte3b4c3562018-03-01 10:01:58 +010063 /* Table 38 of 3GPP TS 29.060 */
64 type enumerated GTP_Cause {
65 GTP_CAUSE_REQUEST_IMEI (1),
66 GTP_CAUSE_REQUEST_IMSI_AND_IMEI (2),
67 GTP_CAUSE_NO_IDENTITY_NEDED (3),
68 GTP_CAUSE_MS_REFUSES (4),
69 GTP_CAUSE_MS_IS_NOT_GPRS_RESPONDING (5),
70 /* reserved */
71 GTP_CAUSE_REQUEST_ACCEPTED (128)
72 /* 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 */
342 template (value) MM_Context ts_MM_ContextUMTS(template (value) OCT16 ck,
343 template (value) OCT16 ik) := {
344 type_gtpc := '81'O,
345 context := {
346 mmcontUMTS := {
347 lengthf := 0, /* overwritten */
348 ksi := '001'B,
349 usedGPRSIntegrityAlgorithm := '000'B,
350 ugipai := '1'B, /* Integrity Protection not required */
351 gupii := '1'B, /* Ignore "Used GPRS integrity protection algorithm" field" */
352 spare1 := '000'B,
353 noofVectors := 0, /* TODO: fill quintpuplets*/
354 security := '01'B, /* UMTS key and quintuplets */
355 ck := ck,
356 ik := ik,
357 quintupletlength := 0, /* overwritten */
358 quintuplet := ''O,
359 drx_par := '0000'O,
360 msNetW_cap_length := 0, /* overwritten */
361 msNetw_cap := omit,
362 containerLength := 0, /* overwritten */
363 container := omit,
364 access_restriction_data_length := 0, /* overwritten */
365 access_restriction_data := omit
366 }
367 }
368 }
369
370 /* 7.7.29 PDP Context */
371 template (value) PDP_Context_GTPC ts_PDP_Context_GTPC(template (value) octetstring pdp_addr,
372 template (value) octetstring ggsn_gsn_addr,
373 template (value) octetstring apn,
374 template (value) OCT4 ggsn_teic := '12345678'O,
375 template (value) OCT4 ggsn_teid := '87654321'O) := {
376 type_gtpc := '82'O,
377 lengthf := 0, /* overwritten */
378 nsapi := '0101'B,
379 order := '0'B,
380 asi := '0'B,
381 vaa := '0'B,
382 ea := '0'B,
383 sapi := '0011'B,
384 spare1 := '0000'B,
385 qos_subLength := 0, /* overwritten */
386 qos_sub := ts_QosProfileValueDefault,
387 qos_reqLength := 0, /* overwritten */
388 qos_req := ts_QosProfileValueDefault,
389 qos_negLength := 0, /* overwritten */
390 qos_neg := ts_QosProfileValueDefault,
391 snd := '0000'O,
392 snu := '0000'O,
393 sendNPDUnum := '00'O,
394 receiveNPDUnum := '00'O,
395 uteidControlPlane := ggsn_teic,
396 uteidData1 := ggsn_teid,
397 pdpcontext := '00'O,
398 pdp_typeorg := '0001'B, /* IETF */
399 spare2 := '1111'B,
400 pdp_typenum := '21'O, /* IETF IPV4 */
401 pdp_addressLength := 0, /* overwritten */
402 pdp_address := pdp_addr,
403 ggsn_addressControlPlaneLength := 0, /* overwritten */
404 ggsn_addressControlPlane := ggsn_gsn_addr,
405 ggsn_addressUserPlaneLength := 0, /* overwritten */
406 ggsn_addressUserPlane := ggsn_gsn_addr,
407 apnLength := 0, /* overwritten */
408 apn := apn,
409 transactionId := '0001'B,
410 spare3 := '0000'B,
411 transactionID_cont := '00'O,
412 pdp_typenum2 := omit,
413 pdp_addresslength2 := omit,
414 pdp_Address2 := omit
415 }
416
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200417
Philipp Maier1c0c7262023-07-24 10:51:53 +0200418 /* template matching reception of GTP-C unit-data */
Philipp Maier57889492023-08-07 12:10:03 +0200419 template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) GtpPeer peer,
420 template (present) OCT1 msg_type,
421 template (present) OCT4 teid,
422 template (present) GTPC_PDUs pdus := ?) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100423 peer := peer,
424 gtpc := tr_GTP1C_PDU(msg_type, teid, pdus)
425 }
426
427 /* template matching reception of GTP-C echo-request */
Philipp Maier57889492023-08-07 12:10:03 +0200428 template (present) Gtp1cUnitdata tr_GTPC_PING(template (present) GtpPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
Harald Weltec69cf4e2018-02-17 20:57:02 +0100429
Philipp Maier57889492023-08-07 12:10:03 +0200430 template (present) GTPC_PDUs tr_EchoRespPDU(template (present) OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100431 echoResponse := {
432 recovery := tr_Recovery(restart_counter),
433 private_extension_gtpc := *
434 }
435 }
436
437 /* template matching reception of GTP-C echo-response */
Philipp Maier57889492023-08-07 12:10:03 +0200438 template (present) Gtp1cUnitdata tr_GTPC_PONG(template (present) GtpPeer peer) := tr_GTPC_MsgType(peer, echoResponse, '00000000'O, tr_EchoRespPDU(?));
Harald Weltec69cf4e2018-02-17 20:57:02 +0100439
Philipp Maier57889492023-08-07 12:10:03 +0200440 template (value) GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100441 echoResponse := {
442 recovery := ts_Recovery(restart_counter),
443 private_extension_gtpc := omit
444 }
445 }
446
447 /* master template for senidng a GTP-C echo response */
Philipp Maier57889492023-08-07 12:10:03 +0200448 template (value) Gtp1cUnitdata ts_GTPC_PONG(GtpPeer peer, uint16_t seq, OCT1 rest_ctr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100449 peer := peer,
450 gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq)
451 }
452
Philipp Maier57889492023-08-07 12:10:03 +0200453 template (value) GTPC_PDUs ts_EchoReqPDU := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100454 echoRequest := {
455 private_extension_gtpc := omit
456 }
457 }
458
459 /* master template for sending a GTP-C echo request */
Philipp Maier57889492023-08-07 12:10:03 +0200460 template (value) Gtp1cUnitdata ts_GTPC_PING(GtpPeer peer, uint16_t seq) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100461 peer := peer,
462 gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq)
463 }
464
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200465 private function f_eua_ipv4_len(template OCT4 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100466 if (istemplatekind(ip_addr, "omit")) {
467 return 2;
468 } else if (istemplatekind(ip_addr, "*")) {
469 return ?;
470 } else if (istemplatekind(ip_addr, "?")) {
471 return 6;
472 }
473 return 6;
474 }
475
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200476 private function f_eua_ipv6_len(template OCT16 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100477 if (istemplatekind(ip_addr, "omit")) {
478 return 2;
479 } else if (istemplatekind(ip_addr, "*")) {
480 return ?;
481 } else if (istemplatekind(ip_addr, "?")) {
482 return 18;
483 }
484 return 18;
485 }
486
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200487 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 +0100488 var integer len := 2;
489 if (istemplatekind(ip_addr4, "*") or
490 istemplatekind(ip_addr6, "*")) {
491 return ?;
492 }
493 if (not istemplatekind(ip_addr4, "omit")) {
494 len := len + 4;
495 }
496 if (not istemplatekind(ip_addr6, "omit")) {
497 len := len + 16;
498 }
499 return len;
500 }
501
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200502 template (present) EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100503 type_gtpc := '80'O,
504 endUserAddress := {
505 endUserAddressIPv4 := {
506 lengthf := 2,
507 pdp_typeorg := '0001'B,
508 spare := '1111'B,
509 pdp_typenum := '21'O,
510 ipv4_address := ip_addr
511 }
512 }
513 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200514 template (present) EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200515 template (present) EndUserAddress tr_EuaIPv4(template (present) OCT4 ip_addr) modifies t_EuaIPv4 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100516 endUserAddress := {
517 endUserAddressIPv4 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100518 lengthf := f_eua_ipv4_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100519 }
520 }
521 }
522
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200523 template (present) EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100524 type_gtpc := '80'O,
525 endUserAddress := {
526 endUserAddressIPv6 := {
527 lengthf := 2,
528 pdp_typeorg := '0001'B,
529 spare := '1111'B,
530 pdp_typenum := '57'O,
531 ipv6_address := ip_addr
532 }
533 }
534 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200535 template (present) EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200536 template (present) EndUserAddress tr_EuaIPv6(template (present) OCT16 ip_addr) modifies t_EuaIPv6 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100537 endUserAddress := {
538 endUserAddressIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100539 lengthf := f_eua_ipv6_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100540 }
541 }
542 }
543
Oliver Smithee6a0882019-03-08 11:05:46 +0100544 /* 3GPP TS 29.060 Figure 37A: End User Address Information Element for IPv4v6 (both static) */
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200545 template (present) EndUserAddress t_EuaIPv4v6(template OCT4 ip_addr4, template OCT16 ip_addr6) := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100546 type_gtpc := '80'O,
547 endUserAddress := {
548 endUserAddressIPv4andIPv6 := {
549 lengthf := 2,
550 pdp_typeorg := '0001'B,
551 spare := '1111'B,
552 pdp_typenum := '8D'O,
553 ipv4_address := ip_addr4,
554 ipv6_address := ip_addr6
555 }
556 }
557 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200558 template (present) EndUserAddress t_EuaIPv4Dynv6Dyn := t_EuaIPv4v6(omit, omit);
Philipp Maier57889492023-08-07 12:10:03 +0200559 template (present) EndUserAddress tr_EuaIPv4v6(template (present) OCT4 ip_addr4,
560 template (present) OCT16 ip_addr6) modifies t_EuaIPv4v6 := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100561 endUserAddress := {
562 endUserAddressIPv4andIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100563 lengthf := f_eua_ipv4v6_len(ip_addr4, ip_addr6)
Oliver Smithee6a0882019-03-08 11:05:46 +0100564 }
565 }
566 }
567
Philipp Maier57889492023-08-07 12:10:03 +0200568 template (value) AccessPointName ts_APN(octetstring apn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100569 type_gtpc := '83'O,
570 lengthf := lengthof(apn),
571 apn_value := apn
572 }
573
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100574 template (value) GSN_Address_GTPC ts_GsnAddr(template (value) octetstring ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100575 type_gtpc := '85'O,
576 lengthf := lengthof(ip_addr),
577 addressf := ip_addr
578 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100579 template (present) GSN_Address_GTPC tr_GsnAddr(template (present) octetstring ip_addr := ?) := {
580 type_gtpc := '85'O,
581 lengthf := ?,
582 addressf := ip_addr
583 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100584
Philipp Maier57889492023-08-07 12:10:03 +0200585 template (value) MSISDN ts_Msisdn(octetstring msisdn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100586 type_gtpc := '86'O,
587 lengthf := lengthof(msisdn),
588 msisdn := msisdn
589 }
590
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100591 template (value) QoSV_GTPC ts_QosValueDefault := {
592 reliabilityClass := '011'B,
593 delayClass := '001'B,
594 spare1 := '00'B,
595 precedenceClass := '010'B,
596 spare2 := '0'B,
597 peakThroughput := '1001'B,
598 meanThroughput := '11111'B,
599 spare3 := '000'B,
600 deliverErroneusSDU := '010'B, /* Erroneus SDU are delivered */
601 deliveryOrder := '10'B, /* Without delivery order */
602 trafficClass := '100'B, /* Background */
603 maxSDUSize := '96'O, /* 1500 octets */
604 maxBitrateUplink := 'FE'O, /* 8640, continues in extended octet */
605 maxBitrateDownlink := 'FE'O, /* 8640, continues in extended octet */
606 sduErrorRatio := '0100'B, /* 1x10^-4 */
607 residualBER := '0101'B, /* 1x10^-3 */
608 trafficHandlingPriority := '01'B, /* prio 1 */
609 transferDelay := '000001'B, /* 10 ms */
610 guaranteedBitRateUplink := 'FE'O, /* 8640, continues in extended octet */
611 guaranteedBitRateDownlink := 'FE'O, /* 8640, continues in extended octet */
612 sourceStatisticsDescriptor := '0000'B, /* unknown */
613 signallingIndication := '0'B, /* Not optimized */
614 spare4 := '000'B,
615 maxBitrateDownlinkExt := '5B'O, /* 33 mbps */
616 guaranteedBitRateDownlinkExt := '5B'O, /* 33 mbps */
617 maxBitrateUplinkExt := '6e'O, /* 52 mbps */
618 guaranteedBitRateUplinkExt := '6e'O /* 52 mbps */
619 }
620
621 template (value) QualityOfServiceProfile_Value ts_QosProfileValueDefault := {
622 allocRetensionPrio := '00'O,
623 qos_ProfileValue := ts_QosValueDefault
624 }
625
Philipp Maier57889492023-08-07 12:10:03 +0200626 template (value) QualityOfServiceProfile ts_QosDefault := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100627 type_gtpc := '87'O,
Pau Espin Pedrol7d58b082022-06-07 13:30:03 +0200628 lengthf := 17,
Harald Weltec69cf4e2018-02-17 20:57:02 +0100629 allocRetensionPrio := '00'O,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100630 qos_ProfileValue := ts_QosValueDefault
Harald Weltec69cf4e2018-02-17 20:57:02 +0100631 }
632
Philipp Maier57889492023-08-07 12:10:03 +0200633 template (value) IMSI_gtpc ts_Imsi(hexstring digits) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100634 type_gtpc := '02'O,
635 digits := digits,
636 padding := 'F'H
637 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100638 function f_ts_Imsi(template (omit) hexstring digits := omit) return template (omit) IMSI_gtpc {
639 var template (omit) IMSI_gtpc imsi;
640 if (istemplatekind(digits, "omit")) {
641 imsi := omit;
642 } else {
643 imsi := ts_Imsi(valueof(digits));
644 }
645 return imsi;
646 }
647 template (present) IMSI_gtpc tr_Imsi(template (present) hexstring digits) := {
648 type_gtpc := '02'O,
649 digits := digits,
650 padding := 'F'H
651 }
652 function f_tr_Imsi(template hexstring digits := *) return template IMSI_gtpc {
653 if (istemplatekind(digits, "omit")) {
654 return omit;
655 } else if (istemplatekind(digits, "*")) {
656 return *;
657 } else {
658 return tr_Imsi(digits);
659 }
660 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100661
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100662 /* 7.7.50 RAT Type */
663 type enumerated GTP_RATType {
664 GTP_RAT_TYPE_RESERVED (0),
665 GTP_RAT_TYPE_UTRAN (1),
666 GTP_RAT_TYPE_GERAN (2),
667 GTP_RAT_TYPE_WLAN (3),
668 GTP_RAT_TYPE_GAN (4),
669 GTP_RAT_TYPE_HSPA_E (5),
670 GTP_RAT_TYPE_EUTRAN (6)
671 };
672 template (value) RATType ts_RATType(template (value) OCT1 rat_type) := {
673 type_gtpc := '97'O,
674 lengthf := 1,
675 ratTypeValue := rat_type
676 }
677 function f_ts_RATType(template (omit) OCT1 rat_type := omit) return template (omit) RATType {
678 if (istemplatekind(rat_type, "omit")) {
679 return omit;
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100680 } else {
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100681 return ts_RATType(rat_type);
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100682 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100683 }
684 template (present) RATType tr_RATType(template (present) OCT1 rat_type) := {
685 type_gtpc := '97'O,
686 lengthf := 1,
687 ratTypeValue := rat_type
688 }
689 function f_tr_RATType(template OCT1 rat_type := *) return template RATType {
690 if (istemplatekind(rat_type, "omit")) {
691 return omit;
692 } else if (istemplatekind(rat_type, "*")) {
693 return *;
694 } else {
695 return tr_RATType(rat_type);
696 }
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100697 }
698
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100699 template (value) RoutingAreaIdentity ts_RoutingAreaIdentity(template (value) hexstring mcc_digits,
700 template (value) hexstring mnc_digits,
701 template (value) OCT2 lac,
702 template (value) OCT1 rac) := {
703 type_gtpc := '03'O,
704 mcc_digits := mcc_digits,
705 mnc_digits := mnc_digits,
706 lac := lac,
707 rac := rac
708 }
709
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100710 template (value) GeographicLocationCGI
711 ts_GeographicLocationCGI(template (value) hexstring mcc,
Philipp Maier57889492023-08-07 12:10:03 +0200712 template (value) hexstring mnc,
713 template (value) OCT2 lac,
714 template (value) OCT2 cI_value) :=
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100715 {
716 mccDigit1 := mcc[0],
717 mccDigit2 := mcc[1],
718 mccDigit3 := mcc[2],
719 mncDigit3 := mnc[2], /* 'F'H for 2 digit MNC */
720 mncDigit1 := mnc[0],
721 mncDigit2 := mnc[1],
722 lac := lac,
723 cI_value := cI_value
724 }
725
Philipp Maier57889492023-08-07 12:10:03 +0200726 template (value) GTPC_PDUs ts_CreatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
727 BIT4 nsapi, EndUserAddress eua, octetstring apn,
728 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
729 octetstring msisdn, template (omit) ProtConfigOptions pco := omit,
730 template (omit) OCT1 ratType := omit,
731 template (omit) UserLocationInformation uli := omit,
732 template (omit) OCT2 charging_char := omit,
733 template (omit) OCT8 imeisv := omit,
734 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100735 createPDPContextRequest := {
736 imsi := ts_Imsi(imsi),
737 rai := omit,
738 recovery := ts_Recovery(restart_ctr),
739 selectionMode := {
740 type_gtpc := '0F'O,
741 selectModeValue := '00'B,
742 spare := '111111'B
743 },
744 teidDataI := {
745 type_gtpc := '00'O,
746 teidDataI := teid_data
747 },
748 teidControlPlane := {
749 type_gtpc := '00'O,
750 teidControlPlane := teid_ctrl
751 },
752 nsapi := {
753 type_gtpc := '00'O,
754 nsapi := nsapi,
755 unused := '0000'B
756 },
757 linked_nsapi := omit,
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200758 charging_char := f_ts_ChargingCharacteristics(charging_char),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100759 trace_ref := omit,
760 trace_type := omit,
761 endUserAddress := eua,
762 accessPointName := ts_APN(apn),
763 protConfigOptions := pco,
764 sgsn_addr_signalling := ts_GsnAddr(sgsn_ip_sign),
765 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
766 msisdn := ts_Msisdn(msisdn),
767 qualityOfServiceProfile := ts_QosDefault,
768 tft := omit,
769 triggerId := omit,
770 omcId := omit,
771 commonFlags := omit,
772 aPN_Restriction := omit,
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100773 ratType := f_ts_RATType(ratType),
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100774 userLocationInformation := uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200775 mS_TimeZone := ms_tz,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200776 imeisv := f_ts_IMEISV(imeisv),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100777 camelChargingInformationContainer := omit,
778 additionalTraceInfo := omit,
779 correlationID := omit,
780 evolvedAllocationRetentionPriorityI := omit,
781 extendedCommonFlags := omit,
782 userCSGInformation := omit,
783 aPN_AMBR := omit,
784 signallingPriorityIndication := omit,
785 cN_OperatorSelectionEntity := omit,
786 private_extension_gtpc := omit
787 }
788 }
789
Philipp Maier57889492023-08-07 12:10:03 +0200790 template (value) Gtp1cUnitdata ts_GTPC_CreatePDP(GtpPeer peer, uint16_t seq, hexstring imsi,
791 OCT1 restart_ctr, OCT4 teid_data,
792 OCT4 teid_ctrl, BIT4 nsapi, EndUserAddress eua,
793 octetstring apn, octetstring sgsn_ip_sign,
794 octetstring sgsn_ip_data, octetstring msisdn,
795 template (omit) ProtConfigOptions pco := omit,
796 template (omit) OCT1 ratType := omit,
797 template (omit) UserLocationInformation uli := omit,
798 template (omit) OCT2 charging_char := omit,
799 template (omit) OCT8 imeisv := omit,
800 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100801 peer := peer,
802 gtpc := ts_GTP1C_PDU(createPDPContextRequest, '00000000'O,
803 valueof(ts_CreatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
804 nsapi, eua, apn, sgsn_ip_sign,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200805 sgsn_ip_data, msisdn, pco, ratType, uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200806 charging_char, imeisv, ms_tz)), seq)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100807 }
808
Harald Welteeded9ad2018-02-17 20:57:34 +0100809
Philipp Maier57889492023-08-07 12:10:03 +0200810 template (value) GTPC_PDUs ts_UpdatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
811 BIT4 nsapi,
812 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
813 template (omit) ProtConfigOptions pco := omit,
814 template (omit) OCT1 ratType := omit,
815 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100816 updatePDPContextRequest := {
817 updatePDPContextRequestSGSN := {
818 imsi := ts_Imsi(imsi),
819 rai := omit,
820 recovery := ts_Recovery(restart_ctr),
821 teidDataI := {
822 type_gtpc := '00'O,
823 teidDataI := teid_data
824 },
825 teidControlPlane := {
826 type_gtpc := '00'O,
827 teidControlPlane := teid_ctrl
828 },
829 nsapi := {
830 type_gtpc := '00'O,
831 nsapi := nsapi,
832 unused := '0000'B
833 },
834 trace_ref := omit,
835 trace_type := omit,
836 protConfigOptions := pco,
837 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_ip_sign),
838 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
839 alt_ggsn_addr_controlPane := omit,
840 alt_ggsn_addr_traffic := omit,
841 qualityOfServiceProfile := ts_QosDefault,
842 tft := omit,
843 triggerId := omit,
844 omcId := omit,
845 commonFlags := omit,
846 ratType := f_ts_RATType(ratType),
847 userLocationInformation := uli,
848 mS_TimeZone := omit,
849 additionalTraceInfo := omit,
850 directTunnelFlags := omit,
851 evolvedAllocationRetentionPriorityI := omit,
852 extendedCommonFlags := omit,
853 userCSGInformation := omit,
854 aPN_AMBR := omit,
855 signallingPriorityIndication := omit,
856 cN_OperatorSelectionEntity := omit,
857 private_extension_gtpc := omit
858 }
859 }
860 }
861
Philipp Maier57889492023-08-07 12:10:03 +0200862 template (value) Gtp1cUnitdata ts_GTPC_UpdatePDP(GtpPeer peer, OCT4 teid, uint16_t seq, hexstring imsi,
863 OCT1 restart_ctr, OCT4 teid_data,
864 OCT4 teid_ctrl, BIT4 nsapi, octetstring sgsn_ip_sign,
865 octetstring sgsn_ip_data,
866 template (omit) ProtConfigOptions pco := omit,
867 template (omit) OCT1 ratType := omit,
868 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100869 peer := peer,
870 gtpc := ts_GTP1C_PDU(updatePDPContextRequest, teid,
871 valueof(ts_UpdatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
872 nsapi, sgsn_ip_sign,
873 sgsn_ip_data, pco, ratType, uli)), seq)
874 }
875
876
Philipp Maier57889492023-08-07 12:10:03 +0200877 template (value) NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100878 type_gtpc := '14'O,
879 nsapi := nsapi,
880 unused := '0000'B
881 }
882
Philipp Maier57889492023-08-07 12:10:03 +0200883 template (value) ReorderingRequired ts_ReorderReq(boolean req := false) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100884 type_gtpc := '08'O,
885 reordreq := bool2bit(req),
886 spare := '0000000'B
887 }
888
Philipp Maier57889492023-08-07 12:10:03 +0200889 template (value) GTPC_PDUs ts_CreatePdpRespPDU(OCT1 cause, OCT4 teid_data, OCT4 teid_ctrl, BIT4 nsapi,
890 octetstring ggsn_ip_sign, octetstring ggsn_ip_data,
891 OCT4 chg_id, template (omit) EndUserAddress eua := omit,
892 template (omit) Recovery_gtpc recovery := omit,
893 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100894 createPDPContextResponse := {
895 cause := { '00'O, cause },
896 reorderingRequired := ts_ReorderReq(false),
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200897 recovery := recovery,
Harald Welteeded9ad2018-02-17 20:57:34 +0100898 teidDataI := {
899 type_gtpc := '00'O,
900 teidDataI := teid_data
901 },
902 teidControlPlane := {
903 type_gtpc := '00'O,
904 teidControlPlane := teid_ctrl
905 },
906 nsapi := ts_NSAPI(nsapi),
Harald Welte7aff2ca2018-02-18 15:34:50 +0100907 chargingID := {
908 type_gtpc := '7F'O,
909 chargingID := chg_id
910 },
Harald Welteeded9ad2018-02-17 20:57:34 +0100911 endUserAddress := eua,
912 protConfigOptions := pco,
913 ggsn_addr_controlPlane := ts_GsnAddr(ggsn_ip_sign),
914 ggsn_addr_traffic := ts_GsnAddr(ggsn_ip_data),
915 alt_ggsn_addr_controlPane := omit,
916 alt_ggsn_addr_traffic := omit,
917 qualityOfServiceProfile := ts_QosDefault,
918 commonFlags := omit,
919 aPN_Restriction := omit,
920 mS_InfoChangeReportingAction := omit,
921 bearerControlMode := omit,
922 evolvedAllocationRetentionPriorityI := omit,
923 extendedCommonFlag := omit,
924 csg_information_reporting_action := omit,
925 aPN_AMBR := omit,
926 gGSN_BackOffTime := omit,
927 private_extension_gtpc := omit
928 }
929 }
930
Philipp Maier57889492023-08-07 12:10:03 +0200931 template (value) Gtp1cUnitdata ts_GTPC_CreatePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid,
932 OCT1 cause,
933 OCT4 teid_ctrl, OCT4 teid_data,
934 BIT4 nsapi, octetstring ggsn_ip_sign,
935 octetstring ggsn_ip_data, OCT4 chg_id,
936 template (omit) EndUserAddress eua := omit,
937 template (omit) Recovery_gtpc recovery := omit,
938 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100939 peer := peer,
940 gtpc := ts_GTP1C_PDU(createPDPContextResponse, teid,
941 valueof(ts_CreatePdpRespPDU(cause, teid_data, teid_ctrl, nsapi,
Harald Welte7aff2ca2018-02-18 15:34:50 +0100942 ggsn_ip_sign, ggsn_ip_data, chg_id,
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200943 eua, recovery, pco)), seq)
Harald Welteeded9ad2018-02-17 20:57:34 +0100944 }
945
Harald Weltec69cf4e2018-02-17 20:57:02 +0100946 /* PCO send base template */
Philipp Maier57889492023-08-07 12:10:03 +0200947 template (value) ProtConfigOptions ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100948 type_gtpc := '84'O,
949 lengthf := 0,
950 configProtocol := '000'B,
951 spare := '0000'B,
952 extension0 := '1'B,
953 protocols := {}
954 }
955 /* PCO receive base template */
Philipp Maier57889492023-08-07 12:10:03 +0200956 template (present) ProtConfigOptions tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100957 type_gtpc := '84'O,
958 lengthf := ?,
959 configProtocol := '000'B,
960 spare := ?,
961 extension0 := '1'B,
962 protocols := {}
963 }
964
Philipp Maier57889492023-08-07 12:10:03 +0200965 template (value) ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100966 protocols := {
967 { protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O }
968 }
969 }
Philipp Maier57889492023-08-07 12:10:03 +0200970 template (present) ProtConfigOptions tr_PCO_IPv6_DNS_resp(template (present) OCT16 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100971 protocols := {
972 *, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, *
973 }
974 }
975
Philipp Maier57889492023-08-07 12:10:03 +0200976 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100977 protocols := {
978 /* dummy PAP entry to check if our parser in the GGSN can properly iterate over
979 * the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */
980 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
981 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
982 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
983 }
984 }
985
Philipp Maier57889492023-08-07 12:10:03 +0200986 template (value) ProtConfigOptions ts_PCO_IPv4_PRI_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +0200987 protocols := {
988 /* dummy PAP entry to check if our parser can cope with a single primary DNS entry
989 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
990 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
991 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
992 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) }
993 }
994 }
Philipp Maier57889492023-08-07 12:10:03 +0200995 template (value) ProtConfigOptions ts_PCO_IPv4_SEC_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +0200996 protocols := {
997 /* dummy PAP entry to check if our parser can cope with a single secondary DNS entry
998 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
999 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1000 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1001 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1002 }
1003 }
Philipp Maier57889492023-08-07 12:10:03 +02001004 template (value) ProtConfigOptions ts_PCO_IPv4_SEPARATE_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001005 protocols := {
1006 /* dummy PAP entry to check if our parser can cope with a primary and secondary DNS
1007 * in separate IPCP containers OS#3381 */
1008 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1009 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1010 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) },
1011 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1012 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1013 }
1014 }
1015
Philipp Maier57889492023-08-07 12:10:03 +02001016 template (present) ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001017 protocolID := prot_id,
1018 lengthProtoID := ?,
1019 protoIDContents := ?
1020 }
Philipp Maier57889492023-08-07 12:10:03 +02001021 template (value) ProtocolElement ts_PCOelem_PAP_broken := {
Harald Weltef8298542019-04-10 10:15:28 +02001022 protocolID := 'C023'O,
1023 lengthProtoID := 60,
1024 /* PPP Password Authentication Protocol containing incorrect Peer-Id-Length set to 4 (6-7 should be the valid one), see OS#3914. */
1025 protoIDContents := '0100003c'O & '0444435338323700bc1c08087c1508083e00790000150808fd06000001000000000000000000000000000000000000000000000000000000'O
1026 }
Philipp Maier57889492023-08-07 12:10:03 +02001027 template (value) ProtConfigOptions ts_PCO_PAP_IPv4_DNS modifies ts_PCO := {
Harald Weltef8298542019-04-10 10:15:28 +02001028 protocols := {
1029 ts_PCOelem_PAP_broken,
1030 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
1031 }
1032 }
Philipp Maier57889492023-08-07 12:10:03 +02001033 template (present) ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001034 protocols := { *, tr_PCO_Proto(prot_id), * }
1035 }
1036
Philipp Maier57889492023-08-07 12:10:03 +02001037 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001038 protocols := {
1039 { protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
1040 }
1041 }
Philipp Maier57889492023-08-07 12:10:03 +02001042 template (present) ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template (present) OCT4 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001043 protocols := {
1044 *, { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }, *
1045 }
1046 }
1047
1048 /* extract a given protocol payload from PCO */
1049 function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring {
1050 var integer i;
1051 var integer num_matches := 0;
1052 for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
1053 if (pco.protocols[i].protocolID == protocol) {
1054 num_matches := num_matches + 1;
1055 if (num_matches == nth_match) {
1056 return pco.protocols[i].protoIDContents;
1057 }
1058 }
1059 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +02001060 setverdict(fail, "Could not extract protocol payload from protocol ", protocol);
1061 mtc.stop;
Harald Weltec69cf4e2018-02-17 20:57:02 +01001062 return ''O;
1063 }
1064
Philipp Maier57889492023-08-07 12:10:03 +02001065 template (present) IpcpPacket tr_IPCP(template (present) LcpCode code, template (present)uint8_t identifier,
1066 template (present) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001067 code := code,
1068 identifier := identifier,
1069 len := ?,
1070 options := opts
1071 }
Philipp Maier57889492023-08-07 12:10:03 +02001072 template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001073 code := IPCP_OPT_PrimaryDNS,
1074 len := 6,
1075 data := addr
1076 }
Philipp Maier57889492023-08-07 12:10:03 +02001077 template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001078 code := IPCP_OPT_SecondaryDNS,
1079 len := 6,
1080 data := addr
1081 }
Philipp Maier57889492023-08-07 12:10:03 +02001082 template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?,
1083 template (present) OCT4 dns1 := ?,
1084 template (present) OCT4 dns2 := ?) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001085 tr_IPCP(LCP_Configure_Ack, identifier,
1086 { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
1087
Philipp Maier57889492023-08-07 12:10:03 +02001088 template (value) IpcpPacket ts_IPCP(LcpCode code, uint8_t identifier, template (value) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001089 code := code,
1090 identifier := identifier,
1091 len := 0, /* overwritten */
1092 options := opts
1093 }
Philipp Maier57889492023-08-07 12:10:03 +02001094 template (value) IpcpPacket ts_IPCP_ReqDNS(uint8_t identifier := 0) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001095 ts_IPCP(LCP_Configure_Request, identifier,
1096 { tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) });
1097
Philipp Maier57889492023-08-07 12:10:03 +02001098 template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001099 ts_IPCP(LCP_Configure_Request, identifier,
1100 { tr_IPCP_PrimaryDns('00000000'O) });
Philipp Maier57889492023-08-07 12:10:03 +02001101 template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001102 ts_IPCP(LCP_Configure_Request, identifier,
1103 { tr_IPCP_SecondaryDns('00000000'O) });
1104
Harald Welte57b9b7f2018-02-18 22:28:13 +01001105 function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd {
1106 if (istemplatekind(ind, "omit")) {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001107 return omit;
1108 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001109 var TearDownInd ret := {
1110 type_gtpc := '13'O,
1111 tdInd := valueof(ind),
1112 spare:= '0000000'B
1113 }
1114 return ret;
1115 }
1116
Philipp Maier57889492023-08-07 12:10:03 +02001117 template (value) GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001118 deletePDPContextRequest := {
1119 cause := omit,
1120 tearDownIndicator := f_teardown_ind_IE(teardown_ind),
1121 nsapi := {
1122 type_gtpc := '14'O,
1123 nsapi := nsapi,
1124 unused := '0000'B
1125 },
1126 protConfigOptions := omit,
1127 userLocationInformation := omit,
1128 mS_TimeZone := omit,
1129 extendedCommonFlags := omit,
1130 uLI_Timestamp := omit,
1131 private_extension_gtpc := omit
1132 }
1133 }
1134
Philipp Maier57889492023-08-07 12:10:03 +02001135 template (value) Gtp1cUnitdata ts_GTPC_DeletePDP(GtpPeer peer, uint16_t seq, OCT4 teid,
1136 BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001137 peer := peer,
1138 gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid,
1139 valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq)
1140 }
1141
Philipp Maier57889492023-08-07 12:10:03 +02001142 template (value) GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause,
1143 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001144 deletePDPContextResponse := {
1145 cause := { '00'O, cause },
1146 protConfigOptions := pco,
1147 userLocationInformation := omit,
1148 mS_TimeZone := omit,
1149 uLI_Timestamp := omit,
1150 private_extension_gtpc := omit
1151 }
1152 }
1153
Philipp Maier57889492023-08-07 12:10:03 +02001154 template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid,
1155 OCT1 cause,
1156 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001157 peer := peer,
1158 gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid,
1159 valueof(ts_DeletePdpRespPDU(cause, pco)), seq)
1160 }
1161
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001162 /* SGSN Context Request - 7.5.3 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001163 template (present) GTPC_PDUs tr_SGSNContextReqPDU(template (present) RoutingAreaIdentity rai := ?,
1164 template (present) OCT4 teic := ?,
1165 template (present) octetstring sgsn_addr_control := ?,
1166 template hexstring imsi := *,
1167 template BIT1 msValidated := *,
1168 template TLLI tlli := *,
1169 template PacketTMSI ptmsi := *,
1170 template PTMSI_Signature ptmsi_sig := *,
1171 template OCT1 rat_type := *) := {
1172 sgsn_ContextRequest := {
1173 imsi := f_tr_Imsi(imsi),
1174 routingAreaIdentity := rai,
1175 tlli := tlli,
1176 packetTMSI := ptmsi,
1177 ptmsi_Signature := ptmsi_sig,
1178 ms_Validated := f_tr_MS_Validated(msValidated),
1179 teidControlPlane := {
1180 type_gtpc := '11'O,
1181 teidControlPlane := teic
1182 },
1183 sgsn_addr_controlPlane := tr_GsnAddr(sgsn_addr_control),
1184 alternative_sgsn_addr_controlPlane := *,
1185 sGSN_Number := *,
1186 ratType := f_tr_RATType(rat_type),
1187 hopCounter := *,
1188 private_extension_gtpc := *
1189 }
1190 }
1191 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextReq(template (present) GtpPeer peer,
1192 template (present) GTPC_PDUs SGSNContextReqPDU) := {
1193 peer := peer,
1194 gtpc := tr_GTP1C_PDU(sgsnContextRequest, '00000000'O, SGSNContextReqPDU)
1195 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001196 template (value) GTPC_PDUs ts_SGSNContextReqPDU(template (value) RoutingAreaIdentity rai,
1197 template (value) OCT4 teic,
1198 template (value) octetstring sgsn_addr_control,
1199 template (omit) hexstring imsi := omit,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001200 template (omit) BIT1 msValidated := '0'B,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001201 template (omit) TLLI tlli := omit,
1202 template (omit) PacketTMSI ptmsi := omit,
1203 template (omit) PTMSI_Signature ptmsi_sig := omit,
1204 template (omit) OCT1 rat_type := omit) := {
1205 sgsn_ContextRequest := {
1206 imsi := f_ts_Imsi(imsi),
1207 routingAreaIdentity := rai,
1208 tlli := tlli,
1209 packetTMSI := ptmsi,
1210 ptmsi_Signature := ptmsi_sig,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001211 ms_Validated := f_ts_MS_Validated(msValidated),
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001212 teidControlPlane := {
1213 type_gtpc := '11'O,
1214 teidControlPlane := teic
1215 },
1216 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1217 alternative_sgsn_addr_controlPlane := omit,
1218 sGSN_Number := omit,
1219 ratType := f_ts_RATType(rat_type),
1220 hopCounter := omit,
1221 private_extension_gtpc := omit
1222 }
1223 }
1224 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextReq(GtpPeer peer, uint16_t seq,
1225 template (value) GTPC_PDUs SGSNContextReqPDU) := {
1226 peer := peer,
1227 gtpc := ts_GTP1C_PDU(sgsnContextRequest, '00000000'O, valueof(SGSNContextReqPDU), seq)
1228 }
1229
1230 /* SGSN Context Response - 7.5.4 */
1231 template (present) GTPC_PDUs tr_SGSNContextRespPDU(template (present) GTP_Cause cause := ?,
1232 template hexstring imsi := *) := {
1233 sgsn_ContextResponse := {
1234 cause := tr_Cause_gtpc(cause),
1235 imsi := f_tr_Imsi(imsi),
1236 teidControlPlane := *,
1237 rabContext := *,
1238 radioPrioritySMS := *,
1239 radioPriority := *,
1240 packetFlowID := *,
1241 charging_char := *,
1242 mm_Context := *,
1243 pdp_Context := *,
1244 sgsn_addr_controlPlane := *,
1245 pdpContextPriorization := *,
1246 radioPriority_LCS := *,
1247 mBMS_UE_Context := *,
1248 subscribedRFSP_Index := *,
1249 rFSP_IndexInUse := *,
1250 colocatedGGSN_PGW_FQDN := *,
1251 evolvedAllocationRetentionPriorityII := *,
1252 extendedCommonFlags := *,
1253 ue_network_capability := *,
1254 ue_ambr := *,
1255 apn_ambr_nsapi := *,
1256 signallingPriorityIndication_nsapi := *,
1257 higher_bitrates_than_16mbps_flag := *,
1258 selectionMode_nsapi := *,
1259 localHomeNetworkID_nsapi := *,
1260 uE_UsageType := *,
1261 extendedCommonFlagsII := *,
1262 private_extension_gtpc := *
1263 }
1264 }
1265 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextResp(template (present) GtpPeer peer := ?,
1266 template (present) OCT4 teid := ?,
1267 template (present) GTPC_PDUs SGSNContextRespPDU := ?)
1268 := tr_GTPC_MsgType(peer, sgsnContextResponse, teid, SGSNContextRespPDU);
1269
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001270 template (value) GTPC_PDUs ts_SGSNContextRespPDU(template (value) GTP_Cause cause,
1271 template (omit) hexstring imsi := omit,
1272 template (omit) OCT4 teic := omit,
1273 template (omit) octetstring sgsn_addr_control := omit,
1274 template (omit) MM_Context mm_context := omit,
1275 template (omit) PDP_Context_GTPC_List pdp_ctx_list := omit) := {
1276 sgsn_ContextResponse := {
1277 cause := ts_Cause_gtpc(cause),
1278 imsi := f_ts_Imsi(imsi),
1279 teidControlPlane := f_ts_TEIC(teic),
1280 rabContext := omit,
1281 radioPrioritySMS := omit,
1282 radioPriority := omit,
1283 packetFlowID := omit,
1284 charging_char := omit,
1285 mm_Context := mm_context,
1286 pdp_Context := pdp_ctx_list,
1287 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1288 pdpContextPriorization := omit,
1289 radioPriority_LCS := omit,
1290 mBMS_UE_Context := omit,
1291 subscribedRFSP_Index := omit,
1292 rFSP_IndexInUse := omit,
1293 colocatedGGSN_PGW_FQDN := omit,
1294 evolvedAllocationRetentionPriorityII := omit,
1295 extendedCommonFlags := omit,
1296 ue_network_capability := omit,
1297 ue_ambr := omit,
1298 apn_ambr_nsapi := omit,
1299 signallingPriorityIndication_nsapi := omit,
1300 higher_bitrates_than_16mbps_flag := omit,
1301 selectionMode_nsapi := omit,
1302 localHomeNetworkID_nsapi := omit,
1303 uE_UsageType := omit,
1304 extendedCommonFlagsII := omit,
1305 private_extension_gtpc := omit
1306 }
1307 }
1308 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextResp(GtpPeer peer, OCT4 teid, uint16_t seq,
1309 template (value) GTPC_PDUs SGSNContextRespPDU) := {
1310 peer := peer,
1311 gtpc := ts_GTP1C_PDU(sgsnContextResponse, teid, valueof(SGSNContextRespPDU), seq)
1312 }
1313
1314
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001315 /* SGSN Context Acknowledge - 7.5.5 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001316 template (present) GTPC_PDUs tr_SGSNContextAckPDU(template (present) GTP_Cause cause := ?) := {
1317 sgsn_ContextAcknowledge := {
1318 cause := tr_Cause_gtpc(cause),
1319 teidDataII := *,
1320 sgsn_AddressForUserTraffic := *,
1321 sgsn_Number := *,
1322 nodeIdentifier := *,
1323 private_extension_gtpc := *
1324 }
1325 }
1326 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextAck(template (present) GtpPeer peer := ?,
1327 template (present) OCT4 teid := ?,
1328 template (present) GTPC_PDUs SGSNContextAckPDU := ?)
1329 := tr_GTPC_MsgType(peer, sgsnContextAcknowledge, teid, SGSNContextAckPDU);
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001330 template (value) GTPC_PDUs ts_SGSNContextAckPDU(template (value) GTP_Cause cause := GTP_CAUSE_REQUEST_ACCEPTED) := {
1331 sgsn_ContextAcknowledge := {
1332 cause := ts_Cause_gtpc(cause),
1333 teidDataII := omit,
1334 sgsn_AddressForUserTraffic := omit,
1335 sgsn_Number := omit,
1336 nodeIdentifier := omit,
1337 private_extension_gtpc := omit
1338 }
1339 }
Pau Espin Pedrolca651b52023-12-20 18:37:39 +01001340 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextAck(GtpPeer peer, OCT4 teid, uint16_t seq,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001341 template (value) GTPC_PDUs SGSNContextAckPDU := ts_SGSNContextAckPDU(GTP_CAUSE_REQUEST_ACCEPTED)) := {
1342 peer := peer,
Pau Espin Pedrolca651b52023-12-20 18:37:39 +01001343 gtpc := ts_GTP1C_PDU(sgsnContextAcknowledge, teid, valueof(SGSNContextAckPDU), seq)
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001344 }
Harald Welte6f203162018-02-18 22:04:55 +01001345
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001346 /* GTP-C RIM */
1347
1348 template (value) RIM_Application_Identity_GTPC ts_GTPC_RIM_Application_Identity(OCT1 app_id) := {
1349 iEI := '4B'O,
1350 ext := '1'B,
1351 lengthIndicator := {
1352 length1 := 1
1353 },
1354 rIMApplicationIdentity := app_id
1355 }
1356 /* 3GPP TS 48.018 11.3.62 */
1357 template (value) RIM_Sequence_Number_GTPC ts_GTPC_RIM_Sequence_Number(integer seq) := {
1358 iEI := '4C'O,
1359 ext := '1'B,
1360 lengthIndicator := {
1361 length1 := 4
1362 },
1363 rIMSequenceNumber := int2oct(seq, 4)
1364 }
1365 template (value) RIM_PDU_Indications_GTPC ts_GTPC_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
1366 iEI := '4F'O,
1367 ext := '1'B,
1368 lengthIndicator := {
1369 length1 := 1
1370 },
1371 ack := bool2bit(ack),
1372 pDU_Type_Extension := type_ext,
1373 reserved := '0000'B
1374 }
1375 /* 3GPP TS 48.018 11.3.67 */
1376 template (value) RIM_Protocol_Version_Number_GTPC ts_GTPC_RIM_Protocol_Version_Number(integer ver) := {
1377 iEI := '55'O,
1378 ext := '1'B,
1379 lengthIndicator := {
1380 length1 := 1
1381 },
1382 rIMProtocolVersionNumber := int2oct(ver, 1)
1383 }
Philipp Maier57889492023-08-07 12:10:03 +02001384 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 +02001385 var template Cell_Identifier_V_GTPC ret := {
1386 mccDigit1 := ?,
1387 mccDigit2 := ?,
1388 mccDigit3 := ?,
1389 mncDigit3 := ?,
1390 mncDigit1 := ?,
1391 mncDigit2 := ?,
1392 lac := ?,
1393 rac := ?,
1394 cI_value := ?
1395 }
Philipp Maier57889492023-08-07 12:10:03 +02001396 if (istemplatekind(cid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001397 return ?;
1398 }
1399 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1400 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1401 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1402 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1403 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1404 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1405 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1406 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1407 }
1408 if (isvalue(cid.ra_id.lai.lac)) {
1409 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
1410 }
1411 }
1412 if (isvalue(cid) and isvalue(cid.ra_id)) {
1413 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
1414 }
1415 if (isvalue(cid)) {
1416 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
1417 }
1418 return ret;
1419 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001420 template (value) Cell_Identifier_V_GTPC ts_GTPC_Cell_Identifier_V(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001421 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1422 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1423 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1424 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1425 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1426 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1427 lac := int2oct(cid.ra_id.lai.lac, 2),
1428 rac := int2oct(cid.ra_id.rac, 1),
1429 cI_value := int2oct(cid.cell_id, 2)
1430 }
Philipp Maier57889492023-08-07 12:10:03 +02001431 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_cid(GTP_CellId cid) := {
1432 cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001433 }
Philipp Maier57889492023-08-07 12:10:03 +02001434 function tr_GTPC_ENB_Identifier(template (present) GTP_CellId cid,
1435 template (present) integer tac,
1436 template (present) octetstring gnbid) return template (present) ENB_Identifier {
1437 var template (present) ENB_Identifier ret := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001438 mccDigit1 := ?,
1439 mccDigit2 := ?,
1440 mccDigit3 := ?,
1441 mncDigit3 := ?,
1442 mncDigit1 := ?,
1443 mncDigit2 := ?,
1444 tAC := ?,
1445 globalENB_ID := ?
1446 }
Philipp Maier57889492023-08-07 12:10:03 +02001447 if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001448 return ?;
1449 }
1450 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1451 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1452 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1453 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1454 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1455 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1456 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1457 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1458 }
1459 }
1460 if (isvalue(tac)) {
1461 ret.tAC := int2oct(valueof(tac), 2);
1462 }
1463 if (isvalue(gnbid)) {
1464 ret.globalENB_ID := gnbid;
1465 }
1466
1467 return ret;
1468 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001469 template (value) ENB_Identifier ts_GTPC_ENB_Identifier(GTP_CellId cid, integer tac, octetstring gnbid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001470 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1471 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1472 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1473 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1474 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1475 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1476 tAC := int2oct(tac, 2),
1477 globalENB_ID := gnbid
1478 }
Philipp Maier57889492023-08-07 12:10:03 +02001479 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_enbid(GTP_CellId cid, integer tac, octetstring gnbid) := {
1480 eNB_Identifier := ts_GTPC_ENB_Identifier(cid, tac, gnbid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001481 }
Philipp Maier57889492023-08-07 12:10:03 +02001482 template (present) RIM_Routing_Information_GTPC
1483 tr_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (present) RIM_Routing_Address_GTPC addr) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001484 iEI := '54'O,
1485 ext := '1'B,
1486 lengthIndicator := {
1487 length1 := ?
1488 },
1489 rIMRoutingAddressDiscriminator := addr_discr,
1490 spare := '0'H,
1491 rIM_Routing_Address := addr
1492 }
1493 template (value) RIM_Routing_Information_GTPC
1494 ts_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address_GTPC addr) := {
1495 iEI := '54'O,
1496 ext := '1'B,
1497 lengthIndicator := {
1498 length1 := 0 /* overwritten */
1499 },
1500 rIMRoutingAddressDiscriminator := addr_discr,
1501 spare := '0'H,
1502 rIM_Routing_Address := addr
1503 }
1504 /* 3GPP TS 48.018 11.3.63.1.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001505 template (present) RAN_Information_Request_Application_Container_NACC_GTPC
1506 tr_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001507 iEI := '4D'O,
1508 ext := '1'B,
1509 lengthIndicator := {
1510 length1 := ?
1511 },
1512 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid)
1513 }
1514 template (value) RAN_Information_Request_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001515 ts_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001516 iEI := '4D'O,
1517 ext := '1'B,
1518 lengthIndicator := {
1519 length1 := 0 /* overwritten */
1520 },
1521 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
1522 }
1523 /* 3GPP TS 48.018 11.3.63.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001524 template (present) RAN_Information_Request_Application_Container_GTPC
1525 tru_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001526 nacc := tr_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1527 }
1528 template (value) RAN_Information_Request_Application_Container_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001529 tsu_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001530 nacc := ts_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1531 }
1532 /* 3GPP TS 48.018 11.3.63.2.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001533 template (present) RAN_Information_Application_Container_NACC_GTPC
1534 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 +02001535 iEI := '4E'O,
1536 ext := '1'B,
1537 lengthIndicator := {
1538 length1 := ?
1539 },
1540 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid),
1541 typeBit := bool2bit(psi_type),
1542 number_of_SI_PSI := int2bit(si_psi_num, 7),
1543 sI_PSI := si_psi
1544 }
1545 template (value) RAN_Information_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001546 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 +02001547 iEI := '4E'O,
1548 ext := '1'B,
1549 lengthIndicator := {
1550 length1 := 0 /* overwritten */
1551 },
1552 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid),
1553 typeBit := bool2bit(psi_type),
1554 number_of_SI_PSI := int2bit(si_psi_num, 7),
1555 sI_PSI := si_psi
1556 }
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001557 external function enc_RIM_Routing_Address_GTPC(in RIM_Routing_Address_GTPC ra) return octetstring
1558 with { extension "prototype(convert) encode(RAW)" };
Philipp Maier21bac7a2023-08-24 12:40:17 +02001559 external function dec_RIM_Routing_Address_GTPC(in octetstring stream) return RIM_Routing_Address_GTPC
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001560 with { extension "prototype(convert) decode(RAW)" };
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001561
1562 /* RAN_Information_Request */
1563 template (value) RAN_Information_Request_RIM_Container_GTPC
1564 ts_GTPC_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1565 template (value) RIM_Sequence_Number_GTPC seq,
1566 template (value) RIM_PDU_Indications_GTPC ind,
1567 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1568 template (omit) RAN_Information_Request_Application_Container_GTPC app_cont := omit,
1569 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1570 iEI := '57'O,
1571 ext := '1'B,
1572 lengthIndicator := {
1573 length1 := 0 /* overwritten */
1574 },
1575 rIM_Application_Identity := app_id,
1576 rIM_Sequence_Number := seq,
1577 rIM_PDU_Indications := ind,
1578 rIM_Protocol_Version_Number := ver,
1579 application_Container := app_cont,
1580 sON_TransferApplicationIdentity := son_app_id
1581 }
1582 template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1583 ts_GTPC_RAN_Information_Request(template (value) RIM_Routing_Information_GTPC dest,
1584 template (value) RIM_Routing_Information_GTPC src,
Philipp Maier6cef1c32023-07-24 11:01:52 +02001585 template (value) RAN_Information_Request_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001586 bssgpPduType := '71'O,
1587 destination_Cell_Identifier := dest,
1588 source_Cell_Identifier := src,
1589 rIM_Container := cont
1590 }
Philipp Maier57889492023-08-07 12:10:03 +02001591 template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1592 tr_GTPC_RAN_Information_Request(template (present) RIM_Routing_Information_GTPC dest := ?,
1593 template (present) RIM_Routing_Information_GTPC src := ?,
1594 template (present) RAN_Information_Request_RIM_Container_GTPC cont := ?) := {
Philipp Maier4b81c6e2023-07-24 11:03:15 +02001595 bssgpPduType := '71'O,
1596 destination_Cell_Identifier := dest,
1597 source_Cell_Identifier := src,
1598 rIM_Container := cont
1599 }
1600
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001601 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO_REQ(template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu) := {
1602 type_gtpc := '90'O,
1603 lengthf := 0, /* FIXME */
1604 rANTransparentContainerField := {
1605 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1606 }
1607 }
Philipp Maier57889492023-08-07 12:10:03 +02001608 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO_REQ(template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu := ?) := {
Philipp Maieredce92f2023-07-26 11:02:10 +02001609 type_gtpc := '90'O,
1610 lengthf := ?,
1611 rANTransparentContainerField := {
1612 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1613 }
1614 }
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001615
1616 /* RAN_Information */
Philipp Maier57889492023-08-07 12:10:03 +02001617 template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001618 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 +02001619 application_Container := tr_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1620 }
1621 template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001622 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 +02001623 application_Container := ts_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1624 }
Philipp Maier57889492023-08-07 12:10:03 +02001625 template (present) ApplContainer_or_ApplErrContainer_GTPC
1626 tru_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001627 nacc := cont
1628 }
1629 template (value) ApplContainer_or_ApplErrContainer_GTPC
1630 tsu_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
1631 nacc := cont
1632 }
Philipp Maier57889492023-08-07 12:10:03 +02001633 template (present) RAN_Information_RIM_Container_GTPC
1634 tr_GTPC_RAN_Information_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id,
1635 template (present) RIM_Sequence_Number_GTPC seq,
1636 template (present) RIM_PDU_Indications_GTPC ind,
1637 template RIM_Protocol_Version_Number_GTPC ver := *,
1638 template ApplContainer_or_ApplErrContainer_GTPC app_cont := *,
1639 template SON_TransferApplicationIdentity son_app_id := *) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001640 iEI := '58'O,
1641 ext := '1'B,
1642 lengthIndicator := {
1643 length1 := ?
1644 },
1645 rIM_Application_Identity := app_id,
1646 rIM_Sequence_Number := seq,
1647 rIM_PDU_Indications := ind,
1648 rIM_Protocol_Version_Number := ver,
1649 applContainer_or_ApplErrContainer := app_cont,
1650 sON_TransferApplicationIdentity := son_app_id
1651 }
1652 template (value) RAN_Information_RIM_Container_GTPC
1653 ts_GTPC_RAN_Information_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1654 template (value) RIM_Sequence_Number_GTPC seq,
1655 template (value) RIM_PDU_Indications_GTPC ind,
1656 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1657 template (omit) ApplContainer_or_ApplErrContainer_GTPC app_cont := omit,
1658 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1659 iEI := '58'O,
1660 ext := '1'B,
1661 lengthIndicator := {
1662 length1 := 0 /* overwritten */
1663 },
1664 rIM_Application_Identity := app_id,
1665 rIM_Sequence_Number := seq,
1666 rIM_PDU_Indications := ind,
1667 rIM_Protocol_Version_Number := ver,
1668 applContainer_or_ApplErrContainer := app_cont,
1669 sON_TransferApplicationIdentity := son_app_id
1670 }
Philipp Maier57889492023-08-07 12:10:03 +02001671 template (present) PDU_BSSGP_RAN_INFORMATION_GTPC
1672 tr_GTPC_RAN_Information(template (present) RIM_Routing_Information_GTPC dest,
1673 template (present) RIM_Routing_Information_GTPC src,
1674 template (present) RAN_Information_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001675 bssgpPduType := '70'O,
1676 destination_Cell_Identifier := dest,
1677 source_Cell_Identifier := src,
1678 rIM_Container := cont
1679 }
1680 template (value) PDU_BSSGP_RAN_INFORMATION_GTPC
1681 ts_GTPC_RAN_Information(template (value) RIM_Routing_Information_GTPC dest,
1682 template (value) RIM_Routing_Information_GTPC src,
1683 template (value) RAN_Information_RIM_Container_GTPC cont) := {
1684 bssgpPduType := '70'O,
1685 destination_Cell_Identifier := dest,
1686 source_Cell_Identifier := src,
1687 rIM_Container := cont
1688 }
Philipp Maier57889492023-08-07 12:10:03 +02001689 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO(template (present) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001690 type_gtpc := '90'O,
1691 lengthf := ?,
1692 rANTransparentContainerField := {
1693 pDU_BSSGP_RAN_INFORMATION := pdu
1694 }
1695 }
1696 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO(template (value) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
1697 type_gtpc := '90'O,
1698 lengthf := 0, /* overwritten */
1699 rANTransparentContainerField := {
1700 pDU_BSSGP_RAN_INFORMATION := pdu
1701 }
1702 }
1703
Philipp Maier57889492023-08-07 12:10:03 +02001704 template (present) RANTransparentContainer tr_RANTransparentContainer(template (present) RANTransparentContainerField rANTransparentContainerField) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001705 type_gtpc := '90'O,
1706 lengthf := ?,
1707 rANTransparentContainerField := rANTransparentContainerField
1708 }
1709 template (value) RANTransparentContainer ts_RANTransparentContainer(template (value) RANTransparentContainerField rANTransparentContainerField) := {
1710 type_gtpc := '90'O,
1711 lengthf := 0, /* overwritten */
1712 rANTransparentContainerField := rANTransparentContainerField
1713 }
Philipp Maier57889492023-08-07 12:10:03 +02001714 template (present) GTPC_PDUs tr_RANInfoRelay(template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001715 ranInformationRelay := {
1716 transparentContainer := transparentContainer,
1717 rIM_RoutingAddress := *,
1718 rIM_RoutingAddress_Discriminator := *,
1719 private_extension_gtpc := *
1720 }
1721 }
Philipp Maier05ad55c2023-07-24 10:56:46 +02001722 template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer,
1723 template (omit) RIM_RoutingAddress ra := omit,
1724 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001725 ranInformationRelay := {
1726 transparentContainer := transparentContainer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001727 rIM_RoutingAddress := ra,
1728 rIM_RoutingAddress_Discriminator := ra_discr,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001729 private_extension_gtpc := omit
1730 }
1731 }
Philipp Maier57889492023-08-07 12:10:03 +02001732 template (present) Gtp1cUnitdata
1733 tr_GTPC_RANInfoRelay(template (present) GtpPeer peer,
1734 template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001735 peer := peer,
1736 gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer))
1737 }
1738 template (value) Gtp1cUnitdata
1739 ts_GTPC_RANInfoRelay(template (value) GtpPeer peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001740 template (value) RANTransparentContainer transparentContainer,
1741 template (omit) RIM_RoutingAddress ra := omit,
1742 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001743 peer := peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001744 gtpc := ts_GTP1C_PDU(rANInformationRelay, '00000000'O, valueof(ts_RANInfoRelay(transparentContainer, ra, ra_discr)), 0)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001745 }
1746
1747
Philipp Maier57889492023-08-07 12:10:03 +02001748 template (present) RAN_Information_Request_RIM_Container_GTPC
1749 tr_GTPC_RAN_Information_Request_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id := ?,
1750 template (present) RIM_Sequence_Number_GTPC seq := ?,
1751 template (present) RIM_PDU_Indications_GTPC ind := ?,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001752 template RIM_Protocol_Version_Number_GTPC ver := *,
1753 template RAN_Information_Request_Application_Container_GTPC app_cont := *,
1754 template SON_TransferApplicationIdentity son_app_id := *) := {
1755 iEI := '57'O,
1756 ext := '1'B,
1757 lengthIndicator := {
1758 length1 := ?
1759 },
1760 rIM_Application_Identity := app_id,
1761 rIM_Sequence_Number := seq,
1762 rIM_PDU_Indications := ind,
1763 rIM_Protocol_Version_Number := ver,
1764 application_Container := app_cont,
1765 sON_TransferApplicationIdentity := son_app_id
1766 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001767
1768 /* GTP-U */
1769
Philipp Maier57889492023-08-07 12:10:03 +02001770 template (present) PDU_GTPU tr_GTP1U_PDU(template (present) OCT1 msg_type,
1771 template (present) OCT4 teid,
1772 template (present) GTPU_IEs ies := ?) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001773 pn_bit := ?,
1774 s_bit := ?,
1775 e_bit := ?,
1776 spare := ?,
1777 /* Protocol Type flag (PT) shall be set to '1' in GTP */
1778 pt := '1'B,
1779 /* Version shall be set to decimal 1 ('001'). */
1780 version := '001'B,
1781 messageType := msg_type,
1782 lengthf := ?,
1783 teid := teid,
1784 opt_part := *,
1785 gtpu_IEs := ies
1786 }
1787
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02001788 function f_GTPU_s_bit(template (omit) uint16_t seq) return BIT1 {
1789 if (istemplatekind(seq, "omit")) {
1790 return '0'B;
1791 }
1792 return '1'B;
1793 }
1794
1795 function f_GTPU_opt_part(template (omit) uint16_t seq) return template (omit) GTPU_Header_optional_part {
1796 if (istemplatekind(seq, "omit")) {
1797 return omit;
1798 }
1799 var GTPU_Header_optional_part ret := {
1800 sequenceNumber := int2oct(valueof(seq), 2),
1801 npduNumber := '00'O,
1802 nextExtHeader := '00'O,
1803 gTPU_extensionHeader_List := omit
1804 };
1805 return ret;
1806 }
1807
Harald Weltec69cf4e2018-02-17 20:57:02 +01001808 /* generalized GTP-U send template */
Pau Espin Pedrol480e67f2022-02-09 16:37:47 +01001809 template (value) PDU_GTPU ts_GTP1U_PDU(OCT1 msg_type, template (omit) uint16_t seq, OCT4 teid, GTPU_IEs ies) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001810 /* N-PDU Number flag (PN): the GTP-U header contains a meaningful N-PDU Number field if the PN
1811 * flag is set to 1. */
1812 pn_bit := '0'B, /* we assume the encoder overwrites this if an optional part is given */
1813 /* If the Sequence Number flag (S) is set to '1' the sequence number field is present and
1814 * meaningful otherwise it is set to '0'. For GTP-U messages Echo Request, Echo Response,
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02001815 * Error Indication and Supported Extension Headers Notification, the S flag shall be set to '1'.
1816 *
1817 * Note that the caller must ensure that these conditions hold.
1818 * The caller can either pass a sequence number (we set s_bit to '1'B) when appropriate,
1819 * or may omit the sequence number (we set s_bit to '0'B). */
1820 s_bit := f_GTPU_s_bit(seq),
Harald Weltec69cf4e2018-02-17 20:57:02 +01001821 /* Extension header presence */
1822 e_bit := '0'B,
1823 spare := '0'B,
1824 /* Protocol Type flag (PT) shall be set to '1' in GTP */
1825 pt := '1'B,
1826 /* Version shall be set to decimal 1 ('001'). */
1827 version := '001'B,
1828 messageType := msg_type,
1829 lengthf := 0, /* we assume encoder overwrites this */
1830 teid := teid,
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02001831 opt_part := f_GTPU_opt_part(seq),
Harald Weltec69cf4e2018-02-17 20:57:02 +01001832 gtpu_IEs := ies
1833 }
1834
Philipp Maier57889492023-08-07 12:10:03 +02001835 template (present) Gtp1uUnitdata tr_GTPU_MsgType(template (present) GtpPeer peer,
1836 template (present) OCT1 msg_type,
1837 template (present) OCT4 teid) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001838 peer := peer,
1839 gtpu := tr_GTP1U_PDU(msg_type, teid)
1840 }
1841
1842
Pau Espin Pedrol480e67f2022-02-09 16:37:47 +01001843 /* template matching reception of GTP-U echo-request/response */
Philipp Maier57889492023-08-07 12:10:03 +02001844 template (present) Gtp1uUnitdata tr_GTPU_PING(template (present) GtpPeer peer) := tr_GTPU_MsgType(peer, echoRequest, '00000000'O);
1845 template (present) Gtp1uUnitdata tr_GTPU_PONG(template (present) GtpPeer peer) := tr_GTPU_MsgType(peer, echoResponse, '00000000'O);
Harald Weltec69cf4e2018-02-17 20:57:02 +01001846
1847 /* template matching reception of GTP-U GPDU */
Philipp Maier57889492023-08-07 12:10:03 +02001848 template GTPU_IEs t_GPDU(template (present) octetstring data) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001849 g_PDU_IEs := {
1850 data := data
1851 }
1852 }
Philipp Maier57889492023-08-07 12:10:03 +02001853 template (present) Gtp1uUnitdata tr_GTPU_GPDU(template (present) GtpPeer peer,
1854 template (present) OCT4 teid,
1855 template (present) octetstring data := ?) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001856 peer := peer,
1857 gtpu := tr_GTP1U_PDU('FF'O, teid, t_GPDU(data))
1858 }
1859
Philipp Maier57889492023-08-07 12:10:03 +02001860 template (present) GTPU_IEs ts_UEchoReqPDU := {
Pau Espin Pedrol480e67f2022-02-09 16:37:47 +01001861 echoRequest_IEs := {
1862 private_extension_gtpu := omit
1863 }
1864 }
1865
1866 /* master template for sending a GTP-C echo request */
1867 template (value) Gtp1uUnitdata ts_GTPU_PING(GtpPeer peer, uint16_t seq) := {
1868 peer := peer,
1869 gtpu := ts_GTP1U_PDU(echoRequest, seq, '00000000'O, valueof(ts_UEchoReqPDU))
1870 }
1871
Harald Weltec69cf4e2018-02-17 20:57:02 +01001872 template GTPU_IEs ts_UEchoRespPDU(OCT1 restart_counter) := {
1873 echoResponse_IEs := {
1874 recovery_gtpu := {
1875 type_gtpu := '00'O, /* we assume encoder fixes? */
1876 restartCounter := restart_counter
1877 },
1878 private_extension_gtpu := omit
1879 }
1880 }
1881
1882 /* master template for sending a GTP-U echo response */
Philipp Maier57889492023-08-07 12:10:03 +02001883 template (present) Gtp1uUnitdata ts_GTPU_PONG(GtpPeer peer, uint16_t seq, OCT1 rest_ctr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001884 peer := peer,
1885 gtpu := ts_GTP1U_PDU(echoResponse, seq, '00000000'O, valueof(ts_UEchoRespPDU(rest_ctr)))
1886 }
1887
Philipp Maier57889492023-08-07 12:10:03 +02001888 template (value) GSNAddress_gtpu ts_UGsnAddr(octetstring ip_addr) := {
Pau Espin Pedrolf3e25382018-07-18 13:46:40 +02001889 type_gtpu := '85'O,
1890 lengthf := lengthof(ip_addr),
1891 gSNAddressValue := ip_addr
1892 }
1893
Philipp Maier57889492023-08-07 12:10:03 +02001894 template (value) TeidDataI_gtpu ts_UteidDataI(OCT4 teid) := {
Pau Espin Pedrolf3e25382018-07-18 13:46:40 +02001895 type_gtpu := '10'O,
1896 teidDataI := teid
1897 }
1898
Philipp Maier57889492023-08-07 12:10:03 +02001899 template (value) GTPU_IEs ts_UErrorIndication(OCT4 teid, octetstring gsn_addr) := {
Pau Espin Pedrolf3e25382018-07-18 13:46:40 +02001900 errorIndication_IEs := {
1901 teidDataI_gtpu := ts_UteidDataI(teid),
1902 gSNAddress_gtpu := ts_UGsnAddr(gsn_addr),
1903 private_extension_gtpu := omit
1904 }
1905 }
1906
1907 /* master template for sending a GTP-U Error indication */
Philipp Maier57889492023-08-07 12:10:03 +02001908 template (value) Gtp1uUnitdata ts_GTPU_ErrorIndication(GtpPeer peer, uint16_t seq, OCT4 teid, octetstring gsn_addr) := {
Pau Espin Pedrolf3e25382018-07-18 13:46:40 +02001909 peer := peer,
1910 gtpu := ts_GTP1U_PDU('1A'O, seq, '00000000'O, valueof(ts_UErrorIndication(teid, gsn_addr)))
1911 }
1912
Harald Weltec69cf4e2018-02-17 20:57:02 +01001913 /* master template for sending a GTP-U user plane data */
Philipp Maier57889492023-08-07 12:10:03 +02001914 template (value) Gtp1uUnitdata ts_GTP1U_GPDU(GtpPeer peer, template (omit) uint16_t seq, OCT4 teid, octetstring data) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001915 peer := peer,
1916 gtpu := ts_GTP1U_PDU('FF'O, seq, teid, { g_PDU_IEs := { data := data }})
1917 }
Philipp Maier653a0142023-08-04 15:22:37 +02001918
1919 /* 3GPP TS 29.060, section 7.7.57 */
1920 template (value) RIM_RoutingAddress ts_RIM_RoutingAddress(octetstring addr_value) := {
1921 type_gtpc := '9F'O,
1922 lengthf := 0, /* we assume encoder overwrites this */
1923 rIM_RoutingAddressValue := addr_value
1924 }
1925 template (present) RIM_RoutingAddress tr_RIM_RoutingAddress(template (present) octetstring addr_value := ?) := {
1926 type_gtpc := '9F'O,
1927 lengthf := ?,
1928 rIM_RoutingAddressValue := addr_value
1929 }
1930
1931 /* 3GPP TS 29.060, section 7.7.77 */
1932 template (value) RIM_RoutingAddress_Discriminator ts_RIM_RoutingAddress_Discriminator(bitstring addr_discr) := {
1933 type_gtpc := 'B2'O,
1934 lengthf := 0, /* we assume encoder overwrites this */
1935 rra_discriminator := addr_discr,
1936 spare := '0000'B
1937 }
1938 template (present) RIM_RoutingAddress_Discriminator tr_RIM_RoutingAddress_Discriminator(template (present) bitstring addr_discr := ?) := {
1939 type_gtpc := 'B2'O,
1940 lengthf := ?,
1941 rra_discriminator := addr_discr,
1942 spare := '0000'B
1943 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001944}