blob: 44d9682ca127aacc40b8796bcac7f8ae6d11f206 [file] [log] [blame]
Harald Weltec69cf4e2018-02-17 20:57:02 +01001module GTP_Templates {
2
3 import from General_Types all;
4 import from Osmocom_Types all;
5 import from GTPC_Types all;
6 import from GTPU_Types all;
7 import from GTP_CodecPort all;
8 import from IPCP_Types all;
9
10 /* generalized GTP-C receive template */
11 template PDU_GTPC tr_GTP1C_PDU(template OCT1 msg_type, template OCT4 teid, template GTPC_PDUs pdu := ?) := {
12 /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
13 * error if this flag is set to '1'. */
14 pn_bit := '0'B,
15 /* Sequence number flag (S) shall be set to '1'. */
16 s_bit := '1'B,
17 e_bit := ?,
18 spare := ?,
19 /* Protocol Type flag (PT) shall be set to '1'.*/
20 pt := '1'B,
21 /* Version shall be set to decimal 1 ('001'). */
22 version := '001'B,
23 messageType := msg_type,
24 lengthf := ?,
25 teid := teid,
26 opt_part := *,
27 gtpc_pdu := pdu
28 }
29
30 /* generalized GTP-C send template */
31 template PDU_GTPC ts_GTP1C_PDU(OCT1 msg_type, OCT4 teid, GTPC_PDUs pdu, uint16_t seq_nr) := {
32 /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
33 * error if this flag is set to '1'. */
34 pn_bit := '0'B,
35 /* Sequence number flag (S) shall be set to '1'. */
36 s_bit := '1'B,
37 e_bit := '0'B,
38 spare := '0'B,
39 /* Protocol Type flag (PT) shall be set to '1'.*/
40 pt := '1'B,
41 /* Version shall be set to decimal 1 ('001'). */
42 version := '001'B,
43 messageType := msg_type,
44 lengthf := 0, /* we assume encoder overwrites this */
45 teid := teid,
46 opt_part := {
47 sequenceNumber := int2oct(seq_nr, 2),
48 npduNumber := '00'O,
49 nextExtHeader := '00'O,
50 gTPC_extensionHeader_List := omit
51 },
52 gtpc_pdu := pdu
53 }
54
55 /* recovery IE */
56 template Recovery_gtpc ts_Recovery(OCT1 restart_counter) := {
57 type_gtpc := '0E'O,
58 restartCounter := restart_counter
59 }
60
61 template Recovery_gtpc tr_Recovery(template OCT1 restart_counter) := {
62 type_gtpc := '0E'O,
63 restartCounter := restart_counter
64 }
65
66 /* template matching reception of GTP-C echo-request */
67 template Gtp1cUnitdata tr_GTPC_MsgType(template GtpPeer peer, template OCT1 msg_type, template OCT4 teid, template GTPC_PDUs pdus := ?) := {
68 peer := peer,
69 gtpc := tr_GTP1C_PDU(msg_type, teid, pdus)
70 }
71
72 /* template matching reception of GTP-C echo-request */
73 template Gtp1cUnitdata tr_GTPC_PING(template GtpPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
74
75 template GTPC_PDUs tr_EchoRespPDU(template OCT1 restart_counter) := {
76 echoResponse := {
77 recovery := tr_Recovery(restart_counter),
78 private_extension_gtpc := *
79 }
80 }
81
82 /* template matching reception of GTP-C echo-response */
83 template Gtp1cUnitdata tr_GTPC_PONG(template GtpPeer peer) := tr_GTPC_MsgType(peer, echoResponse, '00000000'O, tr_EchoRespPDU(?));
84
85 template GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := {
86 echoResponse := {
87 recovery := ts_Recovery(restart_counter),
88 private_extension_gtpc := omit
89 }
90 }
91
92 /* master template for senidng a GTP-C echo response */
93 template Gtp1cUnitdata ts_GTPC_PONG(GtpPeer peer, uint16_t seq, OCT1 rest_ctr) := {
94 peer := peer,
95 gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq)
96 }
97
98 template GTPC_PDUs ts_EchoReqPDU := {
99 echoRequest := {
100 private_extension_gtpc := omit
101 }
102 }
103
104 /* master template for sending a GTP-C echo request */
105 template Gtp1cUnitdata ts_GTPC_PING(GtpPeer peer, uint16_t seq) := {
106 peer := peer,
107 gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq)
108 }
109
110 template EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := {
111 type_gtpc := '80'O,
112 endUserAddress := {
113 endUserAddressIPv4 := {
114 lengthf := 2,
115 pdp_typeorg := '0001'B,
116 spare := '1111'B,
117 pdp_typenum := '21'O,
118 ipv4_address := ip_addr
119 }
120 }
121 }
122 template EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit);
123 template EndUserAddress tr_EuaIPv4(template OCT4 ip_addr) modifies t_EuaIPv4 := {
124 endUserAddress := {
125 endUserAddressIPv4 := {
126 lengthf := 2+lengthof(ip_addr)
127 }
128 }
129 }
130
131 template EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := {
132 type_gtpc := '80'O,
133 endUserAddress := {
134 endUserAddressIPv6 := {
135 lengthf := 2,
136 pdp_typeorg := '0001'B,
137 spare := '1111'B,
138 pdp_typenum := '57'O,
139 ipv6_address := ip_addr
140 }
141 }
142 }
143 template EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit);
144 template EndUserAddress tr_EuaIPv6(template OCT16 ip_addr) modifies t_EuaIPv6 := {
145 endUserAddress := {
146 endUserAddressIPv6 := {
147 lengthf := 2+lengthof(ip_addr)
148 }
149 }
150 }
151
152 template AccessPointName ts_APN(octetstring apn) := {
153 type_gtpc := '83'O,
154 lengthf := lengthof(apn),
155 apn_value := apn
156 }
157
158 template GSN_Address_GTPC ts_GsnAddr(octetstring ip_addr) := {
159 type_gtpc := '85'O,
160 lengthf := lengthof(ip_addr),
161 addressf := ip_addr
162 }
163
164 template MSISDN ts_Msisdn(octetstring msisdn) := {
165 type_gtpc := '86'O,
166 lengthf := lengthof(msisdn),
167 msisdn := msisdn
168 }
169
170 template QualityOfServiceProfile ts_QosDefault := {
171 type_gtpc := '87'O,
172 lengthf := 4,
173 allocRetensionPrio := '00'O,
174 qos_ProfileValue := {
175 reliabilityClass := '011'B,
176 delayClass := '001'B,
177 spare1 := '00'B,
178 precedenceClass := '010'B,
179 spare2 := '0'B,
180 peakThroughput := '1001'B,
181 meanThroughput := '11111'B,
182 spare3 := '000'B,
183 deliverErroneusSDU := omit,
184 deliveryOrder := omit,
185 trafficClass := omit,
186 maxSDUSize := omit,
187 maxBitrateUplink := omit,
188 maxBitrateDownlink := omit,
189 sduErrorRatio := omit,
190 residualBER := omit,
191 trafficHandlingPriority := omit,
192 transferDelay := omit,
193 guaranteedBitRateUplink := omit,
194 guaranteedBitRateDownlink := omit,
195 sourceStatisticsDescriptor := omit,
196 signallingIndication := omit,
197 spare4 := omit,
198 maxBitrateDownlinkExt := omit,
199 guaranteedBitRateDownlinkExt := omit,
200 maxBitrateUplinkExt := omit,
201 guaranteedBitRateUplinkExt := omit
202 }
203 }
204
205 template IMSI_gtpc ts_Imsi(hexstring digits) := {
206 type_gtpc := '02'O,
207 digits := digits,
208 padding := 'F'H
209 }
210
211 template GTPC_PDUs ts_CreatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl,
212 BIT4 nsapi, EndUserAddress eua, octetstring apn,
213 octetstring sgsn_ip_sign, octetstring sgsn_ip_data,
214 octetstring msisdn, template ProtConfigOptions pco := omit) := {
215 createPDPContextRequest := {
216 imsi := ts_Imsi(imsi),
217 rai := omit,
218 recovery := ts_Recovery(restart_ctr),
219 selectionMode := {
220 type_gtpc := '0F'O,
221 selectModeValue := '00'B,
222 spare := '111111'B
223 },
224 teidDataI := {
225 type_gtpc := '00'O,
226 teidDataI := teid_data
227 },
228 teidControlPlane := {
229 type_gtpc := '00'O,
230 teidControlPlane := teid_ctrl
231 },
232 nsapi := {
233 type_gtpc := '00'O,
234 nsapi := nsapi,
235 unused := '0000'B
236 },
237 linked_nsapi := omit,
238 charging_char := omit,
239 trace_ref := omit,
240 trace_type := omit,
241 endUserAddress := eua,
242 accessPointName := ts_APN(apn),
243 protConfigOptions := pco,
244 sgsn_addr_signalling := ts_GsnAddr(sgsn_ip_sign),
245 sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data),
246 msisdn := ts_Msisdn(msisdn),
247 qualityOfServiceProfile := ts_QosDefault,
248 tft := omit,
249 triggerId := omit,
250 omcId := omit,
251 commonFlags := omit,
252 aPN_Restriction := omit,
253 ratType := omit,
254 userLocationInformation := omit,
255 mS_TimeZone := omit,
256 imeisv := omit,
257 camelChargingInformationContainer := omit,
258 additionalTraceInfo := omit,
259 correlationID := omit,
260 evolvedAllocationRetentionPriorityI := omit,
261 extendedCommonFlags := omit,
262 userCSGInformation := omit,
263 aPN_AMBR := omit,
264 signallingPriorityIndication := omit,
265 cN_OperatorSelectionEntity := omit,
266 private_extension_gtpc := omit
267 }
268 }
269
270 template Gtp1cUnitdata ts_GTPC_CreatePDP(GtpPeer peer, uint16_t seq, hexstring imsi,
271 OCT1 restart_ctr, OCT4 teid_data,
272 OCT4 teid_ctrl, BIT4 nsapi, EndUserAddress eua,
273 octetstring apn, octetstring sgsn_ip_sign,
274 octetstring sgsn_ip_data, octetstring msisdn,
275 template ProtConfigOptions pco := omit) := {
276 peer := peer,
277 gtpc := ts_GTP1C_PDU(createPDPContextRequest, '00000000'O,
278 valueof(ts_CreatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl,
279 nsapi, eua, apn, sgsn_ip_sign,
280 sgsn_ip_data, msisdn, pco)), seq)
281 }
282
Harald Welteeded9ad2018-02-17 20:57:34 +0100283
284 template NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := {
285 type_gtpc := '14'O,
286 nsapi := nsapi,
287 unused := '0000'B
288 }
289
290 template ReorderingRequired ts_ReorderReq(boolean req := false) := {
291 type_gtpc := '08'O,
292 reordreq := bool2bit(req),
293 spare := '0000000'B
294 }
295
296 template GTPC_PDUs ts_CreatePdpRespPDU(OCT1 cause, OCT4 teid_data, OCT4 teid_ctrl, BIT4 nsapi,
297 octetstring ggsn_ip_sign, octetstring ggsn_ip_data,
Harald Welte7aff2ca2018-02-18 15:34:50 +0100298 OCT4 chg_id, template EndUserAddress eua := omit,
Harald Welteeded9ad2018-02-17 20:57:34 +0100299 template ProtConfigOptions pco := omit) := {
300 createPDPContextResponse := {
301 cause := { '00'O, cause },
302 reorderingRequired := ts_ReorderReq(false),
303 recovery := omit,
304 teidDataI := {
305 type_gtpc := '00'O,
306 teidDataI := teid_data
307 },
308 teidControlPlane := {
309 type_gtpc := '00'O,
310 teidControlPlane := teid_ctrl
311 },
312 nsapi := ts_NSAPI(nsapi),
Harald Welte7aff2ca2018-02-18 15:34:50 +0100313 chargingID := {
314 type_gtpc := '7F'O,
315 chargingID := chg_id
316 },
Harald Welteeded9ad2018-02-17 20:57:34 +0100317 endUserAddress := eua,
318 protConfigOptions := pco,
319 ggsn_addr_controlPlane := ts_GsnAddr(ggsn_ip_sign),
320 ggsn_addr_traffic := ts_GsnAddr(ggsn_ip_data),
321 alt_ggsn_addr_controlPane := omit,
322 alt_ggsn_addr_traffic := omit,
323 qualityOfServiceProfile := ts_QosDefault,
324 commonFlags := omit,
325 aPN_Restriction := omit,
326 mS_InfoChangeReportingAction := omit,
327 bearerControlMode := omit,
328 evolvedAllocationRetentionPriorityI := omit,
329 extendedCommonFlag := omit,
330 csg_information_reporting_action := omit,
331 aPN_AMBR := omit,
332 gGSN_BackOffTime := omit,
333 private_extension_gtpc := omit
334 }
335 }
336
337 template Gtp1cUnitdata ts_GTPC_CreatePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid,
338 OCT1 cause,
339 OCT4 teid_ctrl, OCT4 teid_data,
340 BIT4 nsapi, octetstring ggsn_ip_sign,
Harald Welte7aff2ca2018-02-18 15:34:50 +0100341 octetstring ggsn_ip_data, OCT4 chg_id,
Harald Welteeded9ad2018-02-17 20:57:34 +0100342 template EndUserAddress eua := omit,
343 template ProtConfigOptions pco := omit) := {
344 peer := peer,
345 gtpc := ts_GTP1C_PDU(createPDPContextResponse, teid,
346 valueof(ts_CreatePdpRespPDU(cause, teid_data, teid_ctrl, nsapi,
Harald Welte7aff2ca2018-02-18 15:34:50 +0100347 ggsn_ip_sign, ggsn_ip_data, chg_id,
Harald Welteeded9ad2018-02-17 20:57:34 +0100348 eua, pco)), seq)
349 }
350
Harald Weltec69cf4e2018-02-17 20:57:02 +0100351 /* PCO send base template */
352 template ProtConfigOptions ts_PCO := {
353 type_gtpc := '84'O,
354 lengthf := 0,
355 configProtocol := '000'B,
356 spare := '0000'B,
357 extension0 := '1'B,
358 protocols := {}
359 }
360 /* PCO receive base template */
361 template ProtConfigOptions tr_PCO := {
362 type_gtpc := '84'O,
363 lengthf := ?,
364 configProtocol := '000'B,
365 spare := ?,
366 extension0 := '1'B,
367 protocols := {}
368 }
369
370 template ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := {
371 protocols := {
372 { protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O }
373 }
374 }
375 template ProtConfigOptions tr_PCO_IPv6_DNS_resp(template OCT16 contents) modifies tr_PCO := {
376 protocols := {
377 *, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, *
378 }
379 }
380
381 template ProtConfigOptions ts_PCO_IPv4_DNS_IPCP modifies ts_PCO := {
382 protocols := {
383 /* dummy PAP entry to check if our parser in the GGSN can properly iterate over
384 * the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */
385 { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
386 { protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
387 enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
388 }
389 }
390
391 template ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
392 protocolID := prot_id,
393 lengthProtoID := ?,
394 protoIDContents := ?
395 }
396 template ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := {
397 protocols := { *, tr_PCO_Proto(prot_id), * }
398 }
399
400 template ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := {
401 protocols := {
402 { protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
403 }
404 }
405 template ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template OCT4 contents) modifies tr_PCO := {
406 protocols := {
407 *, { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }, *
408 }
409 }
410
411 /* extract a given protocol payload from PCO */
412 function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring {
413 var integer i;
414 var integer num_matches := 0;
415 for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
416 if (pco.protocols[i].protocolID == protocol) {
417 num_matches := num_matches + 1;
418 if (num_matches == nth_match) {
419 return pco.protocols[i].protoIDContents;
420 }
421 }
422 }
423 setverdict(fail);
424 return ''O;
425 }
426
427 template IpcpPacket tr_IPCP(template LcpCode code, template uint8_t identifier,
428 template IpcpOptionList opts) := {
429 code := code,
430 identifier := identifier,
431 len := ?,
432 options := opts
433 }
434 template IpcpOption tr_IPCP_PrimaryDns(template OCT4 addr) := {
435 code := IPCP_OPT_PrimaryDNS,
436 len := 6,
437 data := addr
438 }
439 template IpcpOption tr_IPCP_SecondaryDns(template OCT4 addr) := {
440 code := IPCP_OPT_SecondaryDNS,
441 len := 6,
442 data := addr
443 }
444 template IpcpPacket tr_IPCP_Ack_DNS(template uint8_t identifier := ?, template OCT4 dns1 := ?,
445 template OCT4 dns2 := ?) :=
446 tr_IPCP(LCP_Configure_Ack, identifier,
447 { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
448
449 template IpcpPacket ts_IPCP(LcpCode code, uint8_t identifier, template IpcpOptionList opts) := {
450 code := code,
451 identifier := identifier,
452 len := 0, /* overwritten */
453 options := opts
454 }
455 template IpcpPacket ts_IPCP_ReqDNS(uint8_t identifier := 0) :=
456 ts_IPCP(LCP_Configure_Request, identifier,
457 { tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) });
458
Harald Welte57b9b7f2018-02-18 22:28:13 +0100459 function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd {
460 if (istemplatekind(ind, "omit")) {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100461 return omit;
462 }
Harald Weltec69cf4e2018-02-17 20:57:02 +0100463 var TearDownInd ret := {
464 type_gtpc := '13'O,
465 tdInd := valueof(ind),
466 spare:= '0000000'B
467 }
468 return ret;
469 }
470
Harald Welte57b9b7f2018-02-18 22:28:13 +0100471 template GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100472 deletePDPContextRequest := {
473 cause := omit,
474 tearDownIndicator := f_teardown_ind_IE(teardown_ind),
475 nsapi := {
476 type_gtpc := '14'O,
477 nsapi := nsapi,
478 unused := '0000'B
479 },
480 protConfigOptions := omit,
481 userLocationInformation := omit,
482 mS_TimeZone := omit,
483 extendedCommonFlags := omit,
484 uLI_Timestamp := omit,
485 private_extension_gtpc := omit
486 }
487 }
488
489 template Gtp1cUnitdata ts_GTPC_DeletePDP(GtpPeer peer, uint16_t seq, OCT4 teid,
Harald Welte57b9b7f2018-02-18 22:28:13 +0100490 BIT4 nsapi, template (omit) BIT1 teardown_ind) := {
Harald Weltec69cf4e2018-02-17 20:57:02 +0100491 peer := peer,
492 gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid,
493 valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq)
494 }
495
Harald Welte6f203162018-02-18 22:04:55 +0100496 template GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause,
497 template ProtConfigOptions pco := omit) := {
498 deletePDPContextResponse := {
499 cause := { '00'O, cause },
500 protConfigOptions := pco,
501 userLocationInformation := omit,
502 mS_TimeZone := omit,
503 uLI_Timestamp := omit,
504 private_extension_gtpc := omit
505 }
506 }
507
508 template Gtp1cUnitdata ts_GTPC_DeletePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid,
509 OCT1 cause,
510 template ProtConfigOptions pco := omit) := {
511 peer := peer,
512 gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid,
513 valueof(ts_DeletePdpRespPDU(cause, pco)), seq)
514 }
515
516
Harald Weltec69cf4e2018-02-17 20:57:02 +0100517
518 /* GTP-U */
519
520 template PDU_GTPU tr_GTP1U_PDU(template OCT1 msg_type, template OCT4 teid, template GTPU_IEs ies := ?) := {
521 pn_bit := ?,
522 s_bit := ?,
523 e_bit := ?,
524 spare := ?,
525 /* Protocol Type flag (PT) shall be set to '1' in GTP */
526 pt := '1'B,
527 /* Version shall be set to decimal 1 ('001'). */
528 version := '001'B,
529 messageType := msg_type,
530 lengthf := ?,
531 teid := teid,
532 opt_part := *,
533 gtpu_IEs := ies
534 }
535
536 /* generalized GTP-U send template */
537 template PDU_GTPU ts_GTP1U_PDU(OCT1 msg_type, uint16_t seq, OCT4 teid, GTPU_IEs ies) := {
538 /* N-PDU Number flag (PN): the GTP-U header contains a meaningful N-PDU Number field if the PN
539 * flag is set to 1. */
540 pn_bit := '0'B, /* we assume the encoder overwrites this if an optional part is given */
541 /* If the Sequence Number flag (S) is set to '1' the sequence number field is present and
542 * meaningful otherwise it is set to '0'. For GTP-U messages Echo Request, Echo Response,
543 * Error Indication and Supported Extension Headers Notification, the S flag shall be set to '1'. */
544 s_bit := '1'B, /* we assume the encoder overwrites this if an optional part is given */
545 /* Extension header presence */
546 e_bit := '0'B,
547 spare := '0'B,
548 /* Protocol Type flag (PT) shall be set to '1' in GTP */
549 pt := '1'B,
550 /* Version shall be set to decimal 1 ('001'). */
551 version := '001'B,
552 messageType := msg_type,
553 lengthf := 0, /* we assume encoder overwrites this */
554 teid := teid,
555 opt_part := {
556 sequenceNumber := int2oct(seq, 2),
557 npduNumber := '00'O,
558 nextExtHeader := '00'O,
559 gTPU_extensionHeader_List := omit
560 },
561 gtpu_IEs := ies
562 }
563
564 template Gtp1uUnitdata tr_GTPU_MsgType(template GtpPeer peer, template OCT1 msg_type, template OCT4 teid) := {
565 peer := peer,
566 gtpu := tr_GTP1U_PDU(msg_type, teid)
567 }
568
569
570 /* template matching reception of GTP-U echo-request */
571 template Gtp1uUnitdata tr_GTPU_PING(template GtpPeer peer) := tr_GTPU_MsgType(peer, echoRequest, '00000000'O);
572
573 /* template matching reception of GTP-U GPDU */
574 template GTPU_IEs t_GPDU(template octetstring data) := {
575 g_PDU_IEs := {
576 data := data
577 }
578 }
579 template Gtp1uUnitdata tr_GTPU_GPDU(template GtpPeer peer, template OCT4 teid, template octetstring data := ?) := {
580 peer := peer,
581 gtpu := tr_GTP1U_PDU('FF'O, teid, t_GPDU(data))
582 }
583
584 template GTPU_IEs ts_UEchoRespPDU(OCT1 restart_counter) := {
585 echoResponse_IEs := {
586 recovery_gtpu := {
587 type_gtpu := '00'O, /* we assume encoder fixes? */
588 restartCounter := restart_counter
589 },
590 private_extension_gtpu := omit
591 }
592 }
593
594 /* master template for sending a GTP-U echo response */
595 template Gtp1uUnitdata ts_GTPU_PONG(GtpPeer peer, uint16_t seq, OCT1 rest_ctr) := {
596 peer := peer,
597 gtpu := ts_GTP1U_PDU(echoResponse, seq, '00000000'O, valueof(ts_UEchoRespPDU(rest_ctr)))
598 }
599
600 /* master template for sending a GTP-U user plane data */
601 template Gtp1uUnitdata ts_GTP1U_GPDU(GtpPeer peer, uint16_t seq, OCT4 teid, octetstring data) := {
602 peer := peer,
603 gtpu := ts_GTP1U_PDU('FF'O, seq, teid, { g_PDU_IEs := { data := data }})
604 }
605}