blob: dcb8e60f76b8e5a35f85be3f02273c6309b7bfd9 [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 */
Vadim Yanitskiyfdde1682024-04-06 05:34:24 +0700341 template (value) MM_Context ts_MM_ContextGSM(template (value) OCT8 kc,
342 template (value) BIT3 cksn := '000'B,
343 template (value) BIT3 gea := '000'B) := {
344 type_gtpc := '81'O,
345 context := {
346 mmcontGSM := {
347 lengthf := 0, /* overwritten */
348 cksn := cksn,
349 spare := '00000'B,
350 usedCipher := gea,
351 noofVectors := 0,
352 security := '00'B, /* XXX */
353 kc := kc,
354 triplet := ''O,
355 drx_par := '0000'O,
356 msNetW_cap_length := 0, /* overwritten */
357 msNetw_cap := omit,
358 containerLength := 0, /* overwritten */
359 container := omit,
360 access_restriction_data_length := 0,
361 access_restriction_data := omit
362 }
363 }
364 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100365 template (value) MM_Context ts_MM_ContextUMTS(template (value) OCT16 ck,
366 template (value) OCT16 ik) := {
367 type_gtpc := '81'O,
368 context := {
369 mmcontUMTS := {
370 lengthf := 0, /* overwritten */
371 ksi := '001'B,
372 usedGPRSIntegrityAlgorithm := '000'B,
373 ugipai := '1'B, /* Integrity Protection not required */
374 gupii := '1'B, /* Ignore "Used GPRS integrity protection algorithm" field" */
375 spare1 := '000'B,
376 noofVectors := 0, /* TODO: fill quintpuplets*/
377 security := '01'B, /* UMTS key and quintuplets */
378 ck := ck,
379 ik := ik,
380 quintupletlength := 0, /* overwritten */
381 quintuplet := ''O,
382 drx_par := '0000'O,
383 msNetW_cap_length := 0, /* overwritten */
384 msNetw_cap := omit,
385 containerLength := 0, /* overwritten */
386 container := omit,
387 access_restriction_data_length := 0, /* overwritten */
388 access_restriction_data := omit
389 }
390 }
391 }
392
393 /* 7.7.29 PDP Context */
394 template (value) PDP_Context_GTPC ts_PDP_Context_GTPC(template (value) octetstring pdp_addr,
395 template (value) octetstring ggsn_gsn_addr,
396 template (value) octetstring apn,
397 template (value) OCT4 ggsn_teic := '12345678'O,
398 template (value) OCT4 ggsn_teid := '87654321'O) := {
399 type_gtpc := '82'O,
400 lengthf := 0, /* overwritten */
401 nsapi := '0101'B,
402 order := '0'B,
403 asi := '0'B,
404 vaa := '0'B,
405 ea := '0'B,
406 sapi := '0011'B,
407 spare1 := '0000'B,
408 qos_subLength := 0, /* overwritten */
409 qos_sub := ts_QosProfileValueDefault,
410 qos_reqLength := 0, /* overwritten */
411 qos_req := ts_QosProfileValueDefault,
412 qos_negLength := 0, /* overwritten */
413 qos_neg := ts_QosProfileValueDefault,
414 snd := '0000'O,
415 snu := '0000'O,
416 sendNPDUnum := '00'O,
417 receiveNPDUnum := '00'O,
418 uteidControlPlane := ggsn_teic,
419 uteidData1 := ggsn_teid,
420 pdpcontext := '00'O,
421 pdp_typeorg := '0001'B, /* IETF */
422 spare2 := '1111'B,
423 pdp_typenum := '21'O, /* IETF IPV4 */
424 pdp_addressLength := 0, /* overwritten */
425 pdp_address := pdp_addr,
426 ggsn_addressControlPlaneLength := 0, /* overwritten */
427 ggsn_addressControlPlane := ggsn_gsn_addr,
428 ggsn_addressUserPlaneLength := 0, /* overwritten */
429 ggsn_addressUserPlane := ggsn_gsn_addr,
430 apnLength := 0, /* overwritten */
431 apn := apn,
432 transactionId := '0001'B,
433 spare3 := '0000'B,
434 transactionID_cont := '00'O,
435 pdp_typenum2 := omit,
436 pdp_addresslength2 := omit,
437 pdp_Address2 := omit
438 }
439
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200440
Philipp Maier1c0c7262023-07-24 10:51:53 +0200441 /* template matching reception of GTP-C unit-data */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100442 template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) Gtp1cPeer peer,
Philipp Maier57889492023-08-07 12:10:03 +0200443 template (present) OCT1 msg_type,
444 template (present) OCT4 teid,
445 template (present) GTPC_PDUs pdus := ?) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100446 peer := peer,
447 gtpc := tr_GTP1C_PDU(msg_type, teid, pdus)
448 }
449
450 /* template matching reception of GTP-C echo-request */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100451 template (present) Gtp1cUnitdata tr_GTPC_PING(template (present) Gtp1cPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
Harald Weltec69cf4e2018-02-17 20:57:02 +0100452
Philipp Maier57889492023-08-07 12:10:03 +0200453 template (present) GTPC_PDUs tr_EchoRespPDU(template (present) OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100454 echoResponse := {
455 recovery := tr_Recovery(restart_counter),
456 private_extension_gtpc := *
457 }
458 }
459
460 /* template matching reception of GTP-C echo-response */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100461 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 +0100462
Philipp Maier57889492023-08-07 12:10:03 +0200463 template (value) GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100464 echoResponse := {
465 recovery := ts_Recovery(restart_counter),
466 private_extension_gtpc := omit
467 }
468 }
469
470 /* master template for senidng a GTP-C echo response */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100471 template (value) Gtp1cUnitdata ts_GTPC_PONG(Gtp1cPeer peer, uint16_t seq, OCT1 rest_ctr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100472 peer := peer,
473 gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq)
474 }
475
Philipp Maier57889492023-08-07 12:10:03 +0200476 template (value) GTPC_PDUs ts_EchoReqPDU := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100477 echoRequest := {
478 private_extension_gtpc := omit
479 }
480 }
481
482 /* master template for sending a GTP-C echo request */
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100483 template (value) Gtp1cUnitdata ts_GTPC_PING(Gtp1cPeer peer, uint16_t seq) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100484 peer := peer,
485 gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq)
486 }
487
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200488 private function f_eua_ipv4_len(template OCT4 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100489 if (istemplatekind(ip_addr, "omit")) {
490 return 2;
491 } else if (istemplatekind(ip_addr, "*")) {
492 return ?;
493 } else if (istemplatekind(ip_addr, "?")) {
494 return 6;
495 }
496 return 6;
497 }
498
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200499 private function f_eua_ipv6_len(template OCT16 ip_addr) return template (present) integer {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100500 if (istemplatekind(ip_addr, "omit")) {
501 return 2;
502 } else if (istemplatekind(ip_addr, "*")) {
503 return ?;
504 } else if (istemplatekind(ip_addr, "?")) {
505 return 18;
506 }
507 return 18;
508 }
509
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200510 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 +0100511 var integer len := 2;
512 if (istemplatekind(ip_addr4, "*") or
513 istemplatekind(ip_addr6, "*")) {
514 return ?;
515 }
516 if (not istemplatekind(ip_addr4, "omit")) {
517 len := len + 4;
518 }
519 if (not istemplatekind(ip_addr6, "omit")) {
520 len := len + 16;
521 }
522 return len;
523 }
524
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200525 template (present) EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100526 type_gtpc := '80'O,
527 endUserAddress := {
528 endUserAddressIPv4 := {
529 lengthf := 2,
530 pdp_typeorg := '0001'B,
531 spare := '1111'B,
532 pdp_typenum := '21'O,
533 ipv4_address := ip_addr
534 }
535 }
536 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200537 template (present) EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200538 template (present) EndUserAddress tr_EuaIPv4(template (present) OCT4 ip_addr) modifies t_EuaIPv4 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100539 endUserAddress := {
540 endUserAddressIPv4 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100541 lengthf := f_eua_ipv4_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100542 }
543 }
544 }
545
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200546 template (present) EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100547 type_gtpc := '80'O,
548 endUserAddress := {
549 endUserAddressIPv6 := {
550 lengthf := 2,
551 pdp_typeorg := '0001'B,
552 spare := '1111'B,
553 pdp_typenum := '57'O,
554 ipv6_address := ip_addr
555 }
556 }
557 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200558 template (present) EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit);
Philipp Maier57889492023-08-07 12:10:03 +0200559 template (present) EndUserAddress tr_EuaIPv6(template (present) OCT16 ip_addr) modifies t_EuaIPv6 := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100560 endUserAddress := {
561 endUserAddressIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100562 lengthf := f_eua_ipv6_len(ip_addr)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100563 }
564 }
565 }
566
Oliver Smithee6a0882019-03-08 11:05:46 +0100567 /* 3GPP TS 29.060 Figure 37A: End User Address Information Element for IPv4v6 (both static) */
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200568 template (present) EndUserAddress t_EuaIPv4v6(template OCT4 ip_addr4, template OCT16 ip_addr6) := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100569 type_gtpc := '80'O,
570 endUserAddress := {
571 endUserAddressIPv4andIPv6 := {
572 lengthf := 2,
573 pdp_typeorg := '0001'B,
574 spare := '1111'B,
575 pdp_typenum := '8D'O,
576 ipv4_address := ip_addr4,
577 ipv6_address := ip_addr6
578 }
579 }
580 }
Pau Espin Pedrol0d138c62023-08-31 16:23:18 +0200581 template (present) EndUserAddress t_EuaIPv4Dynv6Dyn := t_EuaIPv4v6(omit, omit);
Philipp Maier57889492023-08-07 12:10:03 +0200582 template (present) EndUserAddress tr_EuaIPv4v6(template (present) OCT4 ip_addr4,
583 template (present) OCT16 ip_addr6) modifies t_EuaIPv4v6 := {
Oliver Smithee6a0882019-03-08 11:05:46 +0100584 endUserAddress := {
585 endUserAddressIPv4andIPv6 := {
Pau Espin Pedrol001b3e82022-02-23 18:38:37 +0100586 lengthf := f_eua_ipv4v6_len(ip_addr4, ip_addr6)
Oliver Smithee6a0882019-03-08 11:05:46 +0100587 }
588 }
589 }
590
Philipp Maier57889492023-08-07 12:10:03 +0200591 template (value) AccessPointName ts_APN(octetstring apn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100592 type_gtpc := '83'O,
593 lengthf := lengthof(apn),
594 apn_value := apn
595 }
596
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100597 template (value) GSN_Address_GTPC ts_GsnAddr(template (value) octetstring ip_addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100598 type_gtpc := '85'O,
599 lengthf := lengthof(ip_addr),
600 addressf := ip_addr
601 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100602 template (present) GSN_Address_GTPC tr_GsnAddr(template (present) octetstring ip_addr := ?) := {
603 type_gtpc := '85'O,
604 lengthf := ?,
605 addressf := ip_addr
606 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100607
Philipp Maier57889492023-08-07 12:10:03 +0200608 template (value) MSISDN ts_Msisdn(octetstring msisdn) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100609 type_gtpc := '86'O,
610 lengthf := lengthof(msisdn),
611 msisdn := msisdn
612 }
613
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100614 template (value) QoSV_GTPC ts_QosValueDefault := {
615 reliabilityClass := '011'B,
616 delayClass := '001'B,
617 spare1 := '00'B,
618 precedenceClass := '010'B,
619 spare2 := '0'B,
620 peakThroughput := '1001'B,
621 meanThroughput := '11111'B,
622 spare3 := '000'B,
623 deliverErroneusSDU := '010'B, /* Erroneus SDU are delivered */
624 deliveryOrder := '10'B, /* Without delivery order */
625 trafficClass := '100'B, /* Background */
626 maxSDUSize := '96'O, /* 1500 octets */
627 maxBitrateUplink := 'FE'O, /* 8640, continues in extended octet */
628 maxBitrateDownlink := 'FE'O, /* 8640, continues in extended octet */
629 sduErrorRatio := '0100'B, /* 1x10^-4 */
630 residualBER := '0101'B, /* 1x10^-3 */
631 trafficHandlingPriority := '01'B, /* prio 1 */
632 transferDelay := '000001'B, /* 10 ms */
633 guaranteedBitRateUplink := 'FE'O, /* 8640, continues in extended octet */
634 guaranteedBitRateDownlink := 'FE'O, /* 8640, continues in extended octet */
635 sourceStatisticsDescriptor := '0000'B, /* unknown */
636 signallingIndication := '0'B, /* Not optimized */
637 spare4 := '000'B,
638 maxBitrateDownlinkExt := '5B'O, /* 33 mbps */
639 guaranteedBitRateDownlinkExt := '5B'O, /* 33 mbps */
640 maxBitrateUplinkExt := '6e'O, /* 52 mbps */
641 guaranteedBitRateUplinkExt := '6e'O /* 52 mbps */
642 }
643
644 template (value) QualityOfServiceProfile_Value ts_QosProfileValueDefault := {
645 allocRetensionPrio := '00'O,
646 qos_ProfileValue := ts_QosValueDefault
647 }
648
Philipp Maier57889492023-08-07 12:10:03 +0200649 template (value) QualityOfServiceProfile ts_QosDefault := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100650 type_gtpc := '87'O,
Pau Espin Pedrol7d58b082022-06-07 13:30:03 +0200651 lengthf := 17,
Harald Weltec69cf4e2018-02-17 20:57:02 +0100652 allocRetensionPrio := '00'O,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100653 qos_ProfileValue := ts_QosValueDefault
Harald Weltec69cf4e2018-02-17 20:57:02 +0100654 }
655
Philipp Maier57889492023-08-07 12:10:03 +0200656 template (value) IMSI_gtpc ts_Imsi(hexstring digits) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100657 type_gtpc := '02'O,
658 digits := digits,
659 padding := 'F'H
660 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100661 function f_ts_Imsi(template (omit) hexstring digits := omit) return template (omit) IMSI_gtpc {
662 var template (omit) IMSI_gtpc imsi;
663 if (istemplatekind(digits, "omit")) {
664 imsi := omit;
665 } else {
666 imsi := ts_Imsi(valueof(digits));
667 }
668 return imsi;
669 }
670 template (present) IMSI_gtpc tr_Imsi(template (present) hexstring digits) := {
671 type_gtpc := '02'O,
672 digits := digits,
673 padding := 'F'H
674 }
675 function f_tr_Imsi(template hexstring digits := *) return template IMSI_gtpc {
676 if (istemplatekind(digits, "omit")) {
677 return omit;
678 } else if (istemplatekind(digits, "*")) {
679 return *;
680 } else {
681 return tr_Imsi(digits);
682 }
683 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100684
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100685 /* 7.7.50 RAT Type */
686 type enumerated GTP_RATType {
687 GTP_RAT_TYPE_RESERVED (0),
688 GTP_RAT_TYPE_UTRAN (1),
689 GTP_RAT_TYPE_GERAN (2),
690 GTP_RAT_TYPE_WLAN (3),
691 GTP_RAT_TYPE_GAN (4),
692 GTP_RAT_TYPE_HSPA_E (5),
693 GTP_RAT_TYPE_EUTRAN (6)
694 };
695 template (value) RATType ts_RATType(template (value) OCT1 rat_type) := {
696 type_gtpc := '97'O,
697 lengthf := 1,
698 ratTypeValue := rat_type
699 }
700 function f_ts_RATType(template (omit) OCT1 rat_type := omit) return template (omit) RATType {
701 if (istemplatekind(rat_type, "omit")) {
702 return omit;
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100703 } else {
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100704 return ts_RATType(rat_type);
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100705 }
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +0100706 }
707 template (present) RATType tr_RATType(template (present) OCT1 rat_type) := {
708 type_gtpc := '97'O,
709 lengthf := 1,
710 ratTypeValue := rat_type
711 }
712 function f_tr_RATType(template OCT1 rat_type := *) return template RATType {
713 if (istemplatekind(rat_type, "omit")) {
714 return omit;
715 } else if (istemplatekind(rat_type, "*")) {
716 return *;
717 } else {
718 return tr_RATType(rat_type);
719 }
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100720 }
721
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +0100722 template (value) RoutingAreaIdentity ts_RoutingAreaIdentity(template (value) hexstring mcc_digits,
723 template (value) hexstring mnc_digits,
724 template (value) OCT2 lac,
725 template (value) OCT1 rac) := {
726 type_gtpc := '03'O,
727 mcc_digits := mcc_digits,
728 mnc_digits := mnc_digits,
729 lac := lac,
730 rac := rac
731 }
732
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100733 template (value) GeographicLocationCGI
734 ts_GeographicLocationCGI(template (value) hexstring mcc,
Philipp Maier57889492023-08-07 12:10:03 +0200735 template (value) hexstring mnc,
736 template (value) OCT2 lac,
737 template (value) OCT2 cI_value) :=
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100738 {
739 mccDigit1 := mcc[0],
740 mccDigit2 := mcc[1],
741 mccDigit3 := mcc[2],
742 mncDigit3 := mnc[2], /* 'F'H for 2 digit MNC */
743 mncDigit1 := mnc[0],
744 mncDigit2 := mnc[1],
745 lac := lac,
746 cI_value := cI_value
747 }
748
Philipp Maier57889492023-08-07 12:10:03 +0200749 template (value) GTPC_PDUs ts_CreatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
750 BIT4 nsapi, EndUserAddress eua, octetstring apn,
751 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
752 octetstring msisdn, template (omit) ProtConfigOptions pco := omit,
753 template (omit) OCT1 ratType := omit,
754 template (omit) UserLocationInformation uli := omit,
755 template (omit) OCT2 charging_char := omit,
756 template (omit) OCT8 imeisv := omit,
757 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100758 createPDPContextRequest := {
759 imsi := ts_Imsi(imsi),
760 rai := omit,
761 recovery := ts_Recovery(restart_ctr),
762 selectionMode := {
763 type_gtpc := '0F'O,
764 selectModeValue := '00'B,
765 spare := '111111'B
766 },
767 teidDataI := {
768 type_gtpc := '00'O,
769 teidDataI := teid_data
770 },
771 teidControlPlane := {
772 type_gtpc := '00'O,
773 teidControlPlane := teid_ctrl
774 },
775 nsapi := {
776 type_gtpc := '00'O,
777 nsapi := nsapi,
778 unused := '0000'B
779 },
780 linked_nsapi := omit,
Pau Espin Pedrol0e127872022-05-12 17:58:50 +0200781 charging_char := f_ts_ChargingCharacteristics(charging_char),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100782 trace_ref := omit,
783 trace_type := omit,
784 endUserAddress := eua,
785 accessPointName := ts_APN(apn),
786 protConfigOptions := pco,
787 sgsn_addr_signalling := ts_GsnAddr(sgsn_ip_sign),
788 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
789 msisdn := ts_Msisdn(msisdn),
790 qualityOfServiceProfile := ts_QosDefault,
791 tft := omit,
792 triggerId := omit,
793 omcId := omit,
794 commonFlags := omit,
795 aPN_Restriction := omit,
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100796 ratType := f_ts_RATType(ratType),
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100797 userLocationInformation := uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200798 mS_TimeZone := ms_tz,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200799 imeisv := f_ts_IMEISV(imeisv),
Harald Weltec69cf4e2018-02-17 20:57:02 +0100800 camelChargingInformationContainer := omit,
801 additionalTraceInfo := omit,
802 correlationID := omit,
803 evolvedAllocationRetentionPriorityI := omit,
804 extendedCommonFlags := omit,
805 userCSGInformation := omit,
806 aPN_AMBR := omit,
807 signallingPriorityIndication := omit,
808 cN_OperatorSelectionEntity := omit,
809 private_extension_gtpc := omit
810 }
811 }
812
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100813 template (value) Gtp1cUnitdata ts_GTPC_CreatePDP(Gtp1cPeer peer, uint16_t seq, hexstring imsi,
Philipp Maier57889492023-08-07 12:10:03 +0200814 OCT1 restart_ctr, OCT4 teid_data,
815 OCT4 teid_ctrl, BIT4 nsapi, EndUserAddress eua,
816 octetstring apn, octetstring sgsn_ip_sign,
817 octetstring sgsn_ip_data, octetstring msisdn,
818 template (omit) ProtConfigOptions pco := omit,
819 template (omit) OCT1 ratType := omit,
820 template (omit) UserLocationInformation uli := omit,
821 template (omit) OCT2 charging_char := omit,
822 template (omit) OCT8 imeisv := omit,
823 template (omit) MS_TimeZone ms_tz := omit) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100824 peer := peer,
825 gtpc := ts_GTP1C_PDU(createPDPContextRequest, '00000000'O,
826 valueof(ts_CreatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
827 nsapi, eua, apn, sgsn_ip_sign,
Pau Espin Pedrol38968e92022-05-13 16:17:48 +0200828 sgsn_ip_data, msisdn, pco, ratType, uli,
Pau Espin Pedrol535ca262022-05-16 14:07:17 +0200829 charging_char, imeisv, ms_tz)), seq)
Harald Weltec69cf4e2018-02-17 20:57:02 +0100830 }
831
Harald Welteeded9ad2018-02-17 20:57:34 +0100832
Philipp Maier57889492023-08-07 12:10:03 +0200833 template (value) GTPC_PDUs ts_UpdatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
834 BIT4 nsapi,
835 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
836 template (omit) ProtConfigOptions pco := omit,
837 template (omit) OCT1 ratType := omit,
838 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100839 updatePDPContextRequest := {
840 updatePDPContextRequestSGSN := {
841 imsi := ts_Imsi(imsi),
842 rai := omit,
843 recovery := ts_Recovery(restart_ctr),
844 teidDataI := {
845 type_gtpc := '00'O,
846 teidDataI := teid_data
847 },
848 teidControlPlane := {
849 type_gtpc := '00'O,
850 teidControlPlane := teid_ctrl
851 },
852 nsapi := {
853 type_gtpc := '00'O,
854 nsapi := nsapi,
855 unused := '0000'B
856 },
857 trace_ref := omit,
858 trace_type := omit,
859 protConfigOptions := pco,
860 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_ip_sign),
861 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
862 alt_ggsn_addr_controlPane := omit,
863 alt_ggsn_addr_traffic := omit,
864 qualityOfServiceProfile := ts_QosDefault,
865 tft := omit,
866 triggerId := omit,
867 omcId := omit,
868 commonFlags := omit,
869 ratType := f_ts_RATType(ratType),
870 userLocationInformation := uli,
871 mS_TimeZone := omit,
872 additionalTraceInfo := omit,
873 directTunnelFlags := omit,
874 evolvedAllocationRetentionPriorityI := omit,
875 extendedCommonFlags := omit,
876 userCSGInformation := omit,
877 aPN_AMBR := omit,
878 signallingPriorityIndication := omit,
879 cN_OperatorSelectionEntity := omit,
880 private_extension_gtpc := omit
881 }
882 }
883 }
884
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100885 template (value) Gtp1cUnitdata ts_GTPC_UpdatePDP(Gtp1cPeer peer, OCT4 teid, uint16_t seq, hexstring imsi,
Philipp Maier57889492023-08-07 12:10:03 +0200886 OCT1 restart_ctr, OCT4 teid_data,
887 OCT4 teid_ctrl, BIT4 nsapi, octetstring sgsn_ip_sign,
888 octetstring sgsn_ip_data,
889 template (omit) ProtConfigOptions pco := omit,
890 template (omit) OCT1 ratType := omit,
891 template (omit) UserLocationInformation uli := omit) := {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100892 peer := peer,
893 gtpc := ts_GTP1C_PDU(updatePDPContextRequest, teid,
894 valueof(ts_UpdatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
895 nsapi, sgsn_ip_sign,
896 sgsn_ip_data, pco, ratType, uli)), seq)
897 }
898
899
Philipp Maier57889492023-08-07 12:10:03 +0200900 template (value) NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100901 type_gtpc := '14'O,
902 nsapi := nsapi,
903 unused := '0000'B
904 }
905
Philipp Maier57889492023-08-07 12:10:03 +0200906 template (value) ReorderingRequired ts_ReorderReq(boolean req := false) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100907 type_gtpc := '08'O,
908 reordreq := bool2bit(req),
909 spare := '0000000'B
910 }
911
Philipp Maier57889492023-08-07 12:10:03 +0200912 template (value) GTPC_PDUs ts_CreatePdpRespPDU(OCT1 cause, OCT4 teid_data, OCT4 teid_ctrl, BIT4 nsapi,
913 octetstring ggsn_ip_sign, octetstring ggsn_ip_data,
914 OCT4 chg_id, template (omit) EndUserAddress eua := omit,
915 template (omit) Recovery_gtpc recovery := omit,
916 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100917 createPDPContextResponse := {
918 cause := { '00'O, cause },
919 reorderingRequired := ts_ReorderReq(false),
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200920 recovery := recovery,
Harald Welteeded9ad2018-02-17 20:57:34 +0100921 teidDataI := {
922 type_gtpc := '00'O,
923 teidDataI := teid_data
924 },
925 teidControlPlane := {
926 type_gtpc := '00'O,
927 teidControlPlane := teid_ctrl
928 },
929 nsapi := ts_NSAPI(nsapi),
Harald Welte7aff2ca2018-02-18 15:34:50 +0100930 chargingID := {
931 type_gtpc := '7F'O,
932 chargingID := chg_id
933 },
Harald Welteeded9ad2018-02-17 20:57:34 +0100934 endUserAddress := eua,
935 protConfigOptions := pco,
936 ggsn_addr_controlPlane := ts_GsnAddr(ggsn_ip_sign),
937 ggsn_addr_traffic := ts_GsnAddr(ggsn_ip_data),
938 alt_ggsn_addr_controlPane := omit,
939 alt_ggsn_addr_traffic := omit,
940 qualityOfServiceProfile := ts_QosDefault,
941 commonFlags := omit,
942 aPN_Restriction := omit,
943 mS_InfoChangeReportingAction := omit,
944 bearerControlMode := omit,
945 evolvedAllocationRetentionPriorityI := omit,
946 extendedCommonFlag := omit,
947 csg_information_reporting_action := omit,
948 aPN_AMBR := omit,
949 gGSN_BackOffTime := omit,
950 private_extension_gtpc := omit
951 }
952 }
953
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +0100954 template (value) Gtp1cUnitdata ts_GTPC_CreatePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +0200955 OCT1 cause,
956 OCT4 teid_ctrl, OCT4 teid_data,
957 BIT4 nsapi, octetstring ggsn_ip_sign,
958 octetstring ggsn_ip_data, OCT4 chg_id,
959 template (omit) EndUserAddress eua := omit,
960 template (omit) Recovery_gtpc recovery := omit,
961 template (omit) ProtConfigOptions pco := omit) := {
Harald Welteeded9ad2018-02-17 20:57:34 +0100962 peer := peer,
963 gtpc := ts_GTP1C_PDU(createPDPContextResponse, teid,
964 valueof(ts_CreatePdpRespPDU(cause, teid_data, teid_ctrl, nsapi,
Harald Welte7aff2ca2018-02-18 15:34:50 +0100965 ggsn_ip_sign, ggsn_ip_data, chg_id,
Pau Espin Pedrol94013452018-07-17 15:50:21 +0200966 eua, recovery, pco)), seq)
Harald Welteeded9ad2018-02-17 20:57:34 +0100967 }
968
Harald Weltec69cf4e2018-02-17 20:57:02 +0100969 /* PCO send base template */
Philipp Maier57889492023-08-07 12:10:03 +0200970 template (value) ProtConfigOptions ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100971 type_gtpc := '84'O,
972 lengthf := 0,
973 configProtocol := '000'B,
974 spare := '0000'B,
975 extension0 := '1'B,
976 protocols := {}
977 }
978 /* PCO receive base template */
Philipp Maier57889492023-08-07 12:10:03 +0200979 template (present) ProtConfigOptions tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100980 type_gtpc := '84'O,
981 lengthf := ?,
982 configProtocol := '000'B,
983 spare := ?,
984 extension0 := '1'B,
985 protocols := {}
986 }
987
Philipp Maier57889492023-08-07 12:10:03 +0200988 template (value) ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100989 protocols := {
990 { protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O }
991 }
992 }
Philipp Maier57889492023-08-07 12:10:03 +0200993 template (present) ProtConfigOptions tr_PCO_IPv6_DNS_resp(template (present) OCT16 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100994 protocols := {
995 *, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, *
996 }
997 }
998
Pau Espin Pedrolcff72f82024-01-26 16:58:48 +0100999 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP(uint8_t ipcp_req_id := 0) modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001000 protocols := {
1001 /* dummy PAP entry to check if our parser in the GGSN can properly iterate over
1002 * the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */
1003 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1004 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
Pau Espin Pedrolcff72f82024-01-26 16:58:48 +01001005 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS(ipcp_req_id))) }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001006 }
1007 }
1008
Philipp Maier57889492023-08-07 12:10:03 +02001009 template (value) ProtConfigOptions ts_PCO_IPv4_PRI_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001010 protocols := {
1011 /* dummy PAP entry to check if our parser can cope with a single primary DNS entry
1012 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
1013 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1014 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1015 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) }
1016 }
1017 }
Philipp Maier57889492023-08-07 12:10:03 +02001018 template (value) ProtConfigOptions ts_PCO_IPv4_SEC_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001019 protocols := {
1020 /* dummy PAP entry to check if our parser can cope with a single secondary DNS entry
1021 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
1022 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1023 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1024 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1025 }
1026 }
Philipp Maier57889492023-08-07 12:10:03 +02001027 template (value) ProtConfigOptions ts_PCO_IPv4_SEPARATE_DNS_IPCP modifies ts_PCO := {
Philipp Maier33e52612018-05-30 17:22:02 +02001028 protocols := {
1029 /* dummy PAP entry to check if our parser can cope with a primary and secondary DNS
1030 * in separate IPCP containers OS#3381 */
1031 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
1032 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1033 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) },
1034 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
1035 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
1036 }
1037 }
1038
Philipp Maier57889492023-08-07 12:10:03 +02001039 template (present) ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001040 protocolID := prot_id,
1041 lengthProtoID := ?,
1042 protoIDContents := ?
1043 }
Philipp Maier57889492023-08-07 12:10:03 +02001044 template (value) ProtocolElement ts_PCOelem_PAP_broken := {
Harald Weltef8298542019-04-10 10:15:28 +02001045 protocolID := 'C023'O,
1046 lengthProtoID := 60,
1047 /* PPP Password Authentication Protocol containing incorrect Peer-Id-Length set to 4 (6-7 should be the valid one), see OS#3914. */
1048 protoIDContents := '0100003c'O & '0444435338323700bc1c08087c1508083e00790000150808fd06000001000000000000000000000000000000000000000000000000000000'O
1049 }
Philipp Maier57889492023-08-07 12:10:03 +02001050 template (value) ProtConfigOptions ts_PCO_PAP_IPv4_DNS modifies ts_PCO := {
Harald Weltef8298542019-04-10 10:15:28 +02001051 protocols := {
1052 ts_PCOelem_PAP_broken,
1053 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
1054 }
1055 }
Philipp Maier57889492023-08-07 12:10:03 +02001056 template (present) ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001057 protocols := { *, tr_PCO_Proto(prot_id), * }
1058 }
1059
Philipp Maier57889492023-08-07 12:10:03 +02001060 template (value) ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001061 protocols := {
1062 { protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
1063 }
1064 }
Philipp Maier57889492023-08-07 12:10:03 +02001065 template (present) ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template (present) OCT4 contents) modifies tr_PCO := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001066 protocols := {
1067 *, { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }, *
1068 }
1069 }
1070
1071 /* extract a given protocol payload from PCO */
1072 function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring {
1073 var integer i;
1074 var integer num_matches := 0;
1075 for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
1076 if (pco.protocols[i].protocolID == protocol) {
1077 num_matches := num_matches + 1;
1078 if (num_matches == nth_match) {
1079 return pco.protocols[i].protoIDContents;
1080 }
1081 }
1082 }
Daniel Willmanne4ff5372018-07-05 17:35:03 +02001083 setverdict(fail, "Could not extract protocol payload from protocol ", protocol);
1084 mtc.stop;
Harald Weltec69cf4e2018-02-17 20:57:02 +01001085 return ''O;
1086 }
1087
Philipp Maier57889492023-08-07 12:10:03 +02001088 template (present) IpcpPacket tr_IPCP(template (present) LcpCode code, template (present)uint8_t identifier,
1089 template (present) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001090 code := code,
1091 identifier := identifier,
1092 len := ?,
1093 options := opts
1094 }
Philipp Maier57889492023-08-07 12:10:03 +02001095 template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001096 code := IPCP_OPT_PrimaryDNS,
1097 len := 6,
1098 data := addr
1099 }
Philipp Maier57889492023-08-07 12:10:03 +02001100 template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001101 code := IPCP_OPT_SecondaryDNS,
1102 len := 6,
1103 data := addr
1104 }
Philipp Maier57889492023-08-07 12:10:03 +02001105 template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?,
1106 template (present) OCT4 dns1 := ?,
1107 template (present) OCT4 dns2 := ?) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001108 tr_IPCP(LCP_Configure_Ack, identifier,
1109 { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
1110
Philipp Maier57889492023-08-07 12:10:03 +02001111 template (value) IpcpPacket ts_IPCP(LcpCode code, uint8_t identifier, template (value) IpcpOptionList opts) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001112 code := code,
1113 identifier := identifier,
1114 len := 0, /* overwritten */
1115 options := opts
1116 }
Philipp Maier57889492023-08-07 12:10:03 +02001117 template (value) IpcpPacket ts_IPCP_ReqDNS(uint8_t identifier := 0) :=
Harald Weltec69cf4e2018-02-17 20:57:02 +01001118 ts_IPCP(LCP_Configure_Request, identifier,
1119 { tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) });
1120
Philipp Maier57889492023-08-07 12:10:03 +02001121 template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001122 ts_IPCP(LCP_Configure_Request, identifier,
1123 { tr_IPCP_PrimaryDns('00000000'O) });
Philipp Maier57889492023-08-07 12:10:03 +02001124 template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(uint8_t identifier := 0) :=
Philipp Maier33e52612018-05-30 17:22:02 +02001125 ts_IPCP(LCP_Configure_Request, identifier,
1126 { tr_IPCP_SecondaryDns('00000000'O) });
1127
Harald Welte57b9b7f2018-02-18 22:28:13 +01001128 function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd {
1129 if (istemplatekind(ind, "omit")) {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001130 return omit;
1131 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001132 var TearDownInd ret := {
1133 type_gtpc := '13'O,
1134 tdInd := valueof(ind),
1135 spare:= '0000000'B
1136 }
1137 return ret;
1138 }
1139
Philipp Maier57889492023-08-07 12:10:03 +02001140 template (value) GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001141 deletePDPContextRequest := {
1142 cause := omit,
1143 tearDownIndicator := f_teardown_ind_IE(teardown_ind),
1144 nsapi := {
1145 type_gtpc := '14'O,
1146 nsapi := nsapi,
1147 unused := '0000'B
1148 },
1149 protConfigOptions := omit,
1150 userLocationInformation := omit,
1151 mS_TimeZone := omit,
1152 extendedCommonFlags := omit,
1153 uLI_Timestamp := omit,
1154 private_extension_gtpc := omit
1155 }
1156 }
1157
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001158 template (value) Gtp1cUnitdata ts_GTPC_DeletePDP(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +02001159 BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +01001160 peer := peer,
1161 gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid,
1162 valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq)
1163 }
1164
Philipp Maier57889492023-08-07 12:10:03 +02001165 template (value) GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause,
1166 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001167 deletePDPContextResponse := {
1168 cause := { '00'O, cause },
1169 protConfigOptions := pco,
1170 userLocationInformation := omit,
1171 mS_TimeZone := omit,
1172 uLI_Timestamp := omit,
1173 private_extension_gtpc := omit
1174 }
1175 }
1176
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001177 template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(Gtp1cPeer peer, uint16_t seq, OCT4 teid,
Philipp Maier57889492023-08-07 12:10:03 +02001178 OCT1 cause,
1179 template (omit) ProtConfigOptions pco := omit) := {
Harald Welte6f203162018-02-18 22:04:55 +01001180 peer := peer,
1181 gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid,
1182 valueof(ts_DeletePdpRespPDU(cause, pco)), seq)
1183 }
1184
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001185 /* SGSN Context Request - 7.5.3 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001186 template (present) GTPC_PDUs tr_SGSNContextReqPDU(template (present) RoutingAreaIdentity rai := ?,
1187 template (present) OCT4 teic := ?,
1188 template (present) octetstring sgsn_addr_control := ?,
1189 template hexstring imsi := *,
1190 template BIT1 msValidated := *,
1191 template TLLI tlli := *,
1192 template PacketTMSI ptmsi := *,
1193 template PTMSI_Signature ptmsi_sig := *,
1194 template OCT1 rat_type := *) := {
1195 sgsn_ContextRequest := {
1196 imsi := f_tr_Imsi(imsi),
1197 routingAreaIdentity := rai,
1198 tlli := tlli,
1199 packetTMSI := ptmsi,
1200 ptmsi_Signature := ptmsi_sig,
1201 ms_Validated := f_tr_MS_Validated(msValidated),
1202 teidControlPlane := {
1203 type_gtpc := '11'O,
1204 teidControlPlane := teic
1205 },
1206 sgsn_addr_controlPlane := tr_GsnAddr(sgsn_addr_control),
1207 alternative_sgsn_addr_controlPlane := *,
1208 sGSN_Number := *,
1209 ratType := f_tr_RATType(rat_type),
1210 hopCounter := *,
1211 private_extension_gtpc := *
1212 }
1213 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001214 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextReq(template (present) Gtp1cPeer peer,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001215 template (present) GTPC_PDUs SGSNContextReqPDU) := {
1216 peer := peer,
1217 gtpc := tr_GTP1C_PDU(sgsnContextRequest, '00000000'O, SGSNContextReqPDU)
1218 }
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001219 template (value) GTPC_PDUs ts_SGSNContextReqPDU(template (value) RoutingAreaIdentity rai,
1220 template (value) OCT4 teic,
1221 template (value) octetstring sgsn_addr_control,
1222 template (omit) hexstring imsi := omit,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001223 template (omit) BIT1 msValidated := '0'B,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001224 template (omit) TLLI tlli := omit,
1225 template (omit) PacketTMSI ptmsi := omit,
1226 template (omit) PTMSI_Signature ptmsi_sig := omit,
1227 template (omit) OCT1 rat_type := omit) := {
1228 sgsn_ContextRequest := {
1229 imsi := f_ts_Imsi(imsi),
1230 routingAreaIdentity := rai,
1231 tlli := tlli,
1232 packetTMSI := ptmsi,
1233 ptmsi_Signature := ptmsi_sig,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001234 ms_Validated := f_ts_MS_Validated(msValidated),
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001235 teidControlPlane := {
1236 type_gtpc := '11'O,
1237 teidControlPlane := teic
1238 },
1239 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1240 alternative_sgsn_addr_controlPlane := omit,
1241 sGSN_Number := omit,
1242 ratType := f_ts_RATType(rat_type),
1243 hopCounter := omit,
1244 private_extension_gtpc := omit
1245 }
1246 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001247 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextReq(Gtp1cPeer peer, uint16_t seq,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001248 template (value) GTPC_PDUs SGSNContextReqPDU) := {
1249 peer := peer,
1250 gtpc := ts_GTP1C_PDU(sgsnContextRequest, '00000000'O, valueof(SGSNContextReqPDU), seq)
1251 }
1252
1253 /* SGSN Context Response - 7.5.4 */
1254 template (present) GTPC_PDUs tr_SGSNContextRespPDU(template (present) GTP_Cause cause := ?,
1255 template hexstring imsi := *) := {
1256 sgsn_ContextResponse := {
1257 cause := tr_Cause_gtpc(cause),
1258 imsi := f_tr_Imsi(imsi),
1259 teidControlPlane := *,
1260 rabContext := *,
1261 radioPrioritySMS := *,
1262 radioPriority := *,
1263 packetFlowID := *,
1264 charging_char := *,
1265 mm_Context := *,
1266 pdp_Context := *,
1267 sgsn_addr_controlPlane := *,
1268 pdpContextPriorization := *,
1269 radioPriority_LCS := *,
1270 mBMS_UE_Context := *,
1271 subscribedRFSP_Index := *,
1272 rFSP_IndexInUse := *,
1273 colocatedGGSN_PGW_FQDN := *,
1274 evolvedAllocationRetentionPriorityII := *,
1275 extendedCommonFlags := *,
1276 ue_network_capability := *,
1277 ue_ambr := *,
1278 apn_ambr_nsapi := *,
1279 signallingPriorityIndication_nsapi := *,
1280 higher_bitrates_than_16mbps_flag := *,
1281 selectionMode_nsapi := *,
1282 localHomeNetworkID_nsapi := *,
1283 uE_UsageType := *,
1284 extendedCommonFlagsII := *,
1285 private_extension_gtpc := *
1286 }
1287 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001288 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextResp(template (present) Gtp1cPeer peer := ?,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001289 template (present) OCT4 teid := ?,
1290 template (present) GTPC_PDUs SGSNContextRespPDU := ?)
1291 := tr_GTPC_MsgType(peer, sgsnContextResponse, teid, SGSNContextRespPDU);
1292
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001293 template (value) GTPC_PDUs ts_SGSNContextRespPDU(template (value) GTP_Cause cause,
1294 template (omit) hexstring imsi := omit,
1295 template (omit) OCT4 teic := omit,
1296 template (omit) octetstring sgsn_addr_control := omit,
1297 template (omit) MM_Context mm_context := omit,
1298 template (omit) PDP_Context_GTPC_List pdp_ctx_list := omit) := {
1299 sgsn_ContextResponse := {
1300 cause := ts_Cause_gtpc(cause),
1301 imsi := f_ts_Imsi(imsi),
1302 teidControlPlane := f_ts_TEIC(teic),
1303 rabContext := omit,
1304 radioPrioritySMS := omit,
1305 radioPriority := omit,
1306 packetFlowID := omit,
1307 charging_char := omit,
1308 mm_Context := mm_context,
1309 pdp_Context := pdp_ctx_list,
1310 sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control),
1311 pdpContextPriorization := omit,
1312 radioPriority_LCS := omit,
1313 mBMS_UE_Context := omit,
1314 subscribedRFSP_Index := omit,
1315 rFSP_IndexInUse := omit,
1316 colocatedGGSN_PGW_FQDN := omit,
1317 evolvedAllocationRetentionPriorityII := omit,
1318 extendedCommonFlags := omit,
1319 ue_network_capability := omit,
1320 ue_ambr := omit,
1321 apn_ambr_nsapi := omit,
1322 signallingPriorityIndication_nsapi := omit,
1323 higher_bitrates_than_16mbps_flag := omit,
1324 selectionMode_nsapi := omit,
1325 localHomeNetworkID_nsapi := omit,
1326 uE_UsageType := omit,
1327 extendedCommonFlagsII := omit,
1328 private_extension_gtpc := omit
1329 }
1330 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001331 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextResp(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001332 template (value) GTPC_PDUs SGSNContextRespPDU) := {
1333 peer := peer,
1334 gtpc := ts_GTP1C_PDU(sgsnContextResponse, teid, valueof(SGSNContextRespPDU), seq)
1335 }
1336
1337
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001338 /* SGSN Context Acknowledge - 7.5.5 */
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001339 template (present) GTPC_PDUs tr_SGSNContextAckPDU(template (present) GTP_Cause cause := ?) := {
1340 sgsn_ContextAcknowledge := {
1341 cause := tr_Cause_gtpc(cause),
1342 teidDataII := *,
1343 sgsn_AddressForUserTraffic := *,
1344 sgsn_Number := *,
1345 nodeIdentifier := *,
1346 private_extension_gtpc := *
1347 }
1348 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001349 template (present) Gtp1cUnitdata tr_GTPC_SGSNContextAck(template (present) Gtp1cPeer peer := ?,
Pau Espin Pedrolf95460b2024-01-09 10:25:15 +01001350 template (present) OCT4 teid := ?,
1351 template (present) GTPC_PDUs SGSNContextAckPDU := ?)
1352 := tr_GTPC_MsgType(peer, sgsnContextAcknowledge, teid, SGSNContextAckPDU);
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001353 template (value) GTPC_PDUs ts_SGSNContextAckPDU(template (value) GTP_Cause cause := GTP_CAUSE_REQUEST_ACCEPTED) := {
1354 sgsn_ContextAcknowledge := {
1355 cause := ts_Cause_gtpc(cause),
1356 teidDataII := omit,
1357 sgsn_AddressForUserTraffic := omit,
1358 sgsn_Number := omit,
1359 nodeIdentifier := omit,
1360 private_extension_gtpc := omit
1361 }
1362 }
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001363 template (value) Gtp1cUnitdata ts_GTPC_SGSNContextAck(Gtp1cPeer peer, OCT4 teid, uint16_t seq,
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001364 template (value) GTPC_PDUs SGSNContextAckPDU := ts_SGSNContextAckPDU(GTP_CAUSE_REQUEST_ACCEPTED)) := {
1365 peer := peer,
Pau Espin Pedrolca651b52023-12-20 18:37:39 +01001366 gtpc := ts_GTP1C_PDU(sgsnContextAcknowledge, teid, valueof(SGSNContextAckPDU), seq)
Pau Espin Pedrol408e0ae2023-12-15 18:56:31 +01001367 }
Harald Welte6f203162018-02-18 22:04:55 +01001368
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001369 /* GTP-C RIM */
1370
1371 template (value) RIM_Application_Identity_GTPC ts_GTPC_RIM_Application_Identity(OCT1 app_id) := {
1372 iEI := '4B'O,
1373 ext := '1'B,
1374 lengthIndicator := {
1375 length1 := 1
1376 },
1377 rIMApplicationIdentity := app_id
1378 }
1379 /* 3GPP TS 48.018 11.3.62 */
1380 template (value) RIM_Sequence_Number_GTPC ts_GTPC_RIM_Sequence_Number(integer seq) := {
1381 iEI := '4C'O,
1382 ext := '1'B,
1383 lengthIndicator := {
1384 length1 := 4
1385 },
1386 rIMSequenceNumber := int2oct(seq, 4)
1387 }
1388 template (value) RIM_PDU_Indications_GTPC ts_GTPC_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := {
1389 iEI := '4F'O,
1390 ext := '1'B,
1391 lengthIndicator := {
1392 length1 := 1
1393 },
1394 ack := bool2bit(ack),
1395 pDU_Type_Extension := type_ext,
1396 reserved := '0000'B
1397 }
1398 /* 3GPP TS 48.018 11.3.67 */
1399 template (value) RIM_Protocol_Version_Number_GTPC ts_GTPC_RIM_Protocol_Version_Number(integer ver) := {
1400 iEI := '55'O,
1401 ext := '1'B,
1402 lengthIndicator := {
1403 length1 := 1
1404 },
1405 rIMProtocolVersionNumber := int2oct(ver, 1)
1406 }
Philipp Maier57889492023-08-07 12:10:03 +02001407 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 +02001408 var template Cell_Identifier_V_GTPC ret := {
1409 mccDigit1 := ?,
1410 mccDigit2 := ?,
1411 mccDigit3 := ?,
1412 mncDigit3 := ?,
1413 mncDigit1 := ?,
1414 mncDigit2 := ?,
1415 lac := ?,
1416 rac := ?,
1417 cI_value := ?
1418 }
Philipp Maier57889492023-08-07 12:10:03 +02001419 if (istemplatekind(cid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001420 return ?;
1421 }
1422 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1423 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1424 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1425 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1426 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1427 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1428 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1429 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1430 }
1431 if (isvalue(cid.ra_id.lai.lac)) {
1432 ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2);
1433 }
1434 }
1435 if (isvalue(cid) and isvalue(cid.ra_id)) {
1436 ret.rac := f_oct_or_wc(cid.ra_id.rac, 1);
1437 }
1438 if (isvalue(cid)) {
1439 ret.cI_value := f_oct_or_wc(cid.cell_id, 2);
1440 }
1441 return ret;
1442 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001443 template (value) Cell_Identifier_V_GTPC ts_GTPC_Cell_Identifier_V(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001444 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1445 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1446 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1447 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1448 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1449 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1450 lac := int2oct(cid.ra_id.lai.lac, 2),
1451 rac := int2oct(cid.ra_id.rac, 1),
1452 cI_value := int2oct(cid.cell_id, 2)
1453 }
Philipp Maier57889492023-08-07 12:10:03 +02001454 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_cid(GTP_CellId cid) := {
1455 cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001456 }
Philipp Maier57889492023-08-07 12:10:03 +02001457 function tr_GTPC_ENB_Identifier(template (present) GTP_CellId cid,
1458 template (present) integer tac,
1459 template (present) octetstring gnbid) return template (present) ENB_Identifier {
1460 var template (present) ENB_Identifier ret := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001461 mccDigit1 := ?,
1462 mccDigit2 := ?,
1463 mccDigit3 := ?,
1464 mncDigit3 := ?,
1465 mncDigit1 := ?,
1466 mncDigit2 := ?,
1467 tAC := ?,
1468 globalENB_ID := ?
1469 }
Philipp Maier57889492023-08-07 12:10:03 +02001470 if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001471 return ?;
1472 }
1473 if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) {
1474 if (isvalue(cid.ra_id.lai.mcc_mnc)) {
1475 ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0];
1476 ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1];
1477 ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2];
1478 ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3];
1479 ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4];
1480 ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5];
1481 }
1482 }
1483 if (isvalue(tac)) {
1484 ret.tAC := int2oct(valueof(tac), 2);
1485 }
1486 if (isvalue(gnbid)) {
1487 ret.globalENB_ID := gnbid;
1488 }
1489
1490 return ret;
1491 }
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001492 template (value) ENB_Identifier ts_GTPC_ENB_Identifier(GTP_CellId cid, integer tac, octetstring gnbid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001493 mccDigit1 := cid.ra_id.lai.mcc_mnc[0],
1494 mccDigit2 := cid.ra_id.lai.mcc_mnc[1],
1495 mccDigit3 := cid.ra_id.lai.mcc_mnc[2],
1496 mncDigit3 := cid.ra_id.lai.mcc_mnc[3],
1497 mncDigit1 := cid.ra_id.lai.mcc_mnc[4],
1498 mncDigit2 := cid.ra_id.lai.mcc_mnc[5],
1499 tAC := int2oct(tac, 2),
1500 globalENB_ID := gnbid
1501 }
Philipp Maier57889492023-08-07 12:10:03 +02001502 template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_enbid(GTP_CellId cid, integer tac, octetstring gnbid) := {
1503 eNB_Identifier := ts_GTPC_ENB_Identifier(cid, tac, gnbid)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001504 }
Philipp Maier57889492023-08-07 12:10:03 +02001505 template (present) RIM_Routing_Information_GTPC
1506 tr_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (present) RIM_Routing_Address_GTPC addr) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001507 iEI := '54'O,
1508 ext := '1'B,
1509 lengthIndicator := {
1510 length1 := ?
1511 },
1512 rIMRoutingAddressDiscriminator := addr_discr,
1513 spare := '0'H,
1514 rIM_Routing_Address := addr
1515 }
1516 template (value) RIM_Routing_Information_GTPC
1517 ts_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address_GTPC addr) := {
1518 iEI := '54'O,
1519 ext := '1'B,
1520 lengthIndicator := {
1521 length1 := 0 /* overwritten */
1522 },
1523 rIMRoutingAddressDiscriminator := addr_discr,
1524 spare := '0'H,
1525 rIM_Routing_Address := addr
1526 }
1527 /* 3GPP TS 48.018 11.3.63.1.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001528 template (present) RAN_Information_Request_Application_Container_NACC_GTPC
1529 tr_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001530 iEI := '4D'O,
1531 ext := '1'B,
1532 lengthIndicator := {
1533 length1 := ?
1534 },
1535 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid)
1536 }
1537 template (value) RAN_Information_Request_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001538 ts_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001539 iEI := '4D'O,
1540 ext := '1'B,
1541 lengthIndicator := {
1542 length1 := 0 /* overwritten */
1543 },
1544 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid)
1545 }
1546 /* 3GPP TS 48.018 11.3.63.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001547 template (present) RAN_Information_Request_Application_Container_GTPC
1548 tru_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001549 nacc := tr_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1550 }
1551 template (value) RAN_Information_Request_Application_Container_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001552 tsu_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001553 nacc := ts_GTPC_RAN_Information_Request_Application_Container_NACC(cid)
1554 }
1555 /* 3GPP TS 48.018 11.3.63.2.1 */
Philipp Maier57889492023-08-07 12:10:03 +02001556 template (present) RAN_Information_Application_Container_NACC_GTPC
1557 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 +02001558 iEI := '4E'O,
1559 ext := '1'B,
1560 lengthIndicator := {
1561 length1 := ?
1562 },
1563 reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid),
1564 typeBit := bool2bit(psi_type),
1565 number_of_SI_PSI := int2bit(si_psi_num, 7),
1566 sI_PSI := si_psi
1567 }
1568 template (value) RAN_Information_Application_Container_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001569 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 +02001570 iEI := '4E'O,
1571 ext := '1'B,
1572 lengthIndicator := {
1573 length1 := 0 /* overwritten */
1574 },
1575 reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid),
1576 typeBit := bool2bit(psi_type),
1577 number_of_SI_PSI := int2bit(si_psi_num, 7),
1578 sI_PSI := si_psi
1579 }
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001580 external function enc_RIM_Routing_Address_GTPC(in RIM_Routing_Address_GTPC ra) return octetstring
1581 with { extension "prototype(convert) encode(RAW)" };
Philipp Maier21bac7a2023-08-24 12:40:17 +02001582 external function dec_RIM_Routing_Address_GTPC(in octetstring stream) return RIM_Routing_Address_GTPC
Philipp Maierf7cb0bb2023-07-28 12:35:38 +02001583 with { extension "prototype(convert) decode(RAW)" };
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001584
1585 /* RAN_Information_Request */
1586 template (value) RAN_Information_Request_RIM_Container_GTPC
1587 ts_GTPC_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1588 template (value) RIM_Sequence_Number_GTPC seq,
1589 template (value) RIM_PDU_Indications_GTPC ind,
1590 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1591 template (omit) RAN_Information_Request_Application_Container_GTPC app_cont := omit,
1592 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1593 iEI := '57'O,
1594 ext := '1'B,
1595 lengthIndicator := {
1596 length1 := 0 /* overwritten */
1597 },
1598 rIM_Application_Identity := app_id,
1599 rIM_Sequence_Number := seq,
1600 rIM_PDU_Indications := ind,
1601 rIM_Protocol_Version_Number := ver,
1602 application_Container := app_cont,
1603 sON_TransferApplicationIdentity := son_app_id
1604 }
1605 template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1606 ts_GTPC_RAN_Information_Request(template (value) RIM_Routing_Information_GTPC dest,
1607 template (value) RIM_Routing_Information_GTPC src,
Philipp Maier6cef1c32023-07-24 11:01:52 +02001608 template (value) RAN_Information_Request_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001609 bssgpPduType := '71'O,
1610 destination_Cell_Identifier := dest,
1611 source_Cell_Identifier := src,
1612 rIM_Container := cont
1613 }
Philipp Maier57889492023-08-07 12:10:03 +02001614 template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC
1615 tr_GTPC_RAN_Information_Request(template (present) RIM_Routing_Information_GTPC dest := ?,
1616 template (present) RIM_Routing_Information_GTPC src := ?,
1617 template (present) RAN_Information_Request_RIM_Container_GTPC cont := ?) := {
Philipp Maier4b81c6e2023-07-24 11:03:15 +02001618 bssgpPduType := '71'O,
1619 destination_Cell_Identifier := dest,
1620 source_Cell_Identifier := src,
1621 rIM_Container := cont
1622 }
1623
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001624 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO_REQ(template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu) := {
1625 type_gtpc := '90'O,
1626 lengthf := 0, /* FIXME */
1627 rANTransparentContainerField := {
1628 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1629 }
1630 }
Philipp Maier57889492023-08-07 12:10:03 +02001631 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO_REQ(template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu := ?) := {
Philipp Maieredce92f2023-07-26 11:02:10 +02001632 type_gtpc := '90'O,
1633 lengthf := ?,
1634 rANTransparentContainerField := {
1635 pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu
1636 }
1637 }
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001638
1639 /* RAN_Information */
Philipp Maier57889492023-08-07 12:10:03 +02001640 template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001641 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 +02001642 application_Container := tr_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1643 }
1644 template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC
Pau Espin Pedrol17e0f8c2021-12-03 15:11:34 +01001645 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 +02001646 application_Container := ts_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi)
1647 }
Philipp Maier57889492023-08-07 12:10:03 +02001648 template (present) ApplContainer_or_ApplErrContainer_GTPC
1649 tru_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001650 nacc := cont
1651 }
1652 template (value) ApplContainer_or_ApplErrContainer_GTPC
1653 tsu_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := {
1654 nacc := cont
1655 }
Philipp Maier57889492023-08-07 12:10:03 +02001656 template (present) RAN_Information_RIM_Container_GTPC
1657 tr_GTPC_RAN_Information_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id,
1658 template (present) RIM_Sequence_Number_GTPC seq,
1659 template (present) RIM_PDU_Indications_GTPC ind,
1660 template RIM_Protocol_Version_Number_GTPC ver := *,
1661 template ApplContainer_or_ApplErrContainer_GTPC app_cont := *,
1662 template SON_TransferApplicationIdentity son_app_id := *) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001663 iEI := '58'O,
1664 ext := '1'B,
1665 lengthIndicator := {
1666 length1 := ?
1667 },
1668 rIM_Application_Identity := app_id,
1669 rIM_Sequence_Number := seq,
1670 rIM_PDU_Indications := ind,
1671 rIM_Protocol_Version_Number := ver,
1672 applContainer_or_ApplErrContainer := app_cont,
1673 sON_TransferApplicationIdentity := son_app_id
1674 }
1675 template (value) RAN_Information_RIM_Container_GTPC
1676 ts_GTPC_RAN_Information_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id,
1677 template (value) RIM_Sequence_Number_GTPC seq,
1678 template (value) RIM_PDU_Indications_GTPC ind,
1679 template (omit) RIM_Protocol_Version_Number_GTPC ver := omit,
1680 template (omit) ApplContainer_or_ApplErrContainer_GTPC app_cont := omit,
1681 template (omit) SON_TransferApplicationIdentity son_app_id := omit) := {
1682 iEI := '58'O,
1683 ext := '1'B,
1684 lengthIndicator := {
1685 length1 := 0 /* overwritten */
1686 },
1687 rIM_Application_Identity := app_id,
1688 rIM_Sequence_Number := seq,
1689 rIM_PDU_Indications := ind,
1690 rIM_Protocol_Version_Number := ver,
1691 applContainer_or_ApplErrContainer := app_cont,
1692 sON_TransferApplicationIdentity := son_app_id
1693 }
Philipp Maier57889492023-08-07 12:10:03 +02001694 template (present) PDU_BSSGP_RAN_INFORMATION_GTPC
1695 tr_GTPC_RAN_Information(template (present) RIM_Routing_Information_GTPC dest,
1696 template (present) RIM_Routing_Information_GTPC src,
1697 template (present) RAN_Information_RIM_Container_GTPC cont) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001698 bssgpPduType := '70'O,
1699 destination_Cell_Identifier := dest,
1700 source_Cell_Identifier := src,
1701 rIM_Container := cont
1702 }
1703 template (value) PDU_BSSGP_RAN_INFORMATION_GTPC
1704 ts_GTPC_RAN_Information(template (value) RIM_Routing_Information_GTPC dest,
1705 template (value) RIM_Routing_Information_GTPC src,
1706 template (value) RAN_Information_RIM_Container_GTPC cont) := {
1707 bssgpPduType := '70'O,
1708 destination_Cell_Identifier := dest,
1709 source_Cell_Identifier := src,
1710 rIM_Container := cont
1711 }
Philipp Maier57889492023-08-07 12:10:03 +02001712 template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO(template (present) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001713 type_gtpc := '90'O,
1714 lengthf := ?,
1715 rANTransparentContainerField := {
1716 pDU_BSSGP_RAN_INFORMATION := pdu
1717 }
1718 }
1719 template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO(template (value) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := {
1720 type_gtpc := '90'O,
1721 lengthf := 0, /* overwritten */
1722 rANTransparentContainerField := {
1723 pDU_BSSGP_RAN_INFORMATION := pdu
1724 }
1725 }
1726
Philipp Maier57889492023-08-07 12:10:03 +02001727 template (present) RANTransparentContainer tr_RANTransparentContainer(template (present) RANTransparentContainerField rANTransparentContainerField) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001728 type_gtpc := '90'O,
1729 lengthf := ?,
1730 rANTransparentContainerField := rANTransparentContainerField
1731 }
1732 template (value) RANTransparentContainer ts_RANTransparentContainer(template (value) RANTransparentContainerField rANTransparentContainerField) := {
1733 type_gtpc := '90'O,
1734 lengthf := 0, /* overwritten */
1735 rANTransparentContainerField := rANTransparentContainerField
1736 }
Philipp Maier57889492023-08-07 12:10:03 +02001737 template (present) GTPC_PDUs tr_RANInfoRelay(template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001738 ranInformationRelay := {
1739 transparentContainer := transparentContainer,
1740 rIM_RoutingAddress := *,
1741 rIM_RoutingAddress_Discriminator := *,
1742 private_extension_gtpc := *
1743 }
1744 }
Philipp Maier05ad55c2023-07-24 10:56:46 +02001745 template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer,
1746 template (omit) RIM_RoutingAddress ra := omit,
1747 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001748 ranInformationRelay := {
1749 transparentContainer := transparentContainer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001750 rIM_RoutingAddress := ra,
1751 rIM_RoutingAddress_Discriminator := ra_discr,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001752 private_extension_gtpc := omit
1753 }
1754 }
Philipp Maier57889492023-08-07 12:10:03 +02001755 template (present) Gtp1cUnitdata
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001756 tr_GTPC_RANInfoRelay(template (present) Gtp1cPeer peer,
Philipp Maier57889492023-08-07 12:10:03 +02001757 template (present) RANTransparentContainer transparentContainer) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001758 peer := peer,
1759 gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer))
1760 }
1761 template (value) Gtp1cUnitdata
Pau Espin Pedrol4b090c92024-02-29 19:47:07 +01001762 ts_GTPC_RANInfoRelay(template (value) Gtp1cPeer peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001763 template (value) RANTransparentContainer transparentContainer,
1764 template (omit) RIM_RoutingAddress ra := omit,
1765 template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := {
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001766 peer := peer,
Philipp Maier05ad55c2023-07-24 10:56:46 +02001767 gtpc := ts_GTP1C_PDU(rANInformationRelay, '00000000'O, valueof(ts_RANInfoRelay(transparentContainer, ra, ra_discr)), 0)
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001768 }
1769
1770
Philipp Maier57889492023-08-07 12:10:03 +02001771 template (present) RAN_Information_Request_RIM_Container_GTPC
1772 tr_GTPC_RAN_Information_Request_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id := ?,
1773 template (present) RIM_Sequence_Number_GTPC seq := ?,
1774 template (present) RIM_PDU_Indications_GTPC ind := ?,
Pau Espin Pedrol8c74cbb2021-05-04 15:26:56 +02001775 template RIM_Protocol_Version_Number_GTPC ver := *,
1776 template RAN_Information_Request_Application_Container_GTPC app_cont := *,
1777 template SON_TransferApplicationIdentity son_app_id := *) := {
1778 iEI := '57'O,
1779 ext := '1'B,
1780 lengthIndicator := {
1781 length1 := ?
1782 },
1783 rIM_Application_Identity := app_id,
1784 rIM_Sequence_Number := seq,
1785 rIM_PDU_Indications := ind,
1786 rIM_Protocol_Version_Number := ver,
1787 application_Container := app_cont,
1788 sON_TransferApplicationIdentity := son_app_id
1789 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001790
Philipp Maier653a0142023-08-04 15:22:37 +02001791 /* 3GPP TS 29.060, section 7.7.57 */
1792 template (value) RIM_RoutingAddress ts_RIM_RoutingAddress(octetstring addr_value) := {
1793 type_gtpc := '9F'O,
1794 lengthf := 0, /* we assume encoder overwrites this */
1795 rIM_RoutingAddressValue := addr_value
1796 }
1797 template (present) RIM_RoutingAddress tr_RIM_RoutingAddress(template (present) octetstring addr_value := ?) := {
1798 type_gtpc := '9F'O,
1799 lengthf := ?,
1800 rIM_RoutingAddressValue := addr_value
1801 }
1802
1803 /* 3GPP TS 29.060, section 7.7.77 */
1804 template (value) RIM_RoutingAddress_Discriminator ts_RIM_RoutingAddress_Discriminator(bitstring addr_discr) := {
1805 type_gtpc := 'B2'O,
1806 lengthf := 0, /* we assume encoder overwrites this */
1807 rra_discriminator := addr_discr,
1808 spare := '0000'B
1809 }
1810 template (present) RIM_RoutingAddress_Discriminator tr_RIM_RoutingAddress_Discriminator(template (present) bitstring addr_discr := ?) := {
1811 type_gtpc := 'B2'O,
1812 lengthf := ?,
1813 rra_discriminator := addr_discr,
1814 spare := '0000'B
1815 }
Harald Weltec69cf4e2018-02-17 20:57:02 +01001816}