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