blob: 4a0c8b200708c53300f4b4d650370ad2295cf061 [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 */
70 GTP_CAUSE_REQUEST_ACCEPTED (128)
71 /* FIXME */
72 };
73
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +010074 template (value) Cause_gtpc ts_Cause_gtpc(template (value) GTP_Cause cause) := {
75 type_gtpc := '01'O,
76 causevalue := enum2oct1_Cause_gtpc_tmpl(cause)
77 }
78 private function enum2oct1_Cause_gtpc_tmpl(template GTP_Cause inp) return template OCT1
79 {
80 if (istemplatekind(inp, "omit")) {
81 return omit;
82 } else if (istemplatekind(inp, "*")) {
83 return *;
84 } else if (istemplatekind(inp, "?")) {
85 return ?;
86 } else {
87 return int2oct(enum2int(valueof(inp)), 1);
88 }
89 }
90 template (present) Cause_gtpc tr_Cause_gtpc(template (present) GTP_Cause cause) := {
91 type_gtpc := '01'O,
92 causevalue := enum2oct1_Cause_gtpc_tmpl(cause)
93 }
94 function f_tr_Cause_gtpc(template GTP_Cause cause) return
95 template Cause_gtpc {
96 if (istemplatekind(cause, "omit")) {
97 return omit;
98 } else if (istemplatekind(cause, "*")) {
99 return *;
100 } else {
101 return tr_Cause_gtpc(cause);
102 }
103 }
104
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +0200105 private function f_oct_or_wc(template integer inp, integer len) return template octetstring {
106 if (istemplatekind(inp, "omit")) {
107 return omit;
108 } else if (istemplatekind(inp, "*")) {
109 return *;
110 } else if (istemplatekind(inp, "?")) {
111 return ?;
112 }
113 return int2oct(valueof(inp), len);
114 }
115
116 private function f_hex_or_wc(template integer inp, integer len) return template hexstring {
117 if (istemplatekind(inp, "omit")) {
118 return omit;
119 } else if (istemplatekind(inp, "*")) {
120 return *;
121 } else if (istemplatekind(inp, "?")) {
122 return ?;
123 }
124 return int2hex(valueof(inp), len);
125 }
126
Harald Weltec69cf4e2018-02-17 20:57:02 +0100127 /* generalized GTP-C receive template */
Philipp Maier57889492023-08-07 12:10:03 +0200128 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 +0100129 /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
130 * error if this flag is set to '1'. */
131 pn_bit := '0'B,
132 /* Sequence number flag (S) shall be set to '1'. */
133 s_bit := '1'B,
134 e_bit := ?,
135 spare := ?,
136 /* Protocol Type flag (PT) shall be set to '1'.*/
137 pt := '1'B,
138 /* Version shall be set to decimal 1 ('001'). */
139 version := '001'B,
140 messageType := msg_type,
141 lengthf := ?,
142 teid := teid,
143 opt_part := *,
144 gtpc_pdu := pdu
145 }
146
147 /* generalized GTP-C send template */
Philipp Maier57889492023-08-07 12:10:03 +0200148 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 +0100149 /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
150 * error if this flag is set to '1'. */
151 pn_bit := '0'B,
152 /* Sequence number flag (S) shall be set to '1'. */
153 s_bit := '1'B,
154 e_bit := '0'B,
155 spare := '0'B,
156 /* Protocol Type flag (PT) shall be set to '1'.*/
157 pt := '1'B,
158 /* Version shall be set to decimal 1 ('001'). */
159 version := '001'B,
160 messageType := msg_type,
161 lengthf := 0, /* we assume encoder overwrites this */
162 teid := teid,
163 opt_part := {
164 sequenceNumber := int2oct(seq_nr, 2),
165 npduNumber := '00'O,
166 nextExtHeader := '00'O,
167 gTPC_extensionHeader_List := omit
168 },
169 gtpc_pdu := pdu
170 }
171
172 /* recovery IE */
Philipp Maier57889492023-08-07 12:10:03 +0200173 template (value) Recovery_gtpc ts_Recovery(OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100174 type_gtpc := '0E'O,
175 restartCounter := restart_counter
176 }
177
Philipp Maier57889492023-08-07 12:10:03 +0200178 template (present) Recovery_gtpc tr_Recovery(template (present) OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100179 type_gtpc := '0E'O,
180 restartCounter := restart_counter
181 }
182
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100183 /* Packet TMSI - 7.7.5 */
184 template (value) PacketTMSI ts_PTMSI(OCT4 ptmsi) := {
185 type_gtpc := '05'O,
186 p_tmsi := ptmsi
187 }
188
189 /* PTMSI Signature - 7.7.9 */
190 template (value) PTMSI_Signature ts_PTMSI_sig(OCT3 ptmsi_sig) := {
191 type_gtpc := '0C'O,
192 ptmsi_Signature := ptmsi_sig
193 }
194
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100195 /* MS Validated - 7.7.10 */
196 template (value) MS_Validated ts_MS_Validated(template (value) BIT1 msValidated) := {
197 type_gtpc := '0D'O,
198 msValidated := msValidated,
199 spare := '1111111'B
200 }
201 template (present) MS_Validated tr_MS_Validated(template (present) BIT1 msValidated := ?) := {
202 type_gtpc := '0D'O,
203 msValidated := msValidated,
204 spare := '1111111'B
205 }
206 function f_tr_MS_Validated(template BIT1 msValidated := *) return template MS_Validated {
207 if (istemplatekind(msValidated, "omit")) {
208 return omit;
209 } else if (istemplatekind(msValidated, "*")) {
210 return *;
211 } else {
212 return tr_MS_Validated(msValidated);
213 }
214 }
215 private function f_ts_MS_Validated(template (omit) BIT1 msValidated)
216 return template (omit) MS_Validated {
217 if (istemplatekind(msValidated, "omit")) {
218 return omit;
219 }
220 return ts_MS_Validated(msValidated);
221 }
222
223 /* 7.7.13 TEI Data I */
224 template (value) TeidDataI ts_TeidDataI(template (value) OCT4 teid) := {
225 type_gtpc := '10'O,
226 teidDataI := teid
227 }
228 template (present) TeidDataI tr_TeidDataI(template (present) OCT4 teid := ?) := {
229 type_gtpc := '10'O,
230 teidDataI := teid
231 }
232
233 /* 7.7.14 TEI Control Plane */
234 template (value) TeidControlPlane ts_TEIC(template (value) OCT4 teic) := {
235 type_gtpc := '11'O,
236 teidControlPlane := teic
237 }
238 template (present) TeidControlPlane tr_TEIC(template (present) OCT4 teic := ?) := {
239 type_gtpc := '11'O,
240 teidControlPlane := teic
241 }
242 private function f_ts_TEIC(template (omit) OCT4 teic)
243 return template (omit) TeidControlPlane {
244 if (istemplatekind(teic, "omit")) {
245 return omit;
246 }
247 return ts_TEIC(teic);
248 }
249
250 /* 7.7.15 Tunnel Endpoint Identifier Data II */
251 template (value) TeidDataII ts_TeidDataII(template (value) BIT4 nsapi,
252 template (value) OCT4 teid) := {
253 type_gtpc := '12'O,
254 nsapi := nsapi,
255 unused := '0000'B,
256 teidDataII := teid
257 }
258 template (present) TeidDataII tr_TeidDataII(template (present) BIT4 nsapi := ?,
259 template (present) OCT4 teid := ?) := {
260 type_gtpc := '12'O,
261 nsapi := nsapi,
262 unused := '0000'B,
263 teidDataII := teid
264 }
265
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200266 /* IMEI(SV) IE TS 29.060 7.7.53 */
Philipp Maier57889492023-08-07 12:10:03 +0200267 template (value) IMEISV_gtpc ts_IMEISV(template (value) OCT8 imeisv) := {
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200268 type_gtpc := '9A'O,
269 lengthf := 8,
270 imeisv := imeisv
271 }
272 private function f_ts_IMEISV(template (omit) OCT8 imeisv)
273 return template (omit) IMEISV_gtpc {
274 if (istemplatekind(imeisv, "omit")) {
275 return omit;
276 }
277 return ts_IMEISV(imeisv);
278 }
279
Philipp Maier57889492023-08-07 12:10:03 +0200280 template (present) IMEISV_gtpc tr_IMEISV(template (present) OCT8 imeisv) := {
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200281 type_gtpc := '9A'O,
282 lengthf := 8,
283 imeisv := imeisv
284 }
285
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200286 // MS Time Zone - 7.7.52
287 template (value) MS_TimeZone ts_MS_TimeZone(template (value) OCT1 timeZone := '00'O,
288 template (value) BIT2 daylightSavingTime := '00'B) := {
289 type_gtpc := '99'O,
290 lengthf := 2,
291 timeZone := timeZone,
292 daylightSavingTime := daylightSavingTime,
293 spare1 := '000'B,
294 sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */
295 spare2 := '00'B
296 }
297 function f_ts_MS_TimeZone(template (omit) OCT1 timeZone, template (omit) BIT2 daylightSavingTime)
298 return template (omit) MS_TimeZone {
299 if (istemplatekind(timeZone, "omit") and istemplatekind(daylightSavingTime, "omit")) {
300 return omit;
301 }
302 if (istemplatekind(timeZone, "omit")) {
303 return ts_MS_TimeZone(daylightSavingTime := daylightSavingTime);
304 }
305 if (istemplatekind(daylightSavingTime, "omit")) {
306 return ts_MS_TimeZone(timeZone);
307 }
308 return ts_MS_TimeZone(timeZone, daylightSavingTime);
309 }
310
311 template (present) MS_TimeZone tr_MS_TimeZone(template (present) OCT1 timeZone := ?,
312 template (present) BIT2 daylightSavingTime := ?) := {
313 type_gtpc := '99'O,
314 lengthf := 2,
315 timeZone := timeZone,
316 daylightSavingTime := daylightSavingTime,
317 spare1 := '000'B,
318 sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */
319 spare2 := '00'B
320 }
321
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200322 /* Charging Characteristics IE TS 29.060 7.7.23 */
Philipp Maier57889492023-08-07 12:10:03 +0200323 template (value) ChargingCharacteristics_GTPC ts_ChargingCharacteristics(template (value) OCT2 chargingChar) := {
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200324 type_gtpc := '1A'O,
325 chargingChar := chargingChar
326 }
327 private function f_ts_ChargingCharacteristics(template (omit) OCT2 chargingChar)
328 return template (omit) ChargingCharacteristics_GTPC {
329 if (istemplatekind(chargingChar, "omit")) {
330 return omit;
331 }
332 return ts_ChargingCharacteristics(chargingChar);
333 }
334
Philipp Maier57889492023-08-07 12:10:03 +0200335 template (present) ChargingCharacteristics_GTPC tr_ChargingCharacteristics(template (present) OCT2 chargingChar) := {
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200336 type_gtpc := '1A'O,
337 chargingChar := chargingChar
338 }
339
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100340 /* 7.7.28 MM Context */
341 template (value) MM_Context ts_MM_ContextUMTS(template (value) OCT16 ck,
342 template (value) OCT16 ik) := {
343 type_gtpc := '81'O,
344 context := {
345 mmcontUMTS := {
346 lengthf := 0, /* overwritten */
347 ksi := '001'B,
348 usedGPRSIntegrityAlgorithm := '000'B,
349 ugipai := '1'B, /* Integrity Protection not required */
350 gupii := '1'B, /* Ignore "Used GPRS integrity protection algorithm" field" */
351 spare1 := '000'B,
352 noofVectors := 0, /* TODO: fill quintpuplets*/
353 security := '01'B, /* UMTS key and quintuplets */
354 ck := ck,
355 ik := ik,
356 quintupletlength := 0, /* overwritten */
357 quintuplet := ''O,
358 drx_par := '0000'O,
359 msNetW_cap_length := 0, /* overwritten */
360 msNetw_cap := omit,
361 containerLength := 0, /* overwritten */
362 container := omit,
363 access_restriction_data_length := 0, /* overwritten */
364 access_restriction_data := omit
365 }
366 }
367 }
368
369 /* 7.7.29 PDP Context */
370 template (value) PDP_Context_GTPC ts_PDP_Context_GTPC(template (value) octetstring pdp_addr,
371 template (value) octetstring ggsn_gsn_addr,
372 template (value) octetstring apn,
373 template (value) OCT4 ggsn_teic := '12345678'O,
374 template (value) OCT4 ggsn_teid := '87654321'O) := {
375 type_gtpc := '82'O,
376 lengthf := 0, /* overwritten */
377 nsapi := '0101'B,
378 order := '0'B,
379 asi := '0'B,
380 vaa := '0'B,
381 ea := '0'B,
382 sapi := '0011'B,
383 spare1 := '0000'B,
384 qos_subLength := 0, /* overwritten */
385 qos_sub := ts_QosProfileValueDefault,
386 qos_reqLength := 0, /* overwritten */
387 qos_req := ts_QosProfileValueDefault,
388 qos_negLength := 0, /* overwritten */
389 qos_neg := ts_QosProfileValueDefault,
390 snd := '0000'O,
391 snu := '0000'O,
392 sendNPDUnum := '00'O,
393 receiveNPDUnum := '00'O,
394 uteidControlPlane := ggsn_teic,
395 uteidData1 := ggsn_teid,
396 pdpcontext := '00'O,
397 pdp_typeorg := '0001'B, /* IETF */
398 spare2 := '1111'B,
399 pdp_typenum := '21'O, /* IETF IPV4 */
400 pdp_addressLength := 0, /* overwritten */
401 pdp_address := pdp_addr,
402 ggsn_addressControlPlaneLength := 0, /* overwritten */
403 ggsn_addressControlPlane := ggsn_gsn_addr,
404 ggsn_addressUserPlaneLength := 0, /* overwritten */
405 ggsn_addressUserPlane := ggsn_gsn_addr,
406 apnLength := 0, /* overwritten */
407 apn := apn,
408 transactionId := '0001'B,
409 spare3 := '0000'B,
410 transactionID_cont := '00'O,
411 pdp_typenum2 := omit,
412 pdp_addresslength2 := omit,
413 pdp_Address2 := omit
414 }
415
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200416
Philipp Maier1c0c7262023-07-24 10:51:53 +0200417 /* template matching reception of GTP-C unit-data */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100418 template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) Gtp1cPeer peer,
Philipp Maier57889492023-08-07 12:10:03 +0200419 template (present) OCT1 msg_type,
420 template (present) OCT4 teid,
421 template (present) GTPC_PDUs pdus := ?) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100422 peer := peer,
423 gtpc := tr_GTP1C_PDU(msg_type, teid, pdus)
424 }
425
426 /* template matching reception of GTP-C echo-request */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100427 template (present) Gtp1cUnitdata tr_GTPC_PING(template (present) Gtp1cPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
Harald Weltec69cf4e2018-02-17 20:57:02 +0100428
Philipp Maier57889492023-08-07 12:10:03 +0200429 template (present) GTPC_PDUs tr_EchoRespPDU(template (present) OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100430 echoResponse := {
431 recovery := tr_Recovery(restart_counter),
432 private_extension_gtpc := *
433 }
434 }
435
436 /* template matching reception of GTP-C echo-response */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100437 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 +0100438
Philipp Maier57889492023-08-07 12:10:03 +0200439 template (value) GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100440 echoResponse := {
441 recovery := ts_Recovery(restart_counter),
442 private_extension_gtpc := omit
443 }
444 }
445
446 /* master template for senidng a GTP-C echo response */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100447 template (value) Gtp1cUnitdata ts_GTPC_PONG(Gtp1cPeer peer, uint16_t seq, OCT1 rest_ctr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100448 peer := peer,
449 gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq)
450 }
451
Philipp Maier57889492023-08-07 12:10:03 +0200452 template (value) GTPC_PDUs ts_EchoReqPDU := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100453 echoRequest := {
454 private_extension_gtpc := omit
455 }
456 }
457
458 /* master template for sending a GTP-C echo request */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100459 template (value) Gtp1cUnitdata ts_GTPC_PING(Gtp1cPeer peer, uint16_t seq) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100460 peer := peer,
461 gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq)
462 }
463
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200464 private function f_eua_ipv4_len(template OCT4 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100465 if (istemplatekind(ip_addr, "omit")) {
466 return 2;
467 } else if (istemplatekind(ip_addr, "*")) {
468 return ?;
469 } else if (istemplatekind(ip_addr, "?")) {
470 return 6;
471 }
472 return 6;
473 }
474
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200475 private function f_eua_ipv6_len(template OCT16 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100476 if (istemplatekind(ip_addr, "omit")) {
477 return 2;
478 } else if (istemplatekind(ip_addr, "*")) {
479 return ?;
480 } else if (istemplatekind(ip_addr, "?")) {
481 return 18;
482 }
483 return 18;
484 }
485
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200486 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 +0100487 var integer len := 2;
488 if (istemplatekind(ip_addr4, "*") or
489 istemplatekind(ip_addr6, "*")) {
490 return ?;
491 }
492 if (not istemplatekind(ip_addr4, "omit")) {
493 len := len + 4;
494 }
495 if (not istemplatekind(ip_addr6, "omit")) {
496 len := len + 16;
497 }
498 return len;
499 }
500
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200501 template (present) EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100502 type_gtpc := '80'O,
503 endUserAddress := {
504 endUserAddressIPv4 := {
505 lengthf := 2,
506 pdp_typeorg := '0001'B,
507 spare := '1111'B,
508 pdp_typenum := '21'O,
509 ipv4_address := ip_addr
510 }
511 }
512 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200513 template (present) EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200514 template (present) EndUserAddress tr_EuaIPv4(template (present) OCT4 ip_addr) modifies t_EuaIPv4 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100515 endUserAddress := {
516 endUserAddressIPv4 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100517 lengthf := f_eua_ipv4_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100518 }
519 }
520 }
521
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200522 template (present) EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100523 type_gtpc := '80'O,
524 endUserAddress := {
525 endUserAddressIPv6 := {
526 lengthf := 2,
527 pdp_typeorg := '0001'B,
528 spare := '1111'B,
529 pdp_typenum := '57'O,
530 ipv6_address := ip_addr
531 }
532 }
533 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200534 template (present) EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200535 template (present) EndUserAddress tr_EuaIPv6(template (present) OCT16 ip_addr) modifies t_EuaIPv6 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100536 endUserAddress := {
537 endUserAddressIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100538 lengthf := f_eua_ipv6_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100539 }
540 }
541 }
542
Oliver Smithee6a0882019-03-08 11:05:46 +0100543 /* 3GPP TS 29.060 Figure 37A: End User Address Information Element for IPv4v6 (both static) */
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200544 template (present) EndUserAddress t_EuaIPv4v6(template OCT4 ip_addr4, template OCT16 ip_addr6) := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100545 type_gtpc := '80'O,
546 endUserAddress := {
547 endUserAddressIPv4andIPv6 := {
548 lengthf := 2,
549 pdp_typeorg := '0001'B,
550 spare := '1111'B,
551 pdp_typenum := '8D'O,
552 ipv4_address := ip_addr4,
553 ipv6_address := ip_addr6
554 }
555 }
556 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200557 template (present) EndUserAddress t_EuaIPv4Dynv6Dyn := t_EuaIPv4v6(omit, omit);
Philipp Maier57889492023-08-07 12:10:03 +0200558 template (present) EndUserAddress tr_EuaIPv4v6(template (present) OCT4 ip_addr4,
559 template (present) OCT16 ip_addr6) modifies t_EuaIPv4v6 := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100560 endUserAddress := {
561 endUserAddressIPv4andIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100562 lengthf := f_eua_ipv4v6_len(ip_addr4, ip_addr6)
Oliver Smithee6a0882019-03-08 11:05:46 +0100563 }
564 }
565 }
566
Philipp Maier57889492023-08-07 12:10:03 +0200567 template (value) AccessPointName ts_APN(octetstring apn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100568 type_gtpc := '83'O,
569 lengthf := lengthof(apn),
570 apn_value := apn
571 }
572
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100573 template (value) GSN_Address_GTPC ts_GsnAddr(template (value) octetstring ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100574 type_gtpc := '85'O,
575 lengthf := lengthof(ip_addr),
576 addressf := ip_addr
577 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100578 template (present) GSN_Address_GTPC tr_GsnAddr(template (present) octetstring ip_addr := ?) := {
579 type_gtpc := '85'O,
580 lengthf := ?,
581 addressf := ip_addr
582 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100583
Philipp Maier57889492023-08-07 12:10:03 +0200584 template (value) MSISDN ts_Msisdn(octetstring msisdn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100585 type_gtpc := '86'O,
586 lengthf := lengthof(msisdn),
587 msisdn := msisdn
588 }
589
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100590 template (value) QoSV_GTPC ts_QosValueDefault := {
591 reliabilityClass := '011'B,
592 delayClass := '001'B,
593 spare1 := '00'B,
594 precedenceClass := '010'B,
595 spare2 := '0'B,
596 peakThroughput := '1001'B,
597 meanThroughput := '11111'B,
598 spare3 := '000'B,
599 deliverErroneusSDU := '010'B, /* Erroneus SDU are delivered */
600 deliveryOrder := '10'B, /* Without delivery order */
601 trafficClass := '100'B, /* Background */
602 maxSDUSize := '96'O, /* 1500 octets */
603 maxBitrateUplink := 'FE'O, /* 8640, continues in extended octet */
604 maxBitrateDownlink := 'FE'O, /* 8640, continues in extended octet */
605 sduErrorRatio := '0100'B, /* 1x10^-4 */
606 residualBER := '0101'B, /* 1x10^-3 */
607 trafficHandlingPriority := '01'B, /* prio 1 */
608 transferDelay := '000001'B, /* 10 ms */
609 guaranteedBitRateUplink := 'FE'O, /* 8640, continues in extended octet */
610 guaranteedBitRateDownlink := 'FE'O, /* 8640, continues in extended octet */
611 sourceStatisticsDescriptor := '0000'B, /* unknown */
612 signallingIndication := '0'B, /* Not optimized */
613 spare4 := '000'B,
614 maxBitrateDownlinkExt := '5B'O, /* 33 mbps */
615 guaranteedBitRateDownlinkExt := '5B'O, /* 33 mbps */
616 maxBitrateUplinkExt := '6e'O, /* 52 mbps */
617 guaranteedBitRateUplinkExt := '6e'O /* 52 mbps */
618 }
619
620 template (value) QualityOfServiceProfile_Value ts_QosProfileValueDefault := {
621 allocRetensionPrio := '00'O,
622 qos_ProfileValue := ts_QosValueDefault
623 }
624
Philipp Maier57889492023-08-07 12:10:03 +0200625 template (value) QualityOfServiceProfile ts_QosDefault := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100626 type_gtpc := '87'O,
Pau Espin Pedrol7d58b082022-06-07 13:30:03 +0200627 lengthf := 17,
Harald Weltec69cf4e2018-02-17 20:57:02 +0100628 allocRetensionPrio := '00'O,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100629 qos_ProfileValue := ts_QosValueDefault
Harald Weltec69cf4e2018-02-17 20:57:02 +0100630 }
631
Philipp Maier57889492023-08-07 12:10:03 +0200632 template (value) IMSI_gtpc ts_Imsi(hexstring digits) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100633 type_gtpc := '02'O,
634 digits := digits,
635 padding := 'F'H
636 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100637 function f_ts_Imsi(template (omit) hexstring digits := omit) return template (omit) IMSI_gtpc {
638 var template (omit) IMSI_gtpc imsi;
639 if (istemplatekind(digits, "omit")) {
640 imsi := omit;
641 } else {
642 imsi := ts_Imsi(valueof(digits));
643 }
644 return imsi;
645 }
646 template (present) IMSI_gtpc tr_Imsi(template (present) hexstring digits) := {
647 type_gtpc := '02'O,
648 digits := digits,
649 padding := 'F'H
650 }
651 function f_tr_Imsi(template hexstring digits := *) return template IMSI_gtpc {
652 if (istemplatekind(digits, "omit")) {
653 return omit;
654 } else if (istemplatekind(digits, "*")) {
655 return *;
656 } else {
657 return tr_Imsi(digits);
658 }
659 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100660
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100661 /* 7.7.50 RAT Type */
662 type enumerated GTP_RATType {
663 GTP_RAT_TYPE_RESERVED (0),
664 GTP_RAT_TYPE_UTRAN (1),
665 GTP_RAT_TYPE_GERAN (2),
666 GTP_RAT_TYPE_WLAN (3),
667 GTP_RAT_TYPE_GAN (4),
668 GTP_RAT_TYPE_HSPA_E (5),
669 GTP_RAT_TYPE_EUTRAN (6)
670 };
671 template (value) RATType ts_RATType(template (value) OCT1 rat_type) := {
672 type_gtpc := '97'O,
673 lengthf := 1,
674 ratTypeValue := rat_type
675 }
676 function f_ts_RATType(template (omit) OCT1 rat_type := omit) return template (omit) RATType {
677 if (istemplatekind(rat_type, "omit")) {
678 return omit;
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100679 } else {
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100680 return ts_RATType(rat_type);
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100681 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100682 }
683 template (present) RATType tr_RATType(template (present) OCT1 rat_type) := {
684 type_gtpc := '97'O,
685 lengthf := 1,
686 ratTypeValue := rat_type
687 }
688 function f_tr_RATType(template OCT1 rat_type := *) return template RATType {
689 if (istemplatekind(rat_type, "omit")) {
690 return omit;
691 } else if (istemplatekind(rat_type, "*")) {
692 return *;
693 } else {
694 return tr_RATType(rat_type);
695 }
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100696 }
697
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100698 template (value) RoutingAreaIdentity ts_RoutingAreaIdentity(template (value) hexstring mcc_digits,
699 template (value) hexstring mnc_digits,
700 template (value) OCT2 lac,
701 template (value) OCT1 rac) := {
702 type_gtpc := '03'O,
703 mcc_digits := mcc_digits,
704 mnc_digits := mnc_digits,
705 lac := lac,
706 rac := rac
707 }
708
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100709 template (value) GeographicLocationCGI
710 ts_GeographicLocationCGI(template (value) hexstring mcc,
Philipp Maier57889492023-08-07 12:10:03 +0200711 template (value) hexstring mnc,
712 template (value) OCT2 lac,
713 template (value) OCT2 cI_value) :=
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100714 {
715 mccDigit1 := mcc[0],
716 mccDigit2 := mcc[1],
717 mccDigit3 := mcc[2],
718 mncDigit3 := mnc[2], /* 'F'H for 2 digit MNC */
719 mncDigit1 := mnc[0],
720 mncDigit2 := mnc[1],
721 lac := lac,
722 cI_value := cI_value
723 }
724
Philipp Maier57889492023-08-07 12:10:03 +0200725 template (value) GTPC_PDUs ts_CreatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
726 BIT4 nsapi, EndUserAddress eua, octetstring apn,
727 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
728 octetstring msisdn, template (omit) ProtConfigOptions pco := omit,
729 template (omit) OCT1 ratType := omit,
730 template (omit) UserLocationInformation uli := omit,
731 template (omit) OCT2 charging_char := omit,
732 template (omit) OCT8 imeisv := omit,
733 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100734 createPDPContextRequest := {
735 imsi := ts_Imsi(imsi),
736 rai := omit,
737 recovery := ts_Recovery(restart_ctr),
738 selectionMode := {
739 type_gtpc := '0F'O,
740 selectModeValue := '00'B,
741 spare := '111111'B
742 },
743 teidDataI := {
744 type_gtpc := '00'O,
745 teidDataI := teid_data
746 },
747 teidControlPlane := {
748 type_gtpc := '00'O,
749 teidControlPlane := teid_ctrl
750 },
751 nsapi := {
752 type_gtpc := '00'O,
753 nsapi := nsapi,
754 unused := '0000'B
755 },
756 linked_nsapi := omit,
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200757 charging_char := f_ts_ChargingCharacteristics(charging_char),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100758 trace_ref := omit,
759 trace_type := omit,
760 endUserAddress := eua,
761 accessPointName := ts_APN(apn),
762 protConfigOptions := pco,
763 sgsn_addr_signalling := ts_GsnAddr(sgsn_ip_sign),
764 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
765 msisdn := ts_Msisdn(msisdn),
766 qualityOfServiceProfile := ts_QosDefault,
767 tft := omit,
768 triggerId := omit,
769 omcId := omit,
770 commonFlags := omit,
771 aPN_Restriction := omit,
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100772 ratType := f_ts_RATType(ratType),
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100773 userLocationInformation := uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200774 mS_TimeZone := ms_tz,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200775 imeisv := f_ts_IMEISV(imeisv),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100776 camelChargingInformationContainer := omit,
777 additionalTraceInfo := omit,
778 correlationID := omit,
779 evolvedAllocationRetentionPriorityI := omit,
780 extendedCommonFlags := omit,
781 userCSGInformation := omit,
782 aPN_AMBR := omit,
783 signallingPriorityIndication := omit,
784 cN_OperatorSelectionEntity := omit,
785 private_extension_gtpc := omit
786 }
787 }
788
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100789 template (value) Gtp1cUnitdata ts_GTPC_CreatePDP(Gtp1cPeer peer, uint16_t seq, hexstring imsi,
Philipp Maier57889492023-08-07 12:10:03 +0200790 OCT1 restart_ctr, OCT4 teid_data,
791 OCT4 teid_ctrl, BIT4 nsapi, EndUserAddress eua,
792 octetstring apn, octetstring sgsn_ip_sign,
793 octetstring sgsn_ip_data, octetstring msisdn,
794 template (omit) ProtConfigOptions pco := omit,
795 template (omit) OCT1 ratType := omit,
796 template (omit) UserLocationInformation uli := omit,
797 template (omit) OCT2 charging_char := omit,
798 template (omit) OCT8 imeisv := omit,
799 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100800 peer := peer,
801 gtpc := ts_GTP1C_PDU(createPDPContextRequest, '00000000'O,
802 valueof(ts_CreatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
803 nsapi, eua, apn, sgsn_ip_sign,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200804 sgsn_ip_data, msisdn, pco, ratType, uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200805 charging_char, imeisv, ms_tz)), seq)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100806 }
807
Harald Welteeded9ad2018-02-17 20:57:34 +0100808
Philipp Maier57889492023-08-07 12:10:03 +0200809 template (value) GTPC_PDUs ts_UpdatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
810 BIT4 nsapi,
811 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
812 template (omit) ProtConfigOptions pco := omit,
813 template (omit) OCT1 ratType := omit,
814 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100815 updatePDPContextRequest := {
816 updatePDPContextRequestSGSN := {
817 imsi := ts_Imsi(imsi),
818 rai := omit,
819 recovery := ts_Recovery(restart_ctr),
820 teidDataI := {
821 type_gtpc := '00'O,
822 teidDataI := teid_data
823 },
824 teidControlPlane := {
825 type_gtpc := '00'O,
826 teidControlPlane := teid_ctrl
827 },
828 nsapi := {
829 type_gtpc := '00'O,
830 nsapi := nsapi,
831 unused := '0000'B
832 },
833 trace_ref := omit,
834 trace_type := omit,
835 protConfigOptions := pco,
836 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_ip_sign),
837 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
838 alt_ggsn_addr_controlPane := omit,
839 alt_ggsn_addr_traffic := omit,
840 qualityOfServiceProfile := ts_QosDefault,
841 tft := omit,
842 triggerId := omit,
843 omcId := omit,
844 commonFlags := omit,
845 ratType := f_ts_RATType(ratType),
846 userLocationInformation := uli,
847 mS_TimeZone := omit,
848 additionalTraceInfo := omit,
849 directTunnelFlags := omit,
850 evolvedAllocationRetentionPriorityI := omit,
851 extendedCommonFlags := omit,
852 userCSGInformation := omit,
853 aPN_AMBR := omit,
854 signallingPriorityIndication := omit,
855 cN_OperatorSelectionEntity := omit,
856 private_extension_gtpc := omit
857 }
858 }
859 }
860
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100861 template (value) Gtp1cUnitdata ts_GTPC_UpdatePDP(Gtp1cPeer peer, OCT4 teid, uint16_t seq, hexstring imsi,
Philipp Maier57889492023-08-07 12:10:03 +0200862 OCT1 restart_ctr, OCT4 teid_data,
863 OCT4 teid_ctrl, BIT4 nsapi, octetstring sgsn_ip_sign,
864 octetstring sgsn_ip_data,
865 template (omit) ProtConfigOptions pco := omit,
866 template (omit) OCT1 ratType := omit,
867 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100868 peer := peer,
869 gtpc := ts_GTP1C_PDU(updatePDPContextRequest, teid,
870 valueof(ts_UpdatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
871 nsapi, sgsn_ip_sign,
872 sgsn_ip_data, pco, ratType, uli)), seq)
873 }
874
875
Philipp Maier57889492023-08-07 12:10:03 +0200876 template (value) NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100877 type_gtpc := '14'O,
878 nsapi := nsapi,
879 unused := '0000'B
880 }
881
Philipp Maier57889492023-08-07 12:10:03 +0200882 template (value) ReorderingRequired ts_ReorderReq(boolean req := false) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100883 type_gtpc := '08'O,
884 reordreq := bool2bit(req),
885 spare := '0000000'B
886 }
887
Philipp Maier57889492023-08-07 12:10:03 +0200888 template (value) GTPC_PDUs ts_CreatePdpRespPDU(OCT1 cause, OCT4 teid_data, OCT4 teid_ctrl, BIT4 nsapi,
889 octetstring ggsn_ip_sign, octetstring ggsn_ip_data,
890 OCT4 chg_id, template (omit) EndUserAddress eua := omit,
891 template (omit) Recovery_gtpc recovery := omit,
892 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100893 createPDPContextResponse := {
894 cause := { '00'O, cause },
895 reorderingRequired := ts_ReorderReq(false),
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200896 recovery := recovery,
Harald Welteeded9ad2018-02-17 20:57:34 +0100897 teidDataI := {
898 type_gtpc := '00'O,
899 teidDataI := teid_data
900 },
901 teidControlPlane := {
902 type_gtpc := '00'O,
903 teidControlPlane := teid_ctrl
904 },
905 nsapi := ts_NSAPI(nsapi),
Harald Welte7aff2ca2018-02-18 15:34:50 +0100906 chargingID := {
907 type_gtpc := '7F'O,
908 chargingID := chg_id
909 },
Harald Welteeded9ad2018-02-17 20:57:34 +0100910 endUserAddress := eua,
911 protConfigOptions := pco,
912 ggsn_addr_controlPlane := ts_GsnAddr(ggsn_ip_sign),
913 ggsn_addr_traffic := ts_GsnAddr(ggsn_ip_data),
914 alt_ggsn_addr_controlPane := omit,
915 alt_ggsn_addr_traffic := omit,
916 qualityOfServiceProfile := ts_QosDefault,
917 commonFlags := omit,
918 aPN_Restriction := omit,
919 mS_InfoChangeReportingAction := omit,
920 bearerControlMode := omit,
921 evolvedAllocationRetentionPriorityI := omit,
922 extendedCommonFlag := omit,
923 csg_information_reporting_action := omit,
924 aPN_AMBR := omit,
925 gGSN_BackOffTime := omit,
926 private_extension_gtpc := omit
927 }
928 }
929
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100930 template (value) Gtp1cUnitdata ts_GTPC_CreatePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +0200931 OCT1 cause,
932 OCT4 teid_ctrl, OCT4 teid_data,
933 BIT4 nsapi, octetstring ggsn_ip_sign,
934 octetstring ggsn_ip_data, OCT4 chg_id,
935 template (omit) EndUserAddress eua := omit,
936 template (omit) Recovery_gtpc recovery := omit,
937 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100938 peer := peer,
939 gtpc := ts_GTP1C_PDU(createPDPContextResponse, teid,
940 valueof(ts_CreatePdpRespPDU(cause, teid_data, teid_ctrl, nsapi,
Harald Welte7aff2ca2018-02-18 15:34:50 +0100941 ggsn_ip_sign, ggsn_ip_data, chg_id,
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200942 eua, recovery, pco)), seq)
Harald Welteeded9ad2018-02-17 20:57:34 +0100943 }
944
Harald Weltec69cf4e2018-02-17 20:57:02 +0100945 /* PCO send base template */
Philipp Maier57889492023-08-07 12:10:03 +0200946 template (value) ProtConfigOptions ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100947 type_gtpc := '84'O,
948 lengthf := 0,
949 configProtocol := '000'B,
950 spare := '0000'B,
951 extension0 := '1'B,
952 protocols := {}
953 }
954 /* PCO receive base template */
Philipp Maier57889492023-08-07 12:10:03 +0200955 template (present) ProtConfigOptions tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100956 type_gtpc := '84'O,
957 lengthf := ?,
958 configProtocol := '000'B,
959 spare := ?,
960 extension0 := '1'B,
961 protocols := {}
962 }
963
Philipp Maier57889492023-08-07 12:10:03 +0200964 template (value) ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100965 protocols := {
966 { protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O }
967 }
968 }
Philipp Maier57889492023-08-07 12:10:03 +0200969 template (present) ProtConfigOptions tr_PCO_IPv6_DNS_resp(template (present) OCT16 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100970 protocols := {
971 *, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, *
972 }
973 }
974
Pau Espin Pedrolcff72f82024-01-26 16:58:48 +0100975 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP(uint8_t ipcp_req_id := 0) modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100976 protocols := {
977 /* dummy PAP entry to check if our parser in the GGSN can properly iterate over
978 * the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */
979 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
980 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
Pau Espin Pedrolcff72f82024-01-26 16:58:48 +0100981 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS(ipcp_req_id))) }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100982 }
983 }
984
Philipp Maier57889492023-08-07 12:10:03 +0200985 template (value) ProtConfigOptions ts_PCO_IPv4_PRI_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +0200986 protocols := {
987 /* dummy PAP entry to check if our parser can cope with a single primary DNS entry
988 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
989 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
990 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
991 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) }
992 }
993 }
Philipp Maier57889492023-08-07 12:10:03 +0200994 template (value) ProtConfigOptions ts_PCO_IPv4_SEC_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +0200995 protocols := {
996 /* dummy PAP entry to check if our parser can cope with a single secondary DNS entry
997 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
998 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
999 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1000 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1001 }
1002 }
Philipp Maier57889492023-08-07 12:10:03 +02001003 template (value) ProtConfigOptions ts_PCO_IPv4_SEPARATE_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001004 protocols := {
1005 /* dummy PAP entry to check if our parser can cope with a primary and secondary DNS
1006 * in separate IPCP containers OS#3381 */
1007 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1008 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1009 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) },
1010 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1011 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1012 }
1013 }
1014
Philipp Maier57889492023-08-07 12:10:03 +02001015 template (present) ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001016 protocolID := prot_id,
1017 lengthProtoID := ?,
1018 protoIDContents := ?
1019 }
Philipp Maier57889492023-08-07 12:10:03 +02001020 template (value) ProtocolElement ts_PCOelem_PAP_broken := {
Harald Weltef8298542019-04-10 10:15:28 +02001021 protocolID := 'C023'O,
1022 lengthProtoID := 60,
1023 /* PPP Password Authentication Protocol containing incorrect Peer-Id-Length set to 4 (6-7 should be the valid one), see OS#3914. */
1024 protoIDContents := '0100003c'O & '0444435338323700bc1c08087c1508083e00790000150808fd06000001000000000000000000000000000000000000000000000000000000'O
1025 }
Philipp Maier57889492023-08-07 12:10:03 +02001026 template (value) ProtConfigOptions ts_PCO_PAP_IPv4_DNS modifies ts_PCO := {
Harald Weltef8298542019-04-10 10:15:28 +02001027 protocols := {
1028 ts_PCOelem_PAP_broken,
1029 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
1030 }
1031 }
Philipp Maier57889492023-08-07 12:10:03 +02001032 template (present) ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001033 protocols := { *, tr_PCO_Proto(prot_id), * }
1034 }
1035
Philipp Maier57889492023-08-07 12:10:03 +02001036 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001037 protocols := {
1038 { protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
1039 }
1040 }
Philipp Maier57889492023-08-07 12:10:03 +02001041 template (present) ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template (present) OCT4 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001042 protocols := {
1043 *, { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }, *
1044 }
1045 }
1046
1047 /* extract a given protocol payload from PCO */
1048 function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring {
1049 var integer i;
1050 var integer num_matches := 0;
1051 for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
1052 if (pco.protocols[i].protocolID == protocol) {
1053 num_matches := num_matches + 1;
1054 if (num_matches == nth_match) {
1055 return pco.protocols[i].protoIDContents;
1056 }
1057 }
1058 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +02001059 setverdict(fail, "Could not extract protocol payload from protocol ", protocol);
1060 mtc.stop;
Harald Weltec69cf4e2018-02-17 20:57:02 +01001061 return ''O;
1062 }
1063
Philipp Maier57889492023-08-07 12:10:03 +02001064 template (present) IpcpPacket tr_IPCP(template (present) LcpCode code, template (present)uint8_t identifier,
1065 template (present) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001066 code := code,
1067 identifier := identifier,
1068 len := ?,
1069 options := opts
1070 }
Philipp Maier57889492023-08-07 12:10:03 +02001071 template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001072 code := IPCP_OPT_PrimaryDNS,
1073 len := 6,
1074 data := addr
1075 }
Philipp Maier57889492023-08-07 12:10:03 +02001076 template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001077 code := IPCP_OPT_SecondaryDNS,
1078 len := 6,
1079 data := addr
1080 }
Philipp Maier57889492023-08-07 12:10:03 +02001081 template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?,
1082 template (present) OCT4 dns1 := ?,
1083 template (present) OCT4 dns2 := ?) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001084 tr_IPCP(LCP_Configure_Ack, identifier,
1085 { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
1086
Philipp Maier57889492023-08-07 12:10:03 +02001087 template (value) IpcpPacket ts_IPCP(LcpCode code, uint8_t identifier, template (value) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001088 code := code,
1089 identifier := identifier,
1090 len := 0, /* overwritten */
1091 options := opts
1092 }
Philipp Maier57889492023-08-07 12:10:03 +02001093 template (value) IpcpPacket ts_IPCP_ReqDNS(uint8_t identifier := 0) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001094 ts_IPCP(LCP_Configure_Request, identifier,
1095 { tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) });
1096
Philipp Maier57889492023-08-07 12:10:03 +02001097 template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001098 ts_IPCP(LCP_Configure_Request, identifier,
1099 { tr_IPCP_PrimaryDns('00000000'O) });
Philipp Maier57889492023-08-07 12:10:03 +02001100 template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001101 ts_IPCP(LCP_Configure_Request, identifier,
1102 { tr_IPCP_SecondaryDns('00000000'O) });
1103
Harald Welte57b9b7f2018-02-18 22:28:13 +01001104 function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd {
1105 if (istemplatekind(ind, "omit")) {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001106 return omit;
1107 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001108 var TearDownInd ret := {
1109 type_gtpc := '13'O,
1110 tdInd := valueof(ind),
1111 spare:= '0000000'B
1112 }
1113 return ret;
1114 }
1115
Philipp Maier57889492023-08-07 12:10:03 +02001116 template (value) GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001117 deletePDPContextRequest := {
1118 cause := omit,
1119 tearDownIndicator := f_teardown_ind_IE(teardown_ind),
1120 nsapi := {
1121 type_gtpc := '14'O,
1122 nsapi := nsapi,
1123 unused := '0000'B
1124 },
1125 protConfigOptions := omit,
1126 userLocationInformation := omit,
1127 mS_TimeZone := omit,
1128 extendedCommonFlags := omit,
1129 uLI_Timestamp := omit,
1130 private_extension_gtpc := omit
1131 }
1132 }
1133
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001134 template (value) Gtp1cUnitdata ts_GTPC_DeletePDP(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +02001135 BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001136 peer := peer,
1137 gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid,
1138 valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq)
1139 }
1140
Philipp Maier57889492023-08-07 12:10:03 +02001141 template (value) GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause,
1142 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001143 deletePDPContextResponse := {
1144 cause := { '00'O, cause },
1145 protConfigOptions := pco,
1146 userLocationInformation := omit,
1147 mS_TimeZone := omit,
1148 uLI_Timestamp := omit,
1149 private_extension_gtpc := omit
1150 }
1151 }
1152
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001153 template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +02001154 OCT1 cause,
1155 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001156 peer := peer,
1157 gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid,
1158 valueof(ts_DeletePdpRespPDU(cause, pco)), seq)
1159 }
1160
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001161 /* SGSN Context Request - 7.5.3 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001162 template (present) GTPC_PDUs tr_SGSNContextReqPDU(template (present) RoutingAreaIdentity rai := ?,
1163 template (present) OCT4 teic := ?,
1164 template (present) octetstring sgsn_addr_control := ?,
1165 template hexstring imsi := *,
1166 template BIT1 msValidated := *,
1167 template TLLI tlli := *,
1168 template PacketTMSI ptmsi := *,
1169 template PTMSI_Signature ptmsi_sig := *,
1170 template OCT1 rat_type := *) := {
1171 sgsn_ContextRequest := {
1172 imsi := f_tr_Imsi(imsi),
1173 routingAreaIdentity := rai,
1174 tlli := tlli,
1175 packetTMSI := ptmsi,
1176 ptmsi_Signature := ptmsi_sig,
1177 ms_Validated := f_tr_MS_Validated(msValidated),
1178 teidControlPlane := {
1179 type_gtpc := '11'O,
1180 teidControlPlane := teic
1181 },
1182 sgsn_addr_controlPlane := tr_GsnAddr(sgsn_addr_control),
1183 alternative_sgsn_addr_controlPlane := *,
1184 sGSN_Number := *,
1185 ratType := f_tr_RATType(rat_type),
1186 hopCounter := *,
1187 private_extension_gtpc := *
1188 }
1189 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001190 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextReq(template (present) Gtp1cPeer peer,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001191 template (present) GTPC_PDUs SGSNContextReqPDU) := {
1192 peer := peer,
1193 gtpc := tr_GTP1C_PDU(sgsnContextRequest, '00000000'O, SGSNContextReqPDU)
1194 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001195 template (value) GTPC_PDUs ts_SGSNContextReqPDU(template (value) RoutingAreaIdentity rai,
1196 template (value) OCT4 teic,
1197 template (value) octetstring sgsn_addr_control,
1198 template (omit) hexstring imsi := omit,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001199 template (omit) BIT1 msValidated := '0'B,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001200 template (omit) TLLI tlli := omit,
1201 template (omit) PacketTMSI ptmsi := omit,
1202 template (omit) PTMSI_Signature ptmsi_sig := omit,
1203 template (omit) OCT1 rat_type := omit) := {
1204 sgsn_ContextRequest := {
1205 imsi := f_ts_Imsi(imsi),
1206 routingAreaIdentity := rai,
1207 tlli := tlli,
1208 packetTMSI := ptmsi,
1209 ptmsi_Signature := ptmsi_sig,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001210 ms_Validated := f_ts_MS_Validated(msValidated),
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001211 teidControlPlane := {
1212 type_gtpc := '11'O,
1213 teidControlPlane := teic
1214 },
1215 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1216 alternative_sgsn_addr_controlPlane := omit,
1217 sGSN_Number := omit,
1218 ratType := f_ts_RATType(rat_type),
1219 hopCounter := omit,
1220 private_extension_gtpc := omit
1221 }
1222 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001223 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextReq(Gtp1cPeer peer, uint16_t seq,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001224 template (value) GTPC_PDUs SGSNContextReqPDU) := {
1225 peer := peer,
1226 gtpc := ts_GTP1C_PDU(sgsnContextRequest, '00000000'O, valueof(SGSNContextReqPDU), seq)
1227 }
1228
1229 /* SGSN Context Response - 7.5.4 */
1230 template (present) GTPC_PDUs tr_SGSNContextRespPDU(template (present) GTP_Cause cause := ?,
1231 template hexstring imsi := *) := {
1232 sgsn_ContextResponse := {
1233 cause := tr_Cause_gtpc(cause),
1234 imsi := f_tr_Imsi(imsi),
1235 teidControlPlane := *,
1236 rabContext := *,
1237 radioPrioritySMS := *,
1238 radioPriority := *,
1239 packetFlowID := *,
1240 charging_char := *,
1241 mm_Context := *,
1242 pdp_Context := *,
1243 sgsn_addr_controlPlane := *,
1244 pdpContextPriorization := *,
1245 radioPriority_LCS := *,
1246 mBMS_UE_Context := *,
1247 subscribedRFSP_Index := *,
1248 rFSP_IndexInUse := *,
1249 colocatedGGSN_PGW_FQDN := *,
1250 evolvedAllocationRetentionPriorityII := *,
1251 extendedCommonFlags := *,
1252 ue_network_capability := *,
1253 ue_ambr := *,
1254 apn_ambr_nsapi := *,
1255 signallingPriorityIndication_nsapi := *,
1256 higher_bitrates_than_16mbps_flag := *,
1257 selectionMode_nsapi := *,
1258 localHomeNetworkID_nsapi := *,
1259 uE_UsageType := *,
1260 extendedCommonFlagsII := *,
1261 private_extension_gtpc := *
1262 }
1263 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001264 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextResp(template (present) Gtp1cPeer peer := ?,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001265 template (present) OCT4 teid := ?,
1266 template (present) GTPC_PDUs SGSNContextRespPDU := ?)
1267 := tr_GTPC_MsgType(peer, sgsnContextResponse, teid, SGSNContextRespPDU);
1268
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001269 template (value) GTPC_PDUs ts_SGSNContextRespPDU(template (value) GTP_Cause cause,
1270 template (omit) hexstring imsi := omit,
1271 template (omit) OCT4 teic := omit,
1272 template (omit) octetstring sgsn_addr_control := omit,
1273 template (omit) MM_Context mm_context := omit,
1274 template (omit) PDP_Context_GTPC_List pdp_ctx_list := omit) := {
1275 sgsn_ContextResponse := {
1276 cause := ts_Cause_gtpc(cause),
1277 imsi := f_ts_Imsi(imsi),
1278 teidControlPlane := f_ts_TEIC(teic),
1279 rabContext := omit,
1280 radioPrioritySMS := omit,
1281 radioPriority := omit,
1282 packetFlowID := omit,
1283 charging_char := omit,
1284 mm_Context := mm_context,
1285 pdp_Context := pdp_ctx_list,
1286 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1287 pdpContextPriorization := omit,
1288 radioPriority_LCS := omit,
1289 mBMS_UE_Context := omit,
1290 subscribedRFSP_Index := omit,
1291 rFSP_IndexInUse := omit,
1292 colocatedGGSN_PGW_FQDN := omit,
1293 evolvedAllocationRetentionPriorityII := omit,
1294 extendedCommonFlags := omit,
1295 ue_network_capability := omit,
1296 ue_ambr := omit,
1297 apn_ambr_nsapi := omit,
1298 signallingPriorityIndication_nsapi := omit,
1299 higher_bitrates_than_16mbps_flag := omit,
1300 selectionMode_nsapi := omit,
1301 localHomeNetworkID_nsapi := omit,
1302 uE_UsageType := omit,
1303 extendedCommonFlagsII := omit,
1304 private_extension_gtpc := omit
1305 }
1306 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001307 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextResp(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001308 template (value) GTPC_PDUs SGSNContextRespPDU) := {
1309 peer := peer,
1310 gtpc := ts_GTP1C_PDU(sgsnContextResponse, teid, valueof(SGSNContextRespPDU), seq)
1311 }
1312
1313
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001314 /* SGSN Context Acknowledge - 7.5.5 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001315 template (present) GTPC_PDUs tr_SGSNContextAckPDU(template (present) GTP_Cause cause := ?) := {
1316 sgsn_ContextAcknowledge := {
1317 cause := tr_Cause_gtpc(cause),
1318 teidDataII := *,
1319 sgsn_AddressForUserTraffic := *,
1320 sgsn_Number := *,
1321 nodeIdentifier := *,
1322 private_extension_gtpc := *
1323 }
1324 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001325 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextAck(template (present) Gtp1cPeer peer := ?,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001326 template (present) OCT4 teid := ?,
1327 template (present) GTPC_PDUs SGSNContextAckPDU := ?)
1328 := tr_GTPC_MsgType(peer, sgsnContextAcknowledge, teid, SGSNContextAckPDU);
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001329 template (value) GTPC_PDUs ts_SGSNContextAckPDU(template (value) GTP_Cause cause := GTP_CAUSE_REQUEST_ACCEPTED) := {
1330 sgsn_ContextAcknowledge := {
1331 cause := ts_Cause_gtpc(cause),
1332 teidDataII := omit,
1333 sgsn_AddressForUserTraffic := omit,
1334 sgsn_Number := omit,
1335 nodeIdentifier := omit,
1336 private_extension_gtpc := omit
1337 }
1338 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001339 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextAck(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001340 template (value) GTPC_PDUs SGSNContextAckPDU := ts_SGSNContextAckPDU(GTP_CAUSE_REQUEST_ACCEPTED)) := {
1341 peer := peer,
Pau Espin Pedrolca651b52023-12-20 18:37:39 +01001342 gtpc := ts_GTP1C_PDU(sgsnContextAcknowledge, teid, valueof(SGSNContextAckPDU), seq)
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001343 }
Harald Welte6f203162018-02-18 22:04:55 +01001344
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001345 /* GTP-C RIM */
1346
1347 template (value) RIM_Application_Identity_GTPC ts_GTPC_RIM_Application_Identity(OCT1 app_id) := {
1348 iEI := '4B'O,
1349 ext := '1'B,
1350 lengthIndicator := {
1351 length1 := 1
1352 },
1353 rIMApplicationIdentity := app_id
1354 }
1355 /* 3GPP TS 48.018 11.3.62 */
1356 template (value) RIM_Sequence_Number_GTPC ts_GTPC_RIM_Sequence_Number(integer seq) := {
1357 iEI := '4C'O,
1358 ext := '1'B,
1359 lengthIndicator := {
1360 length1 := 4
1361 },
1362 rIMSequenceNumber := int2oct(seq, 4)
1363 }
1364 template (value) RIM_PDU_Indications_GTPC ts_GTPC_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
1365 iEI := '4F'O,
1366 ext := '1'B,
1367 lengthIndicator := {
1368 length1 := 1
1369 },
1370 ack := bool2bit(ack),
1371 pDU_Type_Extension := type_ext,
1372 reserved := '0000'B
1373 }
1374 /* 3GPP TS 48.018 11.3.67 */
1375 template (value) RIM_Protocol_Version_Number_GTPC ts_GTPC_RIM_Protocol_Version_Number(integer ver) := {
1376 iEI := '55'O,
1377 ext := '1'B,
1378 lengthIndicator := {
1379 length1 := 1
1380 },
1381 rIMProtocolVersionNumber := int2oct(ver, 1)
1382 }
Philipp Maier57889492023-08-07 12:10:03 +02001383 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 +02001384 var template Cell_Identifier_V_GTPC ret := {
1385 mccDigit1 := ?,
1386 mccDigit2 := ?,
1387 mccDigit3 := ?,
1388 mncDigit3 := ?,
1389 mncDigit1 := ?,
1390 mncDigit2 := ?,
1391 lac := ?,
1392 rac := ?,
1393 cI_value := ?
1394 }
Philipp Maier57889492023-08-07 12:10:03 +02001395 if (istemplatekind(cid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001396 return ?;
1397 }
1398 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1399 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1400 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1401 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1402 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1403 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1404 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1405 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1406 }
1407 if (isvalue(cid.ra_id.lai.lac)) {
1408 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
1409 }
1410 }
1411 if (isvalue(cid) and isvalue(cid.ra_id)) {
1412 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
1413 }
1414 if (isvalue(cid)) {
1415 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
1416 }
1417 return ret;
1418 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001419 template (value) Cell_Identifier_V_GTPC ts_GTPC_Cell_Identifier_V(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001420 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1421 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1422 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1423 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1424 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1425 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1426 lac := int2oct(cid.ra_id.lai.lac, 2),
1427 rac := int2oct(cid.ra_id.rac, 1),
1428 cI_value := int2oct(cid.cell_id, 2)
1429 }
Philipp Maier57889492023-08-07 12:10:03 +02001430 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_cid(GTP_CellId cid) := {
1431 cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001432 }
Philipp Maier57889492023-08-07 12:10:03 +02001433 function tr_GTPC_ENB_Identifier(template (present) GTP_CellId cid,
1434 template (present) integer tac,
1435 template (present) octetstring gnbid) return template (present) ENB_Identifier {
1436 var template (present) ENB_Identifier ret := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001437 mccDigit1 := ?,
1438 mccDigit2 := ?,
1439 mccDigit3 := ?,
1440 mncDigit3 := ?,
1441 mncDigit1 := ?,
1442 mncDigit2 := ?,
1443 tAC := ?,
1444 globalENB_ID := ?
1445 }
Philipp Maier57889492023-08-07 12:10:03 +02001446 if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001447 return ?;
1448 }
1449 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1450 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1451 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1452 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1453 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1454 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1455 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1456 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1457 }
1458 }
1459 if (isvalue(tac)) {
1460 ret.tAC := int2oct(valueof(tac), 2);
1461 }
1462 if (isvalue(gnbid)) {
1463 ret.globalENB_ID := gnbid;
1464 }
1465
1466 return ret;
1467 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001468 template (value) ENB_Identifier ts_GTPC_ENB_Identifier(GTP_CellId cid, integer tac, octetstring gnbid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001469 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1470 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1471 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1472 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1473 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1474 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1475 tAC := int2oct(tac, 2),
1476 globalENB_ID := gnbid
1477 }
Philipp Maier57889492023-08-07 12:10:03 +02001478 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_enbid(GTP_CellId cid, integer tac, octetstring gnbid) := {
1479 eNB_Identifier := ts_GTPC_ENB_Identifier(cid, tac, gnbid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001480 }
Philipp Maier57889492023-08-07 12:10:03 +02001481 template (present) RIM_Routing_Information_GTPC
1482 tr_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (present) RIM_Routing_Address_GTPC addr) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001483 iEI := '54'O,
1484 ext := '1'B,
1485 lengthIndicator := {
1486 length1 := ?
1487 },
1488 rIMRoutingAddressDiscriminator := addr_discr,
1489 spare := '0'H,
1490 rIM_Routing_Address := addr
1491 }
1492 template (value) RIM_Routing_Information_GTPC
1493 ts_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address_GTPC addr) := {
1494 iEI := '54'O,
1495 ext := '1'B,
1496 lengthIndicator := {
1497 length1 := 0 /* overwritten */
1498 },
1499 rIMRoutingAddressDiscriminator := addr_discr,
1500 spare := '0'H,
1501 rIM_Routing_Address := addr
1502 }
1503 /* 3GPP TS 48.018 11.3.63.1.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001504 template (present) RAN_Information_Request_Application_Container_NACC_GTPC
1505 tr_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001506 iEI := '4D'O,
1507 ext := '1'B,
1508 lengthIndicator := {
1509 length1 := ?
1510 },
1511 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid)
1512 }
1513 template (value) RAN_Information_Request_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001514 ts_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001515 iEI := '4D'O,
1516 ext := '1'B,
1517 lengthIndicator := {
1518 length1 := 0 /* overwritten */
1519 },
1520 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
1521 }
1522 /* 3GPP TS 48.018 11.3.63.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001523 template (present) RAN_Information_Request_Application_Container_GTPC
1524 tru_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001525 nacc := tr_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1526 }
1527 template (value) RAN_Information_Request_Application_Container_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001528 tsu_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001529 nacc := ts_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1530 }
1531 /* 3GPP TS 48.018 11.3.63.2.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001532 template (present) RAN_Information_Application_Container_NACC_GTPC
1533 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 +02001534 iEI := '4E'O,
1535 ext := '1'B,
1536 lengthIndicator := {
1537 length1 := ?
1538 },
1539 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid),
1540 typeBit := bool2bit(psi_type),
1541 number_of_SI_PSI := int2bit(si_psi_num, 7),
1542 sI_PSI := si_psi
1543 }
1544 template (value) RAN_Information_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001545 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 +02001546 iEI := '4E'O,
1547 ext := '1'B,
1548 lengthIndicator := {
1549 length1 := 0 /* overwritten */
1550 },
1551 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid),
1552 typeBit := bool2bit(psi_type),
1553 number_of_SI_PSI := int2bit(si_psi_num, 7),
1554 sI_PSI := si_psi
1555 }
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001556 external function enc_RIM_Routing_Address_GTPC(in RIM_Routing_Address_GTPC ra) return octetstring
1557 with { extension "prototype(convert) encode(RAW)" };
Philipp Maier21bac7a2023-08-24 12:40:17 +02001558 external function dec_RIM_Routing_Address_GTPC(in octetstring stream) return RIM_Routing_Address_GTPC
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001559 with { extension "prototype(convert) decode(RAW)" };
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001560
1561 /* RAN_Information_Request */
1562 template (value) RAN_Information_Request_RIM_Container_GTPC
1563 ts_GTPC_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1564 template (value) RIM_Sequence_Number_GTPC seq,
1565 template (value) RIM_PDU_Indications_GTPC ind,
1566 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1567 template (omit) RAN_Information_Request_Application_Container_GTPC app_cont := omit,
1568 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1569 iEI := '57'O,
1570 ext := '1'B,
1571 lengthIndicator := {
1572 length1 := 0 /* overwritten */
1573 },
1574 rIM_Application_Identity := app_id,
1575 rIM_Sequence_Number := seq,
1576 rIM_PDU_Indications := ind,
1577 rIM_Protocol_Version_Number := ver,
1578 application_Container := app_cont,
1579 sON_TransferApplicationIdentity := son_app_id
1580 }
1581 template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1582 ts_GTPC_RAN_Information_Request(template (value) RIM_Routing_Information_GTPC dest,
1583 template (value) RIM_Routing_Information_GTPC src,
Philipp Maier6cef1c32023-07-24 11:01:52 +02001584 template (value) RAN_Information_Request_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001585 bssgpPduType := '71'O,
1586 destination_Cell_Identifier := dest,
1587 source_Cell_Identifier := src,
1588 rIM_Container := cont
1589 }
Philipp Maier57889492023-08-07 12:10:03 +02001590 template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1591 tr_GTPC_RAN_Information_Request(template (present) RIM_Routing_Information_GTPC dest := ?,
1592 template (present) RIM_Routing_Information_GTPC src := ?,
1593 template (present) RAN_Information_Request_RIM_Container_GTPC cont := ?) := {
Philipp Maier4b81c6e2023-07-24 11:03:15 +02001594 bssgpPduType := '71'O,
1595 destination_Cell_Identifier := dest,
1596 source_Cell_Identifier := src,
1597 rIM_Container := cont
1598 }
1599
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001600 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO_REQ(template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu) := {
1601 type_gtpc := '90'O,
1602 lengthf := 0, /* FIXME */
1603 rANTransparentContainerField := {
1604 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1605 }
1606 }
Philipp Maier57889492023-08-07 12:10:03 +02001607 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO_REQ(template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu := ?) := {
Philipp Maieredce92f2023-07-26 11:02:10 +02001608 type_gtpc := '90'O,
1609 lengthf := ?,
1610 rANTransparentContainerField := {
1611 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1612 }
1613 }
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001614
1615 /* RAN_Information */
Philipp Maier57889492023-08-07 12:10:03 +02001616 template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001617 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 +02001618 application_Container := tr_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1619 }
1620 template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001621 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 +02001622 application_Container := ts_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1623 }
Philipp Maier57889492023-08-07 12:10:03 +02001624 template (present) ApplContainer_or_ApplErrContainer_GTPC
1625 tru_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001626 nacc := cont
1627 }
1628 template (value) ApplContainer_or_ApplErrContainer_GTPC
1629 tsu_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
1630 nacc := cont
1631 }
Philipp Maier57889492023-08-07 12:10:03 +02001632 template (present) RAN_Information_RIM_Container_GTPC
1633 tr_GTPC_RAN_Information_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id,
1634 template (present) RIM_Sequence_Number_GTPC seq,
1635 template (present) RIM_PDU_Indications_GTPC ind,
1636 template RIM_Protocol_Version_Number_GTPC ver := *,
1637 template ApplContainer_or_ApplErrContainer_GTPC app_cont := *,
1638 template SON_TransferApplicationIdentity son_app_id := *) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001639 iEI := '58'O,
1640 ext := '1'B,
1641 lengthIndicator := {
1642 length1 := ?
1643 },
1644 rIM_Application_Identity := app_id,
1645 rIM_Sequence_Number := seq,
1646 rIM_PDU_Indications := ind,
1647 rIM_Protocol_Version_Number := ver,
1648 applContainer_or_ApplErrContainer := app_cont,
1649 sON_TransferApplicationIdentity := son_app_id
1650 }
1651 template (value) RAN_Information_RIM_Container_GTPC
1652 ts_GTPC_RAN_Information_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1653 template (value) RIM_Sequence_Number_GTPC seq,
1654 template (value) RIM_PDU_Indications_GTPC ind,
1655 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1656 template (omit) ApplContainer_or_ApplErrContainer_GTPC app_cont := omit,
1657 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1658 iEI := '58'O,
1659 ext := '1'B,
1660 lengthIndicator := {
1661 length1 := 0 /* overwritten */
1662 },
1663 rIM_Application_Identity := app_id,
1664 rIM_Sequence_Number := seq,
1665 rIM_PDU_Indications := ind,
1666 rIM_Protocol_Version_Number := ver,
1667 applContainer_or_ApplErrContainer := app_cont,
1668 sON_TransferApplicationIdentity := son_app_id
1669 }
Philipp Maier57889492023-08-07 12:10:03 +02001670 template (present) PDU_BSSGP_RAN_INFORMATION_GTPC
1671 tr_GTPC_RAN_Information(template (present) RIM_Routing_Information_GTPC dest,
1672 template (present) RIM_Routing_Information_GTPC src,
1673 template (present) RAN_Information_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001674 bssgpPduType := '70'O,
1675 destination_Cell_Identifier := dest,
1676 source_Cell_Identifier := src,
1677 rIM_Container := cont
1678 }
1679 template (value) PDU_BSSGP_RAN_INFORMATION_GTPC
1680 ts_GTPC_RAN_Information(template (value) RIM_Routing_Information_GTPC dest,
1681 template (value) RIM_Routing_Information_GTPC src,
1682 template (value) RAN_Information_RIM_Container_GTPC cont) := {
1683 bssgpPduType := '70'O,
1684 destination_Cell_Identifier := dest,
1685 source_Cell_Identifier := src,
1686 rIM_Container := cont
1687 }
Philipp Maier57889492023-08-07 12:10:03 +02001688 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO(template (present) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001689 type_gtpc := '90'O,
1690 lengthf := ?,
1691 rANTransparentContainerField := {
1692 pDU_BSSGP_RAN_INFORMATION := pdu
1693 }
1694 }
1695 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO(template (value) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
1696 type_gtpc := '90'O,
1697 lengthf := 0, /* overwritten */
1698 rANTransparentContainerField := {
1699 pDU_BSSGP_RAN_INFORMATION := pdu
1700 }
1701 }
1702
Philipp Maier57889492023-08-07 12:10:03 +02001703 template (present) RANTransparentContainer tr_RANTransparentContainer(template (present) RANTransparentContainerField rANTransparentContainerField) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001704 type_gtpc := '90'O,
1705 lengthf := ?,
1706 rANTransparentContainerField := rANTransparentContainerField
1707 }
1708 template (value) RANTransparentContainer ts_RANTransparentContainer(template (value) RANTransparentContainerField rANTransparentContainerField) := {
1709 type_gtpc := '90'O,
1710 lengthf := 0, /* overwritten */
1711 rANTransparentContainerField := rANTransparentContainerField
1712 }
Philipp Maier57889492023-08-07 12:10:03 +02001713 template (present) GTPC_PDUs tr_RANInfoRelay(template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001714 ranInformationRelay := {
1715 transparentContainer := transparentContainer,
1716 rIM_RoutingAddress := *,
1717 rIM_RoutingAddress_Discriminator := *,
1718 private_extension_gtpc := *
1719 }
1720 }
Philipp Maier05ad55c2023-07-24 10:56:46 +02001721 template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer,
1722 template (omit) RIM_RoutingAddress ra := omit,
1723 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001724 ranInformationRelay := {
1725 transparentContainer := transparentContainer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001726 rIM_RoutingAddress := ra,
1727 rIM_RoutingAddress_Discriminator := ra_discr,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001728 private_extension_gtpc := omit
1729 }
1730 }
Philipp Maier57889492023-08-07 12:10:03 +02001731 template (present) Gtp1cUnitdata
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001732 tr_GTPC_RANInfoRelay(template (present) Gtp1cPeer peer,
Philipp Maier57889492023-08-07 12:10:03 +02001733 template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001734 peer := peer,
1735 gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer))
1736 }
1737 template (value) Gtp1cUnitdata
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001738 ts_GTPC_RANInfoRelay(template (value) Gtp1cPeer peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001739 template (value) RANTransparentContainer transparentContainer,
1740 template (omit) RIM_RoutingAddress ra := omit,
1741 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001742 peer := peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001743 gtpc := ts_GTP1C_PDU(rANInformationRelay, '00000000'O, valueof(ts_RANInfoRelay(transparentContainer, ra, ra_discr)), 0)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001744 }
1745
1746
Philipp Maier57889492023-08-07 12:10:03 +02001747 template (present) RAN_Information_Request_RIM_Container_GTPC
1748 tr_GTPC_RAN_Information_Request_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id := ?,
1749 template (present) RIM_Sequence_Number_GTPC seq := ?,
1750 template (present) RIM_PDU_Indications_GTPC ind := ?,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001751 template RIM_Protocol_Version_Number_GTPC ver := *,
1752 template RAN_Information_Request_Application_Container_GTPC app_cont := *,
1753 template SON_TransferApplicationIdentity son_app_id := *) := {
1754 iEI := '57'O,
1755 ext := '1'B,
1756 lengthIndicator := {
1757 length1 := ?
1758 },
1759 rIM_Application_Identity := app_id,
1760 rIM_Sequence_Number := seq,
1761 rIM_PDU_Indications := ind,
1762 rIM_Protocol_Version_Number := ver,
1763 application_Container := app_cont,
1764 sON_TransferApplicationIdentity := son_app_id
1765 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001766
Philipp Maier653a0142023-08-04 15:22:37 +02001767 /* 3GPP TS 29.060, section 7.7.57 */
1768 template (value) RIM_RoutingAddress ts_RIM_RoutingAddress(octetstring addr_value) := {
1769 type_gtpc := '9F'O,
1770 lengthf := 0, /* we assume encoder overwrites this */
1771 rIM_RoutingAddressValue := addr_value
1772 }
1773 template (present) RIM_RoutingAddress tr_RIM_RoutingAddress(template (present) octetstring addr_value := ?) := {
1774 type_gtpc := '9F'O,
1775 lengthf := ?,
1776 rIM_RoutingAddressValue := addr_value
1777 }
1778
1779 /* 3GPP TS 29.060, section 7.7.77 */
1780 template (value) RIM_RoutingAddress_Discriminator ts_RIM_RoutingAddress_Discriminator(bitstring addr_discr) := {
1781 type_gtpc := 'B2'O,
1782 lengthf := 0, /* we assume encoder overwrites this */
1783 rra_discriminator := addr_discr,
1784 spare := '0000'B
1785 }
1786 template (present) RIM_RoutingAddress_Discriminator tr_RIM_RoutingAddress_Discriminator(template (present) bitstring addr_discr := ?) := {
1787 type_gtpc := 'B2'O,
1788 lengthf := ?,
1789 rra_discriminator := addr_discr,
1790 spare := '0000'B
1791 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001792}