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 | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 44 | private function f_oct_or_wc(template integer inp, integer len) return template octetstring { |
| 45 | if (istemplatekind(inp, "omit")) { |
| 46 | return omit; |
| 47 | } else if (istemplatekind(inp, "*")) { |
| 48 | return *; |
| 49 | } else if (istemplatekind(inp, "?")) { |
| 50 | return ?; |
| 51 | } |
| 52 | return int2oct(valueof(inp), len); |
| 53 | } |
| 54 | |
| 55 | private function f_hex_or_wc(template integer inp, integer len) return template hexstring { |
| 56 | if (istemplatekind(inp, "omit")) { |
| 57 | return omit; |
| 58 | } else if (istemplatekind(inp, "*")) { |
| 59 | return *; |
| 60 | } else if (istemplatekind(inp, "?")) { |
| 61 | return ?; |
| 62 | } |
| 63 | return int2hex(valueof(inp), len); |
| 64 | } |
| 65 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 66 | /* generalized GTP-C receive template */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 67 | 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] | 68 | /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an |
| 69 | * error if this flag is set to '1'. */ |
| 70 | pn_bit := '0'B, |
| 71 | /* Sequence number flag (S) shall be set to '1'. */ |
| 72 | s_bit := '1'B, |
| 73 | e_bit := ?, |
| 74 | spare := ?, |
| 75 | /* Protocol Type flag (PT) shall be set to '1'.*/ |
| 76 | pt := '1'B, |
| 77 | /* Version shall be set to decimal 1 ('001'). */ |
| 78 | version := '001'B, |
| 79 | messageType := msg_type, |
| 80 | lengthf := ?, |
| 81 | teid := teid, |
| 82 | opt_part := *, |
| 83 | gtpc_pdu := pdu |
| 84 | } |
| 85 | |
| 86 | /* generalized GTP-C send template */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 87 | 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] | 88 | /* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an |
| 89 | * error if this flag is set to '1'. */ |
| 90 | pn_bit := '0'B, |
| 91 | /* Sequence number flag (S) shall be set to '1'. */ |
| 92 | s_bit := '1'B, |
| 93 | e_bit := '0'B, |
| 94 | spare := '0'B, |
| 95 | /* Protocol Type flag (PT) shall be set to '1'.*/ |
| 96 | pt := '1'B, |
| 97 | /* Version shall be set to decimal 1 ('001'). */ |
| 98 | version := '001'B, |
| 99 | messageType := msg_type, |
| 100 | lengthf := 0, /* we assume encoder overwrites this */ |
| 101 | teid := teid, |
| 102 | opt_part := { |
| 103 | sequenceNumber := int2oct(seq_nr, 2), |
| 104 | npduNumber := '00'O, |
| 105 | nextExtHeader := '00'O, |
| 106 | gTPC_extensionHeader_List := omit |
| 107 | }, |
| 108 | gtpc_pdu := pdu |
| 109 | } |
| 110 | |
| 111 | /* recovery IE */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 112 | template (value) Recovery_gtpc ts_Recovery(OCT1 restart_counter) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 113 | type_gtpc := '0E'O, |
| 114 | restartCounter := restart_counter |
| 115 | } |
| 116 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 117 | template (present) Recovery_gtpc tr_Recovery(template (present) OCT1 restart_counter) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 118 | type_gtpc := '0E'O, |
| 119 | restartCounter := restart_counter |
| 120 | } |
| 121 | |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 122 | /* IMEI(SV) IE TS 29.060 7.7.53 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 123 | template (value) IMEISV_gtpc ts_IMEISV(template (value) OCT8 imeisv) := { |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 124 | type_gtpc := '9A'O, |
| 125 | lengthf := 8, |
| 126 | imeisv := imeisv |
| 127 | } |
| 128 | private function f_ts_IMEISV(template (omit) OCT8 imeisv) |
| 129 | return template (omit) IMEISV_gtpc { |
| 130 | if (istemplatekind(imeisv, "omit")) { |
| 131 | return omit; |
| 132 | } |
| 133 | return ts_IMEISV(imeisv); |
| 134 | } |
| 135 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 136 | template (present) IMEISV_gtpc tr_IMEISV(template (present) OCT8 imeisv) := { |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 137 | type_gtpc := '9A'O, |
| 138 | lengthf := 8, |
| 139 | imeisv := imeisv |
| 140 | } |
| 141 | |
Pau Espin Pedrol | 535ca26 | 2022-05-16 14:07:17 +0200 | [diff] [blame] | 142 | // MS Time Zone - 7.7.52 |
| 143 | template (value) MS_TimeZone ts_MS_TimeZone(template (value) OCT1 timeZone := '00'O, |
| 144 | template (value) BIT2 daylightSavingTime := '00'B) := { |
| 145 | type_gtpc := '99'O, |
| 146 | lengthf := 2, |
| 147 | timeZone := timeZone, |
| 148 | daylightSavingTime := daylightSavingTime, |
| 149 | spare1 := '000'B, |
| 150 | sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */ |
| 151 | spare2 := '00'B |
| 152 | } |
| 153 | function f_ts_MS_TimeZone(template (omit) OCT1 timeZone, template (omit) BIT2 daylightSavingTime) |
| 154 | return template (omit) MS_TimeZone { |
| 155 | if (istemplatekind(timeZone, "omit") and istemplatekind(daylightSavingTime, "omit")) { |
| 156 | return omit; |
| 157 | } |
| 158 | if (istemplatekind(timeZone, "omit")) { |
| 159 | return ts_MS_TimeZone(daylightSavingTime := daylightSavingTime); |
| 160 | } |
| 161 | if (istemplatekind(daylightSavingTime, "omit")) { |
| 162 | return ts_MS_TimeZone(timeZone); |
| 163 | } |
| 164 | return ts_MS_TimeZone(timeZone, daylightSavingTime); |
| 165 | } |
| 166 | |
| 167 | template (present) MS_TimeZone tr_MS_TimeZone(template (present) OCT1 timeZone := ?, |
| 168 | template (present) BIT2 daylightSavingTime := ?) := { |
| 169 | type_gtpc := '99'O, |
| 170 | lengthf := 2, |
| 171 | timeZone := timeZone, |
| 172 | daylightSavingTime := daylightSavingTime, |
| 173 | spare1 := '000'B, |
| 174 | sgsnAttempsToUpdateMS := '0'B, /* propietary, use it as spare */ |
| 175 | spare2 := '00'B |
| 176 | } |
| 177 | |
Pau Espin Pedrol | 0e12787 | 2022-05-12 17:58:50 +0200 | [diff] [blame] | 178 | /* Charging Characteristics IE TS 29.060 7.7.23 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 179 | template (value) ChargingCharacteristics_GTPC ts_ChargingCharacteristics(template (value) OCT2 chargingChar) := { |
Pau Espin Pedrol | 0e12787 | 2022-05-12 17:58:50 +0200 | [diff] [blame] | 180 | type_gtpc := '1A'O, |
| 181 | chargingChar := chargingChar |
| 182 | } |
| 183 | private function f_ts_ChargingCharacteristics(template (omit) OCT2 chargingChar) |
| 184 | return template (omit) ChargingCharacteristics_GTPC { |
| 185 | if (istemplatekind(chargingChar, "omit")) { |
| 186 | return omit; |
| 187 | } |
| 188 | return ts_ChargingCharacteristics(chargingChar); |
| 189 | } |
| 190 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 191 | template (present) ChargingCharacteristics_GTPC tr_ChargingCharacteristics(template (present) OCT2 chargingChar) := { |
Pau Espin Pedrol | 0e12787 | 2022-05-12 17:58:50 +0200 | [diff] [blame] | 192 | type_gtpc := '1A'O, |
| 193 | chargingChar := chargingChar |
| 194 | } |
| 195 | |
| 196 | |
Philipp Maier | 1c0c726 | 2023-07-24 10:51:53 +0200 | [diff] [blame] | 197 | /* template matching reception of GTP-C unit-data */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 198 | template (present) Gtp1cUnitdata tr_GTPC_MsgType(template (present) GtpPeer peer, |
| 199 | template (present) OCT1 msg_type, |
| 200 | template (present) OCT4 teid, |
| 201 | template (present) GTPC_PDUs pdus := ?) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 202 | peer := peer, |
| 203 | gtpc := tr_GTP1C_PDU(msg_type, teid, pdus) |
| 204 | } |
| 205 | |
| 206 | /* template matching reception of GTP-C echo-request */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 207 | 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] | 208 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 209 | template (present) GTPC_PDUs tr_EchoRespPDU(template (present) OCT1 restart_counter) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 210 | echoResponse := { |
| 211 | recovery := tr_Recovery(restart_counter), |
| 212 | private_extension_gtpc := * |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | /* template matching reception of GTP-C echo-response */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 217 | 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] | 218 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 219 | template (value) GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 220 | echoResponse := { |
| 221 | recovery := ts_Recovery(restart_counter), |
| 222 | private_extension_gtpc := omit |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | /* master template for senidng a GTP-C echo response */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 227 | 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] | 228 | peer := peer, |
| 229 | gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq) |
| 230 | } |
| 231 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 232 | template (value) GTPC_PDUs ts_EchoReqPDU := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 233 | echoRequest := { |
| 234 | private_extension_gtpc := omit |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | /* master template for sending a GTP-C echo request */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 239 | template (value) Gtp1cUnitdata ts_GTPC_PING(GtpPeer peer, uint16_t seq) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 240 | peer := peer, |
| 241 | gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq) |
| 242 | } |
| 243 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 244 | private function f_eua_ipv4_len(template (present) OCT4 ip_addr) return template integer { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 245 | if (istemplatekind(ip_addr, "omit")) { |
| 246 | return 2; |
| 247 | } else if (istemplatekind(ip_addr, "*")) { |
| 248 | return ?; |
| 249 | } else if (istemplatekind(ip_addr, "?")) { |
| 250 | return 6; |
| 251 | } |
| 252 | return 6; |
| 253 | } |
| 254 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 255 | private function f_eua_ipv6_len(template (omit) OCT16 ip_addr) return template (present) integer { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 256 | if (istemplatekind(ip_addr, "omit")) { |
| 257 | return 2; |
| 258 | } else if (istemplatekind(ip_addr, "*")) { |
| 259 | return ?; |
| 260 | } else if (istemplatekind(ip_addr, "?")) { |
| 261 | return 18; |
| 262 | } |
| 263 | return 18; |
| 264 | } |
| 265 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 266 | private function f_eua_ipv4v6_len(template (omit) OCT4 ip_addr4, template (omit) OCT16 ip_addr6) return template (present) integer { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 267 | var integer len := 2; |
| 268 | if (istemplatekind(ip_addr4, "*") or |
| 269 | istemplatekind(ip_addr6, "*")) { |
| 270 | return ?; |
| 271 | } |
| 272 | if (not istemplatekind(ip_addr4, "omit")) { |
| 273 | len := len + 4; |
| 274 | } |
| 275 | if (not istemplatekind(ip_addr6, "omit")) { |
| 276 | len := len + 16; |
| 277 | } |
| 278 | return len; |
| 279 | } |
| 280 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 281 | template EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := { |
| 282 | type_gtpc := '80'O, |
| 283 | endUserAddress := { |
| 284 | endUserAddressIPv4 := { |
| 285 | lengthf := 2, |
| 286 | pdp_typeorg := '0001'B, |
| 287 | spare := '1111'B, |
| 288 | pdp_typenum := '21'O, |
| 289 | ipv4_address := ip_addr |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | template EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit); |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 294 | 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] | 295 | endUserAddress := { |
| 296 | endUserAddressIPv4 := { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 297 | lengthf := f_eua_ipv4_len(ip_addr) |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 298 | } |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | template EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := { |
| 303 | type_gtpc := '80'O, |
| 304 | endUserAddress := { |
| 305 | endUserAddressIPv6 := { |
| 306 | lengthf := 2, |
| 307 | pdp_typeorg := '0001'B, |
| 308 | spare := '1111'B, |
| 309 | pdp_typenum := '57'O, |
| 310 | ipv6_address := ip_addr |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | template EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit); |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 315 | 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] | 316 | endUserAddress := { |
| 317 | endUserAddressIPv6 := { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 318 | lengthf := f_eua_ipv6_len(ip_addr) |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 323 | /* 3GPP TS 29.060 Figure 37A: End User Address Information Element for IPv4v6 (both static) */ |
| 324 | template EndUserAddress t_EuaIPv4v6(template OCT4 ip_addr4, template OCT16 ip_addr6) := { |
| 325 | type_gtpc := '80'O, |
| 326 | endUserAddress := { |
| 327 | endUserAddressIPv4andIPv6 := { |
| 328 | lengthf := 2, |
| 329 | pdp_typeorg := '0001'B, |
| 330 | spare := '1111'B, |
| 331 | pdp_typenum := '8D'O, |
| 332 | ipv4_address := ip_addr4, |
| 333 | ipv6_address := ip_addr6 |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | template EndUserAddress t_EuaIPv4Dynv6Dyn := t_EuaIPv4v6(omit, omit); |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 338 | template (present) EndUserAddress tr_EuaIPv4v6(template (present) OCT4 ip_addr4, |
| 339 | template (present) OCT16 ip_addr6) modifies t_EuaIPv4v6 := { |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 340 | endUserAddress := { |
| 341 | endUserAddressIPv4andIPv6 := { |
Pau Espin Pedrol | 001b3e8 | 2022-02-23 18:38:37 +0100 | [diff] [blame] | 342 | lengthf := f_eua_ipv4v6_len(ip_addr4, ip_addr6) |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 343 | } |
| 344 | } |
| 345 | } |
| 346 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 347 | template (value) AccessPointName ts_APN(octetstring apn) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 348 | type_gtpc := '83'O, |
| 349 | lengthf := lengthof(apn), |
| 350 | apn_value := apn |
| 351 | } |
| 352 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 353 | template (value) GSN_Address_GTPC ts_GsnAddr(octetstring ip_addr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 354 | type_gtpc := '85'O, |
| 355 | lengthf := lengthof(ip_addr), |
| 356 | addressf := ip_addr |
| 357 | } |
| 358 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 359 | template (value) MSISDN ts_Msisdn(octetstring msisdn) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 360 | type_gtpc := '86'O, |
| 361 | lengthf := lengthof(msisdn), |
| 362 | msisdn := msisdn |
| 363 | } |
| 364 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 365 | template (value) QualityOfServiceProfile ts_QosDefault := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 366 | type_gtpc := '87'O, |
Pau Espin Pedrol | 7d58b08 | 2022-06-07 13:30:03 +0200 | [diff] [blame] | 367 | lengthf := 17, |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 368 | allocRetensionPrio := '00'O, |
| 369 | qos_ProfileValue := { |
| 370 | reliabilityClass := '011'B, |
| 371 | delayClass := '001'B, |
| 372 | spare1 := '00'B, |
| 373 | precedenceClass := '010'B, |
| 374 | spare2 := '0'B, |
| 375 | peakThroughput := '1001'B, |
| 376 | meanThroughput := '11111'B, |
| 377 | spare3 := '000'B, |
Pau Espin Pedrol | 7d58b08 | 2022-06-07 13:30:03 +0200 | [diff] [blame] | 378 | deliverErroneusSDU := '010'B, /* Erroneus SDU are delivered */ |
| 379 | deliveryOrder := '10'B, /* Without delivery order */ |
| 380 | trafficClass := '100'B, /* Background */ |
| 381 | maxSDUSize := '96'O, /* 1500 octets */ |
| 382 | maxBitrateUplink := 'FE'O, /* 8640, continues in extended octet */ |
| 383 | maxBitrateDownlink := 'FE'O, /* 8640, continues in extended octet */ |
| 384 | sduErrorRatio := '0100'B, /* 1x10^-4 */ |
| 385 | residualBER := '0101'B, /* 1x10^-3 */ |
| 386 | trafficHandlingPriority := '01'B, /* prio 1 */ |
| 387 | transferDelay := '000001'B, /* 10 ms */ |
| 388 | guaranteedBitRateUplink := 'FE'O, /* 8640, continues in extended octet */ |
| 389 | guaranteedBitRateDownlink := 'FE'O, /* 8640, continues in extended octet */ |
| 390 | sourceStatisticsDescriptor := '0000'B, /* unknown */ |
| 391 | signallingIndication := '0'B, /* Not optimized */ |
| 392 | spare4 := '000'B, |
| 393 | maxBitrateDownlinkExt := '5B'O, /* 33 mbps */ |
| 394 | guaranteedBitRateDownlinkExt := '5B'O, /* 33 mbps */ |
| 395 | maxBitrateUplinkExt := '6e'O, /* 52 mbps */ |
| 396 | guaranteedBitRateUplinkExt := '6e'O /* 52 mbps */ |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 397 | } |
| 398 | } |
| 399 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 400 | template (value) IMSI_gtpc ts_Imsi(hexstring digits) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 401 | type_gtpc := '02'O, |
| 402 | digits := digits, |
| 403 | padding := 'F'H |
| 404 | } |
| 405 | |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 406 | function f_ts_RATType(template (omit) OCT1 ratType := omit) return template (omit) RATType { |
| 407 | var template (omit) RATType rt; |
| 408 | if (istemplatekind(ratType, "omit")) { |
| 409 | rt := omit; |
| 410 | } else { |
| 411 | rt := { |
| 412 | type_gtpc := '97'O, |
| 413 | lengthf := 1, |
| 414 | ratTypeValue := ratType |
| 415 | }; |
| 416 | } |
| 417 | return rt; |
| 418 | } |
| 419 | |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 420 | template (value) GeographicLocationCGI |
| 421 | ts_GeographicLocationCGI(template (value) hexstring mcc, |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 422 | template (value) hexstring mnc, |
| 423 | template (value) OCT2 lac, |
| 424 | template (value) OCT2 cI_value) := |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 425 | { |
| 426 | mccDigit1 := mcc[0], |
| 427 | mccDigit2 := mcc[1], |
| 428 | mccDigit3 := mcc[2], |
| 429 | mncDigit3 := mnc[2], /* 'F'H for 2 digit MNC */ |
| 430 | mncDigit1 := mnc[0], |
| 431 | mncDigit2 := mnc[1], |
| 432 | lac := lac, |
| 433 | cI_value := cI_value |
| 434 | } |
| 435 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 436 | template (value) GTPC_PDUs ts_CreatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl, |
| 437 | BIT4 nsapi, EndUserAddress eua, octetstring apn, |
| 438 | octetstring sgsn_ip_sign, octetstring sgsn_ip_data, |
| 439 | octetstring msisdn, template (omit) ProtConfigOptions pco := omit, |
| 440 | template (omit) OCT1 ratType := omit, |
| 441 | template (omit) UserLocationInformation uli := omit, |
| 442 | template (omit) OCT2 charging_char := omit, |
| 443 | template (omit) OCT8 imeisv := omit, |
| 444 | template (omit) MS_TimeZone ms_tz := omit) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 445 | createPDPContextRequest := { |
| 446 | imsi := ts_Imsi(imsi), |
| 447 | rai := omit, |
| 448 | recovery := ts_Recovery(restart_ctr), |
| 449 | selectionMode := { |
| 450 | type_gtpc := '0F'O, |
| 451 | selectModeValue := '00'B, |
| 452 | spare := '111111'B |
| 453 | }, |
| 454 | teidDataI := { |
| 455 | type_gtpc := '00'O, |
| 456 | teidDataI := teid_data |
| 457 | }, |
| 458 | teidControlPlane := { |
| 459 | type_gtpc := '00'O, |
| 460 | teidControlPlane := teid_ctrl |
| 461 | }, |
| 462 | nsapi := { |
| 463 | type_gtpc := '00'O, |
| 464 | nsapi := nsapi, |
| 465 | unused := '0000'B |
| 466 | }, |
| 467 | linked_nsapi := omit, |
Pau Espin Pedrol | 0e12787 | 2022-05-12 17:58:50 +0200 | [diff] [blame] | 468 | charging_char := f_ts_ChargingCharacteristics(charging_char), |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 469 | trace_ref := omit, |
| 470 | trace_type := omit, |
| 471 | endUserAddress := eua, |
| 472 | accessPointName := ts_APN(apn), |
| 473 | protConfigOptions := pco, |
| 474 | sgsn_addr_signalling := ts_GsnAddr(sgsn_ip_sign), |
| 475 | sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data), |
| 476 | msisdn := ts_Msisdn(msisdn), |
| 477 | qualityOfServiceProfile := ts_QosDefault, |
| 478 | tft := omit, |
| 479 | triggerId := omit, |
| 480 | omcId := omit, |
| 481 | commonFlags := omit, |
| 482 | aPN_Restriction := omit, |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 483 | ratType := f_ts_RATType(ratType), |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 484 | userLocationInformation := uli, |
Pau Espin Pedrol | 535ca26 | 2022-05-16 14:07:17 +0200 | [diff] [blame] | 485 | mS_TimeZone := ms_tz, |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 486 | imeisv := f_ts_IMEISV(imeisv), |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 487 | camelChargingInformationContainer := omit, |
| 488 | additionalTraceInfo := omit, |
| 489 | correlationID := omit, |
| 490 | evolvedAllocationRetentionPriorityI := omit, |
| 491 | extendedCommonFlags := omit, |
| 492 | userCSGInformation := omit, |
| 493 | aPN_AMBR := omit, |
| 494 | signallingPriorityIndication := omit, |
| 495 | cN_OperatorSelectionEntity := omit, |
| 496 | private_extension_gtpc := omit |
| 497 | } |
| 498 | } |
| 499 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 500 | template (value) Gtp1cUnitdata ts_GTPC_CreatePDP(GtpPeer peer, uint16_t seq, hexstring imsi, |
| 501 | OCT1 restart_ctr, OCT4 teid_data, |
| 502 | OCT4 teid_ctrl, BIT4 nsapi, EndUserAddress eua, |
| 503 | octetstring apn, octetstring sgsn_ip_sign, |
| 504 | octetstring sgsn_ip_data, octetstring msisdn, |
| 505 | template (omit) ProtConfigOptions pco := omit, |
| 506 | template (omit) OCT1 ratType := omit, |
| 507 | template (omit) UserLocationInformation uli := omit, |
| 508 | template (omit) OCT2 charging_char := omit, |
| 509 | template (omit) OCT8 imeisv := omit, |
| 510 | template (omit) MS_TimeZone ms_tz := omit) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 511 | peer := peer, |
| 512 | gtpc := ts_GTP1C_PDU(createPDPContextRequest, '00000000'O, |
| 513 | valueof(ts_CreatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl, |
| 514 | nsapi, eua, apn, sgsn_ip_sign, |
Pau Espin Pedrol | 38968e9 | 2022-05-13 16:17:48 +0200 | [diff] [blame] | 515 | sgsn_ip_data, msisdn, pco, ratType, uli, |
Pau Espin Pedrol | 535ca26 | 2022-05-16 14:07:17 +0200 | [diff] [blame] | 516 | charging_char, imeisv, ms_tz)), seq) |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 517 | } |
| 518 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 519 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 520 | template (value) GTPC_PDUs ts_UpdatePdpPDU(hexstring imsi, OCT1 restart_ctr, OCT4 teid_data, OCT4 teid_ctrl, |
| 521 | BIT4 nsapi, |
| 522 | octetstring sgsn_ip_sign, octetstring sgsn_ip_data, |
| 523 | template (omit) ProtConfigOptions pco := omit, |
| 524 | template (omit) OCT1 ratType := omit, |
| 525 | template (omit) UserLocationInformation uli := omit) := { |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 526 | updatePDPContextRequest := { |
| 527 | updatePDPContextRequestSGSN := { |
| 528 | imsi := ts_Imsi(imsi), |
| 529 | rai := omit, |
| 530 | recovery := ts_Recovery(restart_ctr), |
| 531 | teidDataI := { |
| 532 | type_gtpc := '00'O, |
| 533 | teidDataI := teid_data |
| 534 | }, |
| 535 | teidControlPlane := { |
| 536 | type_gtpc := '00'O, |
| 537 | teidControlPlane := teid_ctrl |
| 538 | }, |
| 539 | nsapi := { |
| 540 | type_gtpc := '00'O, |
| 541 | nsapi := nsapi, |
| 542 | unused := '0000'B |
| 543 | }, |
| 544 | trace_ref := omit, |
| 545 | trace_type := omit, |
| 546 | protConfigOptions := pco, |
| 547 | sgsn_addr_controlPlane := ts_GsnAddr(sgsn_ip_sign), |
| 548 | sgsn_addr_traffic := ts_GsnAddr(sgsn_ip_data), |
| 549 | alt_ggsn_addr_controlPane := omit, |
| 550 | alt_ggsn_addr_traffic := omit, |
| 551 | qualityOfServiceProfile := ts_QosDefault, |
| 552 | tft := omit, |
| 553 | triggerId := omit, |
| 554 | omcId := omit, |
| 555 | commonFlags := omit, |
| 556 | ratType := f_ts_RATType(ratType), |
| 557 | userLocationInformation := uli, |
| 558 | mS_TimeZone := omit, |
| 559 | additionalTraceInfo := omit, |
| 560 | directTunnelFlags := omit, |
| 561 | evolvedAllocationRetentionPriorityI := omit, |
| 562 | extendedCommonFlags := omit, |
| 563 | userCSGInformation := omit, |
| 564 | aPN_AMBR := omit, |
| 565 | signallingPriorityIndication := omit, |
| 566 | cN_OperatorSelectionEntity := omit, |
| 567 | private_extension_gtpc := omit |
| 568 | } |
| 569 | } |
| 570 | } |
| 571 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 572 | template (value) Gtp1cUnitdata ts_GTPC_UpdatePDP(GtpPeer peer, OCT4 teid, uint16_t seq, hexstring imsi, |
| 573 | OCT1 restart_ctr, OCT4 teid_data, |
| 574 | OCT4 teid_ctrl, BIT4 nsapi, octetstring sgsn_ip_sign, |
| 575 | octetstring sgsn_ip_data, |
| 576 | template (omit) ProtConfigOptions pco := omit, |
| 577 | template (omit) OCT1 ratType := omit, |
| 578 | template (omit) UserLocationInformation uli := omit) := { |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 579 | peer := peer, |
| 580 | gtpc := ts_GTP1C_PDU(updatePDPContextRequest, teid, |
| 581 | valueof(ts_UpdatePdpPDU(imsi, restart_ctr, teid_data, teid_ctrl, |
| 582 | nsapi, sgsn_ip_sign, |
| 583 | sgsn_ip_data, pco, ratType, uli)), seq) |
| 584 | } |
| 585 | |
| 586 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 587 | template (value) NSAPI_GTPC ts_NSAPI(BIT4 nsapi) := { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 588 | type_gtpc := '14'O, |
| 589 | nsapi := nsapi, |
| 590 | unused := '0000'B |
| 591 | } |
| 592 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 593 | template (value) ReorderingRequired ts_ReorderReq(boolean req := false) := { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 594 | type_gtpc := '08'O, |
| 595 | reordreq := bool2bit(req), |
| 596 | spare := '0000000'B |
| 597 | } |
| 598 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 599 | template (value) GTPC_PDUs ts_CreatePdpRespPDU(OCT1 cause, OCT4 teid_data, OCT4 teid_ctrl, BIT4 nsapi, |
| 600 | octetstring ggsn_ip_sign, octetstring ggsn_ip_data, |
| 601 | OCT4 chg_id, template (omit) EndUserAddress eua := omit, |
| 602 | template (omit) Recovery_gtpc recovery := omit, |
| 603 | template (omit) ProtConfigOptions pco := omit) := { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 604 | createPDPContextResponse := { |
| 605 | cause := { '00'O, cause }, |
| 606 | reorderingRequired := ts_ReorderReq(false), |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 607 | recovery := recovery, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 608 | teidDataI := { |
| 609 | type_gtpc := '00'O, |
| 610 | teidDataI := teid_data |
| 611 | }, |
| 612 | teidControlPlane := { |
| 613 | type_gtpc := '00'O, |
| 614 | teidControlPlane := teid_ctrl |
| 615 | }, |
| 616 | nsapi := ts_NSAPI(nsapi), |
Harald Welte | 7aff2ca | 2018-02-18 15:34:50 +0100 | [diff] [blame] | 617 | chargingID := { |
| 618 | type_gtpc := '7F'O, |
| 619 | chargingID := chg_id |
| 620 | }, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 621 | endUserAddress := eua, |
| 622 | protConfigOptions := pco, |
| 623 | ggsn_addr_controlPlane := ts_GsnAddr(ggsn_ip_sign), |
| 624 | ggsn_addr_traffic := ts_GsnAddr(ggsn_ip_data), |
| 625 | alt_ggsn_addr_controlPane := omit, |
| 626 | alt_ggsn_addr_traffic := omit, |
| 627 | qualityOfServiceProfile := ts_QosDefault, |
| 628 | commonFlags := omit, |
| 629 | aPN_Restriction := omit, |
| 630 | mS_InfoChangeReportingAction := omit, |
| 631 | bearerControlMode := omit, |
| 632 | evolvedAllocationRetentionPriorityI := omit, |
| 633 | extendedCommonFlag := omit, |
| 634 | csg_information_reporting_action := omit, |
| 635 | aPN_AMBR := omit, |
| 636 | gGSN_BackOffTime := omit, |
| 637 | private_extension_gtpc := omit |
| 638 | } |
| 639 | } |
| 640 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 641 | template (value) Gtp1cUnitdata ts_GTPC_CreatePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid, |
| 642 | OCT1 cause, |
| 643 | OCT4 teid_ctrl, OCT4 teid_data, |
| 644 | BIT4 nsapi, octetstring ggsn_ip_sign, |
| 645 | octetstring ggsn_ip_data, OCT4 chg_id, |
| 646 | template (omit) EndUserAddress eua := omit, |
| 647 | template (omit) Recovery_gtpc recovery := omit, |
| 648 | template (omit) ProtConfigOptions pco := omit) := { |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 649 | peer := peer, |
| 650 | gtpc := ts_GTP1C_PDU(createPDPContextResponse, teid, |
| 651 | valueof(ts_CreatePdpRespPDU(cause, teid_data, teid_ctrl, nsapi, |
Harald Welte | 7aff2ca | 2018-02-18 15:34:50 +0100 | [diff] [blame] | 652 | ggsn_ip_sign, ggsn_ip_data, chg_id, |
Pau Espin Pedrol | 9401345 | 2018-07-17 15:50:21 +0200 | [diff] [blame] | 653 | eua, recovery, pco)), seq) |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 654 | } |
| 655 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 656 | /* PCO send base template */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 657 | template (value) ProtConfigOptions ts_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 658 | type_gtpc := '84'O, |
| 659 | lengthf := 0, |
| 660 | configProtocol := '000'B, |
| 661 | spare := '0000'B, |
| 662 | extension0 := '1'B, |
| 663 | protocols := {} |
| 664 | } |
| 665 | /* PCO receive base template */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 666 | template (present) ProtConfigOptions tr_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 667 | type_gtpc := '84'O, |
| 668 | lengthf := ?, |
| 669 | configProtocol := '000'B, |
| 670 | spare := ?, |
| 671 | extension0 := '1'B, |
| 672 | protocols := {} |
| 673 | } |
| 674 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 675 | template (value) ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 676 | protocols := { |
| 677 | { protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O } |
| 678 | } |
| 679 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 680 | 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] | 681 | protocols := { |
| 682 | *, { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }, * |
| 683 | } |
| 684 | } |
| 685 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 686 | template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP modifies ts_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 687 | protocols := { |
| 688 | /* dummy PAP entry to check if our parser in the GGSN can properly iterate over |
| 689 | * the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */ |
| 690 | { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O }, |
| 691 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 692 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) } |
| 693 | } |
| 694 | } |
| 695 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 696 | template (value) ProtConfigOptions ts_PCO_IPv4_PRI_DNS_IPCP modifies ts_PCO := { |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 697 | protocols := { |
| 698 | /* dummy PAP entry to check if our parser can cope with a single primary DNS entry |
| 699 | * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */ |
| 700 | { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O }, |
| 701 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 702 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) } |
| 703 | } |
| 704 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 705 | template (value) ProtConfigOptions ts_PCO_IPv4_SEC_DNS_IPCP modifies ts_PCO := { |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 706 | protocols := { |
| 707 | /* dummy PAP entry to check if our parser can cope with a single secondary DNS entry |
| 708 | * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */ |
| 709 | { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O }, |
| 710 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 711 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) } |
| 712 | } |
| 713 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 714 | template (value) ProtConfigOptions ts_PCO_IPv4_SEPARATE_DNS_IPCP modifies ts_PCO := { |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 715 | protocols := { |
| 716 | /* dummy PAP entry to check if our parser can cope with a primary and secondary DNS |
| 717 | * in separate IPCP containers OS#3381 */ |
| 718 | { protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O }, |
| 719 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 720 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) }, |
| 721 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := |
| 722 | enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) } |
| 723 | } |
| 724 | } |
| 725 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 726 | template (present) ProtocolElement tr_PCO_Proto(OCT2 prot_id) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 727 | protocolID := prot_id, |
| 728 | lengthProtoID := ?, |
| 729 | protoIDContents := ? |
| 730 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 731 | template (value) ProtocolElement ts_PCOelem_PAP_broken := { |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 732 | protocolID := 'C023'O, |
| 733 | lengthProtoID := 60, |
| 734 | /* PPP Password Authentication Protocol containing incorrect Peer-Id-Length set to 4 (6-7 should be the valid one), see OS#3914. */ |
| 735 | protoIDContents := '0100003c'O & '0444435338323700bc1c08087c1508083e00790000150808fd06000001000000000000000000000000000000000000000000000000000000'O |
| 736 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 737 | template (value) ProtConfigOptions ts_PCO_PAP_IPv4_DNS modifies ts_PCO := { |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 738 | protocols := { |
| 739 | ts_PCOelem_PAP_broken, |
| 740 | { protocolID := '8021'O, lengthProtoID := 16, protoIDContents := enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) } |
| 741 | } |
| 742 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 743 | template (present) ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 744 | protocols := { *, tr_PCO_Proto(prot_id), * } |
| 745 | } |
| 746 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 747 | template (value) ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 748 | protocols := { |
| 749 | { protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O } |
| 750 | } |
| 751 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 752 | 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] | 753 | protocols := { |
| 754 | *, { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }, * |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | /* extract a given protocol payload from PCO */ |
| 759 | function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring { |
| 760 | var integer i; |
| 761 | var integer num_matches := 0; |
| 762 | for (i := 0; i < lengthof(pco.protocols); i := i + 1) { |
| 763 | if (pco.protocols[i].protocolID == protocol) { |
| 764 | num_matches := num_matches + 1; |
| 765 | if (num_matches == nth_match) { |
| 766 | return pco.protocols[i].protoIDContents; |
| 767 | } |
| 768 | } |
| 769 | } |
Daniel Willmann | e4ff537 | 2018-07-05 17:35:03 +0200 | [diff] [blame] | 770 | setverdict(fail, "Could not extract protocol payload from protocol ", protocol); |
| 771 | mtc.stop; |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 772 | return ''O; |
| 773 | } |
| 774 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 775 | template (present) IpcpPacket tr_IPCP(template (present) LcpCode code, template (present)uint8_t identifier, |
| 776 | template (present) IpcpOptionList opts) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 777 | code := code, |
| 778 | identifier := identifier, |
| 779 | len := ?, |
| 780 | options := opts |
| 781 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 782 | template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 783 | code := IPCP_OPT_PrimaryDNS, |
| 784 | len := 6, |
| 785 | data := addr |
| 786 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 787 | template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 788 | code := IPCP_OPT_SecondaryDNS, |
| 789 | len := 6, |
| 790 | data := addr |
| 791 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 792 | template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?, |
| 793 | template (present) OCT4 dns1 := ?, |
| 794 | template (present) OCT4 dns2 := ?) := |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 795 | tr_IPCP(LCP_Configure_Ack, identifier, |
| 796 | { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * }); |
| 797 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 798 | 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] | 799 | code := code, |
| 800 | identifier := identifier, |
| 801 | len := 0, /* overwritten */ |
| 802 | options := opts |
| 803 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 804 | template (value) IpcpPacket ts_IPCP_ReqDNS(uint8_t identifier := 0) := |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 805 | ts_IPCP(LCP_Configure_Request, identifier, |
| 806 | { tr_IPCP_PrimaryDns('00000000'O), tr_IPCP_SecondaryDns('00000000'O) }); |
| 807 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 808 | template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) := |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 809 | ts_IPCP(LCP_Configure_Request, identifier, |
| 810 | { tr_IPCP_PrimaryDns('00000000'O) }); |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 811 | template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(uint8_t identifier := 0) := |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 812 | ts_IPCP(LCP_Configure_Request, identifier, |
| 813 | { tr_IPCP_SecondaryDns('00000000'O) }); |
| 814 | |
Harald Welte | 57b9b7f | 2018-02-18 22:28:13 +0100 | [diff] [blame] | 815 | function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd { |
| 816 | if (istemplatekind(ind, "omit")) { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 817 | return omit; |
| 818 | } |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 819 | var TearDownInd ret := { |
| 820 | type_gtpc := '13'O, |
| 821 | tdInd := valueof(ind), |
| 822 | spare:= '0000000'B |
| 823 | } |
| 824 | return ret; |
| 825 | } |
| 826 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 827 | 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] | 828 | deletePDPContextRequest := { |
| 829 | cause := omit, |
| 830 | tearDownIndicator := f_teardown_ind_IE(teardown_ind), |
| 831 | nsapi := { |
| 832 | type_gtpc := '14'O, |
| 833 | nsapi := nsapi, |
| 834 | unused := '0000'B |
| 835 | }, |
| 836 | protConfigOptions := omit, |
| 837 | userLocationInformation := omit, |
| 838 | mS_TimeZone := omit, |
| 839 | extendedCommonFlags := omit, |
| 840 | uLI_Timestamp := omit, |
| 841 | private_extension_gtpc := omit |
| 842 | } |
| 843 | } |
| 844 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 845 | template (value) Gtp1cUnitdata ts_GTPC_DeletePDP(GtpPeer peer, uint16_t seq, OCT4 teid, |
| 846 | BIT4 nsapi, template (omit) BIT1 teardown_ind) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 847 | peer := peer, |
| 848 | gtpc := ts_GTP1C_PDU(deletePDPContextRequest, teid, |
| 849 | valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq) |
| 850 | } |
| 851 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 852 | template (value) GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause, |
| 853 | template (omit) ProtConfigOptions pco := omit) := { |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 854 | deletePDPContextResponse := { |
| 855 | cause := { '00'O, cause }, |
| 856 | protConfigOptions := pco, |
| 857 | userLocationInformation := omit, |
| 858 | mS_TimeZone := omit, |
| 859 | uLI_Timestamp := omit, |
| 860 | private_extension_gtpc := omit |
| 861 | } |
| 862 | } |
| 863 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 864 | template (value) Gtp1cUnitdata ts_GTPC_DeletePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid, |
| 865 | OCT1 cause, |
| 866 | template (omit) ProtConfigOptions pco := omit) := { |
Harald Welte | 6f20316 | 2018-02-18 22:04:55 +0100 | [diff] [blame] | 867 | peer := peer, |
| 868 | gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid, |
| 869 | valueof(ts_DeletePdpRespPDU(cause, pco)), seq) |
| 870 | } |
| 871 | |
| 872 | |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 873 | /* GTP-C RIM */ |
| 874 | |
| 875 | template (value) RIM_Application_Identity_GTPC ts_GTPC_RIM_Application_Identity(OCT1 app_id) := { |
| 876 | iEI := '4B'O, |
| 877 | ext := '1'B, |
| 878 | lengthIndicator := { |
| 879 | length1 := 1 |
| 880 | }, |
| 881 | rIMApplicationIdentity := app_id |
| 882 | } |
| 883 | /* 3GPP TS 48.018 11.3.62 */ |
| 884 | template (value) RIM_Sequence_Number_GTPC ts_GTPC_RIM_Sequence_Number(integer seq) := { |
| 885 | iEI := '4C'O, |
| 886 | ext := '1'B, |
| 887 | lengthIndicator := { |
| 888 | length1 := 4 |
| 889 | }, |
| 890 | rIMSequenceNumber := int2oct(seq, 4) |
| 891 | } |
| 892 | template (value) RIM_PDU_Indications_GTPC ts_GTPC_RIM_PDU_Indications(boolean ack, BIT3 type_ext) := { |
| 893 | iEI := '4F'O, |
| 894 | ext := '1'B, |
| 895 | lengthIndicator := { |
| 896 | length1 := 1 |
| 897 | }, |
| 898 | ack := bool2bit(ack), |
| 899 | pDU_Type_Extension := type_ext, |
| 900 | reserved := '0000'B |
| 901 | } |
| 902 | /* 3GPP TS 48.018 11.3.67 */ |
| 903 | template (value) RIM_Protocol_Version_Number_GTPC ts_GTPC_RIM_Protocol_Version_Number(integer ver) := { |
| 904 | iEI := '55'O, |
| 905 | ext := '1'B, |
| 906 | lengthIndicator := { |
| 907 | length1 := 1 |
| 908 | }, |
| 909 | rIMProtocolVersionNumber := int2oct(ver, 1) |
| 910 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 911 | 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] | 912 | var template Cell_Identifier_V_GTPC ret := { |
| 913 | mccDigit1 := ?, |
| 914 | mccDigit2 := ?, |
| 915 | mccDigit3 := ?, |
| 916 | mncDigit3 := ?, |
| 917 | mncDigit1 := ?, |
| 918 | mncDigit2 := ?, |
| 919 | lac := ?, |
| 920 | rac := ?, |
| 921 | cI_value := ? |
| 922 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 923 | if (istemplatekind(cid, "?")) { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 924 | return ?; |
| 925 | } |
| 926 | if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) { |
| 927 | if (isvalue(cid.ra_id.lai.mcc_mnc)) { |
| 928 | ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0]; |
| 929 | ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1]; |
| 930 | ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2]; |
| 931 | ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3]; |
| 932 | ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4]; |
| 933 | ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5]; |
| 934 | } |
| 935 | if (isvalue(cid.ra_id.lai.lac)) { |
| 936 | ret.lac := f_oct_or_wc(cid.ra_id.lai.lac, 2); |
| 937 | } |
| 938 | } |
| 939 | if (isvalue(cid) and isvalue(cid.ra_id)) { |
| 940 | ret.rac := f_oct_or_wc(cid.ra_id.rac, 1); |
| 941 | } |
| 942 | if (isvalue(cid)) { |
| 943 | ret.cI_value := f_oct_or_wc(cid.cell_id, 2); |
| 944 | } |
| 945 | return ret; |
| 946 | } |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 947 | 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] | 948 | mccDigit1 := cid.ra_id.lai.mcc_mnc[0], |
| 949 | mccDigit2 := cid.ra_id.lai.mcc_mnc[1], |
| 950 | mccDigit3 := cid.ra_id.lai.mcc_mnc[2], |
| 951 | mncDigit3 := cid.ra_id.lai.mcc_mnc[3], |
| 952 | mncDigit1 := cid.ra_id.lai.mcc_mnc[4], |
| 953 | mncDigit2 := cid.ra_id.lai.mcc_mnc[5], |
| 954 | lac := int2oct(cid.ra_id.lai.lac, 2), |
| 955 | rac := int2oct(cid.ra_id.rac, 1), |
| 956 | cI_value := int2oct(cid.cell_id, 2) |
| 957 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 958 | template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_cid(GTP_CellId cid) := { |
| 959 | cell_Identifier := ts_GTPC_Cell_Identifier_V(cid) |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 960 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 961 | function tr_GTPC_ENB_Identifier(template (present) GTP_CellId cid, |
| 962 | template (present) integer tac, |
| 963 | template (present) octetstring gnbid) return template (present) ENB_Identifier { |
| 964 | var template (present) ENB_Identifier ret := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 965 | mccDigit1 := ?, |
| 966 | mccDigit2 := ?, |
| 967 | mccDigit3 := ?, |
| 968 | mncDigit3 := ?, |
| 969 | mncDigit1 := ?, |
| 970 | mncDigit2 := ?, |
| 971 | tAC := ?, |
| 972 | globalENB_ID := ? |
| 973 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 974 | if (istemplatekind(cid, "?") and istemplatekind(tac, "?") and istemplatekind(gnbid, "?")) { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 975 | return ?; |
| 976 | } |
| 977 | if (isvalue(cid) and isvalue(cid.ra_id) and isvalue(cid.ra_id.lai)) { |
| 978 | if (isvalue(cid.ra_id.lai.mcc_mnc)) { |
| 979 | ret.mccDigit1 := cid.ra_id.lai.mcc_mnc[0]; |
| 980 | ret.mccDigit2 := cid.ra_id.lai.mcc_mnc[1]; |
| 981 | ret.mccDigit3 := cid.ra_id.lai.mcc_mnc[2]; |
| 982 | ret.mncDigit3 := cid.ra_id.lai.mcc_mnc[3]; |
| 983 | ret.mncDigit1 := cid.ra_id.lai.mcc_mnc[4]; |
| 984 | ret.mncDigit2 := cid.ra_id.lai.mcc_mnc[5]; |
| 985 | } |
| 986 | } |
| 987 | if (isvalue(tac)) { |
| 988 | ret.tAC := int2oct(valueof(tac), 2); |
| 989 | } |
| 990 | if (isvalue(gnbid)) { |
| 991 | ret.globalENB_ID := gnbid; |
| 992 | } |
| 993 | |
| 994 | return ret; |
| 995 | } |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 996 | 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] | 997 | mccDigit1 := cid.ra_id.lai.mcc_mnc[0], |
| 998 | mccDigit2 := cid.ra_id.lai.mcc_mnc[1], |
| 999 | mccDigit3 := cid.ra_id.lai.mcc_mnc[2], |
| 1000 | mncDigit3 := cid.ra_id.lai.mcc_mnc[3], |
| 1001 | mncDigit1 := cid.ra_id.lai.mcc_mnc[4], |
| 1002 | mncDigit2 := cid.ra_id.lai.mcc_mnc[5], |
| 1003 | tAC := int2oct(tac, 2), |
| 1004 | globalENB_ID := gnbid |
| 1005 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1006 | template (value) RIM_Routing_Address_GTPC t_GTPC_RIM_Routing_Address_enbid(GTP_CellId cid, integer tac, octetstring gnbid) := { |
| 1007 | eNB_Identifier := ts_GTPC_ENB_Identifier(cid, tac, gnbid) |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1008 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1009 | template (present) RIM_Routing_Information_GTPC |
| 1010 | 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] | 1011 | iEI := '54'O, |
| 1012 | ext := '1'B, |
| 1013 | lengthIndicator := { |
| 1014 | length1 := ? |
| 1015 | }, |
| 1016 | rIMRoutingAddressDiscriminator := addr_discr, |
| 1017 | spare := '0'H, |
| 1018 | rIM_Routing_Address := addr |
| 1019 | } |
| 1020 | template (value) RIM_Routing_Information_GTPC |
| 1021 | ts_GTPC_RIM_Routing_Information(HEX1 addr_discr, template (value) RIM_Routing_Address_GTPC addr) := { |
| 1022 | iEI := '54'O, |
| 1023 | ext := '1'B, |
| 1024 | lengthIndicator := { |
| 1025 | length1 := 0 /* overwritten */ |
| 1026 | }, |
| 1027 | rIMRoutingAddressDiscriminator := addr_discr, |
| 1028 | spare := '0'H, |
| 1029 | rIM_Routing_Address := addr |
| 1030 | } |
| 1031 | /* 3GPP TS 48.018 11.3.63.1.1 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1032 | template (present) RAN_Information_Request_Application_Container_NACC_GTPC |
| 1033 | 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] | 1034 | iEI := '4D'O, |
| 1035 | ext := '1'B, |
| 1036 | lengthIndicator := { |
| 1037 | length1 := ? |
| 1038 | }, |
| 1039 | reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid) |
| 1040 | } |
| 1041 | template (value) RAN_Information_Request_Application_Container_NACC_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1042 | ts_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1043 | iEI := '4D'O, |
| 1044 | ext := '1'B, |
| 1045 | lengthIndicator := { |
| 1046 | length1 := 0 /* overwritten */ |
| 1047 | }, |
| 1048 | reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid) |
| 1049 | } |
| 1050 | /* 3GPP TS 48.018 11.3.63.1 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1051 | template (present) RAN_Information_Request_Application_Container_GTPC |
| 1052 | 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] | 1053 | nacc := tr_GTPC_RAN_Information_Request_Application_Container_NACC(cid) |
| 1054 | } |
| 1055 | template (value) RAN_Information_Request_Application_Container_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1056 | tsu_GTPC_RAN_Information_Request_Application_Container_NACC(GTP_CellId cid) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1057 | nacc := ts_GTPC_RAN_Information_Request_Application_Container_NACC(cid) |
| 1058 | } |
| 1059 | /* 3GPP TS 48.018 11.3.63.2.1 */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1060 | template (present) RAN_Information_Application_Container_NACC_GTPC |
| 1061 | 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] | 1062 | iEI := '4E'O, |
| 1063 | ext := '1'B, |
| 1064 | lengthIndicator := { |
| 1065 | length1 := ? |
| 1066 | }, |
| 1067 | reporting_Cell_Identifier := tr_GTPC_Cell_Identifier_V(cid), |
| 1068 | typeBit := bool2bit(psi_type), |
| 1069 | number_of_SI_PSI := int2bit(si_psi_num, 7), |
| 1070 | sI_PSI := si_psi |
| 1071 | } |
| 1072 | template (value) RAN_Information_Application_Container_NACC_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1073 | 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] | 1074 | iEI := '4E'O, |
| 1075 | ext := '1'B, |
| 1076 | lengthIndicator := { |
| 1077 | length1 := 0 /* overwritten */ |
| 1078 | }, |
| 1079 | reporting_Cell_Identifier := ts_GTPC_Cell_Identifier_V(cid), |
| 1080 | typeBit := bool2bit(psi_type), |
| 1081 | number_of_SI_PSI := int2bit(si_psi_num, 7), |
| 1082 | sI_PSI := si_psi |
| 1083 | } |
Philipp Maier | f7cb0bb | 2023-07-28 12:35:38 +0200 | [diff] [blame] | 1084 | external function enc_RIM_Routing_Address_GTPC(in RIM_Routing_Address_GTPC ra) return octetstring |
| 1085 | with { extension "prototype(convert) encode(RAW)" }; |
| 1086 | external function dec_PCUIF_pch_dt(in octetstring stream) return RIM_Routing_Address_GTPC |
| 1087 | with { extension "prototype(convert) decode(RAW)" }; |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1088 | |
| 1089 | /* RAN_Information_Request */ |
| 1090 | template (value) RAN_Information_Request_RIM_Container_GTPC |
| 1091 | ts_GTPC_RAN_Information_Request_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id, |
| 1092 | template (value) RIM_Sequence_Number_GTPC seq, |
| 1093 | template (value) RIM_PDU_Indications_GTPC ind, |
| 1094 | template (omit) RIM_Protocol_Version_Number_GTPC ver := omit, |
| 1095 | template (omit) RAN_Information_Request_Application_Container_GTPC app_cont := omit, |
| 1096 | template (omit) SON_TransferApplicationIdentity son_app_id := omit) := { |
| 1097 | iEI := '57'O, |
| 1098 | ext := '1'B, |
| 1099 | lengthIndicator := { |
| 1100 | length1 := 0 /* overwritten */ |
| 1101 | }, |
| 1102 | rIM_Application_Identity := app_id, |
| 1103 | rIM_Sequence_Number := seq, |
| 1104 | rIM_PDU_Indications := ind, |
| 1105 | rIM_Protocol_Version_Number := ver, |
| 1106 | application_Container := app_cont, |
| 1107 | sON_TransferApplicationIdentity := son_app_id |
| 1108 | } |
| 1109 | template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC |
| 1110 | ts_GTPC_RAN_Information_Request(template (value) RIM_Routing_Information_GTPC dest, |
| 1111 | template (value) RIM_Routing_Information_GTPC src, |
Philipp Maier | 6cef1c3 | 2023-07-24 11:01:52 +0200 | [diff] [blame] | 1112 | template (value) RAN_Information_Request_RIM_Container_GTPC cont) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1113 | bssgpPduType := '71'O, |
| 1114 | destination_Cell_Identifier := dest, |
| 1115 | source_Cell_Identifier := src, |
| 1116 | rIM_Container := cont |
| 1117 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1118 | template (present) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC |
| 1119 | tr_GTPC_RAN_Information_Request(template (present) RIM_Routing_Information_GTPC dest := ?, |
| 1120 | template (present) RIM_Routing_Information_GTPC src := ?, |
| 1121 | template (present) RAN_Information_Request_RIM_Container_GTPC cont := ?) := { |
Philipp Maier | 4b81c6e | 2023-07-24 11:03:15 +0200 | [diff] [blame] | 1122 | bssgpPduType := '71'O, |
| 1123 | destination_Cell_Identifier := dest, |
| 1124 | source_Cell_Identifier := src, |
| 1125 | rIM_Container := cont |
| 1126 | } |
| 1127 | |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1128 | template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO_REQ(template (value) PDU_BSSGP_RAN_INFORMATION_REQUEST_GTPC pdu) := { |
| 1129 | type_gtpc := '90'O, |
| 1130 | lengthf := 0, /* FIXME */ |
| 1131 | rANTransparentContainerField := { |
| 1132 | pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu |
| 1133 | } |
| 1134 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1135 | 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] | 1136 | type_gtpc := '90'O, |
| 1137 | lengthf := ?, |
| 1138 | rANTransparentContainerField := { |
| 1139 | pDU_BSSGP_RAN_INFORMATION_REQUEST := pdu |
| 1140 | } |
| 1141 | } |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1142 | |
| 1143 | /* RAN_Information */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1144 | template (present) ApplContainer_or_ApplErrContainer_NACC_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1145 | 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] | 1146 | application_Container := tr_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi) |
| 1147 | } |
| 1148 | template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC |
Pau Espin Pedrol | 17e0f8c | 2021-12-03 15:11:34 +0100 | [diff] [blame] | 1149 | 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] | 1150 | application_Container := ts_GTPC_RAN_Information_Application_Container_NACC(cid, psi_type, si_psi_num, si_psi) |
| 1151 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1152 | template (present) ApplContainer_or_ApplErrContainer_GTPC |
| 1153 | 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] | 1154 | nacc := cont |
| 1155 | } |
| 1156 | template (value) ApplContainer_or_ApplErrContainer_GTPC |
| 1157 | tsu_GTPC_ApplContainer_or_ApplErrContainer_NACC(template (value) ApplContainer_or_ApplErrContainer_NACC_GTPC cont) := { |
| 1158 | nacc := cont |
| 1159 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1160 | template (present) RAN_Information_RIM_Container_GTPC |
| 1161 | tr_GTPC_RAN_Information_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id, |
| 1162 | template (present) RIM_Sequence_Number_GTPC seq, |
| 1163 | template (present) RIM_PDU_Indications_GTPC ind, |
| 1164 | template RIM_Protocol_Version_Number_GTPC ver := *, |
| 1165 | template ApplContainer_or_ApplErrContainer_GTPC app_cont := *, |
| 1166 | template SON_TransferApplicationIdentity son_app_id := *) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1167 | iEI := '58'O, |
| 1168 | ext := '1'B, |
| 1169 | lengthIndicator := { |
| 1170 | length1 := ? |
| 1171 | }, |
| 1172 | rIM_Application_Identity := app_id, |
| 1173 | rIM_Sequence_Number := seq, |
| 1174 | rIM_PDU_Indications := ind, |
| 1175 | rIM_Protocol_Version_Number := ver, |
| 1176 | applContainer_or_ApplErrContainer := app_cont, |
| 1177 | sON_TransferApplicationIdentity := son_app_id |
| 1178 | } |
| 1179 | template (value) RAN_Information_RIM_Container_GTPC |
| 1180 | ts_GTPC_RAN_Information_RIM_Container(template (value) RIM_Application_Identity_GTPC app_id, |
| 1181 | template (value) RIM_Sequence_Number_GTPC seq, |
| 1182 | template (value) RIM_PDU_Indications_GTPC ind, |
| 1183 | template (omit) RIM_Protocol_Version_Number_GTPC ver := omit, |
| 1184 | template (omit) ApplContainer_or_ApplErrContainer_GTPC app_cont := omit, |
| 1185 | template (omit) SON_TransferApplicationIdentity son_app_id := omit) := { |
| 1186 | iEI := '58'O, |
| 1187 | ext := '1'B, |
| 1188 | lengthIndicator := { |
| 1189 | length1 := 0 /* overwritten */ |
| 1190 | }, |
| 1191 | rIM_Application_Identity := app_id, |
| 1192 | rIM_Sequence_Number := seq, |
| 1193 | rIM_PDU_Indications := ind, |
| 1194 | rIM_Protocol_Version_Number := ver, |
| 1195 | applContainer_or_ApplErrContainer := app_cont, |
| 1196 | sON_TransferApplicationIdentity := son_app_id |
| 1197 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1198 | template (present) PDU_BSSGP_RAN_INFORMATION_GTPC |
| 1199 | tr_GTPC_RAN_Information(template (present) RIM_Routing_Information_GTPC dest, |
| 1200 | template (present) RIM_Routing_Information_GTPC src, |
| 1201 | template (present) RAN_Information_RIM_Container_GTPC cont) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1202 | bssgpPduType := '70'O, |
| 1203 | destination_Cell_Identifier := dest, |
| 1204 | source_Cell_Identifier := src, |
| 1205 | rIM_Container := cont |
| 1206 | } |
| 1207 | template (value) PDU_BSSGP_RAN_INFORMATION_GTPC |
| 1208 | ts_GTPC_RAN_Information(template (value) RIM_Routing_Information_GTPC dest, |
| 1209 | template (value) RIM_Routing_Information_GTPC src, |
| 1210 | template (value) RAN_Information_RIM_Container_GTPC cont) := { |
| 1211 | bssgpPduType := '70'O, |
| 1212 | destination_Cell_Identifier := dest, |
| 1213 | source_Cell_Identifier := src, |
| 1214 | rIM_Container := cont |
| 1215 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1216 | 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] | 1217 | type_gtpc := '90'O, |
| 1218 | lengthf := ?, |
| 1219 | rANTransparentContainerField := { |
| 1220 | pDU_BSSGP_RAN_INFORMATION := pdu |
| 1221 | } |
| 1222 | } |
| 1223 | template (value) RANTransparentContainer ts_RANTransparentContainer_RAN_INFO(template (value) PDU_BSSGP_RAN_INFORMATION_GTPC pdu) := { |
| 1224 | type_gtpc := '90'O, |
| 1225 | lengthf := 0, /* overwritten */ |
| 1226 | rANTransparentContainerField := { |
| 1227 | pDU_BSSGP_RAN_INFORMATION := pdu |
| 1228 | } |
| 1229 | } |
| 1230 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1231 | template (present) RANTransparentContainer tr_RANTransparentContainer(template (present) RANTransparentContainerField rANTransparentContainerField) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1232 | type_gtpc := '90'O, |
| 1233 | lengthf := ?, |
| 1234 | rANTransparentContainerField := rANTransparentContainerField |
| 1235 | } |
| 1236 | template (value) RANTransparentContainer ts_RANTransparentContainer(template (value) RANTransparentContainerField rANTransparentContainerField) := { |
| 1237 | type_gtpc := '90'O, |
| 1238 | lengthf := 0, /* overwritten */ |
| 1239 | rANTransparentContainerField := rANTransparentContainerField |
| 1240 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1241 | template (present) GTPC_PDUs tr_RANInfoRelay(template (present) RANTransparentContainer transparentContainer) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1242 | ranInformationRelay := { |
| 1243 | transparentContainer := transparentContainer, |
| 1244 | rIM_RoutingAddress := *, |
| 1245 | rIM_RoutingAddress_Discriminator := *, |
| 1246 | private_extension_gtpc := * |
| 1247 | } |
| 1248 | } |
Philipp Maier | 05ad55c | 2023-07-24 10:56:46 +0200 | [diff] [blame] | 1249 | template (value) GTPC_PDUs ts_RANInfoRelay(template (value) RANTransparentContainer transparentContainer, |
| 1250 | template (omit) RIM_RoutingAddress ra := omit, |
| 1251 | template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1252 | ranInformationRelay := { |
| 1253 | transparentContainer := transparentContainer, |
Philipp Maier | 05ad55c | 2023-07-24 10:56:46 +0200 | [diff] [blame] | 1254 | rIM_RoutingAddress := ra, |
| 1255 | rIM_RoutingAddress_Discriminator := ra_discr, |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1256 | private_extension_gtpc := omit |
| 1257 | } |
| 1258 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1259 | template (present) Gtp1cUnitdata |
| 1260 | tr_GTPC_RANInfoRelay(template (present) GtpPeer peer, |
| 1261 | template (present) RANTransparentContainer transparentContainer) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1262 | peer := peer, |
| 1263 | gtpc := tr_GTP1C_PDU(rANInformationRelay, '00000000'O, tr_RANInfoRelay(transparentContainer)) |
| 1264 | } |
| 1265 | template (value) Gtp1cUnitdata |
| 1266 | ts_GTPC_RANInfoRelay(template (value) GtpPeer peer, |
Philipp Maier | 05ad55c | 2023-07-24 10:56:46 +0200 | [diff] [blame] | 1267 | template (value) RANTransparentContainer transparentContainer, |
| 1268 | template (omit) RIM_RoutingAddress ra := omit, |
| 1269 | template (omit) RIM_RoutingAddress_Discriminator ra_discr := omit) := { |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1270 | peer := peer, |
Philipp Maier | 05ad55c | 2023-07-24 10:56:46 +0200 | [diff] [blame] | 1271 | 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] | 1272 | } |
| 1273 | |
| 1274 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1275 | template (present) RAN_Information_Request_RIM_Container_GTPC |
| 1276 | tr_GTPC_RAN_Information_Request_RIM_Container(template (present) RIM_Application_Identity_GTPC app_id := ?, |
| 1277 | template (present) RIM_Sequence_Number_GTPC seq := ?, |
| 1278 | template (present) RIM_PDU_Indications_GTPC ind := ?, |
Pau Espin Pedrol | 8c74cbb | 2021-05-04 15:26:56 +0200 | [diff] [blame] | 1279 | template RIM_Protocol_Version_Number_GTPC ver := *, |
| 1280 | template RAN_Information_Request_Application_Container_GTPC app_cont := *, |
| 1281 | template SON_TransferApplicationIdentity son_app_id := *) := { |
| 1282 | iEI := '57'O, |
| 1283 | ext := '1'B, |
| 1284 | lengthIndicator := { |
| 1285 | length1 := ? |
| 1286 | }, |
| 1287 | rIM_Application_Identity := app_id, |
| 1288 | rIM_Sequence_Number := seq, |
| 1289 | rIM_PDU_Indications := ind, |
| 1290 | rIM_Protocol_Version_Number := ver, |
| 1291 | application_Container := app_cont, |
| 1292 | sON_TransferApplicationIdentity := son_app_id |
| 1293 | } |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1294 | |
| 1295 | /* GTP-U */ |
| 1296 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1297 | template (present) PDU_GTPU tr_GTP1U_PDU(template (present) OCT1 msg_type, |
| 1298 | template (present) OCT4 teid, |
| 1299 | template (present) GTPU_IEs ies := ?) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1300 | pn_bit := ?, |
| 1301 | s_bit := ?, |
| 1302 | e_bit := ?, |
| 1303 | spare := ?, |
| 1304 | /* Protocol Type flag (PT) shall be set to '1' in GTP */ |
| 1305 | pt := '1'B, |
| 1306 | /* Version shall be set to decimal 1 ('001'). */ |
| 1307 | version := '001'B, |
| 1308 | messageType := msg_type, |
| 1309 | lengthf := ?, |
| 1310 | teid := teid, |
| 1311 | opt_part := *, |
| 1312 | gtpu_IEs := ies |
| 1313 | } |
| 1314 | |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1315 | function f_GTPU_s_bit(template (omit) uint16_t seq) return BIT1 { |
| 1316 | if (istemplatekind(seq, "omit")) { |
| 1317 | return '0'B; |
| 1318 | } |
| 1319 | return '1'B; |
| 1320 | } |
| 1321 | |
| 1322 | function f_GTPU_opt_part(template (omit) uint16_t seq) return template (omit) GTPU_Header_optional_part { |
| 1323 | if (istemplatekind(seq, "omit")) { |
| 1324 | return omit; |
| 1325 | } |
| 1326 | var GTPU_Header_optional_part ret := { |
| 1327 | sequenceNumber := int2oct(valueof(seq), 2), |
| 1328 | npduNumber := '00'O, |
| 1329 | nextExtHeader := '00'O, |
| 1330 | gTPU_extensionHeader_List := omit |
| 1331 | }; |
| 1332 | return ret; |
| 1333 | } |
| 1334 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1335 | /* generalized GTP-U send template */ |
Pau Espin Pedrol | 480e67f | 2022-02-09 16:37:47 +0100 | [diff] [blame] | 1336 | 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] | 1337 | /* N-PDU Number flag (PN): the GTP-U header contains a meaningful N-PDU Number field if the PN |
| 1338 | * flag is set to 1. */ |
| 1339 | pn_bit := '0'B, /* we assume the encoder overwrites this if an optional part is given */ |
| 1340 | /* If the Sequence Number flag (S) is set to '1' the sequence number field is present and |
| 1341 | * 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] | 1342 | * Error Indication and Supported Extension Headers Notification, the S flag shall be set to '1'. |
| 1343 | * |
| 1344 | * Note that the caller must ensure that these conditions hold. |
| 1345 | * The caller can either pass a sequence number (we set s_bit to '1'B) when appropriate, |
| 1346 | * or may omit the sequence number (we set s_bit to '0'B). */ |
| 1347 | s_bit := f_GTPU_s_bit(seq), |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1348 | /* Extension header presence */ |
| 1349 | e_bit := '0'B, |
| 1350 | spare := '0'B, |
| 1351 | /* Protocol Type flag (PT) shall be set to '1' in GTP */ |
| 1352 | pt := '1'B, |
| 1353 | /* Version shall be set to decimal 1 ('001'). */ |
| 1354 | version := '001'B, |
| 1355 | messageType := msg_type, |
| 1356 | lengthf := 0, /* we assume encoder overwrites this */ |
| 1357 | teid := teid, |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1358 | opt_part := f_GTPU_opt_part(seq), |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1359 | gtpu_IEs := ies |
| 1360 | } |
| 1361 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1362 | template (present) Gtp1uUnitdata tr_GTPU_MsgType(template (present) GtpPeer peer, |
| 1363 | template (present) OCT1 msg_type, |
| 1364 | template (present) OCT4 teid) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1365 | peer := peer, |
| 1366 | gtpu := tr_GTP1U_PDU(msg_type, teid) |
| 1367 | } |
| 1368 | |
| 1369 | |
Pau Espin Pedrol | 480e67f | 2022-02-09 16:37:47 +0100 | [diff] [blame] | 1370 | /* template matching reception of GTP-U echo-request/response */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1371 | template (present) Gtp1uUnitdata tr_GTPU_PING(template (present) GtpPeer peer) := tr_GTPU_MsgType(peer, echoRequest, '00000000'O); |
| 1372 | 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] | 1373 | |
| 1374 | /* template matching reception of GTP-U GPDU */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1375 | template GTPU_IEs t_GPDU(template (present) octetstring data) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1376 | g_PDU_IEs := { |
| 1377 | data := data |
| 1378 | } |
| 1379 | } |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1380 | template (present) Gtp1uUnitdata tr_GTPU_GPDU(template (present) GtpPeer peer, |
| 1381 | template (present) OCT4 teid, |
| 1382 | template (present) octetstring data := ?) := { |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1383 | peer := peer, |
| 1384 | gtpu := tr_GTP1U_PDU('FF'O, teid, t_GPDU(data)) |
| 1385 | } |
| 1386 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1387 | template (present) GTPU_IEs ts_UEchoReqPDU := { |
Pau Espin Pedrol | 480e67f | 2022-02-09 16:37:47 +0100 | [diff] [blame] | 1388 | echoRequest_IEs := { |
| 1389 | private_extension_gtpu := omit |
| 1390 | } |
| 1391 | } |
| 1392 | |
| 1393 | /* master template for sending a GTP-C echo request */ |
| 1394 | template (value) Gtp1uUnitdata ts_GTPU_PING(GtpPeer peer, uint16_t seq) := { |
| 1395 | peer := peer, |
| 1396 | gtpu := ts_GTP1U_PDU(echoRequest, seq, '00000000'O, valueof(ts_UEchoReqPDU)) |
| 1397 | } |
| 1398 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1399 | template GTPU_IEs ts_UEchoRespPDU(OCT1 restart_counter) := { |
| 1400 | echoResponse_IEs := { |
| 1401 | recovery_gtpu := { |
| 1402 | type_gtpu := '00'O, /* we assume encoder fixes? */ |
| 1403 | restartCounter := restart_counter |
| 1404 | }, |
| 1405 | private_extension_gtpu := omit |
| 1406 | } |
| 1407 | } |
| 1408 | |
| 1409 | /* master template for sending a GTP-U echo response */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1410 | 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] | 1411 | peer := peer, |
| 1412 | gtpu := ts_GTP1U_PDU(echoResponse, seq, '00000000'O, valueof(ts_UEchoRespPDU(rest_ctr))) |
| 1413 | } |
| 1414 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1415 | template (value) GSNAddress_gtpu ts_UGsnAddr(octetstring ip_addr) := { |
Pau Espin Pedrol | f3e2538 | 2018-07-18 13:46:40 +0200 | [diff] [blame] | 1416 | type_gtpu := '85'O, |
| 1417 | lengthf := lengthof(ip_addr), |
| 1418 | gSNAddressValue := ip_addr |
| 1419 | } |
| 1420 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1421 | template (value) TeidDataI_gtpu ts_UteidDataI(OCT4 teid) := { |
Pau Espin Pedrol | f3e2538 | 2018-07-18 13:46:40 +0200 | [diff] [blame] | 1422 | type_gtpu := '10'O, |
| 1423 | teidDataI := teid |
| 1424 | } |
| 1425 | |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1426 | template (value) GTPU_IEs ts_UErrorIndication(OCT4 teid, octetstring gsn_addr) := { |
Pau Espin Pedrol | f3e2538 | 2018-07-18 13:46:40 +0200 | [diff] [blame] | 1427 | errorIndication_IEs := { |
| 1428 | teidDataI_gtpu := ts_UteidDataI(teid), |
| 1429 | gSNAddress_gtpu := ts_UGsnAddr(gsn_addr), |
| 1430 | private_extension_gtpu := omit |
| 1431 | } |
| 1432 | } |
| 1433 | |
| 1434 | /* master template for sending a GTP-U Error indication */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1435 | 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] | 1436 | peer := peer, |
| 1437 | gtpu := ts_GTP1U_PDU('1A'O, seq, '00000000'O, valueof(ts_UErrorIndication(teid, gsn_addr))) |
| 1438 | } |
| 1439 | |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1440 | /* master template for sending a GTP-U user plane data */ |
Philipp Maier | 5788949 | 2023-08-07 12:10:03 +0200 | [diff] [blame] | 1441 | 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] | 1442 | peer := peer, |
| 1443 | gtpu := ts_GTP1U_PDU('FF'O, seq, teid, { g_PDU_IEs := { data := data }}) |
| 1444 | } |
Philipp Maier | 653a014 | 2023-08-04 15:22:37 +0200 | [diff] [blame^] | 1445 | |
| 1446 | /* 3GPP TS 29.060, section 7.7.57 */ |
| 1447 | template (value) RIM_RoutingAddress ts_RIM_RoutingAddress(octetstring addr_value) := { |
| 1448 | type_gtpc := '9F'O, |
| 1449 | lengthf := 0, /* we assume encoder overwrites this */ |
| 1450 | rIM_RoutingAddressValue := addr_value |
| 1451 | } |
| 1452 | template (present) RIM_RoutingAddress tr_RIM_RoutingAddress(template (present) octetstring addr_value := ?) := { |
| 1453 | type_gtpc := '9F'O, |
| 1454 | lengthf := ?, |
| 1455 | rIM_RoutingAddressValue := addr_value |
| 1456 | } |
| 1457 | |
| 1458 | /* 3GPP TS 29.060, section 7.7.77 */ |
| 1459 | template (value) RIM_RoutingAddress_Discriminator ts_RIM_RoutingAddress_Discriminator(bitstring addr_discr) := { |
| 1460 | type_gtpc := 'B2'O, |
| 1461 | lengthf := 0, /* we assume encoder overwrites this */ |
| 1462 | rra_discriminator := addr_discr, |
| 1463 | spare := '0000'B |
| 1464 | } |
| 1465 | template (present) RIM_RoutingAddress_Discriminator tr_RIM_RoutingAddress_Discriminator(template (present) bitstring addr_discr := ?) := { |
| 1466 | type_gtpc := 'B2'O, |
| 1467 | lengthf := ?, |
| 1468 | rra_discriminator := addr_discr, |
| 1469 | spare := '0000'B |
| 1470 | } |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 1471 | } |