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