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