Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1 | module GSUP_Templates { |
| 2 | |
| 3 | /* GSUP_Templates, defining TTCN-3 templates for the GSUP protocol. |
| 4 | * |
| 5 | * GSUP is a non-standard protocol used between OsmoMSC/OsmoSGSN and OsmoHLR |
| 6 | * in order to replace the complex TCAP/MAP protocol. |
| 7 | * |
| 8 | * (C) 2017-2019 by Harald Welte <laforge@gnumonks.org> |
| 9 | * contributions by sysmocom - s.f.m.c. GmbH |
| 10 | * All rights reserved. |
| 11 | * |
| 12 | * Released under the terms of GNU General Public License, Version 2 or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 16 | */ |
| 17 | |
| 18 | import from General_Types all; |
| 19 | import from Osmocom_Types all; |
| 20 | import from GSUP_Types all; |
| 21 | |
| 22 | function f_gsup_postprocess_decoded(inout GSUP_PDU gsup) { |
| 23 | if (gsup.ies[0].tag == OSMO_GSUP_IMSI_IE) { |
| 24 | /* if last digit is 'F', then there's an odd number of digits and we must strip the F */ |
| 25 | var integer num_digits := lengthof(gsup.ies[0].val.imsi); |
| 26 | if (gsup.ies[0].val.imsi[num_digits-1] == 'F'H) { |
| 27 | gsup.ies[0].val.imsi := substr(gsup.ies[0].val.imsi, 0, num_digits-1); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | function f_gsup_preprocess_encoded(inout GSUP_PDU gsup) { |
| 33 | if (ischosen(gsup.ies[0].val.imsi)) { |
| 34 | /* if number of digits is odd, add a 'F' as padding at the end */ |
| 35 | var integer num_digits := lengthof(gsup.ies[0].val.imsi); |
| 36 | if (num_digits rem 2 == 1) { |
| 37 | gsup.ies[0].val.imsi := gsup.ies[0].val.imsi & 'F'H; |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | template (value) GSUP_MSISDN ts_GSUP_MSISDN(hexstring digits, |
| 43 | BIT3 ton := '000'B, |
| 44 | BIT4 npi := '0000'B) := { |
| 45 | len := 0, /* overwritten */ |
| 46 | /* numberingPlanIdentification := npi, |
| 47 | typeOfNumber := ton, |
| 48 | ext1 := '0'B, */ |
| 49 | digits := digits |
| 50 | } |
| 51 | |
| 52 | template GSUP_MSISDN tr_GSUP_MSISDN(template hexstring digits, |
| 53 | template BIT3 ton := ?, |
| 54 | template BIT4 npi := ?) := { |
| 55 | len := ?, |
| 56 | /* numberingPlanIdentification := npi, |
| 57 | typeOfNumber := ton, |
| 58 | ext1 := '0'B, */ |
| 59 | digits := digits |
| 60 | } |
| 61 | |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 62 | template (value) GSUP_PDP_Address ts_GSUP_PDP_Address_IPv4(template (omit) OCT4 ip_addr) := { |
| 63 | ipv4 := { |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 64 | spare := '1111'B, |
Pau Espin Pedrol | a518d05 | 2024-01-30 12:35:33 +0100 | [diff] [blame] | 65 | pdp_typeorg := '0001'B, |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 66 | pdp_typenum := '21'O, |
| 67 | ipv4_address := ip_addr |
| 68 | } |
| 69 | } |
| 70 | template (value) GSUP_PDP_Address ts_EuaIPv4Dyn := ts_GSUP_PDP_Address_IPv4(omit); |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 71 | |
Pau Espin Pedrol | 78598b5 | 2024-02-14 19:21:42 +0100 | [diff] [blame^] | 72 | template (present) GSUP_PDP_Address tr_GSUP_PDP_Address_IPv4(template OCT4 ip_addr) := { |
| 73 | ipv4 := { |
| 74 | spare := ?, |
| 75 | pdp_typeorg := '0001'B, |
| 76 | pdp_typenum := '21'O, |
| 77 | ipv4_address := ip_addr |
| 78 | } |
| 79 | } |
| 80 | |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 81 | template GSUP_IE ts_GSUP_IE_AuthTuple2G(octetstring rand, octetstring sres, |
| 82 | octetstring kc) := { |
| 83 | tag := OSMO_GSUP_AUTH_TUPLE_IE, |
| 84 | len := 0, /* overwritten */ |
| 85 | val := { |
| 86 | auth_tuple := { |
| 87 | valueof(ts_GSUP_IE_RAND(rand)), |
| 88 | valueof(ts_GSUP_IE_SRES(sres)), |
| 89 | valueof(ts_GSUP_IE_Kc(kc)) |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | template GSUP_IE tr_GSUP_IE_AuthTuple3G( |
| 95 | template (present) octetstring rand := ?, |
| 96 | template (present) octetstring ik := ?, |
| 97 | template (present) octetstring ck := ?, |
| 98 | template (present) octetstring autn := ?, |
| 99 | template (present) octetstring res := ?) := { |
| 100 | tag := OSMO_GSUP_AUTH_TUPLE_IE, |
| 101 | len := ?, |
| 102 | val := { |
| 103 | auth_tuple := { |
| 104 | tr_GSUP_IE_RAND(rand), |
| 105 | tr_GSUP_IE_IK(ik), |
| 106 | tr_GSUP_IE_CK(ck), |
| 107 | tr_GSUP_IE_AUTN(autn), |
| 108 | tr_GSUP_IE_RES(res) |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | template GSUP_IE ts_GSUP_IE_AuthTuple3G(octetstring rand, octetstring ik, |
| 114 | octetstring ck, octetstring autn, |
| 115 | octetstring res) := { |
| 116 | tag := OSMO_GSUP_AUTH_TUPLE_IE, |
| 117 | len := 0, /* overwritten */ |
| 118 | val := { |
| 119 | auth_tuple := { |
| 120 | valueof(ts_GSUP_IE_RAND(rand)), |
| 121 | valueof(ts_GSUP_IE_IK(ik)), |
| 122 | valueof(ts_GSUP_IE_CK(ck)), |
| 123 | valueof(ts_GSUP_IE_AUTN(autn)), |
| 124 | valueof(ts_GSUP_IE_RES(res)) |
| 125 | } |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | template GSUP_IE tr_GSUP_IE_AuthTuple2G3G( |
| 130 | template (present) octetstring rand := ?, |
| 131 | template (present) octetstring sres := ?, |
| 132 | template (present) octetstring kc := ?, |
| 133 | template (present) octetstring ik := ?, |
| 134 | template (present) octetstring ck := ?, |
| 135 | template (present) octetstring autn := ?, |
| 136 | template (present) octetstring res := ?) := { |
| 137 | tag := OSMO_GSUP_AUTH_TUPLE_IE, |
| 138 | len := ?, |
| 139 | val := { |
| 140 | auth_tuple := { |
| 141 | tr_GSUP_IE_RAND(rand), |
| 142 | tr_GSUP_IE_SRES(sres), |
| 143 | tr_GSUP_IE_Kc(kc), |
| 144 | tr_GSUP_IE_IK(ik), |
| 145 | tr_GSUP_IE_CK(ck), |
| 146 | tr_GSUP_IE_AUTN(autn), |
| 147 | tr_GSUP_IE_RES(res) |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | template GSUP_IE ts_GSUP_IE_AuthTuple2G3G(octetstring rand, octetstring sres, |
| 153 | octetstring kc, octetstring ik, |
| 154 | octetstring ck, octetstring autn, |
| 155 | octetstring res) := { |
| 156 | tag := OSMO_GSUP_AUTH_TUPLE_IE, |
| 157 | len := 0, /* overwritten */ |
| 158 | val := { |
| 159 | auth_tuple := { |
| 160 | valueof(ts_GSUP_IE_RAND(rand)), |
| 161 | valueof(ts_GSUP_IE_SRES(sres)), |
| 162 | valueof(ts_GSUP_IE_Kc(kc)), |
| 163 | valueof(ts_GSUP_IE_IK(ik)), |
| 164 | valueof(ts_GSUP_IE_CK(ck)), |
| 165 | valueof(ts_GSUP_IE_AUTN(autn)), |
| 166 | valueof(ts_GSUP_IE_RES(res)) |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
Pau Espin Pedrol | bb76d7a | 2024-01-22 19:56:13 +0100 | [diff] [blame] | 171 | template (value) GSUP_IE ts_GSUP_IE_PdpInfoCompl := { |
| 172 | tag := OSMO_GSUP_PDP_INFO_COMPL_IE, |
| 173 | len := 0, /* overwritten */ |
| 174 | val := { |
| 175 | pdp_info_compl := ''O |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | template (present) GSUP_IE tr_GSUP_IE_PdpInfoCompl := { |
| 180 | tag := OSMO_GSUP_PDP_INFO_COMPL_IE, |
| 181 | len := 0, /* overwritten */ |
| 182 | val := { |
| 183 | pdp_info_compl := ''O |
| 184 | } |
| 185 | } |
| 186 | |
Pau Espin Pedrol | c63fa8e | 2024-01-22 19:58:09 +0100 | [diff] [blame] | 187 | template (value) GSUP_IE ts_GSUP_IE_PdpInfo(template (value) OCT1 ctx_id, |
| 188 | template (value) octetstring apn, |
| 189 | template (value) GSUP_PDP_Address pdp_address, |
| 190 | template (value) octetstring pdp_qos) := { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 191 | tag := OSMO_GSUP_PDP_INFO_IE, |
| 192 | len := 0, /* overwritten */ |
| 193 | val := { |
| 194 | pdp_info := { |
Pau Espin Pedrol | c63fa8e | 2024-01-22 19:58:09 +0100 | [diff] [blame] | 195 | valueof(ts_GSUP_IE_PDP_CONTEXT_ID(ctx_id)), |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 196 | valueof(ts_GSUP_IE_PDP_ADDRESS(pdp_address)), |
Pau Espin Pedrol | c63fa8e | 2024-01-22 19:58:09 +0100 | [diff] [blame] | 197 | valueof(ts_GSUP_IE_APN(apn)), |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 198 | valueof(ts_GSUP_IE_PDP_QOS(pdp_qos)) |
| 199 | } |
| 200 | } |
| 201 | } |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 202 | template (value) GSUP_IE ts_GSUP_IE_PdpInfo_ie(template (value) GSUP_IEs pdp_info) := { |
| 203 | tag := OSMO_GSUP_PDP_INFO_IE, |
| 204 | len := 0, /* overwritten */ |
| 205 | val := { |
| 206 | pdp_info := pdp_info |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | template (present) GSUP_IE tr_GSUP_IE_PdpInfo(template (present) OCT1 ctx_id, |
| 211 | template (present) octetstring apn, |
| 212 | template (present) GSUP_PDP_Address pdp_address) := { |
| 213 | tag := OSMO_GSUP_PDP_INFO_IE, |
| 214 | len := ?, |
| 215 | val := { |
| 216 | pdp_info := { |
| 217 | tr_GSUP_IE_PDP_CONTEXT_ID(ctx_id), |
| 218 | tr_GSUP_IE_PDP_ADDRESS(pdp_address), |
| 219 | tr_GSUP_IE_APN(apn) |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | template (present) GSUP_IE tr_GSUP_IE_PdpInfo_ie(template (present) GSUP_IEs pdp_info := ?) := { |
| 224 | tag := OSMO_GSUP_PDP_INFO_IE, |
| 225 | len := ?, |
| 226 | val := { |
| 227 | pdp_info := pdp_info |
| 228 | } |
| 229 | } |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 230 | |
Pau Espin Pedrol | c63fa8e | 2024-01-22 19:58:09 +0100 | [diff] [blame] | 231 | template (value) GSUP_IE ts_GSUP_IE_PDP_CONTEXT_ID(template (value) OCT1 ctx_id) := { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 232 | tag := OSMO_GSUP_PDP_CONTEXT_ID_IE, |
| 233 | len := 0, |
| 234 | val := { |
| 235 | pdp_ctx_id := ctx_id |
| 236 | } |
| 237 | } |
| 238 | |
Pau Espin Pedrol | c63fa8e | 2024-01-22 19:58:09 +0100 | [diff] [blame] | 239 | template (present) GSUP_IE tr_GSUP_IE_PDP_CONTEXT_ID(template OCT1 ctx_id) := { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 240 | tag := OSMO_GSUP_PDP_CONTEXT_ID_IE, |
| 241 | len := ?, |
| 242 | val := { |
| 243 | pdp_ctx_id := ctx_id |
| 244 | } |
| 245 | } |
| 246 | |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 247 | template (value) GSUP_IE ts_GSUP_IE_PDP_ADDRESS(template (value) GSUP_PDP_Address pdp_address) := { |
| 248 | tag := OSMO_GSUP_PDP_ADDRESS_IE, |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 249 | len := 0, |
| 250 | val := { |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 251 | pdp_address := pdp_address |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 252 | } |
| 253 | } |
| 254 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 255 | template (present) GSUP_IE tr_GSUP_IE_PDP_ADDRESS(template (present) GSUP_PDP_Address pdp_address := ?) := { |
| 256 | tag := OSMO_GSUP_PDP_ADDRESS_IE, |
| 257 | len := ?, |
| 258 | val := { |
| 259 | pdp_address := pdp_address |
| 260 | } |
| 261 | } |
| 262 | |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 263 | template (value) GSUP_IE ts_GSUP_IE_PDP_QOS(template (value) octetstring pdp_qos) := { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 264 | tag := OSMO_GSUP_PDP_QOS_IE, |
| 265 | len := 0, |
| 266 | val := { |
| 267 | pdp_qos := pdp_qos |
| 268 | } |
| 269 | } |
| 270 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 271 | template (present) GSUP_IE tr_GSUP_IE_PDP_QOS(template (present) octetstring pdp_qos := ?) := { |
| 272 | tag := OSMO_GSUP_PDP_QOS_IE, |
| 273 | len := ?, |
| 274 | val := { |
| 275 | pdp_qos := pdp_qos |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | template (value) GSUP_IE ts_GSUP_IE_Charging_Characteristics(template (value) octetstring charg_char) := { |
| 280 | tag := OSMO_GSUP_CHARG_CHAR_IE, |
| 281 | len := 0, |
| 282 | val := { |
| 283 | charg_char := charg_char |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | template (present) GSUP_IE tr_GSUP_IE_Charging_Characteristics(template (present) octetstring charg_char := ?) := { |
| 288 | tag := OSMO_GSUP_CHARG_CHAR_IE, |
| 289 | len := ?, |
| 290 | val := { |
| 291 | charg_char := charg_char |
| 292 | } |
| 293 | } |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 294 | |
| 295 | template GSUP_PDU tr_GSUP(template GSUP_MessageType msgt := ?, template GSUP_IEs ies := *) := { |
| 296 | msg_type := msgt, |
| 297 | ies := ies |
| 298 | } |
| 299 | |
| 300 | template (present) GSUP_PDU tr_GSUP_IMSI(template (present) GSUP_MessageType msgt := ?, template (present) hexstring imsi := ?) := { |
| 301 | msg_type := msgt, |
| 302 | ies := { tr_GSUP_IE_IMSI(imsi), * } |
| 303 | } |
| 304 | |
| 305 | template GSUP_PDU ts_GSUP(GSUP_MessageType msgt, GSUP_IEs ies := {}) := { |
| 306 | msg_type := msgt, |
| 307 | ies := ies |
| 308 | } |
| 309 | |
| 310 | template (value) GSUP_IMEI ts_GSUP_IMEI(hexstring digits) := { |
| 311 | len := 0, /* overwritten */ |
| 312 | digits := digits |
| 313 | } |
| 314 | |
| 315 | template GSUP_IMEI tr_GSUP_IMEI(template hexstring digits) := { |
| 316 | len := ?, |
| 317 | digits := digits |
| 318 | } |
| 319 | |
| 320 | |
| 321 | template (value) GSUP_PDU ts_GSUP_SAI_REQ(hexstring imsi) := |
| 322 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 323 | |
| 324 | template (value) GSUP_PDU ts_GSUP_SAI_REQ_EPS(hexstring imsi) := |
| 325 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { |
| 326 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 327 | valueof(ts_GSUP_IE_CURRENT_RAT_TYPE(RAT_TYPE_EUTRAN_SGs)) |
| 328 | }); |
| 329 | |
| 330 | template (value) GSUP_PDU ts_GSUP_SAI_REQ_NUM_AUTH(hexstring imsi, OCT1 num_auth_vectors) := |
| 331 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { |
| 332 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 333 | valueof(ts_GSUP_IE_NUM_VECTORS_REQ(num_auth_vectors)) |
| 334 | }); |
| 335 | |
Pau Espin Pedrol | c2cfd55 | 2024-02-07 17:51:55 +0100 | [diff] [blame] | 336 | template (value) GSUP_PDU ts_GSUP_SAI_REQ_PDP_INFO(hexstring imsi, template (value) GSUP_IEs pdp_info) := |
| 337 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { |
| 338 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 339 | valueof(ts_GSUP_IE_PdpInfo_ie(pdp_info)) |
| 340 | }); |
| 341 | |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 342 | template GSUP_PDU tr_GSUP_SAI_REQ(template hexstring imsi) := |
| 343 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, imsi); |
| 344 | |
| 345 | template GSUP_PDU tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC( |
| 346 | template hexstring imsi, |
| 347 | template octetstring auts, |
| 348 | template octetstring rand) := |
| 349 | tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { |
| 350 | tr_GSUP_IE_IMSI(imsi), |
| 351 | tr_GSUP_IE_AUTS(auts), |
| 352 | tr_GSUP_IE_RAND(rand), |
| 353 | * |
| 354 | }); |
| 355 | |
| 356 | template (value) GSUP_PDU ts_GSUP_SAI_RES(hexstring imsi, GSUP_IE auth_tuple) := |
| 357 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, { |
| 358 | valueof(ts_GSUP_IE_IMSI(imsi)), auth_tuple }); |
| 359 | |
| 360 | template GSUP_PDU tr_GSUP_SAI_ERR(template hexstring imsi, template integer cause) := |
| 361 | tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, { |
| 362 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 363 | |
| 364 | template (value) GSUP_PDU ts_GSUP_SAI_ERR(hexstring imsi, integer cause) := |
| 365 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, { |
| 366 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) }); |
| 367 | |
| 368 | |
| 369 | template GSUP_PDU tr_GSUP_SAI_RES(template (present) hexstring imsi, |
| 370 | template (present) GSUP_IE auth_tuple_ie := tr_GSUP_IE(OSMO_GSUP_AUTH_TUPLE_IE)) := |
| 371 | tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, { |
| 372 | tr_GSUP_IE_IMSI(imsi), *, auth_tuple_ie, * }); |
| 373 | |
| 374 | template GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi, GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS, |
| 375 | template octetstring source_name := omit) := |
| 376 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, f_gen_ts_ies(imsi, dom := dom, |
| 377 | source_name := source_name)); |
| 378 | |
| 379 | template GSUP_PDU tr_GSUP_UL_REQ(template hexstring imsi) := |
| 380 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, imsi); |
| 381 | |
| 382 | template (value) GSUP_PDU ts_GSUP_UL_RES(hexstring imsi, octetstring destination_name := ''O) := |
| 383 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, { valueof(ts_GSUP_IE_IMSI(imsi)), |
| 384 | valueof(ts_GSUP_IE_Destination_Name(destination_name))}); |
| 385 | |
| 386 | template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi, template octetstring destination_name := omit) := |
| 387 | tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, f_gen_tr_ies(imsi, destination_name := destination_name)); |
| 388 | |
| 389 | template (value) GSUP_PDU ts_GSUP_UL_ERR(hexstring imsi, integer cause) := |
| 390 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, { |
| 391 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) }); |
| 392 | |
| 393 | template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?, |
| 394 | template octetstring destination_name := omit) := |
| 395 | tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, |
| 396 | f_gen_tr_ies(imsi, cause := cause, destination_name := destination_name)); |
| 397 | |
| 398 | template (value) GSUP_PDU ts_GSUP_ISD_REQ(hexstring imsi, hexstring msisdn, octetstring destination_name := ''O) := |
| 399 | ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, { |
| 400 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_MSISDN(msisdn)), |
| 401 | valueof(ts_GSUP_IE_Destination_Name(destination_name))}); |
| 402 | |
| 403 | template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?, |
| 404 | template octetstring destination_name := omit) := |
| 405 | tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, |
| 406 | f_gen_tr_ies(imsi, msisdn := msisdn, destination_name := destination_name)); |
| 407 | |
| 408 | template GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi, |
| 409 | template octetstring source_name := omit, |
| 410 | template octetstring destination_name := omit) := |
| 411 | ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, |
| 412 | f_gen_ts_ies(imsi, source_name := source_name, |
| 413 | destination_name := destination_name)); |
| 414 | |
| 415 | template GSUP_PDU tr_GSUP_ISD_RES(template hexstring imsi) := |
| 416 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, imsi); |
| 417 | |
| 418 | template GSUP_PDU tr_GSUP_AUTH_FAIL_IND(hexstring imsi) := |
| 419 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT, imsi); |
| 420 | |
Pau Espin Pedrol | cbe6eba | 2024-02-06 12:53:14 +0100 | [diff] [blame] | 421 | template (present) GSUP_PDU tr_GSUP_CL_REQ(template (present) hexstring imsi := ?, |
| 422 | template GSUP_CnDomain dom := omit, |
| 423 | template GSUP_CancelType ctype := omit) := |
| 424 | tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST, |
| 425 | f_gen_tr_ies(imsi, |
| 426 | cancel_type := ctype, |
| 427 | cn_domain := dom)); |
| 428 | |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 429 | template (value) GSUP_PDU ts_GSUP_CL_REQ(hexstring imsi, GSUP_CancelType ctype) := |
| 430 | ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST, { |
| 431 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CancelType(ctype)) }); |
| 432 | |
| 433 | template GSUP_PDU tr_GSUP_CL_RES(template hexstring imsi) := |
| 434 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, imsi); |
| 435 | |
Pau Espin Pedrol | cbe6eba | 2024-02-06 12:53:14 +0100 | [diff] [blame] | 436 | template (value) GSUP_PDU ts_GSUP_CL_RES(template (value) hexstring imsi) := |
| 437 | ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, {valueof(ts_GSUP_IE_IMSI(imsi))}); |
| 438 | |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 439 | template GSUP_PDU tr_GSUP_CL_ERR(template hexstring imsi, template integer cause := ?) := |
| 440 | tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR, { |
| 441 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause), * }); |
| 442 | |
| 443 | template (value) GSUP_PDU ts_GSUP_PURGE_MS_REQ(hexstring imsi, GSUP_CnDomain dom) := |
| 444 | ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, { |
| 445 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) }); |
| 446 | |
| 447 | template GSUP_PDU tr_GSUP_PURGE_MS_REQ(template hexstring imsi, template GSUP_CnDomain dom := ?) := |
| 448 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, { |
| 449 | tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_CnDomain(dom) }); |
| 450 | |
| 451 | template (value) GSUP_PDU ts_GSUP_PURGE_MS_RES(hexstring imsi) := |
| 452 | ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, { |
| 453 | valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 454 | |
| 455 | template GSUP_PDU tr_GSUP_PURGE_MS_RES(template hexstring imsi) := |
| 456 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, { |
| 457 | tr_GSUP_IE_IMSI(imsi), * }); |
| 458 | |
| 459 | template GSUP_PDU tr_GSUP_PURGE_MS_ERR(template hexstring imsi, template integer cause) := |
| 460 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_ERROR, { |
| 461 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 462 | |
| 463 | template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_REQ(hexstring imsi, hexstring imei, |
| 464 | template (omit) octetstring source_name := omit) := |
| 465 | ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, f_gen_ts_ies(imsi, imei := imei, source_name := source_name)); |
| 466 | |
| 467 | template GSUP_PDU tr_GSUP_CHECK_IMEI_REQ( |
| 468 | template hexstring imsi, |
| 469 | template hexstring imei |
| 470 | ) := tr_GSUP( |
| 471 | OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, |
| 472 | { |
| 473 | tr_GSUP_IE_IMSI(imsi), |
| 474 | tr_GSUP_IE_IMEI(imei), |
| 475 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT) |
| 476 | } |
| 477 | ); |
| 478 | |
| 479 | template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_RES(hexstring imsi, GSUP_IMEIResult result) := |
| 480 | ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, { |
| 481 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI_Result(result)) }); |
| 482 | |
| 483 | template GSUP_PDU tr_GSUP_CHECK_IMEI_RES(template hexstring imsi, template GSUP_IMEIResult result, |
| 484 | template octetstring destination_name := omit) := |
| 485 | tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, |
| 486 | f_gen_tr_ies(imsi, imei_result := result, destination_name := destination_name)); |
| 487 | |
| 488 | template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_ERR(hexstring imsi, integer cause) := |
| 489 | ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, { |
| 490 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) }); |
| 491 | |
| 492 | template GSUP_PDU tr_GSUP_CHECK_IMEI_ERR(template hexstring imsi, template integer cause, |
| 493 | template octetstring destination_name := omit) := |
| 494 | tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, f_gen_tr_ies(imsi, cause := cause, destination_name := destination_name)); |
| 495 | |
| 496 | |
| 497 | /* EPDG Tunnel */ |
| 498 | template (value) GSUP_PDU ts_GSUP_EPDGTunnel_REQ(hexstring imsi, |
| 499 | GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG, |
| 500 | GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS, |
| 501 | template (omit) octetstring source_name := omit) := |
| 502 | ts_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_REQUEST, f_gen_ts_ies(imsi, |
| 503 | message_class := message_class, |
| 504 | dom := dom, |
| 505 | source_name := source_name)); |
| 506 | |
| 507 | template (present) GSUP_PDU tr_GSUP_EPDGTunnel_REQ(template (present) hexstring imsi := ?, |
| 508 | template (present) GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG) := |
| 509 | tr_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_REQUEST, |
| 510 | f_gen_tr_ies(imsi, |
| 511 | message_class := message_class)); |
| 512 | |
| 513 | |
| 514 | template (value) GSUP_PDU ts_GSUP_EPDGTunnel_RES(hexstring imsi, |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 515 | template (value) GSUP_IEs pdp_info, |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 516 | GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG, |
| 517 | octetstring destination_name := ''O) := |
| 518 | ts_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_RESULT, { |
| 519 | valueof(ts_GSUP_IE_IMSI(imsi)), |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 520 | valueof(ts_GSUP_IE_PdpInfoCompl), |
| 521 | valueof(ts_GSUP_IE_PdpInfo_ie(pdp_info)), |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 522 | valueof(ts_GSUP_IE_Message_Class(message_class)), |
| 523 | valueof(ts_GSUP_IE_Destination_Name(destination_name)) |
| 524 | }); |
| 525 | |
| 526 | template (present) GSUP_PDU tr_GSUP_EPDGTunnel_RES(template (present) hexstring imsi, |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 527 | template (present) GSUP_IEs pdp_info, |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 528 | template (present) GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG, |
| 529 | template octetstring destination_name := omit) := |
| 530 | tr_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_RESULT, |
| 531 | f_gen_tr_ies(imsi, |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 532 | pdp_info_compl := true, |
| 533 | pdp_info := pdp_info, |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 534 | message_class := message_class, |
| 535 | destination_name := destination_name)); |
| 536 | |
| 537 | template (value) GSUP_PDU ts_GSUP_EPDGTunnel_ERR(hexstring imsi, |
| 538 | GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG, |
| 539 | integer cause := 0) := |
| 540 | ts_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_ERROR, { |
| 541 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 542 | valueof(ts_GSUP_IE_Cause(cause)), |
| 543 | valueof(ts_GSUP_IE_Message_Class(message_class)) |
| 544 | }); |
| 545 | |
| 546 | template (present) GSUP_PDU tr_GSUP_EPDGTunnel_ERR(template (present) hexstring imsi, |
| 547 | template (present) GSUP_Message_Class message_class := OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG, |
| 548 | template (present) integer cause := ?, |
| 549 | template octetstring destination_name := omit) := |
| 550 | tr_GSUP(OSMO_GSUP_MSGT_EPDG_TUNNEL_ERROR, |
| 551 | f_gen_tr_ies(imsi, |
| 552 | message_class := message_class, |
| 553 | cause := cause, |
| 554 | destination_name := destination_name)); |
| 555 | |
| 556 | |
| 557 | template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := { |
| 558 | tag := OSMO_GSUP_CANCEL_TYPE_IE, |
| 559 | len := 0, /* overwritten */ |
| 560 | val := { |
| 561 | cancel_type := ctype |
| 562 | } |
| 563 | } |
| 564 | |
| 565 | template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) := |
| 566 | tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype}); |
| 567 | |
| 568 | template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) := |
| 569 | tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain}); |
| 570 | |
| 571 | template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := { |
| 572 | tag := iei, |
| 573 | len := ?, |
| 574 | val := val |
| 575 | } |
| 576 | |
Pau Espin Pedrol | cbe6eba | 2024-02-06 12:53:14 +0100 | [diff] [blame] | 577 | template (value) GSUP_IE ts_GSUP_IE_IMSI(template (value) hexstring imsi) := { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 578 | tag := OSMO_GSUP_IMSI_IE, |
| 579 | len := 0, /* overwritten */ |
| 580 | val := { |
| 581 | imsi := imsi |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | template (present) GSUP_IE tr_GSUP_IE_IMSI(template (present) hexstring imsi := ?) := { |
| 586 | tag := OSMO_GSUP_IMSI_IE, |
| 587 | len := ?, |
| 588 | val := { |
| 589 | imsi := imsi |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | template (value) GSUP_IE ts_GSUP_IE_MSISDN(hexstring msisdn) := { |
| 594 | tag := OSMO_GSUP_MSISDN_IE, |
| 595 | len := 0, /* overwritten */ |
| 596 | val := { |
| 597 | msisdn := ts_GSUP_MSISDN(msisdn) |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | template GSUP_IE tr_GSUP_IE_MSISDN(template hexstring msisdn) := { |
| 602 | tag := OSMO_GSUP_MSISDN_IE, |
| 603 | len := ?, |
| 604 | val := { |
| 605 | msisdn := tr_GSUP_MSISDN(msisdn) |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | |
| 610 | template (value) GSUP_IE ts_GSUP_IE_Cause(integer cause) := { |
| 611 | tag := OSMO_GSUP_CAUSE_IE, |
| 612 | len := 0, /* overwritten */ |
| 613 | val := { |
| 614 | cause := cause |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | template GSUP_IE tr_GSUP_IE_Cause(template integer cause) := { |
| 619 | tag := OSMO_GSUP_CAUSE_IE, |
| 620 | len := ?, |
| 621 | val := { |
| 622 | cause := cause |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | template (value) GSUP_IE ts_GSUP_IE_AUTS(octetstring auts) := { |
| 627 | tag := OSMO_GSUP_AUTS_IE, |
| 628 | len := 0, /* overwritten */ |
| 629 | val := { |
| 630 | auts := auts |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | template GSUP_IE tr_GSUP_IE_AUTS(template octetstring auts) := { |
| 635 | tag := OSMO_GSUP_AUTS_IE, |
| 636 | len := ?, |
| 637 | val := { |
| 638 | auts := auts |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | template (value) GSUP_IE ts_GSUP_IE_RAND(octetstring rand) := { |
| 643 | tag := OSMO_GSUP_RAND_IE, |
| 644 | len := 0, /* overwritten */ |
| 645 | val := { |
| 646 | rand := rand |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | template GSUP_IE tr_GSUP_IE_RAND(template octetstring rand := ?) := { |
| 651 | tag := OSMO_GSUP_RAND_IE, |
| 652 | len := ?, |
| 653 | val := { |
| 654 | rand := rand |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | template (present) GSUP_IE tr_GSUP_IE_SRES(template (present) octetstring sres := ?) := { |
| 659 | tag := OSMO_GSUP_SRES_IE, |
| 660 | len := ?, |
| 661 | val := { |
| 662 | sres := sres |
| 663 | } |
| 664 | } |
| 665 | |
| 666 | template (value) GSUP_IE ts_GSUP_IE_SRES(octetstring sres) := { |
| 667 | tag := OSMO_GSUP_SRES_IE, |
| 668 | len := 0, /* overwritten */ |
| 669 | val := { |
| 670 | sres := sres |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | template (present) GSUP_IE tr_GSUP_IE_Kc(template (present) octetstring kc := ?) := { |
| 675 | tag := OSMO_GSUP_KC_IE, |
| 676 | len := ?, |
| 677 | val := { |
| 678 | kc := kc |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | template (value) GSUP_IE ts_GSUP_IE_Kc(octetstring kc) := { |
| 683 | tag := OSMO_GSUP_KC_IE, |
| 684 | len := 0, /* overwritten */ |
| 685 | val := { |
| 686 | kc := kc |
| 687 | } |
| 688 | } |
| 689 | |
| 690 | template (present) GSUP_IE tr_GSUP_IE_IK(template (present) octetstring ik := ?) := { |
| 691 | tag := OSMO_GSUP_IK_IE, |
| 692 | len := ?, |
| 693 | val := { |
| 694 | ik := ik |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | template (value) GSUP_IE ts_GSUP_IE_IK(octetstring ik) := { |
| 699 | tag := OSMO_GSUP_IK_IE, |
| 700 | len := 0, /* overwritten */ |
| 701 | val := { |
| 702 | ik := ik |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | template (present) GSUP_IE tr_GSUP_IE_CK(template (present) octetstring ck := ?) := { |
| 707 | tag := OSMO_GSUP_CK_IE, |
| 708 | len := ?, |
| 709 | val := { |
| 710 | ck := ck |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | template (value) GSUP_IE ts_GSUP_IE_CK(octetstring ck) := { |
| 715 | tag := OSMO_GSUP_CK_IE, |
| 716 | len := 0, /* overwritten */ |
| 717 | val := { |
| 718 | ck := ck |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | template (present) GSUP_IE tr_GSUP_IE_AUTN(template (present) octetstring autn := ?) := { |
| 723 | tag := OSMO_GSUP_AUTN_IE, |
| 724 | len := ?, |
| 725 | val := { |
| 726 | autn := autn |
| 727 | } |
| 728 | } |
| 729 | |
| 730 | template (value) GSUP_IE ts_GSUP_IE_AUTN(octetstring autn) := { |
| 731 | tag := OSMO_GSUP_AUTN_IE, |
| 732 | len := 0, /* overwritten */ |
| 733 | val := { |
| 734 | autn := autn |
| 735 | } |
| 736 | } |
| 737 | |
| 738 | template (present) GSUP_IE tr_GSUP_IE_RES(template (present) octetstring res := ?) := { |
| 739 | tag := OSMO_GSUP_RES_IE, |
| 740 | len := ?, |
| 741 | val := { |
| 742 | res := res |
| 743 | } |
| 744 | } |
| 745 | |
| 746 | template (value) GSUP_IE ts_GSUP_IE_RES(octetstring res) := { |
| 747 | tag := OSMO_GSUP_RES_IE, |
| 748 | len := 0, /* overwritten */ |
| 749 | val := { |
| 750 | res := res |
| 751 | } |
| 752 | } |
| 753 | |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 754 | template (value) GSUP_IE ts_GSUP_IE_APN(template (value) octetstring apn) := { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 755 | tag := OSMO_GSUP_ACCESS_POINT_NAME_IE, |
| 756 | len := 0, /* overwritten */ |
| 757 | val := { |
| 758 | apn := apn |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | template GSUP_IE tr_GSUP_IE_APN(template octetstring apn) := { |
| 763 | tag := OSMO_GSUP_ACCESS_POINT_NAME_IE, |
| 764 | len := ?, |
| 765 | val := { |
| 766 | apn := apn |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | template GSUP_IE ts_GSUP_IE_CnDomain(template GSUP_CnDomain dom) := { |
| 771 | tag := OSMO_GSUP_CN_DOMAIN_IE, |
| 772 | len := 0, /* overwritten */ |
| 773 | val := { |
| 774 | cn_domain := dom |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | template (value) GSUP_IE ts_GSUP_IE_SessionId(OCT4 sid) := { |
| 779 | tag := OSMO_GSUP_SESSION_ID_IE, |
| 780 | len := 0, /* overwritten */ |
| 781 | val := { |
| 782 | session_id := sid |
| 783 | } |
| 784 | } |
| 785 | template GSUP_IE tr_GSUP_IE_SessionId(template OCT4 sid) := { |
| 786 | tag := OSMO_GSUP_SESSION_ID_IE, |
| 787 | len := ?, |
| 788 | val := { |
| 789 | session_id := sid |
| 790 | } |
| 791 | } |
| 792 | |
| 793 | template (value) GSUP_IE ts_GSUP_IE_SessionState(GSUP_SessionState state) := { |
| 794 | tag := OSMO_GSUP_SESSION_STATE_IE, |
| 795 | len := 0, /* overwritten */ |
| 796 | val := { |
| 797 | session_state := state |
| 798 | } |
| 799 | } |
| 800 | template GSUP_IE tr_GSUP_IE_SessionState(template GSUP_SessionState state) := { |
| 801 | tag := OSMO_GSUP_SESSION_STATE_IE, |
| 802 | len := ?, |
| 803 | val := { |
| 804 | session_state := state |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_MR(OCT1 ref) := { |
| 809 | tag := OSMO_GSUP_SM_RP_MR_IE, |
| 810 | len := 0, /* overwritten */ |
| 811 | val := { |
| 812 | sm_rp_mr := ref |
| 813 | } |
| 814 | } |
| 815 | template GSUP_IE tr_GSUP_IE_SM_RP_MR(template OCT1 ref) := { |
| 816 | tag := OSMO_GSUP_SM_RP_MR_IE, |
| 817 | len := ?, |
| 818 | val := { |
| 819 | sm_rp_mr := ref |
| 820 | } |
| 821 | } |
| 822 | |
| 823 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_CAUSE(OCT1 cause) := { |
| 824 | tag := OSMO_GSUP_SM_RP_CAUSE_IE, |
| 825 | len := 0, /* overwritten */ |
| 826 | val := { |
| 827 | sm_rp_cause := cause |
| 828 | } |
| 829 | } |
| 830 | template GSUP_IE tr_GSUP_IE_SM_RP_CAUSE(template OCT1 cause) := { |
| 831 | tag := OSMO_GSUP_SM_RP_CAUSE_IE, |
| 832 | len := ?, |
| 833 | val := { |
| 834 | sm_rp_cause := cause |
| 835 | } |
| 836 | } |
| 837 | |
| 838 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_MMS(OCT1 mms) := { |
| 839 | tag := OSMO_GSUP_SM_RP_MMS_IE, |
| 840 | len := 0, /* overwritten */ |
| 841 | val := { |
| 842 | sm_rp_mms := mms |
| 843 | } |
| 844 | } |
| 845 | template GSUP_IE tr_GSUP_IE_SM_RP_MMS(template OCT1 mms) := { |
| 846 | tag := OSMO_GSUP_SM_RP_MMS_IE, |
| 847 | len := ?, |
| 848 | val := { |
| 849 | sm_rp_mms := mms |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | template (value) GSUP_IE ts_GSUP_IE_IMEI(hexstring imei) := { |
| 854 | tag := OSMO_GSUP_IMEI_IE, |
| 855 | len := 0, /* overwritten */ |
| 856 | val := { |
| 857 | imei := ts_GSUP_IMEI(imei) |
| 858 | } |
| 859 | } |
| 860 | template GSUP_IE tr_GSUP_IE_IMEI(template hexstring imei) := { |
| 861 | tag := OSMO_GSUP_IMEI_IE, |
| 862 | len := ?, |
| 863 | val := { |
| 864 | imei := tr_GSUP_IMEI(imei) |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | template (value) GSUP_IE ts_GSUP_IE_IMEI_Result(GSUP_IMEIResult result) := { |
| 869 | tag := OSMO_GSUP_IMEI_RESULT_IE, |
| 870 | len := 0, /* overwritten */ |
| 871 | val := { |
| 872 | imei_result := result |
| 873 | } |
| 874 | } |
| 875 | template GSUP_IE tr_GSUP_IE_IMEI_Result(template GSUP_IMEIResult result) := { |
| 876 | tag := OSMO_GSUP_IMEI_RESULT_IE, |
| 877 | len := ?, |
| 878 | val := { |
| 879 | imei_result := result |
| 880 | } |
| 881 | } |
| 882 | |
| 883 | template (value) GSUP_IE ts_GSUP_IE_NUM_VECTORS_REQ(OCT1 num) := { |
| 884 | tag := OSMO_GSUP_NUM_VECTORS_REQ_IE, |
| 885 | len := 0, /* overwritten */ |
| 886 | val := { |
| 887 | num_auth_vectors := num |
| 888 | } |
| 889 | } |
| 890 | template GSUP_IE tr_GSUP_IE_NUM_VECTORS_REQ(template OCT1 num) := { |
| 891 | tag := OSMO_GSUP_NUM_VECTORS_REQ_IE, |
| 892 | len := ?, |
| 893 | val := { |
| 894 | num_auth_vectors := num |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | /* See 3GPP TS 24.011, figures 8.5 and 8.6 */ |
| 899 | private function f_pad_SM_RP_Addr(template hexstring number) |
| 900 | return template hexstring { |
| 901 | if (isvalue(number) and not istemplatekind(number, "omit")) { |
| 902 | return f_pad_bcd_number(valueof(number)); |
| 903 | } else { |
| 904 | return number; |
| 905 | } |
| 906 | } |
| 907 | |
| 908 | template GSUP_SM_RP_Addr t_GSUP_SM_RP_Addr(template hexstring number, |
| 909 | template BIT4 npi := '0001'B, |
| 910 | template BIT3 ton := '001'B, |
| 911 | template BIT1 ext := '1'B) := { |
| 912 | ext := ext, |
| 913 | ton := ton, |
| 914 | npi := npi, |
| 915 | /* Work around TITAN's padding problems: encoding works fine, |
| 916 | * but it does not consider 'F'H as padding in decoded data. */ |
| 917 | number := f_pad_SM_RP_Addr(number) |
| 918 | } |
| 919 | |
| 920 | /** |
| 921 | * SM-RP-DA represents the SM Destination Address, see 7.6.8.1. |
| 922 | * It can be either of the following: |
| 923 | * - IMSI |
| 924 | * - LMSI (not implemented) |
| 925 | * - MSISDN |
| 926 | * - roaming number (not implemented) |
| 927 | * - service centre address |
| 928 | */ |
| 929 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_IMSI(hexstring imsi) := { |
| 930 | id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI, |
| 931 | id_enc := { imsi := imsi } |
| 932 | } |
| 933 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_IMSI(template hexstring imsi) := { |
| 934 | id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI, |
| 935 | id_enc := { imsi := imsi } |
| 936 | } |
| 937 | |
| 938 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_MSISDN(GSUP_SM_RP_Addr msisdn) := { |
| 939 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
| 940 | id_enc := { msisdn := msisdn } |
| 941 | } |
| 942 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_MSISDN(template GSUP_SM_RP_Addr msisdn) := { |
| 943 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
| 944 | id_enc := { msisdn := msisdn } |
| 945 | } |
| 946 | |
| 947 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_SMSC_ADDR(GSUP_SM_RP_Addr smsc_addr) := { |
| 948 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
| 949 | id_enc := { smsc_addr := smsc_addr } |
| 950 | } |
| 951 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_SMSC_ADDR(template GSUP_SM_RP_Addr smsc_addr) := { |
| 952 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
| 953 | id_enc := { smsc_addr := smsc_addr } |
| 954 | } |
| 955 | |
| 956 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_NULL := { |
| 957 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
| 958 | id_enc := omit |
| 959 | } |
| 960 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_NULL := { |
| 961 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
| 962 | id_enc := omit |
| 963 | } |
| 964 | |
| 965 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_DA(GSUP_SM_RP_DA val) := { |
| 966 | tag := OSMO_GSUP_SM_RP_DA_IE, |
| 967 | len := 0, /* overwritten */ |
| 968 | val := { |
| 969 | sm_rp_da := val |
| 970 | } |
| 971 | } |
| 972 | template GSUP_IE tr_GSUP_IE_SM_RP_DA(template GSUP_SM_RP_DA val) := { |
| 973 | tag := OSMO_GSUP_SM_RP_DA_IE, |
| 974 | len := ?, |
| 975 | val := { |
| 976 | sm_rp_da := val |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | /** |
| 981 | * SM-RP-OA represents the SM Originating Address, see 7.6.8.2. |
| 982 | * It can be either of the following: |
| 983 | * - MSISDN |
| 984 | * - service centre address |
| 985 | */ |
| 986 | template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_MSISDN(GSUP_SM_RP_Addr msisdn) := { |
| 987 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
| 988 | id_enc := { msisdn := msisdn } |
| 989 | } |
| 990 | template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_MSISDN(template GSUP_SM_RP_Addr msisdn) := { |
| 991 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
| 992 | id_enc := { msisdn := msisdn } |
| 993 | } |
| 994 | |
| 995 | template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_SMSC_ADDR(GSUP_SM_RP_Addr smsc_addr) := { |
| 996 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
| 997 | id_enc := { smsc_addr := smsc_addr } |
| 998 | } |
| 999 | template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_SMSC_ADDR(template GSUP_SM_RP_Addr smsc_addr) := { |
| 1000 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
| 1001 | id_enc := { smsc_addr := smsc_addr } |
| 1002 | } |
| 1003 | |
| 1004 | template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_NULL := { |
| 1005 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
| 1006 | id_enc := omit |
| 1007 | } |
| 1008 | template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_NULL := { |
| 1009 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
| 1010 | id_enc := omit |
| 1011 | } |
| 1012 | |
| 1013 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_OA(GSUP_SM_RP_OA val) := { |
| 1014 | tag := OSMO_GSUP_SM_RP_OA_IE, |
| 1015 | len := 0, /* overwritten */ |
| 1016 | val := { |
| 1017 | sm_rp_oa := val |
| 1018 | } |
| 1019 | } |
| 1020 | template GSUP_IE tr_GSUP_IE_SM_RP_OA(template GSUP_SM_RP_OA val) := { |
| 1021 | tag := OSMO_GSUP_SM_RP_OA_IE, |
| 1022 | len := ?, |
| 1023 | val := { |
| 1024 | sm_rp_oa := val |
| 1025 | } |
| 1026 | } |
| 1027 | |
| 1028 | /* SM-RP-UI represents the SM TPDU, see 7.6.8.4 */ |
| 1029 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_UI(octetstring val) := { |
| 1030 | tag := OSMO_GSUP_SM_RP_UI_IE, |
| 1031 | len := 0, /* overwritten */ |
| 1032 | val := { |
| 1033 | sm_rp_ui := val |
| 1034 | } |
| 1035 | } |
| 1036 | template GSUP_IE tr_GSUP_IE_SM_RP_UI(template octetstring val) := { |
| 1037 | tag := OSMO_GSUP_SM_RP_UI_IE, |
| 1038 | len := ?, |
| 1039 | val := { |
| 1040 | sm_rp_ui := val |
| 1041 | } |
| 1042 | } |
| 1043 | |
| 1044 | /* SM Alert Reason IE (used in READY-FOR-SM), see 7.6.8.8 */ |
| 1045 | template (value) GSUP_IE ts_GSUP_IE_SM_ALERT_RSN(GSUP_SM_ALERT_RSN_Type rsn) := { |
| 1046 | tag := OSMO_GSUP_SM_ALERT_RSN_IE, |
| 1047 | len := 0, /* overwritten */ |
| 1048 | val := { |
| 1049 | sm_alert_rsn := rsn |
| 1050 | } |
| 1051 | } |
| 1052 | template GSUP_IE tr_GSUP_IE_SM_ALERT_RSN(template GSUP_SM_ALERT_RSN_Type rsn) := { |
| 1053 | tag := OSMO_GSUP_SM_ALERT_RSN_IE, |
| 1054 | len := ?, |
| 1055 | val := { |
| 1056 | sm_alert_rsn := rsn |
| 1057 | } |
| 1058 | } |
| 1059 | |
| 1060 | template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := { |
| 1061 | tag := OSMO_GSUP_SS_INFO_IE, |
| 1062 | len := 0, /* overwritten */ |
| 1063 | val := { |
| 1064 | ss_info := ss |
| 1065 | } |
| 1066 | } |
| 1067 | template GSUP_IE tr_GSUP_IE_SSInfo(template octetstring ss) := { |
| 1068 | tag := OSMO_GSUP_SS_INFO_IE, |
| 1069 | len := ?, |
| 1070 | val := { |
| 1071 | ss_info := ss |
| 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | template GSUP_IE tr_GSUP_IE_Message_Class(template GSUP_Message_Class val) := { |
| 1076 | tag := OSMO_GSUP_MESSAGE_CLASS_IE, |
| 1077 | len := ?, |
| 1078 | val := { |
| 1079 | message_class := val |
| 1080 | } |
| 1081 | } |
| 1082 | |
| 1083 | template (value) GSUP_IE ts_GSUP_IE_Message_Class(GSUP_Message_Class val) := { |
| 1084 | tag := OSMO_GSUP_MESSAGE_CLASS_IE, |
| 1085 | len := 0, /* overwritten */ |
| 1086 | val := { |
| 1087 | message_class := val |
| 1088 | } |
| 1089 | } |
| 1090 | |
| 1091 | template GSUP_IE tr_GSUP_IE_Source_Name(template octetstring name) := { |
| 1092 | tag := OSMO_GSUP_SOURCE_NAME_IE, |
| 1093 | len := ?, |
| 1094 | val := { |
| 1095 | source_name := name |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | template (value) GSUP_IE ts_GSUP_IE_Source_Name(octetstring name) := { |
| 1100 | tag := OSMO_GSUP_SOURCE_NAME_IE, |
| 1101 | len := 0, /* overwritten */ |
| 1102 | val := { |
| 1103 | source_name := name |
| 1104 | } |
| 1105 | } |
| 1106 | |
| 1107 | template GSUP_IE tr_GSUP_IE_Destination_Name(template octetstring name) := { |
| 1108 | tag := OSMO_GSUP_DESTINATION_NAME_IE, |
| 1109 | len := ?, |
| 1110 | val := { |
| 1111 | destination_name := name |
| 1112 | } |
| 1113 | } |
| 1114 | |
| 1115 | template (value) GSUP_IE ts_GSUP_IE_Destination_Name(octetstring name) := { |
| 1116 | tag := OSMO_GSUP_DESTINATION_NAME_IE, |
| 1117 | len := 0, /* overwritten */ |
| 1118 | val := { |
| 1119 | destination_name := name |
| 1120 | } |
| 1121 | } |
| 1122 | |
| 1123 | template GSUP_IE tr_GSUP_IE_AN_APDU(template GSUP_AN_APDU an_apdu) := { |
| 1124 | tag := OSMO_GSUP_AN_APDU_IE, |
| 1125 | len := ?, |
| 1126 | val := { |
| 1127 | an_apdu := an_apdu |
| 1128 | } |
| 1129 | } |
| 1130 | |
| 1131 | template (value) GSUP_IE ts_GSUP_IE_AN_APDU(GSUP_AN_APDU an_apdu) := { |
| 1132 | tag := OSMO_GSUP_AN_APDU_IE, |
| 1133 | len := 0, /* overwritten */ |
| 1134 | val := { |
| 1135 | an_apdu := an_apdu |
| 1136 | } |
| 1137 | } |
| 1138 | |
| 1139 | template (present) GSUP_IE tr_GSUP_IE_SUPPORTED_RAT_TYPES(template (present) GSUP_RatTypes ratt) := { |
| 1140 | tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE, |
| 1141 | len := ?, |
| 1142 | val := { |
| 1143 | supported_rat_types := ratt |
| 1144 | } |
| 1145 | } |
| 1146 | template (value) GSUP_IE ts_GSUP_IE_SUPPORTED_RAT_TYPES(GSUP_RatTypes ratt) := { |
| 1147 | tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE, |
| 1148 | len := 0, /* overwritten */ |
| 1149 | val := { |
| 1150 | supported_rat_types := ratt |
| 1151 | } |
| 1152 | } |
| 1153 | |
| 1154 | template (present) GSUP_IE tr_GSUP_IE_CURRENT_RAT_TYPE(template (present) GSUP_RatType ratt) := { |
| 1155 | tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE, |
| 1156 | len := ?, |
| 1157 | val := { |
| 1158 | current_rat_type := ratt |
| 1159 | } |
| 1160 | } |
| 1161 | template (value) GSUP_IE ts_GSUP_IE_CURRENT_RAT_TYPE(GSUP_RatType ratt) := { |
| 1162 | tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE, |
| 1163 | len := 0, /* overwritten */ |
| 1164 | val := { |
| 1165 | current_rat_type := ratt |
| 1166 | } |
| 1167 | } |
| 1168 | |
| 1169 | private function f_gen_ts_ies(hexstring imsi, |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1170 | template (omit) boolean pdp_info_compl := omit, |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1171 | template (omit) GSUP_Message_Class message_class := omit, |
| 1172 | template (omit) hexstring imei := omit, |
| 1173 | template (omit) GSUP_CnDomain dom := omit, |
| 1174 | template (omit) octetstring source_name := omit, |
| 1175 | template (omit) octetstring destination_name := omit |
| 1176 | ) return GSUP_IEs { |
| 1177 | var GSUP_IEs ies := { |
| 1178 | valueof(ts_GSUP_IE_IMSI(imsi)) |
| 1179 | }; |
| 1180 | |
| 1181 | if (isvalue(dom)) { |
| 1182 | ies := ies & { valueof(ts_GSUP_IE_CnDomain(dom)) }; |
| 1183 | } |
| 1184 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1185 | if (isvalue(pdp_info_compl) and valueof(pdp_info_compl)) { |
| 1186 | ies := ies & { valueof(ts_GSUP_IE_PdpInfoCompl) }; |
| 1187 | } |
| 1188 | |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1189 | if (isvalue(imei)) { |
| 1190 | ies := ies & { valueof(ts_GSUP_IE_IMEI(valueof(imei))) }; |
| 1191 | } |
| 1192 | |
| 1193 | if (isvalue(message_class)) { |
| 1194 | ies := ies & { valueof(ts_GSUP_IE_Message_Class(valueof(message_class))) }; |
| 1195 | } |
| 1196 | |
| 1197 | if (isvalue(source_name)) { |
| 1198 | ies := ies & { valueof(ts_GSUP_IE_Source_Name(valueof(source_name))) }; |
| 1199 | } |
| 1200 | |
| 1201 | if (isvalue(destination_name)) { |
| 1202 | ies := ies & { valueof(ts_GSUP_IE_Destination_Name(valueof(destination_name))) }; |
| 1203 | } |
| 1204 | |
| 1205 | return ies; |
| 1206 | } |
| 1207 | |
| 1208 | private function f_gen_tr_ies(template hexstring imsi, |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1209 | template boolean pdp_info_compl := omit, |
| 1210 | template GSUP_IEs pdp_info := omit, |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1211 | template GSUP_Message_Class message_class := omit, |
| 1212 | template integer cause := omit, |
Pau Espin Pedrol | cbe6eba | 2024-02-06 12:53:14 +0100 | [diff] [blame] | 1213 | template GSUP_CancelType cancel_type := omit, |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1214 | template hexstring msisdn := omit, |
| 1215 | template GSUP_IMEIResult imei_result := omit, |
Pau Espin Pedrol | cbe6eba | 2024-02-06 12:53:14 +0100 | [diff] [blame] | 1216 | template GSUP_CnDomain cn_domain := omit, |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1217 | template octetstring source_name := omit, |
| 1218 | template octetstring destination_name := omit |
| 1219 | ) return template GSUP_IEs { |
| 1220 | var template GSUP_IEs ies := { |
| 1221 | tr_GSUP_IE_IMSI(imsi) |
| 1222 | }; |
| 1223 | var integer idx := 1; |
| 1224 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1225 | if (not istemplatekind(msisdn, "omit")) { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1226 | ies[idx] := tr_GSUP_IE_MSISDN(msisdn); |
| 1227 | idx := idx + 1; |
| 1228 | } |
| 1229 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1230 | if (not istemplatekind(cause, "omit")) { |
| 1231 | ies[idx] := tr_GSUP_IE_Cause(cause); |
| 1232 | idx := idx + 1; |
| 1233 | } |
| 1234 | |
Pau Espin Pedrol | cbe6eba | 2024-02-06 12:53:14 +0100 | [diff] [blame] | 1235 | if (not istemplatekind(cancel_type, "omit")) { |
| 1236 | ies[idx] := tr_GSUP_IE_CancelType(cancel_type); |
| 1237 | idx := idx + 1; |
| 1238 | } |
| 1239 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1240 | if (not istemplatekind(pdp_info_compl, "omit")) { |
| 1241 | ies[idx] := tr_GSUP_IE_PdpInfoCompl; |
| 1242 | idx := idx + 1; |
| 1243 | } |
| 1244 | |
| 1245 | if (not istemplatekind(pdp_info, "omit")) { |
| 1246 | ies[idx] := tr_GSUP_IE_PdpInfo_ie(pdp_info); |
| 1247 | idx := idx + 1; |
| 1248 | } |
| 1249 | |
Pau Espin Pedrol | cbe6eba | 2024-02-06 12:53:14 +0100 | [diff] [blame] | 1250 | if (not istemplatekind(cn_domain, "omit")) { |
| 1251 | ies[idx] := tr_GSUP_IE_CnDomain(cn_domain); |
| 1252 | idx := idx + 1; |
| 1253 | } |
| 1254 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1255 | if (not istemplatekind(imei_result, "omit")) { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1256 | ies[idx] := tr_GSUP_IE_IMEI_Result(imei_result); |
| 1257 | idx := idx + 1; |
| 1258 | } |
| 1259 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1260 | if (not istemplatekind(message_class, "omit")) { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1261 | ies[idx] := tr_GSUP_IE_Message_Class(message_class); |
| 1262 | idx := idx + 1; |
| 1263 | } |
| 1264 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1265 | if (not istemplatekind(source_name, "omit")) { |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1266 | ies[idx] := tr_GSUP_IE_Source_Name(source_name); |
| 1267 | idx := idx + 1; |
| 1268 | } |
| 1269 | |
| 1270 | ies[idx] := *; |
| 1271 | idx := idx + 1; |
| 1272 | |
Pau Espin Pedrol | a6b0c1c | 2024-01-22 20:02:06 +0100 | [diff] [blame] | 1273 | if (not istemplatekind(destination_name, "omit")) { |
| 1274 | if (istemplatekind(destination_name, "*")) { |
| 1275 | ies[idx] := *; |
| 1276 | } else { |
| 1277 | ies[idx] := tr_GSUP_IE_Destination_Name(destination_name); |
| 1278 | } |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 1279 | idx := idx + 1; |
| 1280 | } |
| 1281 | |
| 1282 | return ies; |
| 1283 | } |
| 1284 | |
| 1285 | private function f_gen_ts_ss_ies( |
| 1286 | hexstring imsi, |
| 1287 | OCT4 sid, |
| 1288 | GSUP_SessionState state, |
| 1289 | template (omit) octetstring ss := omit, |
| 1290 | template (omit) integer cause := omit, |
| 1291 | template octetstring source_name := omit |
| 1292 | ) return GSUP_IEs { |
| 1293 | /* Mandatory IEs */ |
| 1294 | var GSUP_IEs ies := { |
| 1295 | valueof(ts_GSUP_IE_IMSI(imsi)) |
| 1296 | }; |
| 1297 | |
| 1298 | /* Cause IE is needed for PROC_SS_ERR */ |
| 1299 | if (isvalue(cause)) { |
| 1300 | ies := ies & { valueof(ts_GSUP_IE_Cause(valueof(cause))) }; |
| 1301 | } |
| 1302 | |
| 1303 | /* Mandatory session IEs */ |
| 1304 | ies := ies & { valueof(ts_GSUP_IE_SessionId(sid)) }; |
| 1305 | ies := ies & { valueof(ts_GSUP_IE_SessionState(state)) }; |
| 1306 | |
| 1307 | /* Optional SS payload */ |
| 1308 | if (isvalue(ss)) { |
| 1309 | ies := ies & { valueof(ts_GSUP_IE_SSInfo(valueof(ss))) }; |
| 1310 | } |
| 1311 | |
| 1312 | if (isvalue(source_name)) { |
| 1313 | ies := ies & { valueof(ts_GSUP_IE_Source_Name(valueof(source_name))) }; |
| 1314 | } |
| 1315 | |
| 1316 | return ies; |
| 1317 | } |
| 1318 | private function f_gen_tr_ss_ies( |
| 1319 | template hexstring imsi, |
| 1320 | template OCT4 sid := ?, |
| 1321 | template GSUP_SessionState state := ?, |
| 1322 | template octetstring ss := omit, |
| 1323 | template integer cause := omit, |
| 1324 | template octetstring destination_name := omit |
| 1325 | ) return template GSUP_IEs { |
| 1326 | /* Mandatory IEs */ |
| 1327 | var template GSUP_IEs ies := { |
| 1328 | tr_GSUP_IE_IMSI(imsi) |
| 1329 | }; |
| 1330 | var integer idx := 1; |
| 1331 | |
| 1332 | /* Cause IE is needed for PROC_SS_ERR */ |
| 1333 | if (istemplatekind(cause, "*")) { |
| 1334 | ies[idx] := *; |
| 1335 | idx := idx + 1; |
| 1336 | } else if (not istemplatekind(cause, "omit")) { |
| 1337 | ies[idx] := tr_GSUP_IE_Cause(cause); |
| 1338 | idx := idx + 1; |
| 1339 | } |
| 1340 | |
| 1341 | /* Mandatory session IEs */ |
| 1342 | ies[idx] := tr_GSUP_IE_SessionId(sid); |
| 1343 | ies[idx + 1] := tr_GSUP_IE_SessionState(state); |
| 1344 | idx := idx + 2; |
| 1345 | |
| 1346 | /* Optional SS payload */ |
| 1347 | if (istemplatekind(ss, "*")) { |
| 1348 | ies[idx] := *; |
| 1349 | idx := idx + 1; |
| 1350 | } else if (not istemplatekind(ss, "omit")) { |
| 1351 | ies[idx] := tr_GSUP_IE_SSInfo(ss); |
| 1352 | idx := idx + 1; |
| 1353 | } |
| 1354 | |
| 1355 | if (isvalue(destination_name)) { |
| 1356 | ies[idx] := tr_GSUP_IE_Destination_Name(destination_name); |
| 1357 | idx := idx + 1; |
| 1358 | } |
| 1359 | |
| 1360 | /* the GSUP Message Class IE is optional, as old implementations don't have it yet */ |
| 1361 | var template GSUP_IEs ies2 := ies; |
| 1362 | ies2[idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD); |
| 1363 | idx := idx + 1; |
| 1364 | |
| 1365 | return (ies, ies2); |
| 1366 | } |
| 1367 | |
| 1368 | template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ( |
| 1369 | hexstring imsi, |
| 1370 | OCT4 sid, |
| 1371 | GSUP_SessionState state, |
| 1372 | template (omit) octetstring ss := omit, |
| 1373 | template (omit) octetstring source_name := omit |
| 1374 | ) := ts_GSUP( |
| 1375 | OSMO_GSUP_MSGT_PROC_SS_REQUEST, |
| 1376 | f_gen_ts_ss_ies(imsi, sid, state, ss, source_name := source_name) |
| 1377 | ); |
| 1378 | template GSUP_PDU tr_GSUP_PROC_SS_REQ( |
| 1379 | template hexstring imsi, |
| 1380 | template OCT4 sid := ?, |
| 1381 | template GSUP_SessionState state := ?, |
| 1382 | template octetstring ss := * |
| 1383 | ) := tr_GSUP( |
| 1384 | OSMO_GSUP_MSGT_PROC_SS_REQUEST, |
| 1385 | f_gen_tr_ss_ies(imsi, sid, state, ss) |
| 1386 | ); |
| 1387 | |
| 1388 | template (value) GSUP_PDU ts_GSUP_PROC_SS_RES( |
| 1389 | hexstring imsi, |
| 1390 | OCT4 sid, |
| 1391 | GSUP_SessionState state, |
| 1392 | template (omit) octetstring ss := omit |
| 1393 | ) := ts_GSUP( |
| 1394 | OSMO_GSUP_MSGT_PROC_SS_RESULT, |
| 1395 | f_gen_ts_ss_ies(imsi, sid, state, ss) |
| 1396 | ); |
| 1397 | template GSUP_PDU tr_GSUP_PROC_SS_RES( |
| 1398 | template hexstring imsi, |
| 1399 | template OCT4 sid := ?, |
| 1400 | template GSUP_SessionState state := ?, |
| 1401 | template octetstring ss := *, |
| 1402 | template octetstring destination_name := omit |
| 1403 | ) := tr_GSUP( |
| 1404 | OSMO_GSUP_MSGT_PROC_SS_RESULT, |
| 1405 | f_gen_tr_ss_ies(imsi, sid, state, ss, destination_name := destination_name) |
| 1406 | ); |
| 1407 | |
| 1408 | template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR( |
| 1409 | hexstring imsi, |
| 1410 | OCT4 sid, |
| 1411 | GSUP_SessionState state, |
| 1412 | integer cause |
| 1413 | ) := ts_GSUP( |
| 1414 | OSMO_GSUP_MSGT_PROC_SS_ERROR, |
| 1415 | f_gen_ts_ss_ies(imsi, sid, state, cause := cause) |
| 1416 | ); |
| 1417 | template GSUP_PDU tr_GSUP_PROC_SS_ERR( |
| 1418 | template hexstring imsi, |
| 1419 | template OCT4 sid := ?, |
| 1420 | template GSUP_SessionState state := ?, |
| 1421 | template integer cause := ? |
| 1422 | ) := tr_GSUP( |
| 1423 | OSMO_GSUP_MSGT_PROC_SS_ERROR, |
| 1424 | f_gen_tr_ss_ies(imsi, sid, state, cause := cause) |
| 1425 | ); |
| 1426 | |
| 1427 | template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_REQ( |
| 1428 | hexstring imsi, |
| 1429 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1430 | GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1431 | GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1432 | octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */ |
| 1433 | ) := ts_GSUP( |
| 1434 | OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST, |
| 1435 | { |
| 1436 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1437 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1438 | valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)), |
| 1439 | valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)), |
| 1440 | valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)), |
| 1441 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)) |
| 1442 | } |
| 1443 | ); |
| 1444 | template GSUP_PDU tr_GSUP_MO_FORWARD_SM_REQ( |
| 1445 | template hexstring imsi := ?, |
| 1446 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1447 | template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1448 | template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1449 | template octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */ |
| 1450 | ) := tr_GSUP( |
| 1451 | OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST, |
| 1452 | { |
| 1453 | tr_GSUP_IE_IMSI(imsi), |
| 1454 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1455 | tr_GSUP_IE_SM_RP_DA(sm_rp_da), |
| 1456 | tr_GSUP_IE_SM_RP_OA(sm_rp_oa), |
| 1457 | tr_GSUP_IE_SM_RP_UI(sm_rp_ui), |
| 1458 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS), |
| 1459 | tr_GSUP_IE_Source_Name(?) |
| 1460 | } |
| 1461 | ); |
| 1462 | |
| 1463 | template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_RES( |
| 1464 | hexstring imsi, |
| 1465 | OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1466 | ) := ts_GSUP( |
| 1467 | OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT, |
| 1468 | { |
| 1469 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1470 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1471 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)) |
| 1472 | } |
| 1473 | ); |
| 1474 | template GSUP_PDU tr_GSUP_MO_FORWARD_SM_RES( |
| 1475 | template hexstring imsi := ?, |
| 1476 | template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1477 | ) := tr_GSUP( |
| 1478 | OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT, |
| 1479 | { |
| 1480 | tr_GSUP_IE_IMSI(imsi), |
| 1481 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1482 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS), |
| 1483 | tr_GSUP_IE_Source_Name(?) |
| 1484 | } |
| 1485 | ); |
| 1486 | |
| 1487 | template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_ERR( |
| 1488 | hexstring imsi, |
| 1489 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1490 | OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1491 | ) := ts_GSUP( |
| 1492 | OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR, |
| 1493 | { |
| 1494 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1495 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1496 | valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)), |
| 1497 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)) |
| 1498 | } |
| 1499 | ); |
| 1500 | template GSUP_PDU tr_GSUP_MO_FORWARD_SM_ERR( |
| 1501 | template hexstring imsi := ?, |
| 1502 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1503 | template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1504 | ) := tr_GSUP( |
| 1505 | OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR, |
| 1506 | { |
| 1507 | tr_GSUP_IE_IMSI(imsi), |
| 1508 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1509 | tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause), |
| 1510 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS), |
| 1511 | tr_GSUP_IE_Source_Name(?) |
| 1512 | } |
| 1513 | ); |
| 1514 | |
| 1515 | template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_REQ( |
| 1516 | hexstring imsi, |
| 1517 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1518 | GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1519 | GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1520 | octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */ |
| 1521 | OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */ |
| 1522 | ) := ts_GSUP( |
| 1523 | OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST, |
| 1524 | { |
| 1525 | /** |
| 1526 | * TODO: add MT-specific fields (and IEs): |
| 1527 | * - smDeliveryTimer |
| 1528 | * - smDeliveryStartTime |
| 1529 | */ |
| 1530 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1531 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1532 | valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)), |
| 1533 | valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)), |
| 1534 | valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)), |
| 1535 | valueof(ts_GSUP_IE_SM_RP_MMS(sm_rp_mms)), |
| 1536 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)) |
| 1537 | } |
| 1538 | ); |
| 1539 | template GSUP_PDU tr_GSUP_MT_FORWARD_SM_REQ( |
| 1540 | template hexstring imsi := ?, |
| 1541 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1542 | template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1543 | template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1544 | template octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */ |
| 1545 | template OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */ |
| 1546 | ) := tr_GSUP( |
| 1547 | OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST, |
| 1548 | { |
| 1549 | /** |
| 1550 | * TODO: add MT-specific fields (and IEs): |
| 1551 | * - smDeliveryTimer |
| 1552 | * - smDeliveryStartTime |
| 1553 | */ |
| 1554 | tr_GSUP_IE_IMSI(imsi), |
| 1555 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1556 | tr_GSUP_IE_SM_RP_DA(sm_rp_da), |
| 1557 | tr_GSUP_IE_SM_RP_OA(sm_rp_oa), |
| 1558 | tr_GSUP_IE_SM_RP_UI(sm_rp_ui), |
| 1559 | tr_GSUP_IE_SM_RP_MMS(sm_rp_mms), |
| 1560 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS), |
| 1561 | tr_GSUP_IE_Source_Name(?) |
| 1562 | } |
| 1563 | ); |
| 1564 | |
| 1565 | template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_RES( |
| 1566 | hexstring imsi, |
| 1567 | OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1568 | ) := ts_GSUP( |
| 1569 | OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT, |
| 1570 | { |
| 1571 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1572 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1573 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)) |
| 1574 | } |
| 1575 | ); |
| 1576 | template GSUP_PDU tr_GSUP_MT_FORWARD_SM_RES( |
| 1577 | template hexstring imsi := ?, |
| 1578 | template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1579 | ) := tr_GSUP( |
| 1580 | OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT, |
| 1581 | { |
| 1582 | tr_GSUP_IE_IMSI(imsi), |
| 1583 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1584 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS), |
| 1585 | tr_GSUP_IE_Source_Name(?) |
| 1586 | } |
| 1587 | ); |
| 1588 | |
| 1589 | template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_ERR( |
| 1590 | hexstring imsi, |
| 1591 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1592 | OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1593 | ) := ts_GSUP( |
| 1594 | OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR, |
| 1595 | { |
| 1596 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1597 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1598 | valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)), |
| 1599 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)) |
| 1600 | } |
| 1601 | ); |
| 1602 | template GSUP_PDU tr_GSUP_MT_FORWARD_SM_ERR( |
| 1603 | template hexstring imsi := ?, |
| 1604 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1605 | template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1606 | ) := tr_GSUP( |
| 1607 | OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR, |
| 1608 | { |
| 1609 | tr_GSUP_IE_IMSI(imsi), |
| 1610 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1611 | tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause), |
| 1612 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS), |
| 1613 | tr_GSUP_IE_Source_Name(?) |
| 1614 | } |
| 1615 | ); |
| 1616 | |
| 1617 | template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_REQ( |
| 1618 | hexstring imsi, |
| 1619 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1620 | GSUP_SM_ALERT_RSN_Type sm_alert_rsn /* SM Alert Reason, see 7.6.8.8 */ |
| 1621 | ) := ts_GSUP( |
| 1622 | OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST, |
| 1623 | { |
| 1624 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1625 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1626 | valueof(ts_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn)), |
| 1627 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)) |
| 1628 | } |
| 1629 | ); |
| 1630 | template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_REQ( |
| 1631 | template hexstring imsi := ?, |
| 1632 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1633 | template GSUP_SM_ALERT_RSN_Type sm_alert_rsn := ? /* SM Alert Reason, see 7.6.8.8 */ |
| 1634 | ) := tr_GSUP( |
| 1635 | OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST, |
| 1636 | { |
| 1637 | tr_GSUP_IE_IMSI(imsi), |
| 1638 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1639 | tr_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn), |
| 1640 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS), |
| 1641 | tr_GSUP_IE_Source_Name(?) |
| 1642 | } |
| 1643 | ); |
| 1644 | |
| 1645 | template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_RES( |
| 1646 | hexstring imsi, |
| 1647 | OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1648 | ) := ts_GSUP( |
| 1649 | OSMO_GSUP_MSGT_READY_FOR_SM_RESULT, |
| 1650 | { |
| 1651 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1652 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1653 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)) |
| 1654 | } |
| 1655 | ); |
| 1656 | template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_RES( |
| 1657 | template hexstring imsi := ?, |
| 1658 | template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1659 | ) := tr_GSUP( |
| 1660 | OSMO_GSUP_MSGT_READY_FOR_SM_RESULT, |
| 1661 | { |
| 1662 | tr_GSUP_IE_IMSI(imsi), |
| 1663 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1664 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS), |
| 1665 | tr_GSUP_IE_Source_Name(?) |
| 1666 | } |
| 1667 | ); |
| 1668 | |
| 1669 | template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_ERR( |
| 1670 | hexstring imsi, |
| 1671 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1672 | OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1673 | ) := ts_GSUP( |
| 1674 | OSMO_GSUP_MSGT_READY_FOR_SM_ERROR, |
| 1675 | { |
| 1676 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1677 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1678 | valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)), |
| 1679 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS)) |
| 1680 | } |
| 1681 | ); |
| 1682 | template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_ERR( |
| 1683 | template hexstring imsi := ?, |
| 1684 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1685 | template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1686 | ) := tr_GSUP( |
| 1687 | OSMO_GSUP_MSGT_READY_FOR_SM_ERROR, |
| 1688 | { |
| 1689 | tr_GSUP_IE_IMSI(imsi), |
| 1690 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1691 | tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause), |
| 1692 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS), |
| 1693 | tr_GSUP_IE_Source_Name(?) |
| 1694 | } |
| 1695 | ); |
| 1696 | |
| 1697 | function f_gsup_find_nested_ie_multiple(GSUP_IEs ies, GSUP_IEI iei, integer nth, out GSUP_IeValue ret) return boolean { |
| 1698 | var integer current := 0; |
| 1699 | for (var integer i := 0; i < sizeof(ies); i := i+1) { |
| 1700 | if (ies[i].tag == iei) { |
| 1701 | if (current == nth) { |
| 1702 | ret := ies[i].val; |
| 1703 | return true; |
| 1704 | } else { |
| 1705 | current := current + 1; |
| 1706 | } |
| 1707 | } |
| 1708 | } |
| 1709 | return false; |
| 1710 | } |
| 1711 | |
| 1712 | function f_gsup_find_nested_ie(GSUP_IEs ies, GSUP_IEI iei, out GSUP_IeValue ret) return boolean { |
| 1713 | for (var integer i := 0; i < sizeof(ies); i := i+1) { |
| 1714 | if (ies[i].tag == iei) { |
| 1715 | ret := ies[i].val; |
| 1716 | return true; |
| 1717 | } |
| 1718 | } |
| 1719 | return false; |
| 1720 | } |
| 1721 | |
| 1722 | function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) return boolean { |
| 1723 | return f_gsup_find_nested_ie(msg.ies, iei, ret); |
| 1724 | } |
| 1725 | |
| 1726 | template GSUP_AN_APDU t_GSUP_AN_APDU( |
| 1727 | template GSUP_AN_PROTO an_proto := ?, |
| 1728 | template octetstring pdu := ? |
| 1729 | ) := { |
| 1730 | proto := an_proto, |
| 1731 | pdu := pdu |
| 1732 | }; |
| 1733 | |
| 1734 | template GSUP_PDU tr_GSUP_E_AN_APDU( |
| 1735 | template GSUP_MessageType msgt, |
| 1736 | template hexstring imsi := ?, |
| 1737 | template octetstring source_name := ?, |
| 1738 | template octetstring destination_name := ?, |
| 1739 | template GSUP_AN_APDU an_apdu := ? |
| 1740 | ) := tr_GSUP( |
| 1741 | msgt, |
| 1742 | { |
| 1743 | tr_GSUP_IE_IMSI(imsi), |
| 1744 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC), |
| 1745 | tr_GSUP_IE_Source_Name(source_name), |
| 1746 | tr_GSUP_IE_Destination_Name(destination_name), |
| 1747 | tr_GSUP_IE_AN_APDU(an_apdu) |
| 1748 | } |
| 1749 | ); |
| 1750 | |
| 1751 | template GSUP_PDU tr_GSUP_E_NO_PDU( |
| 1752 | template GSUP_MessageType msgt, |
| 1753 | template hexstring imsi := ?, |
| 1754 | template octetstring source_name := ?, |
| 1755 | template octetstring destination_name := ? |
| 1756 | ) := tr_GSUP( |
| 1757 | msgt, |
| 1758 | { |
| 1759 | tr_GSUP_IE_IMSI(imsi), |
| 1760 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC), |
| 1761 | tr_GSUP_IE_Source_Name(source_name), |
| 1762 | tr_GSUP_IE_Destination_Name(destination_name) |
| 1763 | } |
| 1764 | ); |
| 1765 | |
| 1766 | template (value) GSUP_PDU ts_GSUP_E_AN_APDU( |
| 1767 | GSUP_MessageType msgt, |
| 1768 | hexstring imsi, |
| 1769 | octetstring source_name, |
| 1770 | octetstring destination_name, |
| 1771 | GSUP_AN_APDU an_apdu |
| 1772 | ) := ts_GSUP( |
| 1773 | msgt, |
| 1774 | { |
| 1775 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1776 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)), |
| 1777 | valueof(ts_GSUP_IE_Source_Name(source_name)), |
| 1778 | valueof(ts_GSUP_IE_Destination_Name(destination_name)), |
| 1779 | valueof(ts_GSUP_IE_AN_APDU(an_apdu)) |
| 1780 | } |
| 1781 | ); |
| 1782 | |
| 1783 | template (value) GSUP_PDU ts_GSUP_E_PrepareHandoverResult( |
| 1784 | hexstring imsi, |
| 1785 | hexstring msisdn, |
| 1786 | octetstring source_name, |
| 1787 | octetstring destination_name, |
| 1788 | GSUP_AN_APDU an_apdu |
| 1789 | ) := ts_GSUP( |
| 1790 | OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT, |
| 1791 | { |
| 1792 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1793 | valueof(ts_GSUP_IE_MSISDN(msisdn)), |
| 1794 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)), |
| 1795 | valueof(ts_GSUP_IE_Source_Name(source_name)), |
| 1796 | valueof(ts_GSUP_IE_Destination_Name(destination_name)), |
| 1797 | valueof(ts_GSUP_IE_AN_APDU(an_apdu)) |
| 1798 | } |
| 1799 | ); |
| 1800 | |
| 1801 | } with { encode "RAW"; variant "FIELDORDER(msb)" } |