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