Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 1 | /* GTP Templates in TTCN-3 |
| 2 | * (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 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 12 | module GTP_Templates { |
| 13 | |
| 14 | import from General_Types all; |
| 15 | import from Osmocom_Types all; |
| 16 | import from GTPC_Types all; |
| 17 | import from GTPU_Types all; |
| 18 | import from GTP_CodecPort all; |
| 19 | import from IPCP_Types all; |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 20 | import from GSM_Types all; // RoutingAreaIdentification, CellIdentity |
| 21 | |
Pau Espin Pedrol | bbff8b7 | 2024-01-15 18:45:35 +0100 | [diff] [blame^] | 22 | template (present) OCT1 gtp1_requests := ( |
| 23 | '10'O, /* createPDPContextRequest */ |
| 24 | '12'O, /* updatePDPContextRequest */ |
| 25 | '14'O, /* */ |
| 26 | '16'O, /* deletePDPContextRequest */ |
| 27 | '1B'O, /* pdu_NotificationRequest */ |
| 28 | '1D'O, /* pdu_NotificationRejectRequest */ |
| 29 | '1F'O, /* supportedExtensionHeadersNotification */ |
| 30 | '20'O, /* sendRouteingInformationForGPRSRequest */ |
| 31 | '22'O, /* failureReportRequest */ |
| 32 | '24'O, /* noteMS_GPRSPresentRequest */ |
| 33 | '30'O, /* identificationRequest */ |
| 34 | '32'O, /* sgsn_ContextRequest */ |
| 35 | '35'O, /* forwardRelocationRequest */ |
| 36 | '38'O, /* relocationCancelRequest */ |
| 37 | '3A'O, /* forwardSRNSContext */ |
| 38 | '3D'O, /* uERegistrationQueryRequest */ |
| 39 | '46'O, /* ranInformationRelay */ |
| 40 | '60'O, /* mBMSNotificationRequest */ |
| 41 | '62'O, /* mBMSNotificationRejectRequest */ |
| 42 | '64'O, /* createMBMSContextRequest */ |
| 43 | '66'O, /* updateMBMSContextRequest */ |
| 44 | '68'O, /* deleteMBMSContextRequest */ |
| 45 | '70'O, /* mBMSRegistrationRequest */ |
| 46 | '72'O, /* mBMSDeRegistrationRequest */ |
| 47 | '74'O, /* mBMSSessionStartRequest */ |
| 48 | '76'O, /* mBMSSessionStopRequest */ |
| 49 | '78'O, /* mBMSSessionUpdateRequest */ |
| 50 | '80'O /* mS_InfoChangeNotificationRequest */ |
| 51 | ); |
| 52 | |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 53 | type record GTP_CellId { |
| 54 | RoutingAreaIdentification ra_id, |
| 55 | CellIdentity cell_id |
| 56 | } with { encode "RAW" }; |
| 57 | |
| 58 | template (value) GTP_CellId ts_GTP_CellId(template (value) RoutingAreaIdentification rai, CellIdentity cell_id) := { |
| 59 | ra_id := rai, |
| 60 | cell_id := cell_id |
| 61 | }; |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 62 | |
Harald Welte | 3b4c356 | 2018-03-01 10:01:58 +0100 | [diff] [blame] | 63 | /* Table 38 of 3GPP TS 29.060 */ |
| 64 | type enumerated GTP_Cause { |
| 65 | GTP_CAUSE_REQUEST_IMEI (1), |
| 66 | GTP_CAUSE_REQUEST_IMSI_AND_IMEI (2), |
| 67 | GTP_CAUSE_NO_IDENTITY_NEDED (3), |
| 68 | GTP_CAUSE_MS_REFUSES (4), |
| 69 | GTP_CAUSE_MS_IS_NOT_GPRS_RESPONDING (5), |
| 70 | /* reserved */ |
| 71 | GTP_CAUSE_REQUEST_ACCEPTED (128) |
| 72 | /* FIXME */ |
| 73 | }; |
| 74 | |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 75 | template (value) Cause_gtpc ts_Cause_gtpc(template (value) GTP_Cause cause) := { |
| 76 | type_gtpc := '01'O, |
| 77 | causevalue := enum2oct1_Cause_gtpc_tmpl(cause) |
| 78 | } |
| 79 | private function enum2oct1_Cause_gtpc_tmpl(template GTP_Cause inp) return template OCT1 |
| 80 | { |
| 81 | if (istemplatekind(inp, "omit")) { |
| 82 | return omit; |
| 83 | } else if (istemplatekind(inp, "*")) { |
| 84 | return *; |
| 85 | } else if (istemplatekind(inp, "?")) { |
| 86 | return ?; |
| 87 | } else { |
| 88 | return int2oct(enum2int(valueof(inp)), 1); |
| 89 | } |
| 90 | } |
| 91 | template (present) Cause_gtpc tr_Cause_gtpc(template (present) GTP_Cause cause) := { |
| 92 | type_gtpc := '01'O, |
| 93 | causevalue := enum2oct1_Cause_gtpc_tmpl(cause) |
| 94 | } |
| 95 | function f_tr_Cause_gtpc(template GTP_Cause cause) return |
| 96 | template Cause_gtpc { |
| 97 | if (istemplatekind(cause, "omit")) { |
| 98 | return omit; |
| 99 | } else if (istemplatekind(cause, "*")) { |
| 100 | return *; |
| 101 | } else { |
| 102 | return tr_Cause_gtpc(cause); |
| 103 | } |
| 104 | } |
| 105 | |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 106 | private function f_oct_or_wc(template integer inp, integer len) return template octetstring { |
| 107 | if (istemplatekind(inp, "omit")) { |
| 108 | return omit; |
| 109 | } else if (istemplatekind(inp, "*")) { |
| 110 | return *; |
| 111 | } else if (istemplatekind(inp, "?")) { |
| 112 | return ?; |
| 113 | } |
| 114 | return int2oct(valueof(inp), len); |
| 115 | } |
| 116 | |
| 117 | private function f_hex_or_wc(template integer inp, integer len) return template hexstring { |
| 118 | if (istemplatekind(inp, "omit")) { |
| 119 | return omit; |
| 120 | } else if (istemplatekind(inp, "*")) { |
| 121 | return *; |
| 122 | } else if (istemplatekind(inp, "?")) { |
| 123 | return ?; |
| 124 | } |
| 125 | return int2hex(valueof(inp), len); |
| 126 | } |
| 127 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 128 | /* generalized GTP-C receive template */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 129 | template (present) PDU_GTPC tr_GTP1C_PDU(template (present) OCT1 msg_type, template (present) OCT4 teid, template (present) GTPC_PDUs pdu := ?) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 130 | /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an |
| 131 | * error if this flag is set to '1'. */ |
| 132 | pn_bit := '0'B, |
| 133 | /* Sequence number flag (S) shall be set to '1'. */ |
| 134 | s_bit := '1'B, |
| 135 | e_bit := ?, |
| 136 | spare := ?, |
| 137 | /* Protocol Type flag (PT) shall be set to '1'.*/ |
| 138 | pt := '1'B, |
| 139 | /* Version shall be set to decimal 1 ('001'). */ |
| 140 | version := '001'B, |
| 141 | messageType := msg_type, |
| 142 | lengthf := ?, |
| 143 | teid := teid, |
| 144 | opt_part := *, |
| 145 | gtpc_pdu := pdu |
| 146 | } |
| 147 | |
| 148 | /* generalized GTP-C send template */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 149 | template (value) PDU_GTPC ts_GTP1C_PDU(OCT1 msg_type, OCT4 teid, GTPC_PDUs pdu, uint16_t seq_nr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 150 | /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an |
| 151 | * error if this flag is set to '1'. */ |
| 152 | pn_bit := '0'B, |
| 153 | /* Sequence number flag (S) shall be set to '1'. */ |
| 154 | s_bit := '1'B, |
| 155 | e_bit := '0'B, |
| 156 | spare := '0'B, |
| 157 | /* Protocol Type flag (PT) shall be set to '1'.*/ |
| 158 | pt := '1'B, |
| 159 | /* Version shall be set to decimal 1 ('001'). */ |
| 160 | version := '001'B, |
| 161 | messageType := msg_type, |
| 162 | lengthf := 0, /* we assume encoder overwrites this */ |
| 163 | teid := teid, |
| 164 | opt_part := { |
| 165 | sequenceNumber := int2oct(seq_nr, 2), |
| 166 | npduNumber := '00'O, |
| 167 | nextExtHeader := '00'O, |
| 168 | gTPC_extensionHeader_List := omit |
| 169 | }, |
| 170 | gtpc_pdu := pdu |
| 171 | } |
| 172 | |
| 173 | /* recovery IE */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 174 | template (value) Recovery_gtpc ts_Recovery(OCT1 restart_counter) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 175 | type_gtpc := '0E'O, |
| 176 | restartCounter := restart_counter |
| 177 | } |
| 178 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 179 | template (present) Recovery_gtpc tr_Recovery(template (present) OCT1 restart_counter) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 180 | type_gtpc := '0E'O, |
| 181 | restartCounter := restart_counter |
| 182 | } |
| 183 | |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 184 | /* Packet TMSI - 7.7.5 */ |
| 185 | template (value) PacketTMSI ts_PTMSI(OCT4 ptmsi) := { |
| 186 | type_gtpc := '05'O, |
| 187 | p_tmsi := ptmsi |
| 188 | } |
| 189 | |
| 190 | /* PTMSI Signature - 7.7.9 */ |
| 191 | template (value) PTMSI_Signature ts_PTMSI_sig(OCT3 ptmsi_sig) := { |
| 192 | type_gtpc := '0C'O, |
| 193 | ptmsi_Signature := ptmsi_sig |
| 194 | } |
| 195 | |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 196 | /* MS Validated - 7.7.10 */ |
| 197 | template (value) MS_Validated ts_MS_Validated(template (value) BIT1 msValidated) := { |
| 198 | type_gtpc := '0D'O, |
| 199 | msValidated := msValidated, |
| 200 | spare := '1111111'B |
| 201 | } |
| 202 | template (present) MS_Validated tr_MS_Validated(template (present) BIT1 msValidated := ?) := { |
| 203 | type_gtpc := '0D'O, |
| 204 | msValidated := msValidated, |
| 205 | spare := '1111111'B |
| 206 | } |
| 207 | function f_tr_MS_Validated(template BIT1 msValidated := *) return template MS_Validated { |
| 208 | if (istemplatekind(msValidated, "omit")) { |
| 209 | return omit; |
| 210 | } else if (istemplatekind(msValidated, "*")) { |
| 211 | return *; |
| 212 | } else { |
| 213 | return tr_MS_Validated(msValidated); |
| 214 | } |
| 215 | } |
| 216 | private function f_ts_MS_Validated(template (omit) BIT1 msValidated) |
| 217 | return template (omit) MS_Validated { |
| 218 | if (istemplatekind(msValidated, "omit")) { |
| 219 | return omit; |
| 220 | } |
| 221 | return ts_MS_Validated(msValidated); |
| 222 | } |
| 223 | |
| 224 | /* 7.7.13 TEI Data I */ |
| 225 | template (value) TeidDataI ts_TeidDataI(template (value) OCT4 teid) := { |
| 226 | type_gtpc := '10'O, |
| 227 | teidDataI := teid |
| 228 | } |
| 229 | template (present) TeidDataI tr_TeidDataI(template (present) OCT4 teid := ?) := { |
| 230 | type_gtpc := '10'O, |
| 231 | teidDataI := teid |
| 232 | } |
| 233 | |
| 234 | /* 7.7.14 TEI Control Plane */ |
| 235 | template (value) TeidControlPlane ts_TEIC(template (value) OCT4 teic) := { |
| 236 | type_gtpc := '11'O, |
| 237 | teidControlPlane := teic |
| 238 | } |
| 239 | template (present) TeidControlPlane tr_TEIC(template (present) OCT4 teic := ?) := { |
| 240 | type_gtpc := '11'O, |
| 241 | teidControlPlane := teic |
| 242 | } |
| 243 | private function f_ts_TEIC(template (omit) OCT4 teic) |
| 244 | return template (omit) TeidControlPlane { |
| 245 | if (istemplatekind(teic, "omit")) { |
| 246 | return omit; |
| 247 | } |
| 248 | return ts_TEIC(teic); |
| 249 | } |
| 250 | |
| 251 | /* 7.7.15 Tunnel Endpoint Identifier Data II */ |
| 252 | template (value) TeidDataII ts_TeidDataII(template (value) BIT4 nsapi, |
| 253 | template (value) OCT4 teid) := { |
| 254 | type_gtpc := '12'O, |
| 255 | nsapi := nsapi, |
| 256 | unused := '0000'B, |
| 257 | teidDataII := teid |
| 258 | } |
| 259 | template (present) TeidDataII tr_TeidDataII(template (present) BIT4 nsapi := ?, |
| 260 | template (present) OCT4 teid := ?) := { |
| 261 | type_gtpc := '12'O, |
| 262 | nsapi := nsapi, |
| 263 | unused := '0000'B, |
| 264 | teidDataII := teid |
| 265 | } |
| 266 | |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 267 | /* IMEI(SV) IE TS 29.060 7.7.53 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 268 | template (value) IMEISV_gtpc ts_IMEISV(template (value) OCT8 imeisv) := { |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 269 | type_gtpc := '9A'O, |
| 270 | lengthf := 8, |
| 271 | imeisv := imeisv |
| 272 | } |
| 273 | private function f_ts_IMEISV(template (omit) OCT8 imeisv) |
| 274 | return template (omit) IMEISV_gtpc { |
| 275 | if (istemplatekind(imeisv, "omit")) { |
| 276 | return omit; |
| 277 | } |
| 278 | return ts_IMEISV(imeisv); |
| 279 | } |
| 280 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 281 | template (present) IMEISV_gtpc tr_IMEISV(template (present) OCT8 imeisv) := { |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 282 | type_gtpc := '9A'O, |
| 283 | lengthf := 8, |
| 284 | imeisv := imeisv |
| 285 | } |
| 286 | |
Pau Espin Pedrol | 535ca26 | 2022-05-16 14:07:17 +0200 | [diff] [blame] | 287 | // MS Time Zone - 7.7.52 |
| 288 | template (value) MS_TimeZone ts_MS_TimeZone(template (value) OCT1 timeZone := '00'O, |
| 289 | template (value) BIT2 daylightSavingTime := '00'B) := { |
| 290 | type_gtpc := '99'O, |
| 291 | lengthf := 2, |
| 292 | timeZone := timeZone, |
| 293 | daylightSavingTime := daylightSavingTime, |
| 294 | spare1 := '000'B, |
| 295 | sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */ |
| 296 | spare2 := '00'B |
| 297 | } |
| 298 | function f_ts_MS_TimeZone(template (omit) OCT1 timeZone, template (omit) BIT2 daylightSavingTime) |
| 299 | return template (omit) MS_TimeZone { |
| 300 | if (istemplatekind(timeZone, "omit") and istemplatekind(daylightSavingTime, "omit")) { |
| 301 | return omit; |
| 302 | } |
| 303 | if (istemplatekind(timeZone, "omit")) { |
| 304 | return ts_MS_TimeZone(daylightSavingTime := daylightSavingTime); |
| 305 | } |
| 306 | if (istemplatekind(daylightSavingTime, "omit")) { |
| 307 | return ts_MS_TimeZone(timeZone); |
| 308 | } |
| 309 | return ts_MS_TimeZone(timeZone, daylightSavingTime); |
| 310 | } |
| 311 | |
| 312 | template (present) MS_TimeZone tr_MS_TimeZone(template (present) OCT1 timeZone := ?, |
| 313 | template (present) BIT2 daylightSavingTime := ?) := { |
| 314 | type_gtpc := '99'O, |
| 315 | lengthf := 2, |
| 316 | timeZone := timeZone, |
| 317 | daylightSavingTime := daylightSavingTime, |
| 318 | spare1 := '000'B, |
| 319 | sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */ |
| 320 | spare2 := '00'B |
| 321 | } |
| 322 | |
Pau Espin Pedrol | 0e12787 | 2022-05-12 17:58:50 +0200 | [diff] [blame] | 323 | /* Charging Characteristics IE TS 29.060 7.7.23 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 324 | template (value) ChargingCharacteristics_GTPC ts_ChargingCharacteristics(template (value) OCT2 chargingChar) := { |
Pau Espin Pedrol | 0e12787 | 2022-05-12 17:58:50 +0200 | [diff] [blame] | 325 | type_gtpc := '1A'O, |
| 326 | chargingChar := chargingChar |
| 327 | } |
| 328 | private function f_ts_ChargingCharacteristics(template (omit) OCT2 chargingChar) |
| 329 | return template (omit) ChargingCharacteristics_GTPC { |
| 330 | if (istemplatekind(chargingChar, "omit")) { |
| 331 | return omit; |
| 332 | } |
| 333 | return ts_ChargingCharacteristics(chargingChar); |
| 334 | } |
| 335 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 336 | template (present) ChargingCharacteristics_GTPC tr_ChargingCharacteristics(template (present) OCT2 chargingChar) := { |
Pau Espin Pedrol | 0e12787 | 2022-05-12 17:58:50 +0200 | [diff] [blame] | 337 | type_gtpc := '1A'O, |
| 338 | chargingChar := chargingChar |
| 339 | } |
| 340 | |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 341 | /* 7.7.28 MM Context */ |
| 342 | template (value) MM_Context ts_MM_ContextUMTS(template (value) OCT16 ck, |
| 343 | template (value) OCT16 ik) := { |
| 344 | type_gtpc := '81'O, |
| 345 | context := { |
| 346 | mmcontUMTS := { |
| 347 | lengthf := 0, /* overwritten */ |
| 348 | ksi := '001'B, |
| 349 | usedGPRSIntegrityAlgorithm := '000'B, |
| 350 | ugipai := '1'B, /* Integrity Protection not required */ |
| 351 | gupii := '1'B, /* Ignore "Used GPRS integrity protection algorithm" field" */ |
| 352 | spare1 := '000'B, |
| 353 | noofVectors := 0, /* TODO: fill quintpuplets*/ |
| 354 | security := '01'B, /* UMTS key and quintuplets */ |
| 355 | ck := ck, |
| 356 | ik := ik, |
| 357 | quintupletlength := 0, /* overwritten */ |
| 358 | quintuplet := ''O, |
| 359 | drx_par := '0000'O, |
| 360 | msNetW_cap_length := 0, /* overwritten */ |
| 361 | msNetw_cap := omit, |
| 362 | containerLength := 0, /* overwritten */ |
| 363 | container := omit, |
| 364 | access_restriction_data_length := 0, /* overwritten */ |
| 365 | access_restriction_data := omit |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | /* 7.7.29 PDP Context */ |
| 371 | template (value) PDP_Context_GTPC ts_PDP_Context_GTPC(template (value) octetstring pdp_addr, |
| 372 | template (value) octetstring ggsn_gsn_addr, |
| 373 | template (value) octetstring apn, |
| 374 | template (value) OCT4 ggsn_teic := '12345678'O, |
| 375 | template (value) OCT4 ggsn_teid := '87654321'O) := { |
| 376 | type_gtpc := '82'O, |
| 377 | lengthf := 0, /* overwritten */ |
| 378 | nsapi := '0101'B, |
| 379 | order := '0'B, |
| 380 | asi := '0'B, |
| 381 | vaa := '0'B, |
| 382 | ea := '0'B, |
| 383 | sapi := '0011'B, |
| 384 | spare1 := '0000'B, |
| 385 | qos_subLength := 0, /* overwritten */ |
| 386 | qos_sub := ts_QosProfileValueDefault, |
| 387 | qos_reqLength := 0, /* overwritten */ |
| 388 | qos_req := ts_QosProfileValueDefault, |
| 389 | qos_negLength := 0, /* overwritten */ |
| 390 | qos_neg := ts_QosProfileValueDefault, |
| 391 | snd := '0000'O, |
| 392 | snu := '0000'O, |
| 393 | sendNPDUnum := '00'O, |
| 394 | receiveNPDUnum := '00'O, |
| 395 | uteidControlPlane := ggsn_teic, |
| 396 | uteidData1 := ggsn_teid, |
| 397 | pdpcontext := '00'O, |
| 398 | pdp_typeorg := '0001'B, /* IETF */ |
| 399 | spare2 := '1111'B, |
| 400 | pdp_typenum := '21'O, /* IETF IPV4 */ |
| 401 | pdp_addressLength := 0, /* overwritten */ |
| 402 | pdp_address := pdp_addr, |
| 403 | ggsn_addressControlPlaneLength := 0, /* overwritten */ |
| 404 | ggsn_addressControlPlane := ggsn_gsn_addr, |
| 405 | ggsn_addressUserPlaneLength := 0, /* overwritten */ |
| 406 | ggsn_addressUserPlane := ggsn_gsn_addr, |
| 407 | apnLength := 0, /* overwritten */ |
| 408 | apn := apn, |
| 409 | transactionId := '0001'B, |
| 410 | spare3 := '0000'B, |
| 411 | transactionID_cont := '00'O, |
| 412 | pdp_typenum2 := omit, |
| 413 | pdp_addresslength2 := omit, |
| 414 | pdp_Address2 := omit |
| 415 | } |
| 416 | |
Pau Espin Pedrol | 0e12787 | 2022-05-12 17:58:50 +0200 | [diff] [blame] | 417 | |
Philipp Maier | 1c0c726 | 2023-07-24 10:51:53 +0200 | [diff] [blame] | 418 | /* template matching reception of GTP-C unit-data */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 419 | template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) GtpPeer peer, |
| 420 | template (present) OCT1 msg_type, |
| 421 | template (present) OCT4 teid, |
| 422 | template (present) GTPC_PDUs pdus := ?) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 423 | peer := peer, |
| 424 | gtpc := tr_GTP1C_PDU(msg_type, teid, pdus) |
| 425 | } |
| 426 | |
| 427 | /* template matching reception of GTP-C echo-request */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 428 | template (present) Gtp1cUnitdata tr_GTPC_PING(template (present) GtpPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O); |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 429 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 430 | template (present) GTPC_PDUs tr_EchoRespPDU(template (present) OCT1 restart_counter) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 431 | echoResponse := { |
| 432 | recovery := tr_Recovery(restart_counter), |
| 433 | private_extension_gtpc := * |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | /* template matching reception of GTP-C echo-response */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 438 | template (present) Gtp1cUnitdata tr_GTPC_PONG(template (present) GtpPeer peer) := tr_GTPC_MsgType(peer, echoResponse, '00000000'O, tr_EchoRespPDU(?)); |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 439 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 440 | template (value) GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 441 | echoResponse := { |
| 442 | recovery := ts_Recovery(restart_counter), |
| 443 | private_extension_gtpc := omit |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | /* master template for senidng a GTP-C echo response */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 448 | template (value) Gtp1cUnitdata ts_GTPC_PONG(GtpPeer peer, uint16_t seq, OCT1 rest_ctr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 449 | peer := peer, |
| 450 | gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq) |
| 451 | } |
| 452 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 453 | template (value) GTPC_PDUs ts_EchoReqPDU := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 454 | echoRequest := { |
| 455 | private_extension_gtpc := omit |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | /* master template for sending a GTP-C echo request */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 460 | template (value) Gtp1cUnitdata ts_GTPC_PING(GtpPeer peer, uint16_t seq) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 461 | peer := peer, |
| 462 | gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq) |
| 463 | } |
| 464 | |
Pau Espin Pedrol | 0d138c6 | 2023-08-31 16:23:18 +0200 | [diff] [blame] | 465 | private function f_eua_ipv4_len(template OCT4 ip_addr) return template (present) integer { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 466 | if (istemplatekind(ip_addr, "omit")) { |
| 467 | return 2; |
| 468 | } else if (istemplatekind(ip_addr, "*")) { |
| 469 | return ?; |
| 470 | } else if (istemplatekind(ip_addr, "?")) { |
| 471 | return 6; |
| 472 | } |
| 473 | return 6; |
| 474 | } |
| 475 | |
Pau Espin Pedrol | 0d138c6 | 2023-08-31 16:23:18 +0200 | [diff] [blame] | 476 | private function f_eua_ipv6_len(template OCT16 ip_addr) return template (present) integer { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 477 | if (istemplatekind(ip_addr, "omit")) { |
| 478 | return 2; |
| 479 | } else if (istemplatekind(ip_addr, "*")) { |
| 480 | return ?; |
| 481 | } else if (istemplatekind(ip_addr, "?")) { |
| 482 | return 18; |
| 483 | } |
| 484 | return 18; |
| 485 | } |
| 486 | |
Pau Espin Pedrol | 0d138c6 | 2023-08-31 16:23:18 +0200 | [diff] [blame] | 487 | private function f_eua_ipv4v6_len(template OCT4 ip_addr4, template OCT16 ip_addr6) return template (present) integer { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 488 | var integer len := 2; |
| 489 | if (istemplatekind(ip_addr4, "*") or |
| 490 | istemplatekind(ip_addr6, "*")) { |
| 491 | return ?; |
| 492 | } |
| 493 | if (not istemplatekind(ip_addr4, "omit")) { |
| 494 | len := len + 4; |
| 495 | } |
| 496 | if (not istemplatekind(ip_addr6, "omit")) { |
| 497 | len := len + 16; |
| 498 | } |
| 499 | return len; |
| 500 | } |
| 501 | |
Pau Espin Pedrol | 0d138c6 | 2023-08-31 16:23:18 +0200 | [diff] [blame] | 502 | template (present) EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 503 | type_gtpc := '80'O, |
| 504 | endUserAddress := { |
| 505 | endUserAddressIPv4 := { |
| 506 | lengthf := 2, |
| 507 | pdp_typeorg := '0001'B, |
| 508 | spare := '1111'B, |
| 509 | pdp_typenum := '21'O, |
| 510 | ipv4_address := ip_addr |
| 511 | } |
| 512 | } |
| 513 | } |
Pau Espin Pedrol | 0d138c6 | 2023-08-31 16:23:18 +0200 | [diff] [blame] | 514 | template (present) EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit); |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 515 | template (present) EndUserAddress tr_EuaIPv4(template (present) OCT4 ip_addr) modifies t_EuaIPv4 := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 516 | endUserAddress := { |
| 517 | endUserAddressIPv4 := { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 518 | lengthf := f_eua_ipv4_len(ip_addr) |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 519 | } |
| 520 | } |
| 521 | } |
| 522 | |
Pau Espin Pedrol | 0d138c6 | 2023-08-31 16:23:18 +0200 | [diff] [blame] | 523 | template (present) EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 524 | type_gtpc := '80'O, |
| 525 | endUserAddress := { |
| 526 | endUserAddressIPv6 := { |
| 527 | lengthf := 2, |
| 528 | pdp_typeorg := '0001'B, |
| 529 | spare := '1111'B, |
| 530 | pdp_typenum := '57'O, |
| 531 | ipv6_address := ip_addr |
| 532 | } |
| 533 | } |
| 534 | } |
Pau Espin Pedrol | 0d138c6 | 2023-08-31 16:23:18 +0200 | [diff] [blame] | 535 | template (present) EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit); |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 536 | template (present) EndUserAddress tr_EuaIPv6(template (present) OCT16 ip_addr) modifies t_EuaIPv6 := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 537 | endUserAddress := { |
| 538 | endUserAddressIPv6 := { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 539 | lengthf := f_eua_ipv6_len(ip_addr) |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 540 | } |
| 541 | } |
| 542 | } |
| 543 | |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 544 | /* 3GPP TS 29.060 Figure 37A: End User Address Information Element for IPv4v6 (both static) */ |
Pau Espin Pedrol | 0d138c6 | 2023-08-31 16:23:18 +0200 | [diff] [blame] | 545 | template (present) EndUserAddress t_EuaIPv4v6(template OCT4 ip_addr4, template OCT16 ip_addr6) := { |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 546 | type_gtpc := '80'O, |
| 547 | endUserAddress := { |
| 548 | endUserAddressIPv4andIPv6 := { |
| 549 | lengthf := 2, |
| 550 | pdp_typeorg := '0001'B, |
| 551 | spare := '1111'B, |
| 552 | pdp_typenum := '8D'O, |
| 553 | ipv4_address := ip_addr4, |
| 554 | ipv6_address := ip_addr6 |
| 555 | } |
| 556 | } |
| 557 | } |
Pau Espin Pedrol | 0d138c6 | 2023-08-31 16:23:18 +0200 | [diff] [blame] | 558 | template (present) EndUserAddress t_EuaIPv4Dynv6Dyn := t_EuaIPv4v6(omit, omit); |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 559 | template (present) EndUserAddress tr_EuaIPv4v6(template (present) OCT4 ip_addr4, |
| 560 | template (present) OCT16 ip_addr6) modifies t_EuaIPv4v6 := { |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 561 | endUserAddress := { |
| 562 | endUserAddressIPv4andIPv6 := { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 563 | lengthf := f_eua_ipv4v6_len(ip_addr4, ip_addr6) |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 564 | } |
| 565 | } |
| 566 | } |
| 567 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 568 | template (value) AccessPointName ts_APN(octetstring apn) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 569 | type_gtpc := '83'O, |
| 570 | lengthf := lengthof(apn), |
| 571 | apn_value := apn |
| 572 | } |
| 573 | |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 574 | template (value) GSN_Address_GTPC ts_GsnAddr(template (value) octetstring ip_addr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 575 | type_gtpc := '85'O, |
| 576 | lengthf := lengthof(ip_addr), |
| 577 | addressf := ip_addr |
| 578 | } |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 579 | template (present) GSN_Address_GTPC tr_GsnAddr(template (present) octetstring ip_addr := ?) := { |
| 580 | type_gtpc := '85'O, |
| 581 | lengthf := ?, |
| 582 | addressf := ip_addr |
| 583 | } |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 584 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 585 | template (value) MSISDN ts_Msisdn(octetstring msisdn) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 586 | type_gtpc := '86'O, |
| 587 | lengthf := lengthof(msisdn), |
| 588 | msisdn := msisdn |
| 589 | } |
| 590 | |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 591 | template (value) QoSV_GTPC ts_QosValueDefault := { |
| 592 | reliabilityClass := '011'B, |
| 593 | delayClass := '001'B, |
| 594 | spare1 := '00'B, |
| 595 | precedenceClass := '010'B, |
| 596 | spare2 := '0'B, |
| 597 | peakThroughput := '1001'B, |
| 598 | meanThroughput := '11111'B, |
| 599 | spare3 := '000'B, |
| 600 | deliverErroneusSDU := '010'B, /* Erroneus SDU are delivered */ |
| 601 | deliveryOrder := '10'B, /* Without delivery order */ |
| 602 | trafficClass := '100'B, /* Background */ |
| 603 | maxSDUSize := '96'O, /* 1500 octets */ |
| 604 | maxBitrateUplink := 'FE'O, /* 8640, continues in extended octet */ |
| 605 | maxBitrateDownlink := 'FE'O, /* 8640, continues in extended octet */ |
| 606 | sduErrorRatio := '0100'B, /* 1x10^-4 */ |
| 607 | residualBER := '0101'B, /* 1x10^-3 */ |
| 608 | trafficHandlingPriority := '01'B, /* prio 1 */ |
| 609 | transferDelay := '000001'B, /* 10 ms */ |
| 610 | guaranteedBitRateUplink := 'FE'O, /* 8640, continues in extended octet */ |
| 611 | guaranteedBitRateDownlink := 'FE'O, /* 8640, continues in extended octet */ |
| 612 | sourceStatisticsDescriptor := '0000'B, /* unknown */ |
| 613 | signallingIndication := '0'B, /* Not optimized */ |
| 614 | spare4 := '000'B, |
| 615 | maxBitrateDownlinkExt := '5B'O, /* 33 mbps */ |
| 616 | guaranteedBitRateDownlinkExt := '5B'O, /* 33 mbps */ |
| 617 | maxBitrateUplinkExt := '6e'O, /* 52 mbps */ |
| 618 | guaranteedBitRateUplinkExt := '6e'O /* 52 mbps */ |
| 619 | } |
| 620 | |
| 621 | template (value) QualityOfServiceProfile_Value ts_QosProfileValueDefault := { |
| 622 | allocRetensionPrio := '00'O, |
| 623 | qos_ProfileValue := ts_QosValueDefault |
| 624 | } |
| 625 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 626 | template (value) QualityOfServiceProfile ts_QosDefault := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 627 | type_gtpc := '87'O, |
Pau Espin Pedrol | 7d58b08 | 2022-06-07 13:30:03 +0200 | [diff] [blame] | 628 | lengthf := 17, |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 629 | allocRetensionPrio := '00'O, |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 630 | qos_ProfileValue := ts_QosValueDefault |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 631 | } |
| 632 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 633 | template (value) IMSI_gtpc ts_Imsi(hexstring digits) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 634 | type_gtpc := '02'O, |
| 635 | digits := digits, |
| 636 | padding := 'F'H |
| 637 | } |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 638 | function f_ts_Imsi(template (omit) hexstring digits := omit) return template (omit) IMSI_gtpc { |
| 639 | var template (omit) IMSI_gtpc imsi; |
| 640 | if (istemplatekind(digits, "omit")) { |
| 641 | imsi := omit; |
| 642 | } else { |
| 643 | imsi := ts_Imsi(valueof(digits)); |
| 644 | } |
| 645 | return imsi; |
| 646 | } |
| 647 | template (present) IMSI_gtpc tr_Imsi(template (present) hexstring digits) := { |
| 648 | type_gtpc := '02'O, |
| 649 | digits := digits, |
| 650 | padding := 'F'H |
| 651 | } |
| 652 | function f_tr_Imsi(template hexstring digits := *) return template IMSI_gtpc { |
| 653 | if (istemplatekind(digits, "omit")) { |
| 654 | return omit; |
| 655 | } else if (istemplatekind(digits, "*")) { |
| 656 | return *; |
| 657 | } else { |
| 658 | return tr_Imsi(digits); |
| 659 | } |
| 660 | } |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 661 | |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 662 | /* 7.7.50 RAT Type */ |
| 663 | type enumerated GTP_RATType { |
| 664 | GTP_RAT_TYPE_RESERVED (0), |
| 665 | GTP_RAT_TYPE_UTRAN (1), |
| 666 | GTP_RAT_TYPE_GERAN (2), |
| 667 | GTP_RAT_TYPE_WLAN (3), |
| 668 | GTP_RAT_TYPE_GAN (4), |
| 669 | GTP_RAT_TYPE_HSPA_E (5), |
| 670 | GTP_RAT_TYPE_EUTRAN (6) |
| 671 | }; |
| 672 | template (value) RATType ts_RATType(template (value) OCT1 rat_type) := { |
| 673 | type_gtpc := '97'O, |
| 674 | lengthf := 1, |
| 675 | ratTypeValue := rat_type |
| 676 | } |
| 677 | function f_ts_RATType(template (omit) OCT1 rat_type := omit) return template (omit) RATType { |
| 678 | if (istemplatekind(rat_type, "omit")) { |
| 679 | return omit; |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 680 | } else { |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 681 | return ts_RATType(rat_type); |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 682 | } |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 683 | } |
| 684 | template (present) RATType tr_RATType(template (present) OCT1 rat_type) := { |
| 685 | type_gtpc := '97'O, |
| 686 | lengthf := 1, |
| 687 | ratTypeValue := rat_type |
| 688 | } |
| 689 | function f_tr_RATType(template OCT1 rat_type := *) return template RATType { |
| 690 | if (istemplatekind(rat_type, "omit")) { |
| 691 | return omit; |
| 692 | } else if (istemplatekind(rat_type, "*")) { |
| 693 | return *; |
| 694 | } else { |
| 695 | return tr_RATType(rat_type); |
| 696 | } |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 697 | } |
| 698 | |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 699 | template (value) RoutingAreaIdentity ts_RoutingAreaIdentity(template (value) hexstring mcc_digits, |
| 700 | template (value) hexstring mnc_digits, |
| 701 | template (value) OCT2 lac, |
| 702 | template (value) OCT1 rac) := { |
| 703 | type_gtpc := '03'O, |
| 704 | mcc_digits := mcc_digits, |
| 705 | mnc_digits := mnc_digits, |
| 706 | lac := lac, |
| 707 | rac := rac |
| 708 | } |
| 709 | |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 710 | template (value) GeographicLocationCGI |
| 711 | ts_GeographicLocationCGI(template (value) hexstring mcc, |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 712 | template (value) hexstring mnc, |
| 713 | template (value) OCT2 lac, |
| 714 | template (value) OCT2 cI_value) := |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 715 | { |
| 716 | mccDigit1 := mcc[0], |
| 717 | mccDigit2 := mcc[1], |
| 718 | mccDigit3 := mcc[2], |
| 719 | mncDigit3 := mnc[2], /* 'F'H for 2 digit MNC */ |
| 720 | mncDigit1 := mnc[0], |
| 721 | mncDigit2 := mnc[1], |
| 722 | lac := lac, |
| 723 | cI_value := cI_value |
| 724 | } |
| 725 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 726 | template (value) GTPC_PDUs ts_CreatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl, |
| 727 | BIT4 nsapi, EndUserAddress eua, octetstring apn, |
| 728 | octetstring sgsn_ip_sign, octetstring sgsn_ip_data, |
| 729 | octetstring msisdn, template (omit) ProtConfigOptions pco := omit, |
| 730 | template (omit) OCT1 ratType := omit, |
| 731 | template (omit) UserLocationInformation uli := omit, |
| 732 | template (omit) OCT2 charging_char := omit, |
| 733 | template (omit) OCT8 imeisv := omit, |
| 734 | template (omit) MS_TimeZone ms_tz := omit) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 735 | createPDPContextRequest := { |
| 736 | imsi := ts_Imsi(imsi), |
| 737 | rai := omit, |
| 738 | recovery := ts_Recovery(restart_ctr), |
| 739 | selectionMode := { |
| 740 | type_gtpc := '0F'O, |
| 741 | selectModeValue := '00'B, |
| 742 | spare := '111111'B |
| 743 | }, |
| 744 | teidDataI := { |
| 745 | type_gtpc := '00'O, |
| 746 | teidDataI := teid_data |
| 747 | }, |
| 748 | teidControlPlane := { |
| 749 | type_gtpc := '00'O, |
| 750 | teidControlPlane := teid_ctrl |
| 751 | }, |
| 752 | nsapi := { |
| 753 | type_gtpc := '00'O, |
| 754 | nsapi := nsapi, |
| 755 | unused := '0000'B |
| 756 | }, |
| 757 | linked_nsapi := omit, |
Pau Espin Pedrol | 0e12787 | 2022-05-12 17:58:50 +0200 | [diff] [blame] | 758 | charging_char := f_ts_ChargingCharacteristics(charging_char), |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 759 | trace_ref := omit, |
| 760 | trace_type := omit, |
| 761 | endUserAddress := eua, |
| 762 | accessPointName := ts_APN(apn), |
| 763 | protConfigOptions := pco, |
| 764 | sgsn_addr_signalling := ts_GsnAddr(sgsn_ip_sign), |
| 765 | sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data), |
| 766 | msisdn := ts_Msisdn(msisdn), |
| 767 | qualityOfServiceProfile := ts_QosDefault, |
| 768 | tft := omit, |
| 769 | triggerId := omit, |
| 770 | omcId := omit, |
| 771 | commonFlags := omit, |
| 772 | aPN_Restriction := omit, |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 773 | ratType := f_ts_RATType(ratType), |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 774 | userLocationInformation := uli, |
Pau Espin Pedrol | 535ca26 | 2022-05-16 14:07:17 +0200 | [diff] [blame] | 775 | mS_TimeZone := ms_tz, |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 776 | imeisv := f_ts_IMEISV(imeisv), |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 777 | camelChargingInformationContainer := omit, |
| 778 | additionalTraceInfo := omit, |
| 779 | correlationID := omit, |
| 780 | evolvedAllocationRetentionPriorityI := omit, |
| 781 | extendedCommonFlags := omit, |
| 782 | userCSGInformation := omit, |
| 783 | aPN_AMBR := omit, |
| 784 | signallingPriorityIndication := omit, |
| 785 | cN_OperatorSelectionEntity := omit, |
| 786 | private_extension_gtpc := omit |
| 787 | } |
| 788 | } |
| 789 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 790 | template (value) Gtp1cUnitdata ts_GTPC_CreatePDP(GtpPeer peer, uint16_t seq, hexstring imsi, |
| 791 | OCT1 restart_ctr, OCT4 teid_data, |
| 792 | OCT4 teid_ctrl, BIT4 nsapi, EndUserAddress eua, |
| 793 | octetstring apn, octetstring sgsn_ip_sign, |
| 794 | octetstring sgsn_ip_data, octetstring msisdn, |
| 795 | template (omit) ProtConfigOptions pco := omit, |
| 796 | template (omit) OCT1 ratType := omit, |
| 797 | template (omit) UserLocationInformation uli := omit, |
| 798 | template (omit) OCT2 charging_char := omit, |
| 799 | template (omit) OCT8 imeisv := omit, |
| 800 | template (omit) MS_TimeZone ms_tz := omit) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 801 | peer := peer, |
| 802 | gtpc := ts_GTP1C_PDU(createPDPContextRequest, '00000000'O, |
| 803 | valueof(ts_CreatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl, |
| 804 | nsapi, eua, apn, sgsn_ip_sign, |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 805 | sgsn_ip_data, msisdn, pco, ratType, uli, |
Pau Espin Pedrol | 535ca26 | 2022-05-16 14:07:17 +0200 | [diff] [blame] | 806 | charging_char, imeisv, ms_tz)), seq) |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 807 | } |
| 808 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 809 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 810 | template (value) GTPC_PDUs ts_UpdatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl, |
| 811 | BIT4 nsapi, |
| 812 | octetstring sgsn_ip_sign, octetstring sgsn_ip_data, |
| 813 | template (omit) ProtConfigOptions pco := omit, |
| 814 | template (omit) OCT1 ratType := omit, |
| 815 | template (omit) UserLocationInformation uli := omit) := { |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 816 | updatePDPContextRequest := { |
| 817 | updatePDPContextRequestSGSN := { |
| 818 | imsi := ts_Imsi(imsi), |
| 819 | rai := omit, |
| 820 | recovery := ts_Recovery(restart_ctr), |
| 821 | teidDataI := { |
| 822 | type_gtpc := '00'O, |
| 823 | teidDataI := teid_data |
| 824 | }, |
| 825 | teidControlPlane := { |
| 826 | type_gtpc := '00'O, |
| 827 | teidControlPlane := teid_ctrl |
| 828 | }, |
| 829 | nsapi := { |
| 830 | type_gtpc := '00'O, |
| 831 | nsapi := nsapi, |
| 832 | unused := '0000'B |
| 833 | }, |
| 834 | trace_ref := omit, |
| 835 | trace_type := omit, |
| 836 | protConfigOptions := pco, |
| 837 | sgsn_addr_controlPlane := ts_GsnAddr(sgsn_ip_sign), |
| 838 | sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data), |
| 839 | alt_ggsn_addr_controlPane := omit, |
| 840 | alt_ggsn_addr_traffic := omit, |
| 841 | qualityOfServiceProfile := ts_QosDefault, |
| 842 | tft := omit, |
| 843 | triggerId := omit, |
| 844 | omcId := omit, |
| 845 | commonFlags := omit, |
| 846 | ratType := f_ts_RATType(ratType), |
| 847 | userLocationInformation := uli, |
| 848 | mS_TimeZone := omit, |
| 849 | additionalTraceInfo := omit, |
| 850 | directTunnelFlags := omit, |
| 851 | evolvedAllocationRetentionPriorityI := omit, |
| 852 | extendedCommonFlags := omit, |
| 853 | userCSGInformation := omit, |
| 854 | aPN_AMBR := omit, |
| 855 | signallingPriorityIndication := omit, |
| 856 | cN_OperatorSelectionEntity := omit, |
| 857 | private_extension_gtpc := omit |
| 858 | } |
| 859 | } |
| 860 | } |
| 861 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 862 | template (value) Gtp1cUnitdata ts_GTPC_UpdatePDP(GtpPeer peer, OCT4 teid, uint16_t seq, hexstring imsi, |
| 863 | OCT1 restart_ctr, OCT4 teid_data, |
| 864 | OCT4 teid_ctrl, BIT4 nsapi, octetstring sgsn_ip_sign, |
| 865 | octetstring sgsn_ip_data, |
| 866 | template (omit) ProtConfigOptions pco := omit, |
| 867 | template (omit) OCT1 ratType := omit, |
| 868 | template (omit) UserLocationInformation uli := omit) := { |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 869 | peer := peer, |
| 870 | gtpc := ts_GTP1C_PDU(updatePDPContextRequest, teid, |
| 871 | valueof(ts_UpdatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl, |
| 872 | nsapi, sgsn_ip_sign, |
| 873 | sgsn_ip_data, pco, ratType, uli)), seq) |
| 874 | } |
| 875 | |
| 876 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 877 | template (value) NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 878 | type_gtpc := '14'O, |
| 879 | nsapi := nsapi, |
| 880 | unused := '0000'B |
| 881 | } |
| 882 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 883 | template (value) ReorderingRequired ts_ReorderReq(boolean req := false) := { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 884 | type_gtpc := '08'O, |
| 885 | reordreq := bool2bit(req), |
| 886 | spare := '0000000'B |
| 887 | } |
| 888 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 889 | template (value) GTPC_PDUs ts_CreatePdpRespPDU(OCT1 cause, OCT4 teid_data, OCT4 teid_ctrl, BIT4 nsapi, |
| 890 | octetstring ggsn_ip_sign, octetstring ggsn_ip_data, |
| 891 | OCT4 chg_id, template (omit) EndUserAddress eua := omit, |
| 892 | template (omit) Recovery_gtpc recovery := omit, |
| 893 | template (omit) ProtConfigOptions pco := omit) := { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 894 | createPDPContextResponse := { |
| 895 | cause := { '00'O, cause }, |
| 896 | reorderingRequired := ts_ReorderReq(false), |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 897 | recovery := recovery, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 898 | teidDataI := { |
| 899 | type_gtpc := '00'O, |
| 900 | teidDataI := teid_data |
| 901 | }, |
| 902 | teidControlPlane := { |
| 903 | type_gtpc := '00'O, |
| 904 | teidControlPlane := teid_ctrl |
| 905 | }, |
| 906 | nsapi := ts_NSAPI(nsapi), |
Harald Welte | 7aff2ca | 2018-02-18 15:34:50 +0100 | [diff] [blame] | 907 | chargingID := { |
| 908 | type_gtpc := '7F'O, |
| 909 | chargingID := chg_id |
| 910 | }, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 911 | endUserAddress := eua, |
| 912 | protConfigOptions := pco, |
| 913 | ggsn_addr_controlPlane := ts_GsnAddr(ggsn_ip_sign), |
| 914 | ggsn_addr_traffic := ts_GsnAddr(ggsn_ip_data), |
| 915 | alt_ggsn_addr_controlPane := omit, |
| 916 | alt_ggsn_addr_traffic := omit, |
| 917 | qualityOfServiceProfile := ts_QosDefault, |
| 918 | commonFlags := omit, |
| 919 | aPN_Restriction := omit, |
| 920 | mS_InfoChangeReportingAction := omit, |
| 921 | bearerControlMode := omit, |
| 922 | evolvedAllocationRetentionPriorityI := omit, |
| 923 | extendedCommonFlag := omit, |
| 924 | csg_information_reporting_action := omit, |
| 925 | aPN_AMBR := omit, |
| 926 | gGSN_BackOffTime := omit, |
| 927 | private_extension_gtpc := omit |
| 928 | } |
| 929 | } |
| 930 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 931 | template (value) Gtp1cUnitdata ts_GTPC_CreatePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid, |
| 932 | OCT1 cause, |
| 933 | OCT4 teid_ctrl, OCT4 teid_data, |
| 934 | BIT4 nsapi, octetstring ggsn_ip_sign, |
| 935 | octetstring ggsn_ip_data, OCT4 chg_id, |
| 936 | template (omit) EndUserAddress eua := omit, |
| 937 | template (omit) Recovery_gtpc recovery := omit, |
| 938 | template (omit) ProtConfigOptions pco := omit) := { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 939 | peer := peer, |
| 940 | gtpc := ts_GTP1C_PDU(createPDPContextResponse, teid, |
| 941 | valueof(ts_CreatePdpRespPDU(cause, teid_data, teid_ctrl, nsapi, |
Harald Welte | 7aff2ca | 2018-02-18 15:34:50 +0100 | [diff] [blame] | 942 | ggsn_ip_sign, ggsn_ip_data, chg_id, |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 943 | eua, recovery, pco)), seq) |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 944 | } |
| 945 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 946 | /* PCO send base template */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 947 | template (value) ProtConfigOptions ts_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 948 | type_gtpc := '84'O, |
| 949 | lengthf := 0, |
| 950 | configProtocol := '000'B, |
| 951 | spare := '0000'B, |
| 952 | extension0 := '1'B, |
| 953 | protocols := {} |
| 954 | } |
| 955 | /* PCO receive base template */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 956 | template (present) ProtConfigOptions tr_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 957 | type_gtpc := '84'O, |
| 958 | lengthf := ?, |
| 959 | configProtocol := '000'B, |
| 960 | spare := ?, |
| 961 | extension0 := '1'B, |
| 962 | protocols := {} |
| 963 | } |
| 964 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 965 | template (value) ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 966 | protocols := { |
| 967 | { protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O } |
| 968 | } |
| 969 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 970 | template (present) ProtConfigOptions tr_PCO_IPv6_DNS_resp(template (present) OCT16 contents) modifies tr_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 971 | protocols := { |
| 972 | *, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, * |
| 973 | } |
| 974 | } |
| 975 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 976 | template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP modifies ts_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 977 | protocols := { |
| 978 | /* dummy PAP entry to check if our parser in the GGSN can properly iterate over |
| 979 | * the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */ |
| 980 | { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O }, |
| 981 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 982 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) } |
| 983 | } |
| 984 | } |
| 985 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 986 | template (value) ProtConfigOptions ts_PCO_IPv4_PRI_DNS_IPCP modifies ts_PCO := { |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 987 | protocols := { |
| 988 | /* dummy PAP entry to check if our parser can cope with a single primary DNS entry |
| 989 | * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */ |
| 990 | { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O }, |
| 991 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 992 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) } |
| 993 | } |
| 994 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 995 | template (value) ProtConfigOptions ts_PCO_IPv4_SEC_DNS_IPCP modifies ts_PCO := { |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 996 | protocols := { |
| 997 | /* dummy PAP entry to check if our parser can cope with a single secondary DNS entry |
| 998 | * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */ |
| 999 | { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O }, |
| 1000 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 1001 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) } |
| 1002 | } |
| 1003 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1004 | template (value) ProtConfigOptions ts_PCO_IPv4_SEPARATE_DNS_IPCP modifies ts_PCO := { |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1005 | protocols := { |
| 1006 | /* dummy PAP entry to check if our parser can cope with a primary and secondary DNS |
| 1007 | * in separate IPCP containers OS#3381 */ |
| 1008 | { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O }, |
| 1009 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 1010 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) }, |
| 1011 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 1012 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) } |
| 1013 | } |
| 1014 | } |
| 1015 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1016 | template (present) ProtocolElement tr_PCO_Proto(OCT2 prot_id) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1017 | protocolID := prot_id, |
| 1018 | lengthProtoID := ?, |
| 1019 | protoIDContents := ? |
| 1020 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1021 | template (value) ProtocolElement ts_PCOelem_PAP_broken := { |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 1022 | protocolID := 'C023'O, |
| 1023 | lengthProtoID := 60, |
| 1024 | /* PPP Password Authentication Protocol containing incorrect Peer-Id-Length set to 4 (6-7 should be the valid one), see OS#3914. */ |
| 1025 | protoIDContents := '0100003c'O & '0444435338323700bc1c08087c1508083e00790000150808fd06000001000000000000000000000000000000000000000000000000000000'O |
| 1026 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1027 | template (value) ProtConfigOptions ts_PCO_PAP_IPv4_DNS modifies ts_PCO := { |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 1028 | protocols := { |
| 1029 | ts_PCOelem_PAP_broken, |
| 1030 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) } |
| 1031 | } |
| 1032 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1033 | template (present) ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1034 | protocols := { *, tr_PCO_Proto(prot_id), * } |
| 1035 | } |
| 1036 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1037 | template (value) ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1038 | protocols := { |
| 1039 | { protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O } |
| 1040 | } |
| 1041 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1042 | template (present) ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template (present) OCT4 contents) modifies tr_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1043 | protocols := { |
| 1044 | *, { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }, * |
| 1045 | } |
| 1046 | } |
| 1047 | |
| 1048 | /* extract a given protocol payload from PCO */ |
| 1049 | function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring { |
| 1050 | var integer i; |
| 1051 | var integer num_matches := 0; |
| 1052 | for (i := 0; i < lengthof(pco.protocols); i := i + 1) { |
| 1053 | if (pco.protocols[i].protocolID == protocol) { |
| 1054 | num_matches := num_matches + 1; |
| 1055 | if (num_matches == nth_match) { |
| 1056 | return pco.protocols[i].protoIDContents; |
| 1057 | } |
| 1058 | } |
| 1059 | } |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 1060 | setverdict(fail, "Could not extract protocol payload from protocol ", protocol); |
| 1061 | mtc.stop; |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1062 | return ''O; |
| 1063 | } |
| 1064 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1065 | template (present) IpcpPacket tr_IPCP(template (present) LcpCode code, template (present)uint8_t identifier, |
| 1066 | template (present) IpcpOptionList opts) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1067 | code := code, |
| 1068 | identifier := identifier, |
| 1069 | len := ?, |
| 1070 | options := opts |
| 1071 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1072 | template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1073 | code := IPCP_OPT_PrimaryDNS, |
| 1074 | len := 6, |
| 1075 | data := addr |
| 1076 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1077 | template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1078 | code := IPCP_OPT_SecondaryDNS, |
| 1079 | len := 6, |
| 1080 | data := addr |
| 1081 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1082 | template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?, |
| 1083 | template (present) OCT4 dns1 := ?, |
| 1084 | template (present) OCT4 dns2 := ?) := |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1085 | tr_IPCP(LCP_Configure_Ack, identifier, |
| 1086 | { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * }); |
| 1087 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1088 | template (value) IpcpPacket ts_IPCP(LcpCode code, uint8_t identifier, template (value) IpcpOptionList opts) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1089 | code := code, |
| 1090 | identifier := identifier, |
| 1091 | len := 0, /* overwritten */ |
| 1092 | options := opts |
| 1093 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1094 | template (value) IpcpPacket ts_IPCP_ReqDNS(uint8_t identifier := 0) := |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1095 | ts_IPCP(LCP_Configure_Request, identifier, |
| 1096 | { tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) }); |
| 1097 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1098 | template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) := |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1099 | ts_IPCP(LCP_Configure_Request, identifier, |
| 1100 | { tr_IPCP_PrimaryDns('00000000'O) }); |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1101 | template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(uint8_t identifier := 0) := |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1102 | ts_IPCP(LCP_Configure_Request, identifier, |
| 1103 | { tr_IPCP_SecondaryDns('00000000'O) }); |
| 1104 | |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 1105 | function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd { |
| 1106 | if (istemplatekind(ind, "omit")) { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1107 | return omit; |
| 1108 | } |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1109 | var TearDownInd ret := { |
| 1110 | type_gtpc := '13'O, |
| 1111 | tdInd := valueof(ind), |
| 1112 | spare:= '0000000'B |
| 1113 | } |
| 1114 | return ret; |
| 1115 | } |
| 1116 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1117 | template (value) GTPC_PDUs ts_DeletePdpPDU(BIT4 nsapi, template (omit) BIT1 teardown_ind) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1118 | deletePDPContextRequest := { |
| 1119 | cause := omit, |
| 1120 | tearDownIndicator := f_teardown_ind_IE(teardown_ind), |
| 1121 | nsapi := { |
| 1122 | type_gtpc := '14'O, |
| 1123 | nsapi := nsapi, |
| 1124 | unused := '0000'B |
| 1125 | }, |
| 1126 | protConfigOptions := omit, |
| 1127 | userLocationInformation := omit, |
| 1128 | mS_TimeZone := omit, |
| 1129 | extendedCommonFlags := omit, |
| 1130 | uLI_Timestamp := omit, |
| 1131 | private_extension_gtpc := omit |
| 1132 | } |
| 1133 | } |
| 1134 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1135 | template (value) Gtp1cUnitdata ts_GTPC_DeletePDP(GtpPeer peer, uint16_t seq, OCT4 teid, |
| 1136 | BIT4 nsapi, template (omit) BIT1 teardown_ind) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1137 | peer := peer, |
| 1138 | gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid, |
| 1139 | valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq) |
| 1140 | } |
| 1141 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1142 | template (value) GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause, |
| 1143 | template (omit) ProtConfigOptions pco := omit) := { |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1144 | deletePDPContextResponse := { |
| 1145 | cause := { '00'O, cause }, |
| 1146 | protConfigOptions := pco, |
| 1147 | userLocationInformation := omit, |
| 1148 | mS_TimeZone := omit, |
| 1149 | uLI_Timestamp := omit, |
| 1150 | private_extension_gtpc := omit |
| 1151 | } |
| 1152 | } |
| 1153 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1154 | template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid, |
| 1155 | OCT1 cause, |
| 1156 | template (omit) ProtConfigOptions pco := omit) := { |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1157 | peer := peer, |
| 1158 | gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid, |
| 1159 | valueof(ts_DeletePdpRespPDU(cause, pco)), seq) |
| 1160 | } |
| 1161 | |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 1162 | /* SGSN Context Request - 7.5.3 */ |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 1163 | template (present) GTPC_PDUs tr_SGSNContextReqPDU(template (present) RoutingAreaIdentity rai := ?, |
| 1164 | template (present) OCT4 teic := ?, |
| 1165 | template (present) octetstring sgsn_addr_control := ?, |
| 1166 | template hexstring imsi := *, |
| 1167 | template BIT1 msValidated := *, |
| 1168 | template TLLI tlli := *, |
| 1169 | template PacketTMSI ptmsi := *, |
| 1170 | template PTMSI_Signature ptmsi_sig := *, |
| 1171 | template OCT1 rat_type := *) := { |
| 1172 | sgsn_ContextRequest := { |
| 1173 | imsi := f_tr_Imsi(imsi), |
| 1174 | routingAreaIdentity := rai, |
| 1175 | tlli := tlli, |
| 1176 | packetTMSI := ptmsi, |
| 1177 | ptmsi_Signature := ptmsi_sig, |
| 1178 | ms_Validated := f_tr_MS_Validated(msValidated), |
| 1179 | teidControlPlane := { |
| 1180 | type_gtpc := '11'O, |
| 1181 | teidControlPlane := teic |
| 1182 | }, |
| 1183 | sgsn_addr_controlPlane := tr_GsnAddr(sgsn_addr_control), |
| 1184 | alternative_sgsn_addr_controlPlane := *, |
| 1185 | sGSN_Number := *, |
| 1186 | ratType := f_tr_RATType(rat_type), |
| 1187 | hopCounter := *, |
| 1188 | private_extension_gtpc := * |
| 1189 | } |
| 1190 | } |
| 1191 | template (present) Gtp1cUnitdata tr_GTPC_SGSNContextReq(template (present) GtpPeer peer, |
| 1192 | template (present) GTPC_PDUs SGSNContextReqPDU) := { |
| 1193 | peer := peer, |
| 1194 | gtpc := tr_GTP1C_PDU(sgsnContextRequest, '00000000'O, SGSNContextReqPDU) |
| 1195 | } |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 1196 | template (value) GTPC_PDUs ts_SGSNContextReqPDU(template (value) RoutingAreaIdentity rai, |
| 1197 | template (value) OCT4 teic, |
| 1198 | template (value) octetstring sgsn_addr_control, |
| 1199 | template (omit) hexstring imsi := omit, |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 1200 | template (omit) BIT1 msValidated := '0'B, |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 1201 | template (omit) TLLI tlli := omit, |
| 1202 | template (omit) PacketTMSI ptmsi := omit, |
| 1203 | template (omit) PTMSI_Signature ptmsi_sig := omit, |
| 1204 | template (omit) OCT1 rat_type := omit) := { |
| 1205 | sgsn_ContextRequest := { |
| 1206 | imsi := f_ts_Imsi(imsi), |
| 1207 | routingAreaIdentity := rai, |
| 1208 | tlli := tlli, |
| 1209 | packetTMSI := ptmsi, |
| 1210 | ptmsi_Signature := ptmsi_sig, |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 1211 | ms_Validated := f_ts_MS_Validated(msValidated), |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 1212 | teidControlPlane := { |
| 1213 | type_gtpc := '11'O, |
| 1214 | teidControlPlane := teic |
| 1215 | }, |
| 1216 | sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control), |
| 1217 | alternative_sgsn_addr_controlPlane := omit, |
| 1218 | sGSN_Number := omit, |
| 1219 | ratType := f_ts_RATType(rat_type), |
| 1220 | hopCounter := omit, |
| 1221 | private_extension_gtpc := omit |
| 1222 | } |
| 1223 | } |
| 1224 | template (value) Gtp1cUnitdata ts_GTPC_SGSNContextReq(GtpPeer peer, uint16_t seq, |
| 1225 | template (value) GTPC_PDUs SGSNContextReqPDU) := { |
| 1226 | peer := peer, |
| 1227 | gtpc := ts_GTP1C_PDU(sgsnContextRequest, '00000000'O, valueof(SGSNContextReqPDU), seq) |
| 1228 | } |
| 1229 | |
| 1230 | /* SGSN Context Response - 7.5.4 */ |
| 1231 | template (present) GTPC_PDUs tr_SGSNContextRespPDU(template (present) GTP_Cause cause := ?, |
| 1232 | template hexstring imsi := *) := { |
| 1233 | sgsn_ContextResponse := { |
| 1234 | cause := tr_Cause_gtpc(cause), |
| 1235 | imsi := f_tr_Imsi(imsi), |
| 1236 | teidControlPlane := *, |
| 1237 | rabContext := *, |
| 1238 | radioPrioritySMS := *, |
| 1239 | radioPriority := *, |
| 1240 | packetFlowID := *, |
| 1241 | charging_char := *, |
| 1242 | mm_Context := *, |
| 1243 | pdp_Context := *, |
| 1244 | sgsn_addr_controlPlane := *, |
| 1245 | pdpContextPriorization := *, |
| 1246 | radioPriority_LCS := *, |
| 1247 | mBMS_UE_Context := *, |
| 1248 | subscribedRFSP_Index := *, |
| 1249 | rFSP_IndexInUse := *, |
| 1250 | colocatedGGSN_PGW_FQDN := *, |
| 1251 | evolvedAllocationRetentionPriorityII := *, |
| 1252 | extendedCommonFlags := *, |
| 1253 | ue_network_capability := *, |
| 1254 | ue_ambr := *, |
| 1255 | apn_ambr_nsapi := *, |
| 1256 | signallingPriorityIndication_nsapi := *, |
| 1257 | higher_bitrates_than_16mbps_flag := *, |
| 1258 | selectionMode_nsapi := *, |
| 1259 | localHomeNetworkID_nsapi := *, |
| 1260 | uE_UsageType := *, |
| 1261 | extendedCommonFlagsII := *, |
| 1262 | private_extension_gtpc := * |
| 1263 | } |
| 1264 | } |
| 1265 | template (present) Gtp1cUnitdata tr_GTPC_SGSNContextResp(template (present) GtpPeer peer := ?, |
| 1266 | template (present) OCT4 teid := ?, |
| 1267 | template (present) GTPC_PDUs SGSNContextRespPDU := ?) |
| 1268 | := tr_GTPC_MsgType(peer, sgsnContextResponse, teid, SGSNContextRespPDU); |
| 1269 | |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 1270 | template (value) GTPC_PDUs ts_SGSNContextRespPDU(template (value) GTP_Cause cause, |
| 1271 | template (omit) hexstring imsi := omit, |
| 1272 | template (omit) OCT4 teic := omit, |
| 1273 | template (omit) octetstring sgsn_addr_control := omit, |
| 1274 | template (omit) MM_Context mm_context := omit, |
| 1275 | template (omit) PDP_Context_GTPC_List pdp_ctx_list := omit) := { |
| 1276 | sgsn_ContextResponse := { |
| 1277 | cause := ts_Cause_gtpc(cause), |
| 1278 | imsi := f_ts_Imsi(imsi), |
| 1279 | teidControlPlane := f_ts_TEIC(teic), |
| 1280 | rabContext := omit, |
| 1281 | radioPrioritySMS := omit, |
| 1282 | radioPriority := omit, |
| 1283 | packetFlowID := omit, |
| 1284 | charging_char := omit, |
| 1285 | mm_Context := mm_context, |
| 1286 | pdp_Context := pdp_ctx_list, |
| 1287 | sgsn_addr_controlPlane := ts_GsnAddr(sgsn_addr_control), |
| 1288 | pdpContextPriorization := omit, |
| 1289 | radioPriority_LCS := omit, |
| 1290 | mBMS_UE_Context := omit, |
| 1291 | subscribedRFSP_Index := omit, |
| 1292 | rFSP_IndexInUse := omit, |
| 1293 | colocatedGGSN_PGW_FQDN := omit, |
| 1294 | evolvedAllocationRetentionPriorityII := omit, |
| 1295 | extendedCommonFlags := omit, |
| 1296 | ue_network_capability := omit, |
| 1297 | ue_ambr := omit, |
| 1298 | apn_ambr_nsapi := omit, |
| 1299 | signallingPriorityIndication_nsapi := omit, |
| 1300 | higher_bitrates_than_16mbps_flag := omit, |
| 1301 | selectionMode_nsapi := omit, |
| 1302 | localHomeNetworkID_nsapi := omit, |
| 1303 | uE_UsageType := omit, |
| 1304 | extendedCommonFlagsII := omit, |
| 1305 | private_extension_gtpc := omit |
| 1306 | } |
| 1307 | } |
| 1308 | template (value) Gtp1cUnitdata ts_GTPC_SGSNContextResp(GtpPeer peer, OCT4 teid, uint16_t seq, |
| 1309 | template (value) GTPC_PDUs SGSNContextRespPDU) := { |
| 1310 | peer := peer, |
| 1311 | gtpc := ts_GTP1C_PDU(sgsnContextResponse, teid, valueof(SGSNContextRespPDU), seq) |
| 1312 | } |
| 1313 | |
| 1314 | |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 1315 | /* SGSN Context Acknowledge - 7.5.5 */ |
Pau Espin Pedrol | f95460b | 2024-01-09 10:25:15 +0100 | [diff] [blame] | 1316 | template (present) GTPC_PDUs tr_SGSNContextAckPDU(template (present) GTP_Cause cause := ?) := { |
| 1317 | sgsn_ContextAcknowledge := { |
| 1318 | cause := tr_Cause_gtpc(cause), |
| 1319 | teidDataII := *, |
| 1320 | sgsn_AddressForUserTraffic := *, |
| 1321 | sgsn_Number := *, |
| 1322 | nodeIdentifier := *, |
| 1323 | private_extension_gtpc := * |
| 1324 | } |
| 1325 | } |
| 1326 | template (present) Gtp1cUnitdata tr_GTPC_SGSNContextAck(template (present) GtpPeer peer := ?, |
| 1327 | template (present) OCT4 teid := ?, |
| 1328 | template (present) GTPC_PDUs SGSNContextAckPDU := ?) |
| 1329 | := tr_GTPC_MsgType(peer, sgsnContextAcknowledge, teid, SGSNContextAckPDU); |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 1330 | template (value) GTPC_PDUs ts_SGSNContextAckPDU(template (value) GTP_Cause cause := GTP_CAUSE_REQUEST_ACCEPTED) := { |
| 1331 | sgsn_ContextAcknowledge := { |
| 1332 | cause := ts_Cause_gtpc(cause), |
| 1333 | teidDataII := omit, |
| 1334 | sgsn_AddressForUserTraffic := omit, |
| 1335 | sgsn_Number := omit, |
| 1336 | nodeIdentifier := omit, |
| 1337 | private_extension_gtpc := omit |
| 1338 | } |
| 1339 | } |
Pau Espin Pedrol | ca651b5 | 2023-12-20 18:37:39 +0100 | [diff] [blame] | 1340 | template (value) Gtp1cUnitdata ts_GTPC_SGSNContextAck(GtpPeer peer, OCT4 teid, uint16_t seq, |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 1341 | template (value) GTPC_PDUs SGSNContextAckPDU := ts_SGSNContextAckPDU(GTP_CAUSE_REQUEST_ACCEPTED)) := { |
| 1342 | peer := peer, |
Pau Espin Pedrol | ca651b5 | 2023-12-20 18:37:39 +0100 | [diff] [blame] | 1343 | gtpc := ts_GTP1C_PDU(sgsnContextAcknowledge, teid, valueof(SGSNContextAckPDU), seq) |
Pau Espin Pedrol | 408e0ae | 2023-12-15 18:56:31 +0100 | [diff] [blame] | 1344 | } |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 1345 | |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1346 | /* GTP-C RIM */ |
| 1347 | |
| 1348 | template (value) RIM_Application_Identity_GTPC ts_GTPC_RIM_Application_Identity(OCT1 app_id) := { |
| 1349 | iEI := '4B'O, |
| 1350 | ext := '1'B, |
| 1351 | lengthIndicator := { |
| 1352 | length1 := 1 |
| 1353 | }, |
| 1354 | rIMApplicationIdentity := app_id |
| 1355 | } |
| 1356 | /* 3GPP TS 48.018 11.3.62 */ |
| 1357 | template (value) RIM_Sequence_Number_GTPC ts_GTPC_RIM_Sequence_Number(integer seq) := { |
| 1358 | iEI := '4C'O, |
| 1359 | ext := '1'B, |
| 1360 | lengthIndicator := { |
| 1361 | length1 := 4 |
| 1362 | }, |
| 1363 | rIMSequenceNumber := int2oct(seq, 4) |
| 1364 | } |
| 1365 | template (value) RIM_PDU_Indications_GTPC ts_GTPC_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := { |
| 1366 | iEI := '4F'O, |
| 1367 | ext := '1'B, |
| 1368 | lengthIndicator := { |
| 1369 | length1 := 1 |
| 1370 | }, |
| 1371 | ack := bool2bit(ack), |
| 1372 | pDU_Type_Extension := type_ext, |
| 1373 | reserved := '0000'B |
| 1374 | } |
| 1375 | /* 3GPP TS 48.018 11.3.67 */ |
| 1376 | template (value) RIM_Protocol_Version_Number_GTPC ts_GTPC_RIM_Protocol_Version_Number(integer ver) := { |
| 1377 | iEI := '55'O, |
| 1378 | ext := '1'B, |
| 1379 | lengthIndicator := { |
| 1380 | length1 := 1 |
| 1381 | }, |
| 1382 | rIMProtocolVersionNumber := int2oct(ver, 1) |
| 1383 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1384 | function tr_GTPC_Cell_Identifier_V(template (present) GTP_CellId cid) return template (present) Cell_Identifier_V_GTPC { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1385 | var template Cell_Identifier_V_GTPC ret := { |
| 1386 | mccDigit1 := ?, |
| 1387 | mccDigit2 := ?, |
| 1388 | mccDigit3 := ?, |
| 1389 | mncDigit3 := ?, |
| 1390 | mncDigit1 := ?, |
| 1391 | mncDigit2 := ?, |
| 1392 | lac := ?, |
| 1393 | rac := ?, |
| 1394 | cI_value := ? |
| 1395 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1396 | if (istemplatekind(cid, "?")) { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1397 | return ?; |
| 1398 | } |
| 1399 | if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) { |
| 1400 | if (isvalue(cid.ra_id.lai.mcc_mnc)) { |
| 1401 | ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0]; |
| 1402 | ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1]; |
| 1403 | ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2]; |
| 1404 | ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3]; |
| 1405 | ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4]; |
| 1406 | ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5]; |
| 1407 | } |
| 1408 | if (isvalue(cid.ra_id.lai.lac)) { |
| 1409 | ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2); |
| 1410 | } |
| 1411 | } |
| 1412 | if (isvalue(cid) and isvalue(cid.ra_id)) { |
| 1413 | ret.rac := f_oct_or_wc(cid.ra_id.rac, 1); |
| 1414 | } |
| 1415 | if (isvalue(cid)) { |
| 1416 | ret.cI_value := f_oct_or_wc(cid.cell_id, 2); |
| 1417 | } |
| 1418 | return ret; |
| 1419 | } |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1420 | template (value) Cell_Identifier_V_GTPC ts_GTPC_Cell_Identifier_V(GTP_CellId cid) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1421 | mccDigit1 := cid.ra_id.lai.mcc_mnc[0], |
| 1422 | mccDigit2 := cid.ra_id.lai.mcc_mnc[1], |
| 1423 | mccDigit3 := cid.ra_id.lai.mcc_mnc[2], |
| 1424 | mncDigit3 := cid.ra_id.lai.mcc_mnc[3], |
| 1425 | mncDigit1 := cid.ra_id.lai.mcc_mnc[4], |
| 1426 | mncDigit2 := cid.ra_id.lai.mcc_mnc[5], |
| 1427 | lac := int2oct(cid.ra_id.lai.lac, 2), |
| 1428 | rac := int2oct(cid.ra_id.rac, 1), |
| 1429 | cI_value := int2oct(cid.cell_id, 2) |
| 1430 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1431 | template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_cid(GTP_CellId cid) := { |
| 1432 | cell_Identifier := ts_GTPC_Cell_Identifier_V(cid) |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1433 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1434 | function tr_GTPC_ENB_Identifier(template (present) GTP_CellId cid, |
| 1435 | template (present) integer tac, |
| 1436 | template (present) octetstring gnbid) return template (present) ENB_Identifier { |
| 1437 | var template (present) ENB_Identifier ret := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1438 | mccDigit1 := ?, |
| 1439 | mccDigit2 := ?, |
| 1440 | mccDigit3 := ?, |
| 1441 | mncDigit3 := ?, |
| 1442 | mncDigit1 := ?, |
| 1443 | mncDigit2 := ?, |
| 1444 | tAC := ?, |
| 1445 | globalENB_ID := ? |
| 1446 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1447 | if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1448 | return ?; |
| 1449 | } |
| 1450 | if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) { |
| 1451 | if (isvalue(cid.ra_id.lai.mcc_mnc)) { |
| 1452 | ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0]; |
| 1453 | ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1]; |
| 1454 | ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2]; |
| 1455 | ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3]; |
| 1456 | ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4]; |
| 1457 | ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5]; |
| 1458 | } |
| 1459 | } |
| 1460 | if (isvalue(tac)) { |
| 1461 | ret.tAC := int2oct(valueof(tac), 2); |
| 1462 | } |
| 1463 | if (isvalue(gnbid)) { |
| 1464 | ret.globalENB_ID := gnbid; |
| 1465 | } |
| 1466 | |
| 1467 | return ret; |
| 1468 | } |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1469 | template (value) ENB_Identifier ts_GTPC_ENB_Identifier(GTP_CellId cid, integer tac, octetstring gnbid) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1470 | mccDigit1 := cid.ra_id.lai.mcc_mnc[0], |
| 1471 | mccDigit2 := cid.ra_id.lai.mcc_mnc[1], |
| 1472 | mccDigit3 := cid.ra_id.lai.mcc_mnc[2], |
| 1473 | mncDigit3 := cid.ra_id.lai.mcc_mnc[3], |
| 1474 | mncDigit1 := cid.ra_id.lai.mcc_mnc[4], |
| 1475 | mncDigit2 := cid.ra_id.lai.mcc_mnc[5], |
| 1476 | tAC := int2oct(tac, 2), |
| 1477 | globalENB_ID := gnbid |
| 1478 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1479 | template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_enbid(GTP_CellId cid, integer tac, octetstring gnbid) := { |
| 1480 | eNB_Identifier := ts_GTPC_ENB_Identifier(cid, tac, gnbid) |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1481 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1482 | template (present) RIM_Routing_Information_GTPC |
| 1483 | tr_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (present) RIM_Routing_Address_GTPC addr) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1484 | iEI := '54'O, |
| 1485 | ext := '1'B, |
| 1486 | lengthIndicator := { |
| 1487 | length1 := ? |
| 1488 | }, |
| 1489 | rIMRoutingAddressDiscriminator := addr_discr, |
| 1490 | spare := '0'H, |
| 1491 | rIM_Routing_Address := addr |
| 1492 | } |
| 1493 | template (value) RIM_Routing_Information_GTPC |
| 1494 | ts_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address_GTPC addr) := { |
| 1495 | iEI := '54'O, |
| 1496 | ext := '1'B, |
| 1497 | lengthIndicator := { |
| 1498 | length1 := 0 /* overwritten */ |
| 1499 | }, |
| 1500 | rIMRoutingAddressDiscriminator := addr_discr, |
| 1501 | spare := '0'H, |
| 1502 | rIM_Routing_Address := addr |
| 1503 | } |
| 1504 | /* 3GPP TS 48.018 11.3.63.1.1 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1505 | template (present) RAN_Information_Request_Application_Container_NACC_GTPC |
| 1506 | tr_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1507 | iEI := '4D'O, |
| 1508 | ext := '1'B, |
| 1509 | lengthIndicator := { |
| 1510 | length1 := ? |
| 1511 | }, |
| 1512 | reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid) |
| 1513 | } |
| 1514 | template (value) RAN_Information_Request_Application_Container_NACC_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1515 | ts_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1516 | iEI := '4D'O, |
| 1517 | ext := '1'B, |
| 1518 | lengthIndicator := { |
| 1519 | length1 := 0 /* overwritten */ |
| 1520 | }, |
| 1521 | reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid) |
| 1522 | } |
| 1523 | /* 3GPP TS 48.018 11.3.63.1 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1524 | template (present) RAN_Information_Request_Application_Container_GTPC |
| 1525 | tru_GTPC_RAN_Information_Request_Application_Container_NACC(template (present) GTP_CellId cid) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1526 | nacc := tr_GTPC_RAN_Information_Request_Application_Container_NACC(cid) |
| 1527 | } |
| 1528 | template (value) RAN_Information_Request_Application_Container_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1529 | tsu_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1530 | nacc := ts_GTPC_RAN_Information_Request_Application_Container_NACC(cid) |
| 1531 | } |
| 1532 | /* 3GPP TS 48.018 11.3.63.2.1 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1533 | template (present) RAN_Information_Application_Container_NACC_GTPC |
| 1534 | tr_GTPC_RAN_Information_Application_Container_NACC(template (present) GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1535 | iEI := '4E'O, |
| 1536 | ext := '1'B, |
| 1537 | lengthIndicator := { |
| 1538 | length1 := ? |
| 1539 | }, |
| 1540 | reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid), |
| 1541 | typeBit := bool2bit(psi_type), |
| 1542 | number_of_SI_PSI := int2bit(si_psi_num, 7), |
| 1543 | sI_PSI := si_psi |
| 1544 | } |
| 1545 | template (value) RAN_Information_Application_Container_NACC_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1546 | ts_GTPC_RAN_Information_Application_Container_NACC(GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1547 | iEI := '4E'O, |
| 1548 | ext := '1'B, |
| 1549 | lengthIndicator := { |
| 1550 | length1 := 0 /* overwritten */ |
| 1551 | }, |
| 1552 | reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid), |
| 1553 | typeBit := bool2bit(psi_type), |
| 1554 | number_of_SI_PSI := int2bit(si_psi_num, 7), |
| 1555 | sI_PSI := si_psi |
| 1556 | } |
Philipp Maier | f7cb0bb | 2023-07-28 12:35:38 +0200 | [diff] [blame] | 1557 | external function enc_RIM_Routing_Address_GTPC(in RIM_Routing_Address_GTPC ra) return octetstring |
| 1558 | with { extension "prototype(convert) encode(RAW)" }; |
Philipp Maier | 21bac7a | 2023-08-24 12:40:17 +0200 | [diff] [blame] | 1559 | external function dec_RIM_Routing_Address_GTPC(in octetstring stream) return RIM_Routing_Address_GTPC |
Philipp Maier | f7cb0bb | 2023-07-28 12:35:38 +0200 | [diff] [blame] | 1560 | with { extension "prototype(convert) decode(RAW)" }; |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1561 | |
| 1562 | /* RAN_Information_Request */ |
| 1563 | template (value) RAN_Information_Request_RIM_Container_GTPC |
| 1564 | ts_GTPC_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id, |
| 1565 | template (value) RIM_Sequence_Number_GTPC seq, |
| 1566 | template (value) RIM_PDU_Indications_GTPC ind, |
| 1567 | template (omit) RIM_Protocol_Version_Number_GTPC ver := omit, |
| 1568 | template (omit) RAN_Information_Request_Application_Container_GTPC app_cont := omit, |
| 1569 | template (omit) SON_TransferApplicationIdentity son_app_id := omit) := { |
| 1570 | iEI := '57'O, |
| 1571 | ext := '1'B, |
| 1572 | lengthIndicator := { |
| 1573 | length1 := 0 /* overwritten */ |
| 1574 | }, |
| 1575 | rIM_Application_Identity := app_id, |
| 1576 | rIM_Sequence_Number := seq, |
| 1577 | rIM_PDU_Indications := ind, |
| 1578 | rIM_Protocol_Version_Number := ver, |
| 1579 | application_Container := app_cont, |
| 1580 | sON_TransferApplicationIdentity := son_app_id |
| 1581 | } |
| 1582 | template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC |
| 1583 | ts_GTPC_RAN_Information_Request(template (value) RIM_Routing_Information_GTPC dest, |
| 1584 | template (value) RIM_Routing_Information_GTPC src, |
Philipp Maier | 6cef1c3 | 2023-07-24 11:01:52 +0200 | [diff] [blame] | 1585 | template (value) RAN_Information_Request_RIM_Container_GTPC cont) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1586 | bssgpPduType := '71'O, |
| 1587 | destination_Cell_Identifier := dest, |
| 1588 | source_Cell_Identifier := src, |
| 1589 | rIM_Container := cont |
| 1590 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1591 | template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC |
| 1592 | tr_GTPC_RAN_Information_Request(template (present) RIM_Routing_Information_GTPC dest := ?, |
| 1593 | template (present) RIM_Routing_Information_GTPC src := ?, |
| 1594 | template (present) RAN_Information_Request_RIM_Container_GTPC cont := ?) := { |
Philipp Maier | 4b81c6e | 2023-07-24 11:03:15 +0200 | [diff] [blame] | 1595 | bssgpPduType := '71'O, |
| 1596 | destination_Cell_Identifier := dest, |
| 1597 | source_Cell_Identifier := src, |
| 1598 | rIM_Container := cont |
| 1599 | } |
| 1600 | |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1601 | template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO_REQ(template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu) := { |
| 1602 | type_gtpc := '90'O, |
| 1603 | lengthf := 0, /* FIXME */ |
| 1604 | rANTransparentContainerField := { |
| 1605 | pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu |
| 1606 | } |
| 1607 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1608 | template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO_REQ(template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu := ?) := { |
Philipp Maier | edce92f | 2023-07-26 11:02:10 +0200 | [diff] [blame] | 1609 | type_gtpc := '90'O, |
| 1610 | lengthf := ?, |
| 1611 | rANTransparentContainerField := { |
| 1612 | pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu |
| 1613 | } |
| 1614 | } |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1615 | |
| 1616 | /* RAN_Information */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1617 | template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1618 | tru_GTPC_ApplContainer_NACC(GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1619 | application_Container := tr_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi) |
| 1620 | } |
| 1621 | template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1622 | tsu_GTPC_ApplContainer_NACC(GTP_CellId cid, boolean psi_type, integer si_psi_num, octetstring si_psi) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1623 | application_Container := ts_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi) |
| 1624 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1625 | template (present) ApplContainer_or_ApplErrContainer_GTPC |
| 1626 | tru_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1627 | nacc := cont |
| 1628 | } |
| 1629 | template (value) ApplContainer_or_ApplErrContainer_GTPC |
| 1630 | tsu_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := { |
| 1631 | nacc := cont |
| 1632 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1633 | template (present) RAN_Information_RIM_Container_GTPC |
| 1634 | tr_GTPC_RAN_Information_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id, |
| 1635 | template (present) RIM_Sequence_Number_GTPC seq, |
| 1636 | template (present) RIM_PDU_Indications_GTPC ind, |
| 1637 | template RIM_Protocol_Version_Number_GTPC ver := *, |
| 1638 | template ApplContainer_or_ApplErrContainer_GTPC app_cont := *, |
| 1639 | template SON_TransferApplicationIdentity son_app_id := *) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1640 | iEI := '58'O, |
| 1641 | ext := '1'B, |
| 1642 | lengthIndicator := { |
| 1643 | length1 := ? |
| 1644 | }, |
| 1645 | rIM_Application_Identity := app_id, |
| 1646 | rIM_Sequence_Number := seq, |
| 1647 | rIM_PDU_Indications := ind, |
| 1648 | rIM_Protocol_Version_Number := ver, |
| 1649 | applContainer_or_ApplErrContainer := app_cont, |
| 1650 | sON_TransferApplicationIdentity := son_app_id |
| 1651 | } |
| 1652 | template (value) RAN_Information_RIM_Container_GTPC |
| 1653 | ts_GTPC_RAN_Information_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id, |
| 1654 | template (value) RIM_Sequence_Number_GTPC seq, |
| 1655 | template (value) RIM_PDU_Indications_GTPC ind, |
| 1656 | template (omit) RIM_Protocol_Version_Number_GTPC ver := omit, |
| 1657 | template (omit) ApplContainer_or_ApplErrContainer_GTPC app_cont := omit, |
| 1658 | template (omit) SON_TransferApplicationIdentity son_app_id := omit) := { |
| 1659 | iEI := '58'O, |
| 1660 | ext := '1'B, |
| 1661 | lengthIndicator := { |
| 1662 | length1 := 0 /* overwritten */ |
| 1663 | }, |
| 1664 | rIM_Application_Identity := app_id, |
| 1665 | rIM_Sequence_Number := seq, |
| 1666 | rIM_PDU_Indications := ind, |
| 1667 | rIM_Protocol_Version_Number := ver, |
| 1668 | applContainer_or_ApplErrContainer := app_cont, |
| 1669 | sON_TransferApplicationIdentity := son_app_id |
| 1670 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1671 | template (present) PDU_BSSGP_RAN_INFORMATION_GTPC |
| 1672 | tr_GTPC_RAN_Information(template (present) RIM_Routing_Information_GTPC dest, |
| 1673 | template (present) RIM_Routing_Information_GTPC src, |
| 1674 | template (present) RAN_Information_RIM_Container_GTPC cont) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1675 | bssgpPduType := '70'O, |
| 1676 | destination_Cell_Identifier := dest, |
| 1677 | source_Cell_Identifier := src, |
| 1678 | rIM_Container := cont |
| 1679 | } |
| 1680 | template (value) PDU_BSSGP_RAN_INFORMATION_GTPC |
| 1681 | ts_GTPC_RAN_Information(template (value) RIM_Routing_Information_GTPC dest, |
| 1682 | template (value) RIM_Routing_Information_GTPC src, |
| 1683 | template (value) RAN_Information_RIM_Container_GTPC cont) := { |
| 1684 | bssgpPduType := '70'O, |
| 1685 | destination_Cell_Identifier := dest, |
| 1686 | source_Cell_Identifier := src, |
| 1687 | rIM_Container := cont |
| 1688 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1689 | template (present) RANTransparentContainer tr_RANTransparentContainer_RAN_INFO(template (present) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1690 | type_gtpc := '90'O, |
| 1691 | lengthf := ?, |
| 1692 | rANTransparentContainerField := { |
| 1693 | pDU_BSSGP_RAN_INFORMATION := pdu |
| 1694 | } |
| 1695 | } |
| 1696 | template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO(template (value) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := { |
| 1697 | type_gtpc := '90'O, |
| 1698 | lengthf := 0, /* overwritten */ |
| 1699 | rANTransparentContainerField := { |
| 1700 | pDU_BSSGP_RAN_INFORMATION := pdu |
| 1701 | } |
| 1702 | } |
| 1703 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1704 | template (present) RANTransparentContainer tr_RANTransparentContainer(template (present) RANTransparentContainerField rANTransparentContainerField) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1705 | type_gtpc := '90'O, |
| 1706 | lengthf := ?, |
| 1707 | rANTransparentContainerField := rANTransparentContainerField |
| 1708 | } |
| 1709 | template (value) RANTransparentContainer ts_RANTransparentContainer(template (value) RANTransparentContainerField rANTransparentContainerField) := { |
| 1710 | type_gtpc := '90'O, |
| 1711 | lengthf := 0, /* overwritten */ |
| 1712 | rANTransparentContainerField := rANTransparentContainerField |
| 1713 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1714 | template (present) GTPC_PDUs tr_RANInfoRelay(template (present) RANTransparentContainer transparentContainer) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1715 | ranInformationRelay := { |
| 1716 | transparentContainer := transparentContainer, |
| 1717 | rIM_RoutingAddress := *, |
| 1718 | rIM_RoutingAddress_Discriminator := *, |
| 1719 | private_extension_gtpc := * |
| 1720 | } |
| 1721 | } |
Philipp Maier | 05ad55c | 2023-07-24 10:56:46 +0200 | [diff] [blame] | 1722 | template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer, |
| 1723 | template (omit) RIM_RoutingAddress ra := omit, |
| 1724 | template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1725 | ranInformationRelay := { |
| 1726 | transparentContainer := transparentContainer, |
Philipp Maier | 05ad55c | 2023-07-24 10:56:46 +0200 | [diff] [blame] | 1727 | rIM_RoutingAddress := ra, |
| 1728 | rIM_RoutingAddress_Discriminator := ra_discr, |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1729 | private_extension_gtpc := omit |
| 1730 | } |
| 1731 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1732 | template (present) Gtp1cUnitdata |
| 1733 | tr_GTPC_RANInfoRelay(template (present) GtpPeer peer, |
| 1734 | template (present) RANTransparentContainer transparentContainer) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1735 | peer := peer, |
| 1736 | gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer)) |
| 1737 | } |
| 1738 | template (value) Gtp1cUnitdata |
| 1739 | ts_GTPC_RANInfoRelay(template (value) GtpPeer peer, |
Philipp Maier | 05ad55c | 2023-07-24 10:56:46 +0200 | [diff] [blame] | 1740 | template (value) RANTransparentContainer transparentContainer, |
| 1741 | template (omit) RIM_RoutingAddress ra := omit, |
| 1742 | template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1743 | peer := peer, |
Philipp Maier | 05ad55c | 2023-07-24 10:56:46 +0200 | [diff] [blame] | 1744 | gtpc := ts_GTP1C_PDU(rANInformationRelay, '00000000'O, valueof(ts_RANInfoRelay(transparentContainer, ra, ra_discr)), 0) |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1745 | } |
| 1746 | |
| 1747 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1748 | template (present) RAN_Information_Request_RIM_Container_GTPC |
| 1749 | tr_GTPC_RAN_Information_Request_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id := ?, |
| 1750 | template (present) RIM_Sequence_Number_GTPC seq := ?, |
| 1751 | template (present) RIM_PDU_Indications_GTPC ind := ?, |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1752 | template RIM_Protocol_Version_Number_GTPC ver := *, |
| 1753 | template RAN_Information_Request_Application_Container_GTPC app_cont := *, |
| 1754 | template SON_TransferApplicationIdentity son_app_id := *) := { |
| 1755 | iEI := '57'O, |
| 1756 | ext := '1'B, |
| 1757 | lengthIndicator := { |
| 1758 | length1 := ? |
| 1759 | }, |
| 1760 | rIM_Application_Identity := app_id, |
| 1761 | rIM_Sequence_Number := seq, |
| 1762 | rIM_PDU_Indications := ind, |
| 1763 | rIM_Protocol_Version_Number := ver, |
| 1764 | application_Container := app_cont, |
| 1765 | sON_TransferApplicationIdentity := son_app_id |
| 1766 | } |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1767 | |
| 1768 | /* GTP-U */ |
| 1769 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1770 | template (present) PDU_GTPU tr_GTP1U_PDU(template (present) OCT1 msg_type, |
| 1771 | template (present) OCT4 teid, |
| 1772 | template (present) GTPU_IEs ies := ?) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1773 | pn_bit := ?, |
| 1774 | s_bit := ?, |
| 1775 | e_bit := ?, |
| 1776 | spare := ?, |
| 1777 | /* Protocol Type flag (PT) shall be set to '1' in GTP */ |
| 1778 | pt := '1'B, |
| 1779 | /* Version shall be set to decimal 1 ('001'). */ |
| 1780 | version := '001'B, |
| 1781 | messageType := msg_type, |
| 1782 | lengthf := ?, |
| 1783 | teid := teid, |
| 1784 | opt_part := *, |
| 1785 | gtpu_IEs := ies |
| 1786 | } |
| 1787 | |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1788 | function f_GTPU_s_bit(template (omit) uint16_t seq) return BIT1 { |
| 1789 | if (istemplatekind(seq, "omit")) { |
| 1790 | return '0'B; |
| 1791 | } |
| 1792 | return '1'B; |
| 1793 | } |
| 1794 | |
| 1795 | function f_GTPU_opt_part(template (omit) uint16_t seq) return template (omit) GTPU_Header_optional_part { |
| 1796 | if (istemplatekind(seq, "omit")) { |
| 1797 | return omit; |
| 1798 | } |
| 1799 | var GTPU_Header_optional_part ret := { |
| 1800 | sequenceNumber := int2oct(valueof(seq), 2), |
| 1801 | npduNumber := '00'O, |
| 1802 | nextExtHeader := '00'O, |
| 1803 | gTPU_extensionHeader_List := omit |
| 1804 | }; |
| 1805 | return ret; |
| 1806 | } |
| 1807 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1808 | /* generalized GTP-U send template */ |
Pau Espin Pedrol | 480e67f | 2022-02-09 16:37:47 +0100 | [diff] [blame] | 1809 | template (value) PDU_GTPU ts_GTP1U_PDU(OCT1 msg_type, template (omit) uint16_t seq, OCT4 teid, GTPU_IEs ies) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1810 | /* N-PDU Number flag (PN): the GTP-U header contains a meaningful N-PDU Number field if the PN |
| 1811 | * flag is set to 1. */ |
| 1812 | pn_bit := '0'B, /* we assume the encoder overwrites this if an optional part is given */ |
| 1813 | /* If the Sequence Number flag (S) is set to '1' the sequence number field is present and |
| 1814 | * meaningful otherwise it is set to '0'. For GTP-U messages Echo Request, Echo Response, |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1815 | * Error Indication and Supported Extension Headers Notification, the S flag shall be set to '1'. |
| 1816 | * |
| 1817 | * Note that the caller must ensure that these conditions hold. |
| 1818 | * The caller can either pass a sequence number (we set s_bit to '1'B) when appropriate, |
| 1819 | * or may omit the sequence number (we set s_bit to '0'B). */ |
| 1820 | s_bit := f_GTPU_s_bit(seq), |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1821 | /* Extension header presence */ |
| 1822 | e_bit := '0'B, |
| 1823 | spare := '0'B, |
| 1824 | /* Protocol Type flag (PT) shall be set to '1' in GTP */ |
| 1825 | pt := '1'B, |
| 1826 | /* Version shall be set to decimal 1 ('001'). */ |
| 1827 | version := '001'B, |
| 1828 | messageType := msg_type, |
| 1829 | lengthf := 0, /* we assume encoder overwrites this */ |
| 1830 | teid := teid, |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1831 | opt_part := f_GTPU_opt_part(seq), |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1832 | gtpu_IEs := ies |
| 1833 | } |
| 1834 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1835 | template (present) Gtp1uUnitdata tr_GTPU_MsgType(template (present) GtpPeer peer, |
| 1836 | template (present) OCT1 msg_type, |
| 1837 | template (present) OCT4 teid) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1838 | peer := peer, |
| 1839 | gtpu := tr_GTP1U_PDU(msg_type, teid) |
| 1840 | } |
| 1841 | |
| 1842 | |
Pau Espin Pedrol | 480e67f | 2022-02-09 16:37:47 +0100 | [diff] [blame] | 1843 | /* template matching reception of GTP-U echo-request/response */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1844 | template (present) Gtp1uUnitdata tr_GTPU_PING(template (present) GtpPeer peer) := tr_GTPU_MsgType(peer, echoRequest, '00000000'O); |
| 1845 | template (present) Gtp1uUnitdata tr_GTPU_PONG(template (present) GtpPeer peer) := tr_GTPU_MsgType(peer, echoResponse, '00000000'O); |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1846 | |
| 1847 | /* template matching reception of GTP-U GPDU */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1848 | template GTPU_IEs t_GPDU(template (present) octetstring data) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1849 | g_PDU_IEs := { |
| 1850 | data := data |
| 1851 | } |
| 1852 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1853 | template (present) Gtp1uUnitdata tr_GTPU_GPDU(template (present) GtpPeer peer, |
| 1854 | template (present) OCT4 teid, |
| 1855 | template (present) octetstring data := ?) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1856 | peer := peer, |
| 1857 | gtpu := tr_GTP1U_PDU('FF'O, teid, t_GPDU(data)) |
| 1858 | } |
| 1859 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1860 | template (present) GTPU_IEs ts_UEchoReqPDU := { |
Pau Espin Pedrol | 480e67f | 2022-02-09 16:37:47 +0100 | [diff] [blame] | 1861 | echoRequest_IEs := { |
| 1862 | private_extension_gtpu := omit |
| 1863 | } |
| 1864 | } |
| 1865 | |
| 1866 | /* master template for sending a GTP-C echo request */ |
| 1867 | template (value) Gtp1uUnitdata ts_GTPU_PING(GtpPeer peer, uint16_t seq) := { |
| 1868 | peer := peer, |
| 1869 | gtpu := ts_GTP1U_PDU(echoRequest, seq, '00000000'O, valueof(ts_UEchoReqPDU)) |
| 1870 | } |
| 1871 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1872 | template GTPU_IEs ts_UEchoRespPDU(OCT1 restart_counter) := { |
| 1873 | echoResponse_IEs := { |
| 1874 | recovery_gtpu := { |
| 1875 | type_gtpu := '00'O, /* we assume encoder fixes? */ |
| 1876 | restartCounter := restart_counter |
| 1877 | }, |
| 1878 | private_extension_gtpu := omit |
| 1879 | } |
| 1880 | } |
| 1881 | |
| 1882 | /* master template for sending a GTP-U echo response */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1883 | template (present) Gtp1uUnitdata ts_GTPU_PONG(GtpPeer peer, uint16_t seq, OCT1 rest_ctr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1884 | peer := peer, |
| 1885 | gtpu := ts_GTP1U_PDU(echoResponse, seq, '00000000'O, valueof(ts_UEchoRespPDU(rest_ctr))) |
| 1886 | } |
| 1887 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1888 | template (value) GSNAddress_gtpu ts_UGsnAddr(octetstring ip_addr) := { |
Pau Espin Pedrol | f3e2538 | 2018-07-18 13:46:40 +0200 | [diff] [blame] | 1889 | type_gtpu := '85'O, |
| 1890 | lengthf := lengthof(ip_addr), |
| 1891 | gSNAddressValue := ip_addr |
| 1892 | } |
| 1893 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1894 | template (value) TeidDataI_gtpu ts_UteidDataI(OCT4 teid) := { |
Pau Espin Pedrol | f3e2538 | 2018-07-18 13:46:40 +0200 | [diff] [blame] | 1895 | type_gtpu := '10'O, |
| 1896 | teidDataI := teid |
| 1897 | } |
| 1898 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1899 | template (value) GTPU_IEs ts_UErrorIndication(OCT4 teid, octetstring gsn_addr) := { |
Pau Espin Pedrol | f3e2538 | 2018-07-18 13:46:40 +0200 | [diff] [blame] | 1900 | errorIndication_IEs := { |
| 1901 | teidDataI_gtpu := ts_UteidDataI(teid), |
| 1902 | gSNAddress_gtpu := ts_UGsnAddr(gsn_addr), |
| 1903 | private_extension_gtpu := omit |
| 1904 | } |
| 1905 | } |
| 1906 | |
| 1907 | /* master template for sending a GTP-U Error indication */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1908 | template (value) Gtp1uUnitdata ts_GTPU_ErrorIndication(GtpPeer peer, uint16_t seq, OCT4 teid, octetstring gsn_addr) := { |
Pau Espin Pedrol | f3e2538 | 2018-07-18 13:46:40 +0200 | [diff] [blame] | 1909 | peer := peer, |
| 1910 | gtpu := ts_GTP1U_PDU('1A'O, seq, '00000000'O, valueof(ts_UErrorIndication(teid, gsn_addr))) |
| 1911 | } |
| 1912 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1913 | /* master template for sending a GTP-U user plane data */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1914 | template (value) Gtp1uUnitdata ts_GTP1U_GPDU(GtpPeer peer, template (omit) uint16_t seq, OCT4 teid, octetstring data) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1915 | peer := peer, |
| 1916 | gtpu := ts_GTP1U_PDU('FF'O, seq, teid, { g_PDU_IEs := { data := data }}) |
| 1917 | } |
Philipp Maier | 653a014 | 2023-08-04 15:22:37 +0200 | [diff] [blame] | 1918 | |
| 1919 | /* 3GPP TS 29.060, section 7.7.57 */ |
| 1920 | template (value) RIM_RoutingAddress ts_RIM_RoutingAddress(octetstring addr_value) := { |
| 1921 | type_gtpc := '9F'O, |
| 1922 | lengthf := 0, /* we assume encoder overwrites this */ |
| 1923 | rIM_RoutingAddressValue := addr_value |
| 1924 | } |
| 1925 | template (present) RIM_RoutingAddress tr_RIM_RoutingAddress(template (present) octetstring addr_value := ?) := { |
| 1926 | type_gtpc := '9F'O, |
| 1927 | lengthf := ?, |
| 1928 | rIM_RoutingAddressValue := addr_value |
| 1929 | } |
| 1930 | |
| 1931 | /* 3GPP TS 29.060, section 7.7.77 */ |
| 1932 | template (value) RIM_RoutingAddress_Discriminator ts_RIM_RoutingAddress_Discriminator(bitstring addr_discr) := { |
| 1933 | type_gtpc := 'B2'O, |
| 1934 | lengthf := 0, /* we assume encoder overwrites this */ |
| 1935 | rra_discriminator := addr_discr, |
| 1936 | spare := '0000'B |
| 1937 | } |
| 1938 | template (present) RIM_RoutingAddress_Discriminator tr_RIM_RoutingAddress_Discriminator(template (present) bitstring addr_discr := ?) := { |
| 1939 | type_gtpc := 'B2'O, |
| 1940 | lengthf := ?, |
| 1941 | rra_discriminator := addr_discr, |
| 1942 | spare := '0000'B |
| 1943 | } |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1944 | } |