blob: 9f242eecda99f36c930fa8fb0c60d8f8ea3a19bf [file] [log] [blame]
Harald Welte0f7d03a2019-07-16 19:43:32 +09001module GTPv2_Templates {
2
3/* (C) 2019 by Harald Welte <laforge@gnumonks.org>
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
12import from General_Types all;
13import from Osmocom_Types all;
14import from GTPv2_Types all;
15
16private function fs_GTP2C_t_bit(template (omit) OCT4 teid) return BIT1 {
17 if (istemplatekind(teid, "omit")) {
18 return '0'B;
19 } else {
20 return '1'B;
21 }
22}
23
24private function fs_GTP2C_p_bit(template (omit) PDU_GTPCv2 piggyback) return BIT1 {
25 if (istemplatekind(piggyback, "omit")) {
26 return '0'B;
27 } else {
28 return '1'B;
29 }
30}
31
32template (present) PDU_GTPCv2 tr_PDU_GTP2C(template OCT4 teid := ?,
Harald Welte88b3ccb2020-03-12 21:36:32 +010033 template (present) OCT3 seq := ?,
Harald Welte0f7d03a2019-07-16 19:43:32 +090034 template (present) GTPCv2_PDUs pdus := ?,
35 template PDU_GTPCv2 piggyback := omit) := {
36 spare := '000'B,
37 t_Bit := ?,
38 p_Bit := ?,
39 version := '010'B,
40 messageType := ?,
41 lengthf := ?,
42 tEID := teid,
Harald Welte88b3ccb2020-03-12 21:36:32 +010043 sequenceNumber := seq,
Harald Welte0f7d03a2019-07-16 19:43:32 +090044 spare3 := '00'O,
45 gtpcv2_pdu := pdus,
46 piggybackPDU_GTPCv2 := piggyback
47}
48
Harald Welte88b3ccb2020-03-12 21:36:32 +010049template (present) OCT1 gtp2_requests := (
50 '01'O, // echoRequest
51 '20'O, // createSessionRequest
52 '5F'O, // createBearerRequest
53 '22'O, // modifyBearerRequest
54 '24'O, // deleteSessionRequest
55 '63'O, // deleteBearerRequest
56 'A8'O, // deleteIndirectDataForwardingTunnelRequest
57 '61'O, // updateBearerRequest
58 '42'O, // deleteBearerCommand
59 'A6'O, // createIndirectDataForwardingTunnelRequest
60 'AA'O, // releaseAccessBearersRequest
61 'B3'O, // modifyAccessBearersRequest
62 '85'O, // forwardRelocationRequest
63 '82'O, // contextRequest
64 '80'O, // identificationRequest
65 '26'O, // changeNotificationRequest
66 '8B'O, // relocationCancelRequest
67 'A0'O, // createForwardingTunnelRequest
68 '65'O, // deletePDN_ConnectionSetRequest
69 'C8'O, // updatePDN_ConnectionSetRequest
70 '9E'O, // uE_RegistrationQueryRequest
71 'E7'O, // mBMSSessionStartRequest
72 'E9'O, // mBMSSessionUpdateRequest
73 'EB'O // mBMSSessionStopRequest
74);
75template (present) OCT1 gtp2_responses := (
76 '02'O, // echoResponse
77 '21'O, // createSessionResponse
78 '60'O, // createBearerResponse
79 '23'O, // modifyBearerResponse
80 '25'O, // deleteSessionResponse
81 '64'O, // deleteBearerResponse
82 'A9'O, // deleteIndirectDataForwardingTunnelResponse
83 '62'O, // updateBearerResponse
84 '43'O, // deleteBearerFailureIndication
85 'A7'O, // createIndirectDataForwardingTunnelResponse
86 'AB'O, // releaseAccessBearersResponse
87 'B4'O, // modifyAccessBearersResponse
88 '86'O, // forwardRelocationResponse
89 '83'O, // contextResponse
90 '81'O, // identificationResponse
91 '27'O, // changeNotificationResponse
92 '8C'O, // relocationCancelResponse
93 'A1'O, // createForwardingTunnelResponse
94 '66'O, // deletePDN_ConnectionSetResponse
95 'C9'O, // updatePDN_ConnectionSetResponse
96 '9F'O, // uE_RegistrationQueryResponse
97 'E8'O, // mBMSSessionStartResponse
98 'EA'O, // mBMSSessionUpdateResponse
99 'EC'O // mBMSSessionStopResponse
100);
101
102template (present) PDU_GTPCv2 tr_PDU_GTP2C_msgtypes(template (present) OCT1 types) := {
103 spare := '000'B,
104 t_Bit := ?,
105 p_Bit := ?,
106 version := '010'B,
107 messageType := types,
108 lengthf := ?,
Pau Espin Pedrol94110822024-01-09 12:07:24 +0100109 tEID := *,
Harald Welte88b3ccb2020-03-12 21:36:32 +0100110 sequenceNumber := ?,
111 spare3 := '00'O,
112 gtpcv2_pdu := ?,
113 piggybackPDU_GTPCv2 := *
114};
Harald Welte0f7d03a2019-07-16 19:43:32 +0900115
116/* 8.3 */
117template (value) IMSI ts_GTP2C_Imsi(template (value) hexstring imsi) := {
118 elementIdentifier := '01'O,
119 lengthIndicator := 0, /* overwritten */
120 instance := '0000'B,
121 spare := '0000'B,
122 iMSI_Value := imsi
123}
124template (present) IMSI tr_GTP2C_Imsi(template (present) hexstring imsi) := {
125 elementIdentifier := '01'O,
126 lengthIndicator := ?,
127 instance := ?,
128 spare := '0000'B,
Pau Espin Pedrol5c18a0c2023-10-19 13:41:41 +0200129 iMSI_Value := f_pad_bcd_number_tmpl(imsi)
Harald Welte0f7d03a2019-07-16 19:43:32 +0900130}
131
Harald Welte88b3ccb2020-03-12 21:36:32 +0100132template (present) MSISDN ts_GTP2C_msisdn(template (present) hexstring msisdn) := {
133 elementIdentifier := '4C'O,
134 lengthIndicator := 0, /* overwritten */
135 instance := '0000'B,
136 spare := '0000'B,
137 mSISDN_Value := msisdn
138}
139private function fs_GTP2C_msisdn(template (omit) hexstring msisdn) return
140template (omit) MSISDN {
141 if (istemplatekind(msisdn, "omit")) {
142 return omit;
143 } else {
144 return ts_GTP2C_msisdn(msisdn);
145 }
146}
147
148
Harald Welte0f7d03a2019-07-16 19:43:32 +0900149/* 8.4-1 */
Harald Welte0f7d03a2019-07-16 19:43:32 +0900150type enumerated GTP2C_Cause {
151 Local_Detach (2),
152 Complete_Detach (3),
153 RAT_changed_from_3GPP_to_Non_3GPP (4),
154 ISR_deactivation (5),
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200155 Error_Ind_from_RNC_eNB_SGSN_MME (6),
Harald Welte0f7d03a2019-07-16 19:43:32 +0900156 IMSI_Detach_Only (7),
157 Reactivation_Required (8),
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200158 PDN_reconnection_to_APN_disallowed (9),
159 Access_changed_from_Non_3GPP_to_3GPP (10),
160 PDN_connection_inactivity_timer_expires (11),
161 PGW_not_responding (12),
162 Network_Failure (13),
163 QoS_parameter_mismatch (14),
164 EPS_to_5GS_Mobility (15),
165 Request_accepted (16),
166 Request_accepted_partially (17),
167 New_PDN_type_due_to_network_preference (18),
168 New_PDN_type_due_to_single_address_bearer_only (19),
169 /* ... */
170 Context_Not_Found (64)
171} with { variant "FIELDLENGTH(8)" encode "RAW" };
Harald Welte0f7d03a2019-07-16 19:43:32 +0900172
173/* 8.4 */
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200174template (value) Cause ts_GTP2C_Cause(template (value) GTP2C_Cause cause,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900175 template (value) BIT1 cs) := {
176 elementIdentifier := '02'O,
177 lengthIndicator := 0, /* overwritten */
178 instance := '0000'B,
179 spare := '0000'B,
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200180 causeValue := int2oct(enum2int(valueof(cause)), 1),
Harald Welte0f7d03a2019-07-16 19:43:32 +0900181 cS := cs,
182 bCE := '0'B,
183 pCE := '0'B,
184 spare2 := '00000'B,
185 typeOfOffendingIE := omit,
186 lengthIndicator2 := omit,
187 instanceOfOffendingIE := omit,
188 spare3 := omit
189}
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200190private function enum2int_GTP2C_Cause_tmpl(template GTP2C_Cause inp) return template integer
191{
192 if (istemplatekind(inp, "omit")) {
193 return omit;
194 } else if (istemplatekind(inp, "*")) {
195 return *;
196 } else if (istemplatekind(inp, "?")) {
197 return ?;
198 } else {
199 return enum2int(valueof(inp));
200 }
201}
202template (present) Cause tr_GTP2C_Cause(template (present) GTP2C_Cause cause) := {
Harald Welte0f7d03a2019-07-16 19:43:32 +0900203 elementIdentifier := '02'O,
204 lengthIndicator := ?,
205 instance := ?,
206 spare := '0000'B,
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200207 causeValue := int2oct_tmpl(enum2int_GTP2C_Cause_tmpl(cause), 1),
Harald Welte0f7d03a2019-07-16 19:43:32 +0900208 cS := ?,
209 bCE := ?,
210 pCE := ?,
211 spare2 := '00000'B,
212 typeOfOffendingIE := *,
213 lengthIndicator2 := *,
214 instanceOfOffendingIE := *,
215 spare3 := *
216}
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200217private function fs_GTP2C_Cause(template (omit) GTP2C_Cause cause, template (value) BIT1 cs) return
Harald Welte88b3ccb2020-03-12 21:36:32 +0100218template (omit) Cause {
219 if (istemplatekind(cause, "omit")) {
220 return omit;
221 } else {
222 return ts_GTP2C_Cause(cause, cs);
223 }
224}
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200225private function fr_GTP2C_Cause(template GTP2C_Cause cause) return
Harald Welte88b3ccb2020-03-12 21:36:32 +0100226template Cause {
227 if (istemplatekind(cause, "omit")) {
228 return omit;
229 } else if (istemplatekind(cause, "*")) {
230 return *;
231 } else {
232 return tr_GTP2C_Cause(cause);
233 }
234}
235
Harald Welte0f7d03a2019-07-16 19:43:32 +0900236
Pau Espin Pedrol2a2e8542023-10-19 13:39:45 +0200237/* 8.6 */
Harald Welte0f7d03a2019-07-16 19:43:32 +0900238template (value) AccessPointName ts_GTP2C_APN(template (value) octetstring apn) := {
Pau Espin Pedrol2a2e8542023-10-19 13:39:45 +0200239 elementIdentifier := '47'O,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900240 lengthIndicator := 0, /* overwritten */
241 instance := '0000'B,
242 spare := '0000'B,
243 aPN_Value := apn
244}
245template (present) AccessPointName tr_GTP2C_APN(template (present) octetstring apn) := {
Pau Espin Pedrol2a2e8542023-10-19 13:39:45 +0200246 elementIdentifier := '47'O,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900247 lengthIndicator := ?,
248 instance := ?,
249 spare := '0000'B,
250 aPN_Value := apn
251}
252
Harald Welte88b3ccb2020-03-12 21:36:32 +0100253/* 8.7 */
254template (value) AggregateMaximumBitRate
255ts_GTP2C_Ambr(integer ambr_ul, integer ambr_dl) := {
256 elementIdentifier := '48'O,
257 lengthIndicator := 0, /* overwritten */
258 instance := '0000'B,
259 spare := '0000'B,
260 aPN_AMBR_for_uplink := int2oct(ambr_ul, 4),
261 aPN_AMBR_for_downlink := int2oct(ambr_dl, 4)
262}
263
264/* 8.8 */
265template (value) EPS_BearerID
266ts_GTP2C_EpsBearerId(template (value) uint4_t bid) := {
267 elementIdentifier := '49'O,
268 lengthIndicator := 0, /* overwritten */
269 instance := '0000'B,
270 spare := '0000'B,
271 ePS_Bearer_ID_Value := bid,
272 spare2 := '0000'B,
273 additionalOctets := omit
274}
275template (present) EPS_BearerID
276tr_GTP2C_EpsBearerId(template (present) uint4_t bid) := {
277 elementIdentifier := '49'O,
278 lengthIndicator := ?, /* overwritten */
279 instance := '0000'B,
280 spare := '0000'B,
281 ePS_Bearer_ID_Value := bid,
282 spare2 := '0000'B,
283 additionalOctets := *
284}
285
Pau Espin Pedrol78c5e412023-12-21 19:50:11 +0100286/* 8.12 */
287template (present) Indication
288tr_GTP2C_Indication(template (present) BIT1 oI := ?) := {
289 elementIdentifier := '4D'O,
290 lengthIndicator := ?,
291 instance := '0000'B,
292 spare := '0000'B,
293 sGWCI := ?,
294 iSRAI := ?,
295 iSRSI := ?,
296 oI := oI,
297 dFI := ?,
298 hI := ?,
299 dTF := ?,
300 dAF := ?,
301 mSV := ?,
302 sI := ?,
303 pT := ?,
304 pBit := ?,
305 cRSI := ?,
306 cFSI := ?,
307 uIMSI := ?,
308 sQCI := ?,
309 cCRSI := *,
310 iSRAU := *,
311 mBMDT := *,
312 s4AF := *,
313 s6AF := *,
314 sRNI := *,
315 pBIC := *,
316 retLoc := *,
317 cPSR := *,
318 cLII := *,
319 cSFBI := *,
320 pPSI := *,
321 pPON_PPEI := *,
322 pPOF := *,
323 aRRL := *,
324 cPRAI := *,
325 aOPI := *,
326 aOSI := *,
327 pCRI := *,
328 pSCI := *,
329 bDWI := *,
330 dTCI := *,
331 uASI := *,
332 nSI := *,
333 wPMSI := *,
334 uNACCSI := *,
335 pNSI := *,
336 s11TF := *,
337 pMTSMI := *,
338 cPOPCI := *,
339 ePCOSI := *,
340 rOAAI := *,
341 tSPCMI := *,
342 spare_1 := *,
343 spare_2 := *,
344 spare_3 := *,
345 spare_4 := *,
346 spare_5 := *,
347 spare_6 := *,
348 spare_7 := *,
Harald Welte88b3ccb2020-03-12 21:36:32 +0100349
350
Pau Espin Pedrol78c5e412023-12-21 19:50:11 +0100351 additionalOctets := *
352}
353
Harald Welte0f7d03a2019-07-16 19:43:32 +0900354/* 8.14 */
355template (value) PDN_AddressAllocation
356ts_GTP2C_PdnAddrAlloc(template (value) BIT3 pdn_type,
357 template (value) PDN_Address_and_Prefix addr_pfx) := {
358 elementIdentifier := '4F'O,
359 lengthIndicator := 0, /* overwritten */
360 instance := '0000'B,
361 spare := '0000'B,
362 pDN_Type := pdn_type,
363 spare2 := '00000'B,
364 pDN_Address_and_Prefix := addr_pfx
365}
366template (present) PDN_AddressAllocation
367tr_GTP2C_PdnAddrAlloc(template (present) BIT3 pdn_type,
368 template (present) PDN_Address_and_Prefix addr_pfx) := {
369 elementIdentifier := '4F'O,
370 lengthIndicator := ?,
371 instance := ?,
372 spare := '0000'B,
373 pDN_Type := pdn_type,
374 spare2 := '00000'B,
375 pDN_Address_and_Prefix := addr_pfx
376}
377template (value) PDN_AddressAllocation
378ts_GTP2C_PdnAddrAlloc_v4(template (value) OCT4 addr) :=
379 ts_GTP2C_PdnAddrAlloc('001'B, {iPv4_Address:=addr});
380template (present) PDN_AddressAllocation
381tr_GTP2C_PdnAddrAlloc_v4(template (present) OCT4 addr) :=
382 ts_GTP2C_PdnAddrAlloc('001'B, {iPv4_Address:=addr});
383
Harald Welte88b3ccb2020-03-12 21:36:32 +0100384/* 8.15 */
385template (value) Bearer_QoS
386ts_GTP2C_BearerQos(template (value) OCT1 qci,
387 uint40_t max_br_ul, uint40_t max_br_dl,
388 uint40_t g_br_ul, uint40_t g_br_dl,
389 template (value) BIT4 prio_lvl := '1001'B,
390 template (value) BIT1 pe_vuln := '0'B,
391 template (value) BIT1 pe_capa := '0'B) := {
392 elementIdentifier := '50'O,
393 lengthIndicator := 0, /* overwritten */
394 instance := '0000'B,
395 spare := '0000'B,
396 pVI := pe_vuln,
397 spare2 := '0'B,
398 pL := prio_lvl,
399 pCI := pe_capa,
400 spare3 := '0'B,
401 labelQCI := qci,
402 maxBitrateUplink := int2oct(max_br_ul, 5),
403 maxBitrateDownLink := int2oct(max_br_dl, 5),
404 guaranteedBitrateUplink := int2oct(g_br_ul, 5),
405 guaranteedBitrateDownLink := int2oct(g_br_dl, 5),
406 additionalOctets := omit
407}
408
Harald Welte0f7d03a2019-07-16 19:43:32 +0900409/* 8.17 */
410template (value) RAT_Type ts_GTP2C_RatType(template (value) integer rat) := {
Pau Espin Pedrol2a2e8542023-10-19 13:39:45 +0200411 elementIdentifier := '52'O,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900412 lengthIndicator := 0, /* overwritten */
413 instance := '0000'B,
414 spare := '0000'B,
415 rAT_TypeValue := rat,
416 additionalOctets := omit
417}
418template (present) RAT_Type tr_GTP2C_RatType(template (present) integer rat) := {
Pau Espin Pedrol2a2e8542023-10-19 13:39:45 +0200419 elementIdentifier := '52'O,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900420 lengthIndicator := ?,
421 instance := ?,
422 spare := '0000'B,
423 rAT_TypeValue := rat,
424 additionalOctets := *
425}
426
Harald Welte88b3ccb2020-03-12 21:36:32 +0100427/* 8.21 */
428function ts_GTP2C_UserLocInfo(template (omit) CGI cgi := omit,
429 template (omit) SAI sai := omit,
430 template (omit) RAI rai := omit,
431 template (omit) TAI tai := omit,
432 template (omit) ECGI ecgi := omit,
433 template (omit) LAI lai := omit)
434return template (value) UserLocationInfo {
435 var template (value) UserLocationInfo uli;
436 uli.elementIdentifier := '56'O;
437 uli.lengthIndicator := 0; // overwritten
438 uli.instance := '0000'B;
439 uli.spare := '0000'B;
440 uli.spare2 := '00'B;
441 uli.additionalOctets := omit;
442
443 if (istemplatekind(cgi, "omit")) {
444 uli.cGI_Flag := '0'B;
445 } else {
446 uli.cGI_Flag := '1'B;
447 }
448 uli.cGI := cgi;
449
450 if (istemplatekind(sai, "omit")) {
451 uli.sAI_Flag := '0'B;
452 } else {
453 uli.sAI_Flag := '1'B;
454 }
455 uli.sAI := sai;
456
457 if (istemplatekind(rai, "omit")) {
458 uli.rAI_Flag := '0'B;
459 } else {
460 uli.rAI_Flag := '1'B;
461 }
462 uli.rAI := rai
463
464 if (istemplatekind(tai, "omit")) {
465 uli.tAI_Flag := '0'B;
466 } else {
467 uli.tAI_Flag := '1'B;
468 }
469 uli.tAI := tai
470
471 if (istemplatekind(ecgi, "omit")) {
472 uli.eCGI_Flag := '0'B;
473 } else {
474 uli.eCGI_Flag := '1'B;
475 }
476 uli.eCGI := ecgi;
477
478 if (istemplatekind(lai, "omit")) {
479 uli.lAI_Flag := '0'B;
480 } else {
481 uli.lAI_Flag := '1'B;
482 }
483 uli.lAI := lai
484
485 return uli;
486}
Harald Welte0f7d03a2019-07-16 19:43:32 +0900487
488/* 8.22 */
489private function f_bit4oct(template (omit) octetstring os) return BIT1
490{
491 if (istemplatekind(os, "omit")) {
492 return '0'B;
493 } else {
494 return '1'B;
495 }
496}
Harald Welte88b3ccb2020-03-12 21:36:32 +0100497type enumerated FteidInterface {
498 FTEID_IF_S1U_eNodeB_GTPU (0),
499 FTEID_IF_S1U_SGW_GTPU (1),
500 FTEID_IF_S12_RNC_GTPU (2),
501 FTEID_IF_S12_SGW_GTPU (3),
502 FTEID_IF_S5S8_SGW_GTPU (4),
503 FTEID_IF_S5S8_PGW_GTPU (5),
504 FTEID_IF_S5S8_SGW_GTPC (6),
505 FTEID_IF_S5S8_PGW_GTPC (7),
506 FTEID_IF_S5S8_SGW_PMIPv6 (8),
507 FTEID_IF_S5S8_PGW_PMIPv6 (9),
508 FTEID_IF_S11_MME_GTPC (10),
509 FTEID_IF_S11S4_SGW_GTPC (11),
510 FTEID_IF_S10ND26_MME_GTPC (12),
511 FTEID_IF_S3_MME_GTPC (13),
512 FTEID_IF_S3_SGSN_GTPC (14),
513 FTEID_IF_S4_SGSN_GTPU (15),
514 FTEID_IF_S4_SGW_GTPU (16),
515 FTEID_IF_S16_SGSN_GTPC (18),
516 FTEID_IF_eNB_GTPU_DL_DATA_FW (19),
517 FTEID_IF_eNB_GTPU_UL_DATA_FW (20),
518 FTEID_IF_RNC_GTPU_DATA_FW (21),
519 FTEID_IF_SGSN_GTPU_DATA_FW (22),
520 FTEID_IF_SGWUPF_GTPU_DL_DATA_FW (23),
521 FTEID_IF_Sm_MMBS_GW_GTPC (24),
522 FTEID_IF_Sn_MMBS_GW_GTPC (25),
523 FTEID_IF_Sm_MME_GTPC (26),
524 FTEID_IF_Sn_MME_GTPC (27),
525 FTEID_IF_SGW_GTPU_UL_DATA_FW (28),
526 FTEID_IF_Sn_SGSN_GTPU (29),
527 FTEID_IF_S2b_ePDG_GTPC (30),
528 FTEID_IF_S2bU_ePDG_GTPU (31),
529 FTEID_IF_S2b_PGW_GTPC (32),
530 FTEID_IF_S2bU_PGW_GTPU (33),
531 FTEID_IF_S2a_TWAN_GTPU (34),
532 FTEID_IF_S2a_TWAN_GTPC (35),
533 FTEID_IF_S2a_PGW_GTPC (36),
534 FTEID_IF_S2a_PGW_GTPU (37),
535 FTEID_IF_S11_MME_GTPU (38),
536 FTEID_IF_S11_SGW_GTPU (39),
537 FTEID_IF_N26_AMF_GTPC (40)
538};
Harald Welte0f7d03a2019-07-16 19:43:32 +0900539template (value) FullyQualifiedTEID
Harald Welte88b3ccb2020-03-12 21:36:32 +0100540ts_GTP2C_FTEID(FteidInterface if_type, OCT4 teid, uint4_t instance := 0,
541 template (omit) OCT4 v4_addr := omit,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900542 template (omit) OCT16 v6_addr := omit) := {
543 elementIdentifier := '57'O,
544 lengthIndicator := 0, /* overwritten */
Harald Welte88b3ccb2020-03-12 21:36:32 +0100545 instance := int2bit(instance, 4),
Harald Welte0f7d03a2019-07-16 19:43:32 +0900546 spare := '0000'B,
Harald Welte88b3ccb2020-03-12 21:36:32 +0100547 interfaceType := enum2int(if_type),
548 v6_Flag := f_bit4oct(v6_addr),
549 v4_Flag := f_bit4oct(v4_addr),
Harald Welte0f7d03a2019-07-16 19:43:32 +0900550 tEID_GRE_Key := teid,
551 iPv4_Address := v4_addr,
552 iPv6_Address := v6_addr,
553 additionalOctets := omit
554}
555template (present) FullyQualifiedTEID
556tr_GTP2C_FTEID(template (present) integer if_type, template (present) OCT4 teid,
Harald Welte88b3ccb2020-03-12 21:36:32 +0100557 template BIT4 instance := ?,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900558 template OCT4 v4_addr := omit,
559 template OCT16 v6_addr := omit) := {
560 elementIdentifier := '57'O,
561 lengthIndicator := ?,
Harald Welte88b3ccb2020-03-12 21:36:32 +0100562 instance := instance,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900563 spare := '0000'B,
564 interfaceType := if_type,
565 v6_Flag := ?,
566 v4_Flag := ?,
567 tEID_GRE_Key := teid,
568 iPv4_Address := v4_addr,
569 iPv6_Address := v6_addr,
570 additionalOctets := omit
571}
572
Harald Welte88b3ccb2020-03-12 21:36:32 +0100573/* 8.28 */
Pau Espin Pedrol8c746492023-10-23 20:56:09 +0200574template (value) BearerContextIEs
Pau Espin Pedrold4a20082023-10-23 19:59:24 +0200575ts_GTP2C_BcContextIE(template (value) uint4_t ebi,
Pau Espin Pedrol8c746492023-10-23 20:56:09 +0200576 template (omit) FullyQualifiedTEID_List teid_list := omit,
577 template (omit) Bearer_QoS qos := ts_GTP2C_BearerQos('09'O, 0,0,0,0),
578 template (omit) ChargingID charging_id := omit) := {
Pau Espin Pedrold4a20082023-10-23 19:59:24 +0200579 ePS_Bearer_ID := ts_GTP2C_EpsBearerId(ebi),
Pau Espin Pedrol8c746492023-10-23 20:56:09 +0200580 cause := ts_GTP2C_Cause(Request_accepted, '0'B),
581 ePS_Bearer_TFT := omit,
582 fullyQualifiedTEID := teid_list,
583 bearerLevel_QoS := qos,
584 chargingID := charging_id,
585 bearerFlags := omit,
586 transactionIdentifier := omit,
587 protocolConfigOptions := omit,
588 rAN_NASCause := omit,
589 additionalProtocolConfigOptions := omit,
590 extendedProtocolConfigOptions := omit
591}
592
Harald Welte88b3ccb2020-03-12 21:36:32 +0100593template (value) BearerContextGrouped
594ts_GTP2C_BcGrouped(template (value) BearerContextIEs ies) := {
595 elementIdentifier := '5D'O,
596 lengthIndicator := 0, /* overwritten */
597 instance := '0000'B,
598 spare := '0000'B,
599 bearerContextIEs := ies
600}
601template (present) BearerContextGrouped
602tr_GTP2C_BcGrouped(template (present) BearerContextIEs ies) := {
603 elementIdentifier := '5D'O,
604 lengthIndicator := ?, /* overwritten */
605 instance := '0000'B,
606 spare := '0000'B,
607 bearerContextIEs := ies
608}
609
Pau Espin Pedrol8c746492023-10-23 20:56:09 +0200610/* 8.29 */
611template (value) ChargingID
612ts_GTP2C_ChargingID(template (value) OCT4 chargingID_Value) := {
613 elementIdentifier := '5D'O,
614 lengthIndicator := 0, /* overwritten */
615 instance := '0000'B,
616 spare := '0000'B,
617 chargingID_Value := chargingID_Value,
618 additionalOctets := omit
619}
Harald Welte88b3ccb2020-03-12 21:36:32 +0100620
621/* 8.30 */
622template (value) ChargingCharacteristics
623ts_GTP2C_ChargingCaracteristics(template (value) OCT2 cc) := {
624 elementIdentifier := '5F'O,
625 lengthIndicator := 0, /* overwritten */
626 instance := '0000'B,
627 spare := '0000'B,
628 chargingCharacteristicsValue := cc,
629 additionalOctets := omit
630}
631template (present) ChargingCharacteristics
632tr_GTP2C_ChargingCaracteristics(template (present) OCT2 cc) := {
633 elementIdentifier := '5F'O,
634 lengthIndicator := ?, /* overwritten */
635 instance := '0000'B,
636 spare := '0000'B,
637 chargingCharacteristicsValue := cc,
638 additionalOctets := omit
639}
640
641
642/* 8.34 */
643template (value) PDN_Type
644ts_GTP2C_PdnType(template (value) BIT3 pdn_type) := {
645 elementIdentifier := '63'O,
646 lengthIndicator := 0,
647 instance := '0000'B,
648 spare := '0000'B,
649 pDN_TypeValue := pdn_type,
650 spare2 := '00000'B,
651 additionalOctets := omit
652}
653template (present) PDN_Type
654tr_GTP2C_PdnType(template (present) BIT3 pdn_type) := {
655 elementIdentifier := '63'O,
656 lengthIndicator := ?,
657 instance := ?,
658 spare := ?,
659 pDN_TypeValue := pdn_type,
660 spare2 := ?,
661 additionalOctets := *
662}
663
664/* 8.35 */
665template (value) ProcedureTransactionID
666ts_GTP2C_ProcTransId(template (value) integer pti) := {
667 elementIdentifier := '64'O,
668 lengthIndicator := 0,
669 instance := '0000'B,
670 spare := '0000'B,
671 pTI_Value := pti,
672 additionalOctets := omit
673}
Pau Espin Pedrol14abac52024-02-05 21:05:17 +0100674private function f_ts_GTP2C_ProcTransId_omit(template (omit) integer pti)
675return template (omit) ProcedureTransactionID {
676 if (istemplatekind(pti, "omit")) {
677 return omit;
678 }
679 return ts_GTP2C_ProcTransId(pti);
680}
Harald Welte88b3ccb2020-03-12 21:36:32 +0100681template (present) ProcedureTransactionID
682tr_GTP2C_ProcTransId(template (present) integer pti) := {
683 elementIdentifier := '64'O,
684 lengthIndicator := ?,
685 instance :=?,
686 spare := ?,
687 pTI_Value := pti,
688 additionalOctets := *
689}
690
691
692/* 8.57 */
693template (value) APN_Restriction
694ts_GTP2C_ApnRestriction(template (value) integer val) := {
695 elementIdentifier := '7F'O,
696 lengthIndicator := 0,
697 instance := '0000'B,
698 spare := '0000'B,
699 restrictionTypeValue := val,
700 additionalOctets := omit
701}
702template (present) APN_Restriction
703tr_GTP2C_ApnRestriction(template (present) integer val) := {
704 elementIdentifier := '7F'O,
705 lengthIndicator := ?,
706 instance := '0000'B,
707 spare := ?,
708 restrictionTypeValue := val,
709 additionalOctets := *
710}
711
712
713/* 8.58 */
714template (value) SelectionMode
715ts_GTP2C_SelectionMode(template (value) integer mode) := {
716 elementIdentifier := '80'O,
717 lengthIndicator := 0, /* overwritten */
718 instance := '0000'B,
719 spare := '0000'B,
720 selectionModeValue := mode,
721 spare2 := '000000'B,
722 additionalOctets := omit
723}
724template (present) SelectionMode
725tr_GTP2C_SelectionMode(template (present) integer mode) := {
726 elementIdentifier := '80'O,
727 lengthIndicator := ?,
728 instance := ?,
729 spare := ?,
730 selectionModeValue := mode,
731 spare2 := ?,
732 additionalOctets := *
733}
734
Pau Espin Pedrol14abac52024-02-05 21:05:17 +0100735/* 8.62 Fully qualified PDN Connection Set Identifier (FQ-CSID) */
736template (value) NodeID ts_GTP2C_FQCSID_NodeID_IPv4(template (value) OCT4 addr) := {
737 globalUnicastIPv4 := addr
738}
739template (value) FullyQualifiedPDN_ConnectionSetID
740ts_GTP2C_FQCSID(template (value) integer nRofCSIDs,
741 template (value) integer nodeIDType,
742 template (value) NodeID nodeID,
743 template (value) PDN_CSID_List pDN_CSID_List,
744 template (value) uint4_t instance := 0) := {
745 elementIdentifier := '84'O,
746 lengthIndicator := 0, /* overwritten */
747 instance := int2bit(valueof(instance), 4),
748 spare := '0000'B,
749 nRofCSIDs := nRofCSIDs,
750 nodeIDType := nodeIDType,
751 nodeID := nodeID,
752 pDN_CSID_List := pDN_CSID_List,
753 additionalOctets := omit
754}
755template (value) FullyQualifiedPDN_ConnectionSetID
756ts_GTP2C_FQCSID_IPv4(template (value) OCT4 addr,
757 template (value) OCT2 csid,
758 template (value) uint4_t instance := 0) :=
759ts_GTP2C_FQCSID(nRofCSIDs := 1,
760 nodeIDType := 0,
761 nodeID := ts_GTP2C_FQCSID_NodeID_IPv4(addr),
762 pDN_CSID_List := {csid},
763 instance := instance);
Harald Welte0f7d03a2019-07-16 19:43:32 +0900764
765
766template (value) PDU_GTPCv2 ts_PDU_GTP2C(template (omit) OCT4 teid, template (value) OCT3 seq,
767 template (value) OCT1 msg_type,
768 template (value) GTPCv2_PDUs pdus,
769 template (omit) PDU_GTPCv2 piggyback := omit) := {
770 spare := '000'B,
771 t_Bit := fs_GTP2C_t_bit(teid),
772 p_Bit := fs_GTP2C_p_bit(piggyback),
773 version := '010'B,
774 messageType := msg_type,
775 lengthf := 0, /* overwritten */
776 tEID := teid,
777 sequenceNumber := seq,
778 spare3 := '00'O,
779 gtpcv2_pdu := pdus,
780 piggybackPDU_GTPCv2 := piggyback
781}
782
783
Harald Welte88b3ccb2020-03-12 21:36:32 +0100784template (value) PDU_GTPCv2
785ts_GTP2C_EchoReq(template (value) integer rec_val) :=
786ts_PDU_GTP2C(omit, '000000'O, '01'O, {
787 echoRequest := {
788 recovery := {
789 elementIdentifier := '03'O,
790 lengthIndicator := 0,
791 instance := '0000'B,
792 spare := '0000'B,
793 recoveryValue := rec_val
794 },
795 sendingNodeFeatures := omit,
796 privateExtension := omit
797 }});
Harald Welte0f7d03a2019-07-16 19:43:32 +0900798template (present) PDU_GTPCv2
Harald Welte88b3ccb2020-03-12 21:36:32 +0100799tr_GTP2C_EchoReq(template (present) OCT3 seq := ?) :=
800tr_PDU_GTP2C(omit, seq, { echoRequest := ? }, omit);
801
802template (value) PDU_GTPCv2
803ts_GTP2C_EchoResp(template (value) integer rec_val) :=
804ts_PDU_GTP2C(omit, '000000'O, '02'O, {
805 echoRequest := {
806 recovery := {
807 elementIdentifier := '03'O,
808 lengthIndicator := 0,
809 instance := '0000'B,
810 spare := '0000'B,
811 recoveryValue := rec_val
812 },
813 sendingNodeFeatures := omit,
814 privateExtension := omit
815 }});
816template (present) PDU_GTPCv2
817tr_GTP2C_EchoResp(template (present) OCT3 seq := ?) :=
818tr_PDU_GTP2C(omit, seq, { echoResponse := ? }, omit);
819
820
821
822template (present) PDU_GTPCv2
823ts_GTP2C_CreateSessionReq(template (value) hexstring imsi, template (omit) hexstring msisdn,
824 integer rat_type, template (value) FullyQualifiedTEID sender_fteid,
825 template (value) octetstring apn, template (value) BIT3 pdn_type,
826 template (omit) FullyQualifiedTEID_List teid_list,
827 template (value) OCT2 chg_car, template (value) uint4_t bearer_id,
828 template (value) Bearer_QoS qos := ts_GTP2C_BearerQos('09'O, 0,0,0,0)) :=
829ts_PDU_GTP2C('00000000'O, '000000'O, '20'O, {
830 createSessionRequest := {
831 iMSI := ts_GTP2C_Imsi(imsi),
832 mSISDN := fs_GTP2C_msisdn(msisdn),
833 mEI := omit,
834 userLocationInfo := omit,
835 servingNetwork := omit,
836 rAT_Type := ts_GTP2C_RatType(rat_type),
837 indication := omit,
838 fullyQualifiedTEID := { sender_fteid },
839 accessPointName := ts_GTP2C_APN(apn),
840 selectionMode := ts_GTP2C_SelectionMode(0),
841 pDN_Type := ts_GTP2C_PdnType(pdn_type),
842 pDN_AddressAllocation := ts_GTP2C_PdnAddrAlloc('001'B, {iPv4_Address:='00000000'O}),
843 maxAPN_Restriction := ts_GTP2C_ApnRestriction(0),
844 ambr := ts_GTP2C_Ambr(102400, 102400),
845 linkedEPS_Bearer_ID := omit,
846 trustedWLANModeIndication := omit,
847 protocolConfigOptions := omit,
848 bearerContextGrouped := {
849 ts_GTP2C_BcGrouped({
850 ePS_Bearer_ID := ts_GTP2C_EpsBearerId(bearer_id),
851 cause := omit,
852 ePS_Bearer_TFT := omit,
853 fullyQualifiedTEID := teid_list,
854 bearerLevel_QoS := qos,
855 chargingID := omit,
856 bearerFlags := omit,
857 transactionIdentifier := omit,
858 protocolConfigOptions := omit,
859 rAN_NASCause := omit,
860 additionalProtocolConfigOptions := omit,
861 extendedProtocolConfigOptions := omit
862 })
863 },
864 traceInformation := omit,
865 recovery := omit,
866 csid := omit,
867 uE_TimeZone := omit,
868 user_CSG_Information := omit,
869 chargingCharacteristics := ts_GTP2C_ChargingCaracteristics(chg_car),
870 lDN := omit,
871 signallingPriorityIndication := omit,
872 iP_Addr := omit,
873 portNumber := omit,
874 aPCO := omit,
875 trustedWLANAccessNetworkIdentifier := omit,
876 cNOperatorSelectionEntity := omit,
877 presenceReportingAreaInformation := omit,
878 overloadControlInformationGrouped := omit,
879 originationTimeStamp := omit,
880 maximumWaitTime := omit,
881 wLANLocationTimestamp := omit,
882 nBIFOMContainer := omit,
883 remoteUEContextGrouped := omit,
884 nodeIdentifier := omit,
885 extendedProtocolConfigOptions := omit,
886 servingPLMNRateControl := omit,
887 counter := omit,
888 privateExtension := omit
889 }});
890
891
892template (present) PDU_GTPCv2
Pau Espin Pedrol90a46c42023-10-19 13:44:44 +0200893tr_GTP2C_CreateSessionReq(template (present) hexstring imsi := ?, template (present) octetstring apn := ?) :=
Harald Welte88b3ccb2020-03-12 21:36:32 +0100894tr_PDU_GTP2C('00000000'O, ?, {
Harald Welte0f7d03a2019-07-16 19:43:32 +0900895 createSessionRequest := {
896 iMSI := tr_GTP2C_Imsi(imsi),
897 mSISDN := *,
898 mEI := *,
Pau Espin Pedrol90a46c42023-10-19 13:44:44 +0200899 userLocationInfo := *,
900 servingNetwork := *,
901 rAT_Type := tr_GTP2C_RatType(?),
Harald Welte0f7d03a2019-07-16 19:43:32 +0900902 indication := *,
903 fullyQualifiedTEID := ?,
Pau Espin Pedrol90a46c42023-10-19 13:44:44 +0200904 accessPointName := tr_GTP2C_APN(apn), // '*'
Harald Welte0f7d03a2019-07-16 19:43:32 +0900905 selectionMode := ?,
Pau Espin Pedrol90a46c42023-10-19 13:44:44 +0200906 pDN_Type := *,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900907 pDN_AddressAllocation := ?,
Pau Espin Pedrol90a46c42023-10-19 13:44:44 +0200908 maxAPN_Restriction := *,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900909 ambr := *,
910 linkedEPS_Bearer_ID := omit,
911 trustedWLANModeIndication := omit,
912 protocolConfigOptions := omit,
913 bearerContextGrouped := ?,
914 traceInformation := *,
Pau Espin Pedrol90a46c42023-10-19 13:44:44 +0200915 recovery := *,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900916 csid := omit,
Pau Espin Pedrol90a46c42023-10-19 13:44:44 +0200917 uE_TimeZone := *,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900918 user_CSG_Information := omit,
Pau Espin Pedrol90a46c42023-10-19 13:44:44 +0200919 chargingCharacteristics := *,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900920 lDN := omit,
921 signallingPriorityIndication := *,
922 iP_Addr := omit,
923 portNumber := omit,
Pau Espin Pedrol90a46c42023-10-19 13:44:44 +0200924 aPCO := *,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900925 trustedWLANAccessNetworkIdentifier := omit,
926 cNOperatorSelectionEntity := omit,
927 presenceReportingAreaInformation := omit,
928 overloadControlInformationGrouped := omit,
929 originationTimeStamp := *,
930 maximumWaitTime := *,
931 wLANLocationTimestamp := omit,
932 nBIFOMContainer := omit,
933 remoteUEContextGrouped := *,
934 nodeIdentifier := *,
935 extendedProtocolConfigOptions := omit,
936 servingPLMNRateControl := omit,
937 counter := omit,
938 privateExtension := omit
939 }});
940
941template (value) PDU_GTPCv2
Pau Espin Pedrolfa2b3842023-12-13 18:49:19 +0100942ts_GTP2C_CreateSessionResp(template (value) OCT4 d_teid,
943 template (value) OCT3 seq,
944 template (value) FullyQualifiedTEID_List fteids,
Pau Espin Pedrol8c746492023-10-23 20:56:09 +0200945 template (value) PDN_AddressAllocation addr,
946 template (omit) BearerContextGrouped_List bearerContextGrouped := omit) :=
Pau Espin Pedrolfa2b3842023-12-13 18:49:19 +0100947ts_PDU_GTP2C(d_teid, seq, '21'O, {
Harald Welte0f7d03a2019-07-16 19:43:32 +0900948 createSessionResponse := {
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200949 cause := ts_GTP2C_Cause(Request_accepted, '0'B),
Harald Welte0f7d03a2019-07-16 19:43:32 +0900950 changeReportingAction := omit,
951 cSG_InformationReportingAction := omit,
952 heNBInformationReporting := omit,
953 fullyQualifiedTEID := fteids,
954 pDN_AddressAllocation := addr,
955 aPN_Restriction := omit,
956 ambr := omit,
957 linkedEPS_Bearer_ID := omit,
958 protocolConfigOptions := omit,
Pau Espin Pedrol8c746492023-10-23 20:56:09 +0200959 bearerContextGrouped := bearerContextGrouped,
Harald Welte0f7d03a2019-07-16 19:43:32 +0900960 recovery := omit,
961 chargingGatewayName := omit,
962 chargingGatewayAddress := omit,
963 csid := omit,
964 lDN := omit,
965 pGW_Back_OffTime := omit,
966 aPCO := omit,
967 trustedWLANIPv4Parameters := omit,
968 indicationFlags := omit,
969 presenceReportingAreaAction := omit,
970 loadControlInformationGrouped := omit,
971 overloadControlInformationGrouped := omit,
972 nBIFOMContainer := omit,
973 pDNConnectionChargingID := omit,
974 extendedProtocolConfigOptions := omit,
975 privateExtension := omit
976 }});
Harald Welte88b3ccb2020-03-12 21:36:32 +0100977template (present) PDU_GTPCv2
978tr_GTP2C_CreateSessionResp(template (present) OCT4 d_teid := ?,
979 template (present) OCT3 seq := ?,
Pau Espin Pedrol1344e472023-10-23 19:54:29 +0200980 template (present) GTP2C_Cause cause := ?,
Harald Welte88b3ccb2020-03-12 21:36:32 +0100981 template FullyQualifiedTEID_List fteids := *,
982 template PDN_AddressAllocation addr := *,
983 template BearerContextGrouped_List bctxg := *) :=
984tr_PDU_GTP2C(d_teid, seq, {
985 createSessionResponse := {
986 cause := tr_GTP2C_Cause(cause),
987 changeReportingAction := *,
988 cSG_InformationReportingAction := *,
989 heNBInformationReporting := *,
990 fullyQualifiedTEID := fteids,
991 pDN_AddressAllocation := addr,
992 aPN_Restriction := ?,
993 ambr := *,
994 linkedEPS_Bearer_ID := *,
995 protocolConfigOptions := *,
996 bearerContextGrouped := bctxg,
997 recovery := *,
998 chargingGatewayName := *,
999 chargingGatewayAddress := *,
1000 csid := *,
1001 lDN := *,
1002 pGW_Back_OffTime := *,
1003 aPCO := *,
1004 trustedWLANIPv4Parameters := *,
1005 indicationFlags := *,
1006 presenceReportingAreaAction := *,
1007 loadControlInformationGrouped := *,
1008 overloadControlInformationGrouped := *,
1009 nBIFOMContainer := *,
1010 pDNConnectionChargingID := *,
1011 extendedProtocolConfigOptions := *,
1012 privateExtension := *
1013 }});
1014
1015
1016template (value) PDU_GTPCv2
1017ts_GTP2C_DeleteSessionReq(template (value) OCT4 d_teid,
Pau Espin Pedrol1344e472023-10-23 19:54:29 +02001018 template (omit) GTP2C_Cause cause := omit,
Harald Welte88b3ccb2020-03-12 21:36:32 +01001019 template (value) FullyQualifiedTEID sender_fteid,
1020 template (omit) FullyQualifiedTEID_List teid_list := omit,
1021 template (value) uint4_t bearer_id) :=
1022ts_PDU_GTP2C(d_teid, '000000'O, '24'O, {
1023 deleteSessionRequest := {
1024 cause := fs_GTP2C_Cause(cause, '0'B),
1025 linkedEPS_Bearer_ID := ts_GTP2C_EpsBearerId(bearer_id),
1026 uLI := omit,
1027 indicationFlags := omit,
1028 protocolConfigOptions := omit,
1029 originatingNode := omit,
1030 fullyQualifiedTEID := sender_fteid,
1031 uE_TimeZone := omit,
1032 uLITimestamp := omit,
1033 rANNASReleaseCause := omit,
1034 trustedWLANAccessNetworkIdentifier := omit,
1035 tWANIdentifierTimestamp := omit,
1036 overloadControlInformationGrouped := omit,
1037 uELocalIP_Addr := omit,
1038 portNumber := omit,
1039 extendedProtocolConfigOptions := omit,
1040 privateExtension := omit
1041 }});
1042template (present) PDU_GTPCv2
Pau Espin Pedrol2f327072023-12-21 19:11:35 +01001043tr_GTP2C_DeleteSessionReq(template (present) OCT4 d_teid := ?,
Harald Welte88b3ccb2020-03-12 21:36:32 +01001044 template (present) OCT3 seq := ?,
Pau Espin Pedrol2f327072023-12-21 19:11:35 +01001045 template GTP2C_Cause cause := *,
1046 template (present) uint4_t bearer_id := ?,
Pau Espin Pedrol78c5e412023-12-21 19:50:11 +01001047 template Indication indicationFlags := *,
Pau Espin Pedrol2f327072023-12-21 19:11:35 +01001048 template FullyQualifiedTEID sender_fteid := *) :=
Harald Welte88b3ccb2020-03-12 21:36:32 +01001049tr_PDU_GTP2C(d_teid, seq, {
1050 deleteSessionRequest := {
1051 cause := fr_GTP2C_Cause(cause),
1052 linkedEPS_Bearer_ID := tr_GTP2C_EpsBearerId(bearer_id),
1053 uLI := *,
Pau Espin Pedrol78c5e412023-12-21 19:50:11 +01001054 indicationFlags := indicationFlags,
Harald Welte88b3ccb2020-03-12 21:36:32 +01001055 protocolConfigOptions := *,
1056 originatingNode := *,
1057 fullyQualifiedTEID := sender_fteid,
1058 uE_TimeZone := *,
1059 uLITimestamp := *,
1060 rANNASReleaseCause := *,
1061 trustedWLANAccessNetworkIdentifier := *,
1062 tWANIdentifierTimestamp := *,
1063 overloadControlInformationGrouped := *,
1064 uELocalIP_Addr := *,
1065 portNumber := *,
1066 extendedProtocolConfigOptions := *,
1067 privateExtension := *
1068 }});
1069
1070
1071template (value) PDU_GTPCv2
1072ts_GTP2C_DeleteSessionResp(template (value) OCT4 d_teid,
1073 template (value) OCT3 seq,
Pau Espin Pedrol1344e472023-10-23 19:54:29 +02001074 template (value) GTP2C_Cause cause) :=
Pau Espin Pedrol2e9988d2023-12-13 18:48:33 +01001075ts_PDU_GTP2C(d_teid, seq, '25'O, {
Harald Welte88b3ccb2020-03-12 21:36:32 +01001076 deleteSessionResponse := {
1077 cause := ts_GTP2C_Cause(cause, '0'B),
1078 recovery := omit,
1079 protocolConfigOptions := omit,
1080 indicationFlags := omit,
1081 loadControlInformationGrouped := omit,
1082 overloadControlInformationGrouped := omit,
1083 extendedProtocolConfigOptions := omit,
1084 privateExtension := omit
1085
1086 }});
1087template (present) PDU_GTPCv2
1088tr_GTP2C_DeleteSessionResp(template (present) OCT4 d_teid,
1089 template (present) OCT3 seq := ?,
Pau Espin Pedrol1344e472023-10-23 19:54:29 +02001090 template (present) GTP2C_Cause cause := ?
Harald Welte88b3ccb2020-03-12 21:36:32 +01001091 ) :=
1092tr_PDU_GTP2C(d_teid, seq, {
1093 deleteSessionResponse := {
1094 cause := tr_GTP2C_Cause(cause),
1095 recovery := *,
1096 protocolConfigOptions := *,
1097 indicationFlags := *,
1098 loadControlInformationGrouped := *,
1099 overloadControlInformationGrouped := *,
1100 extendedProtocolConfigOptions := *,
1101 privateExtension := *
1102 }});
1103
1104template (value) PDU_GTPCv2
1105ts_GTP2C_CreateBearerReq(template (value) OCT4 d_teid,
Pau Espin Pedrol14abac52024-02-05 21:05:17 +01001106 template (omit) integer proc_trans_id,
Harald Welte88b3ccb2020-03-12 21:36:32 +01001107 template (value) uint4_t linked_id,
1108 template (value) uint4_t bearer_id,
Pau Espin Pedrol14abac52024-02-05 21:05:17 +01001109 template (value) BearerContextGrouped_List bearer_ctx_list,
1110 template (omit) FullyQualifiedPDN_ConnectionSetID_List csid := omit,
Harald Welte88b3ccb2020-03-12 21:36:32 +01001111 template (value) Bearer_QoS qos := ts_GTP2C_BearerQos('09'O, 0,0,0,0)) :=
1112ts_PDU_GTP2C(d_teid, '000000'O, '5F'O, {
1113 createBearerRequest := {
Pau Espin Pedrol14abac52024-02-05 21:05:17 +01001114 procedureTransactionID := f_ts_GTP2C_ProcTransId_omit(proc_trans_id),
Harald Welte88b3ccb2020-03-12 21:36:32 +01001115 linkedEPS_BearerID := ts_GTP2C_EpsBearerId(linked_id),
1116 protocolConfigOptions := omit,
Pau Espin Pedrol14abac52024-02-05 21:05:17 +01001117 bearerContextGrouped := bearer_ctx_list,
1118 csid := csid,
Harald Welte88b3ccb2020-03-12 21:36:32 +01001119 changeReportingAction := omit,
1120 cSG_InformationReportingAction := omit,
1121 heNBInformationReporting := omit,
1122 presenceReportingAreaAction := omit,
1123 indicationFlags := omit,
1124 loadControlInformationGrouped := omit,
1125 overloadControlInformationGrouped := omit,
1126 nBIFOMContainer := omit,
1127 privateExtension := omit
1128 }});
Pau Espin Pedrol14abac52024-02-05 21:05:17 +01001129template (present) PDU_GTPCv2
1130tr_GTP2C_CreateBearerResp(template (present) OCT4 d_teid,
1131 template (present) OCT3 seq := ?,
1132 template (present) GTP2C_Cause cause := ?
1133 ) :=
1134tr_PDU_GTP2C(d_teid, seq, {
1135 createBearerResponse := {
1136 cause := tr_GTP2C_Cause(cause),
1137 bearerContextGrouped := *,
1138 recovery := *,
1139 csid := *,
1140 protocolConfigOptions := *,
1141 uE_TimeZone := *,
1142 uLI := *,
1143 trustedWLANAccessNetworkIdentifier := *,
1144 overloadControlInformationGrouped := *,
1145 presenceReportingAreaInformation := *,
1146 iP_Addr := *,
1147 wLANLocationTimestamp := *,
1148 portNumber := *,
1149 nBIFOMContainer := *,
1150 extendedProtocolConfigOptions := *,
1151 privateExtension:= *
1152 }});
Harald Welte88b3ccb2020-03-12 21:36:32 +01001153
Pau Espin Pedrolecfc7d62023-12-13 18:49:29 +01001154template (present) PDU_GTPCv2
1155tr_GTP2C_ModifyBearerReq(template (present) OCT4 d_teid := ?,
1156 template (present) OCT3 seq := ?) :=
1157tr_PDU_GTP2C(d_teid, seq, {
1158 modifyBearerRequest := {
1159 mEI := *,
1160 userLocationInfo := *,
1161 servingNetwork := *,
1162 rAT_Type := *,
1163 indicationFlags := *,
1164 fullyQualifiedTEID := *,
1165 ambr := *,
1166 delayDownlinkPacketNotificationReq := *,
1167 bearerContextGrouped := *,
1168 recovery := *,
1169 uE_TimeZone := *,
1170 csid := *,
1171 user_CSG_Information := *,
1172 iP_Addr := *,
1173 portNumber := *,
1174 lDN := *,
1175 //maxMBR_APN_AMBR := *,
1176 cNOperatorSelectionEntity := *,
1177 presenceReportingAreaInformation := *,
1178 overloadControlInformationGrouped := *,
1179 servingPLMNRateControl := *,
1180 counter := *,
1181 privateExtension := *
1182 }});
1183
1184template (value) PDU_GTPCv2
1185ts_GTP2C_ModifyBearerResp(template (value) OCT4 d_teid,
1186 template (value) OCT3 seq,
1187 template (value) GTP2C_Cause cause,
1188 template (value) uint4_t bearer_id,
1189 template (omit) BearerContextGrouped_List bearerContextGrouped := omit) :=
1190ts_PDU_GTP2C(d_teid, seq, '23'O, {
1191 modifyBearerResponse := {
1192 cause := ts_GTP2C_Cause(cause, '0'B),
1193 mSISDN := omit,
1194 linkedEPS_Bearer_ID := ts_GTP2C_EpsBearerId(bearer_id),
1195 aPN_Restriction := omit,
1196 protocolConfigOptions := omit,
1197 bearerContextGrouped := bearerContextGrouped,
1198 changeReportingAction := omit,
1199 cSG_InformationReportingAction := omit,
1200 heNBInformationReporting := omit,
1201 chargingGatewayName := omit,
1202 chargingGatewayAddress := omit,
1203 csid := omit,
1204 recovery := omit,
1205 lDN := omit,
1206 indicationFlags := omit,
1207 presenceReportingAreaAction := omit,
1208 loadControlInformationGrouped := omit,
1209 overloadControlInformationGrouped := omit,
1210 pDNConnectionChargingID := omit,
1211 privateExtension := omit
1212 }});
Harald Welte88b3ccb2020-03-12 21:36:32 +01001213
1214template (value) PDU_GTPCv2
1215ts_GTP2C_DeleteBearerReq(template (value) OCT4 d_teid,
1216 template (value) integer proc_trans_id,
1217 template (value) uint4_t bearer_id,
Pau Espin Pedrol1344e472023-10-23 19:54:29 +02001218 template (value) GTP2C_Cause cause) :=
Harald Welte88b3ccb2020-03-12 21:36:32 +01001219ts_PDU_GTP2C(d_teid, '000000'O, '63'O, {
1220 deleteBearerRequest := {
1221 epsBearerIdentity := { ts_GTP2C_EpsBearerId(bearer_id) },
1222 bearerContextGrouped := omit,
1223 procedureTransactionID := ts_GTP2C_ProcTransId(proc_trans_id),
1224 protocolConfigOptions := omit,
1225 csid := omit,
1226 cause := ts_GTP2C_Cause(cause, '0'B),
1227 indicationFlags := omit,
1228 loadControlInformationGrouped := omit,
1229 overloadControlInformationGrouped := omit,
1230 nBIFOMContainer := omit,
1231 extendedProtocolConfigOptions := omit,
1232 privateExtension := omit
1233 }});
1234
1235
1236template (present) PDU_GTPCv2
1237tr_GTP2C_DeleteBearerResp(template (present) OCT4 d_teid,
1238 template (present) OCT3 seq := ?,
Pau Espin Pedrol1344e472023-10-23 19:54:29 +02001239 template (present) GTP2C_Cause cause := ?) :=
Harald Welte88b3ccb2020-03-12 21:36:32 +01001240tr_PDU_GTP2C(d_teid, seq, {
1241 deleteBearerResponse := {
1242 cause := tr_GTP2C_Cause(cause),
1243 linkedBearerIdentity := *,
1244 bearerContextGrouped := *,
1245 recovery := *,
1246 csid := *,
1247 protocolConfigOptions := *,
1248 uE_TimeZone := *,
1249 uLI := *,
1250 uLITimestamp := *,
1251 trustedWLANAccessNetworkIdentifier := *,
1252 tWANIdentifierTimestamp := *,
1253 overloadControlInformationGrouped := *,
1254 iP_Addr := *,
1255 portNumber := *,
1256 nBIFOMContainer := *,
1257 privateExtension := *
1258 }});
Harald Welte0f7d03a2019-07-16 19:43:32 +09001259
Vadim Yanitskiybada3c92022-01-20 18:59:07 +06001260/* 8.18 */
1261template (value) ServingNetwork
1262ts_GTP2C_ServingNetwork(template (value) hexstring mcc,
1263 template (value) hexstring mnc,
1264 template (value) BIT4 instance := '0000'B) :=
1265{
1266 elementIdentifier := '53'O,
1267 lengthIndicator := 0, /* overwritten */
1268 instance := instance,
1269 spare := '0000'B,
1270 mccDigit1 := mcc[0],
1271 mccDigit2 := mcc[1],
1272 mccDigit3 := mcc[2],
1273 mncDigit3 := mnc[2], /* 'F'H for 2 digit MNC */
1274 mncDigit1 := mnc[0],
1275 mncDigit2 := mnc[1],
1276 additionalOctets := omit
1277}
1278
Harald Welte0f7d03a2019-07-16 19:43:32 +09001279
1280
1281}