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