Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 1 | module GSUP_Types { |
| 2 | |
Harald Welte | 35bb716 | 2018-01-03 21:07:52 +0100 | [diff] [blame] | 3 | /* GSUP_Types, defining abstract TTCN-3 data types 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 by Harald Welte <laforge@gnumonks.org> |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * Released under the terms of GNU General Public License, Version 2 or |
| 12 | * (at your option) any later version. |
| 13 | */ |
| 14 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 15 | import from General_Types all; |
| 16 | import from Osmocom_Types all; |
| 17 | |
| 18 | type enumerated GSUP_IEI { |
| 19 | OSMO_GSUP_IMSI_IE ('01'O), |
| 20 | OSMO_GSUP_CAUSE_IE ('02'O), |
| 21 | OSMO_GSUP_AUTH_TUPLE_IE ('03'O), |
| 22 | OSMO_GSUP_PDP_INFO_COMPL_IE ('04'O), |
| 23 | OSMO_GSUP_PDP_INFO_IE ('05'O), |
| 24 | OSMO_GSUP_CANCEL_TYPE_IE ('06'O), |
| 25 | OSMO_GSUP_FREEZE_PTMSI_IE ('07'O), |
| 26 | OSMO_GSUP_MSISDN_IE ('08'O), |
| 27 | OSMO_GSUP_HLR_NUMBER_IE ('09'O), |
| 28 | OSMO_GSUP_PDP_CONTEXT_ID_IE ('10'O), |
| 29 | OSMO_GSUP_PDP_TYPE_IE ('11'O), |
| 30 | OSMO_GSUP_ACCESS_POINT_NAME_IE ('12'O), |
| 31 | OSMO_GSUP_PDP_QOS_IE ('13'O), |
| 32 | OSMO_GSUP_CHARG_CHAR_IE ('14'O), |
| 33 | |
| 34 | OSMO_GSUP_RAND_IE ('20'O), |
| 35 | OSMO_GSUP_SRES_IE ('21'O), |
| 36 | OSMO_GSUP_KC_IE ('22'O), |
| 37 | OSMO_GSUP_IK_IE ('23'O), |
| 38 | OSMO_GSUP_CK_IE ('24'O), |
| 39 | OSMO_GSUP_AUTN_IE ('25'O), |
| 40 | OSMO_GSUP_AUTS_IE ('26'O), |
| 41 | OSMO_GSUP_RES_IE ('27'O), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 42 | OSMO_GSUP_CN_DOMAIN_IE ('28'O), |
| 43 | |
| 44 | OSMO_GSUP_SESSION_ID_IE ('30'O), |
| 45 | OSMO_GSUP_SESSION_STATE_IE ('31'O), |
| 46 | OSMO_GSUP_SS_INFO_IE ('35'O) |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 47 | } with { variant "FIELDLENGTH(8)" }; |
| 48 | |
| 49 | type enumerated GSUP_MessageType { |
| 50 | OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST ('00000100'B), |
| 51 | OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR ('00000101'B), |
| 52 | OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT ('00000110'B), |
| 53 | |
| 54 | OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST ('00001000'B), |
| 55 | OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR ('00001001'B), |
| 56 | OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT ('00001010'B), |
| 57 | |
| 58 | OSMO_GSUP_MSGT_AUTH_FAIL_REPORT ('00001011'B), |
| 59 | |
| 60 | OSMO_GSUP_MSGT_PURGE_MS_REQUEST ('00001100'B), |
| 61 | OSMO_GSUP_MSGT_PURGE_MS_ERROR ('00001101'B), |
| 62 | OSMO_GSUP_MSGT_PURGE_MS_RESULT ('00001110'B), |
| 63 | |
| 64 | OSMO_GSUP_MSGT_INSERT_DATA_REQUEST ('00010000'B), |
| 65 | OSMO_GSUP_MSGT_INSERT_DATA_ERROR ('00010001'B), |
| 66 | OSMO_GSUP_MSGT_INSERT_DATA_RESULT ('00010010'B), |
| 67 | |
| 68 | OSMO_GSUP_MSGT_DELETE_DATA_REQUEST ('00010100'B), |
| 69 | OSMO_GSUP_MSGT_DELETE_DATA_ERROR ('00010101'B), |
| 70 | OSMO_GSUP_MSGT_DELETE_DATA_RESULT ('00010110'B), |
| 71 | |
| 72 | OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST ('00011100'B), |
| 73 | OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR ('00011101'B), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 74 | OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT ('00011110'B), |
| 75 | |
| 76 | OSMO_GSUP_MSGT_PROC_SS_REQUEST ('00100000'B), |
| 77 | OSMO_GSUP_MSGT_PROC_SS_ERROR ('00100001'B), |
| 78 | OSMO_GSUP_MSGT_PROC_SS_RESULT ('00100010'B) |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 79 | } with { variant "FIELDLENGTH(8)" }; |
| 80 | |
| 81 | type enumerated GSUP_CancelType { |
Alexander Couzens | 4786b3f | 2018-09-16 03:33:30 +0200 | [diff] [blame] | 82 | OSMO_GSUP_CANCEL_TYPE_UPDATE (0), |
| 83 | OSMO_GSUP_CANCEL_TYPE_WITHDRAW (1) |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 84 | } with { variant "FIELDLENGTH(8)" }; |
| 85 | |
| 86 | type enumerated GSUP_CnDomain { |
| 87 | OSMO_GSUP_CN_DOMAIN_PS (1), |
| 88 | OSMO_GSUP_CN_DOMAIN_CS (2) |
| 89 | } with { variant "FIELDLENGTH(8)" }; |
| 90 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 91 | type enumerated GSUP_SessionState { |
| 92 | OSMO_GSUP_SESSION_STATE_NONE (0), |
| 93 | OSMO_GSUP_SESSION_STATE_BEGIN (1), |
| 94 | OSMO_GSUP_SESSION_STATE_CONTINUE (2), |
| 95 | OSMO_GSUP_SESSION_STATE_END (3) |
| 96 | } with { variant "FIELDLENGTH(8)" }; |
| 97 | |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 98 | type record GSUP_MSISDN { |
| 99 | uint8_t len, |
| 100 | hexstring digits optional |
| 101 | } with { variant (len) "LENGTHTO(digits)" }; |
| 102 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 103 | type record GSUP_IE { |
| 104 | GSUP_IEI tag, |
| 105 | uint8_t len, |
| 106 | GSUP_IeValue val |
| 107 | } with { variant (len) "LENGTHTO(val)" |
| 108 | variant (val) "CROSSTAG(imsi, tag = OSMO_GSUP_IMSI_IE; |
| 109 | cause, tag = OSMO_GSUP_CAUSE_IE; |
| 110 | cancel_type, tag = OSMO_GSUP_CANCEL_TYPE_IE; |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 111 | auth_tuple, tag = OSMO_GSUP_AUTH_TUPLE_IE; |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 112 | auts, tag = OSMO_GSUP_AUTS_IE; |
| 113 | rand, tag = OSMO_GSUP_RAND_IE; |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 114 | sres, tag = OSMO_GSUP_SRES_IE; |
| 115 | kc, tag = OSMO_GSUP_KC_IE; |
| 116 | ik, tag = OSMO_GSUP_IK_IE; |
| 117 | ck, tag = OSMO_GSUP_CK_IE; |
| 118 | autn, tag = OSMO_GSUP_AUTN_IE; |
| 119 | res, tag = OSMO_GSUP_RES_IE; |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 120 | msisdn, tag = OSMO_GSUP_MSISDN_IE; |
| 121 | hlr_number, tag = OSMO_GSUP_HLR_NUMBER_IE; |
| 122 | cn_domain, tag = OSMO_GSUP_CN_DOMAIN_IE; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 123 | pdp_info, tag = OSMO_GSUP_PDP_INFO_IE; |
| 124 | apn, tag = OSMO_GSUP_ACCESS_POINT_NAME_IE; |
| 125 | pdp_qos, tag = OSMO_GSUP_PDP_QOS_IE; |
| 126 | pdp_type, tag = OSMO_GSUP_PDP_TYPE_IE; |
| 127 | charg_char, tag = OSMO_GSUP_CHARG_CHAR_IE; |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 128 | session_state, tag = OSMO_GSUP_SESSION_STATE_IE; |
| 129 | session_id, tag = OSMO_GSUP_SESSION_ID_IE; |
| 130 | ss_info, tag = OSMO_GSUP_SS_INFO_IE; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 131 | )" |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | type record of GSUP_IE GSUP_IEs; |
| 135 | |
| 136 | type union GSUP_IeValue { |
| 137 | hexstring imsi, |
| 138 | integer cause, |
| 139 | GSUP_CancelType cancel_type, |
| 140 | //boolean pdp_info_compl, |
| 141 | //boolean freeze_ptmsi, |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 142 | GSUP_IEs auth_tuple, |
| 143 | octetstring auts, |
| 144 | octetstring rand, |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 145 | octetstring sres, |
| 146 | octetstring kc, |
| 147 | octetstring ik, |
| 148 | octetstring ck, |
| 149 | octetstring autn, |
| 150 | octetstring res, |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 151 | GSUP_MSISDN msisdn, |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 152 | octetstring hlr_number, |
| 153 | GSUP_CnDomain cn_domain, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 154 | /* PDP context + nested IEs */ |
| 155 | GSUP_IEs pdp_info, |
| 156 | octetstring apn, |
| 157 | octetstring pdp_qos, |
| 158 | OCT2 pdp_type, |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 159 | octetstring charg_char, |
| 160 | /* Session information */ |
| 161 | GSUP_SessionState session_state, |
| 162 | OCT4 session_id, |
| 163 | /* Supplementary Services */ |
| 164 | octetstring ss_info |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 165 | }; |
| 166 | |
| 167 | type record GSUP_PDU { |
| 168 | GSUP_MessageType msg_type, |
| 169 | GSUP_IEs ies |
| 170 | }; |
| 171 | |
| 172 | external function enc_GSUP_PDU(in GSUP_PDU msg) return octetstring |
| 173 | with { extension "prototype(convert) encode(RAW)" }; |
| 174 | |
| 175 | external function dec_GSUP_PDU(in octetstring msg) return GSUP_PDU |
| 176 | with { extension "prototype(convert) decode(RAW)" }; |
| 177 | |
Harald Welte | 2f562b1 | 2018-01-24 20:52:38 +0100 | [diff] [blame] | 178 | function f_gsup_postprocess_decoded(inout GSUP_PDU gsup) { |
| 179 | if (gsup.ies[0].tag == OSMO_GSUP_IMSI_IE) { |
| 180 | /* if last digit is 'F', then there's an odd number of digits and we must strip the F */ |
| 181 | var integer num_digits := lengthof(gsup.ies[0].val.imsi); |
| 182 | if (gsup.ies[0].val.imsi[num_digits-1] == 'F'H) { |
| 183 | gsup.ies[0].val.imsi := substr(gsup.ies[0].val.imsi, 0, num_digits-1); |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | function f_gsup_preprocess_encoded(inout GSUP_PDU gsup) { |
| 189 | if (ischosen(gsup.ies[0].val.imsi)) { |
| 190 | /* if number of digits is odd, add a 'F' as padding at the end */ |
| 191 | var integer num_digits := lengthof(gsup.ies[0].val.imsi); |
| 192 | if (num_digits rem 2 == 1) { |
| 193 | gsup.ies[0].val.imsi := gsup.ies[0].val.imsi & 'F'H; |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 198 | template (value) GSUP_MSISDN ts_GSUP_MSISDN(hexstring digits, |
| 199 | BIT3 ton := '000'B, |
| 200 | BIT4 npi := '0000'B) := { |
| 201 | len := 0, /* overwritten */ |
| 202 | /* numberingPlanIdentification := npi, |
| 203 | typeOfNumber := ton, |
| 204 | ext1 := '0'B, */ |
| 205 | digits := digits |
| 206 | } |
| 207 | |
| 208 | template GSUP_MSISDN tr_GSUP_MSISDN(template hexstring digits, |
| 209 | template BIT3 ton := ?, |
| 210 | template BIT4 npi := ?) := { |
| 211 | len := ?, |
| 212 | /* numberingPlanIdentification := npi, |
| 213 | typeOfNumber := ton, |
| 214 | ext1 := '0'B, */ |
| 215 | digits := digits |
| 216 | } |
| 217 | |
| 218 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 219 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 220 | template GSUP_IE ts_GSUP_IE_AuthTuple2G(octetstring rand, octetstring sres, |
| 221 | octetstring kc) := { |
| 222 | tag := OSMO_GSUP_AUTH_TUPLE_IE, |
| 223 | len := 0, /* overwritten */ |
| 224 | val := { |
| 225 | auth_tuple := { |
| 226 | valueof(ts_GSUP_IE_RAND(rand)), |
| 227 | valueof(ts_GSUP_IE_SRES(sres)), |
| 228 | valueof(ts_GSUP_IE_Kc(kc)) |
| 229 | } |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | template GSUP_IE ts_GSUP_IE_AuthTuple2G3G(octetstring rand, octetstring sres, |
| 234 | octetstring kc, octetstring ik, |
| 235 | octetstring ck, octetstring autn, |
| 236 | octetstring res) := { |
| 237 | tag := OSMO_GSUP_AUTH_TUPLE_IE, |
| 238 | len := 0, /* overwritten */ |
| 239 | val := { |
| 240 | auth_tuple := { |
| 241 | valueof(ts_GSUP_IE_RAND(rand)), |
| 242 | valueof(ts_GSUP_IE_SRES(sres)), |
| 243 | valueof(ts_GSUP_IE_Kc(kc)), |
| 244 | valueof(ts_GSUP_IE_IK(ik)), |
| 245 | valueof(ts_GSUP_IE_CK(ck)), |
| 246 | valueof(ts_GSUP_IE_AUTN(autn)), |
| 247 | valueof(ts_GSUP_IE_RES(res)) |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 252 | template GSUP_IE ts_GSUP_IE_PdpInfo(octetstring apn, octetstring pdp_type, octetstring pdp_qos) := { |
| 253 | tag := OSMO_GSUP_PDP_INFO_IE, |
| 254 | len := 0, /* overwritten */ |
| 255 | val := { |
| 256 | pdp_info := { |
| 257 | valueof(ts_GSUP_IE_APN(apn)), |
| 258 | valueof(ts_GSUP_IE_PDP_TYPE(pdp_type)), |
| 259 | valueof(ts_GSUP_IE_PDP_QOS(pdp_qos)) |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | template (value) GSUP_IE ts_GSUP_IE_PDP_TYPE(OCT2 pdp_type) := { |
| 265 | tag := OSMO_GSUP_PDP_TYPE_IE, |
| 266 | len := 0, |
| 267 | val := { |
| 268 | pdp_type := pdp_type |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | template (value) GSUP_IE ts_GSUP_IE_PDP_QOS(octetstring pdp_qos) := { |
| 273 | tag := OSMO_GSUP_PDP_QOS_IE, |
| 274 | len := 0, |
| 275 | val := { |
| 276 | pdp_qos := pdp_qos |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 281 | template GSUP_PDU tr_GSUP(template GSUP_MessageType msgt := ?, template GSUP_IEs ies := *) := { |
| 282 | msg_type := msgt, |
| 283 | ies := ies |
| 284 | } |
| 285 | |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 286 | template GSUP_PDU tr_GSUP_IMSI(template GSUP_MessageType msgt := ?, template hexstring imsi) := { |
| 287 | msg_type := msgt, |
| 288 | ies := { tr_GSUP_IE_IMSI(imsi), * } |
| 289 | } |
| 290 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 291 | template GSUP_PDU ts_GSUP(GSUP_MessageType msgt, GSUP_IEs ies := {}) := { |
| 292 | msg_type := msgt, |
| 293 | ies := ies |
| 294 | } |
| 295 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 296 | template (value) GSUP_PDU ts_GSUP_SAI_REQ(hexstring imsi) := |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 297 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 298 | |
Harald Welte | ef9fa87 | 2018-01-22 03:00:17 +0100 | [diff] [blame] | 299 | template GSUP_PDU tr_GSUP_SAI_REQ(template hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 300 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, imsi); |
Harald Welte | ef9fa87 | 2018-01-22 03:00:17 +0100 | [diff] [blame] | 301 | |
Alexander Couzens | d24973d | 2018-09-04 16:10:14 +0200 | [diff] [blame] | 302 | template GSUP_PDU tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC( |
| 303 | template hexstring imsi, |
| 304 | template octetstring auts, |
| 305 | template octetstring rand) := |
| 306 | tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { |
| 307 | tr_GSUP_IE_IMSI(imsi), |
| 308 | tr_GSUP_IE_AUTS(auts), |
| 309 | tr_GSUP_IE_RAND(rand), |
| 310 | * |
| 311 | }); |
| 312 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 313 | template (value) GSUP_PDU ts_GSUP_SAI_RES(hexstring imsi, GSUP_IE auth_tuple) := |
| 314 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, { |
| 315 | valueof(ts_GSUP_IE_IMSI(imsi)), auth_tuple }); |
| 316 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 317 | template GSUP_PDU tr_GSUP_SAI_ERR(template hexstring imsi, template integer cause) := |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 318 | tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, { |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 319 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 320 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 321 | template (value) GSUP_PDU ts_GSUP_SAI_ERR(hexstring imsi, integer cause) := |
| 322 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, { |
| 323 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) }); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 324 | |
| 325 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 326 | template GSUP_PDU tr_GSUP_SAI_RES(template hexstring imsi) := |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 327 | tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, { |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 328 | tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE(OSMO_GSUP_AUTH_TUPLE_IE), * }); |
| 329 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 330 | template (value) GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi) := |
| 331 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, { |
| 332 | valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 333 | |
Harald Welte | dfe94dd | 2018-01-21 13:55:22 +0100 | [diff] [blame] | 334 | template GSUP_PDU tr_GSUP_UL_REQ(template hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 335 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, imsi); |
Harald Welte | dfe94dd | 2018-01-21 13:55:22 +0100 | [diff] [blame] | 336 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 337 | template (value) GSUP_PDU ts_GSUP_UL_RES(hexstring imsi) := |
Harald Welte | dfe94dd | 2018-01-21 13:55:22 +0100 | [diff] [blame] | 338 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, { valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 339 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 340 | template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi) := |
| 341 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, imsi); |
| 342 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 343 | template (value) GSUP_PDU ts_GSUP_UL_ERR(hexstring imsi, integer cause) := |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 344 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, { |
| 345 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) }); |
| 346 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 347 | template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?) := |
| 348 | tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, { |
| 349 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 350 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 351 | template (value) GSUP_PDU ts_GSUP_ISD_REQ(hexstring imsi, hexstring msisdn) := |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 352 | ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, { |
| 353 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_MSISDN(msisdn)) }); |
| 354 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 355 | template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?) := |
| 356 | tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, { |
Harald Welte | 8f6ac16 | 2018-03-01 22:43:28 +0100 | [diff] [blame] | 357 | tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_MSISDN(msisdn), * }); |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 358 | |
| 359 | template (value) GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi) := |
| 360 | ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, { |
| 361 | valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 362 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 363 | template GSUP_PDU tr_GSUP_ISD_RES(template hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 364 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, imsi); |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 365 | |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 366 | template GSUP_PDU tr_GSUP_AUTH_FAIL_IND(hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 367 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT, imsi); |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 368 | |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 369 | template (value) GSUP_PDU ts_GSUP_CL_REQ(hexstring imsi, GSUP_CancelType ctype) := |
| 370 | ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST, { |
| 371 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CancelType(ctype)) }); |
| 372 | |
| 373 | template GSUP_PDU tr_GSUP_CL_RES(template hexstring imsi) := |
| 374 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, imsi); |
| 375 | |
| 376 | template GSUP_PDU tr_GSUP_CL_ERR(template hexstring imsi, template integer cause := ?) := |
| 377 | tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR, { |
Alexander Couzens | 4cfff3a | 2018-05-22 17:08:36 +0200 | [diff] [blame] | 378 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause), * }); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 379 | |
Harald Welte | 958f8b4 | 2018-03-01 23:40:17 +0100 | [diff] [blame] | 380 | template (value) GSUP_PDU ts_GSUP_PURGE_MS_REQ(hexstring imsi, GSUP_CnDomain dom) := |
| 381 | ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, { |
| 382 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) }); |
| 383 | |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 384 | template GSUP_PDU tr_GSUP_PURGE_MS_REQ(template hexstring imsi, template GSUP_CnDomain dom := ?) := |
| 385 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, { |
| 386 | tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_CnDomain(dom) }); |
| 387 | |
| 388 | template (value) GSUP_PDU ts_GSUP_PURGE_MS_RES(hexstring imsi) := |
| 389 | ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, { |
| 390 | valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 391 | |
Harald Welte | 958f8b4 | 2018-03-01 23:40:17 +0100 | [diff] [blame] | 392 | template GSUP_PDU tr_GSUP_PURGE_MS_RES(template hexstring imsi) := |
| 393 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, { |
| 394 | tr_GSUP_IE_IMSI(imsi), * }); |
| 395 | |
| 396 | template GSUP_PDU tr_GSUP_PURGE_MS_ERR(template hexstring imsi, template integer cause) := |
| 397 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_ERROR, { |
| 398 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 399 | |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 400 | |
| 401 | template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := { |
| 402 | tag := OSMO_GSUP_CANCEL_TYPE_IE, |
| 403 | len := 0, /* overwritten */ |
| 404 | val := { |
| 405 | cancel_type := ctype |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) := |
| 410 | tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype}); |
| 411 | |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 412 | template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) := |
| 413 | tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain}); |
| 414 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 415 | template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := { |
| 416 | tag := iei, |
| 417 | len := ?, |
| 418 | val := val |
| 419 | } |
| 420 | |
| 421 | template (value) GSUP_IE ts_GSUP_IE_IMSI(hexstring imsi) := { |
| 422 | tag := OSMO_GSUP_IMSI_IE, |
| 423 | len := 0, /* overwritten */ |
| 424 | val := { |
| 425 | imsi := imsi |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | template GSUP_IE tr_GSUP_IE_IMSI(template hexstring imsi) := { |
| 430 | tag := OSMO_GSUP_IMSI_IE, |
| 431 | len := ?, |
| 432 | val := { |
| 433 | imsi := imsi |
| 434 | } |
| 435 | } |
| 436 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 437 | template (value) GSUP_IE ts_GSUP_IE_MSISDN(hexstring msisdn) := { |
| 438 | tag := OSMO_GSUP_MSISDN_IE, |
| 439 | len := 0, /* overwritten */ |
| 440 | val := { |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 441 | msisdn := ts_GSUP_MSISDN(msisdn) |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 442 | } |
| 443 | } |
| 444 | |
| 445 | template GSUP_IE tr_GSUP_IE_MSISDN(template hexstring msisdn) := { |
| 446 | tag := OSMO_GSUP_MSISDN_IE, |
| 447 | len := ?, |
| 448 | val := { |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 449 | msisdn := tr_GSUP_MSISDN(msisdn) |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 450 | } |
| 451 | } |
| 452 | |
| 453 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 454 | template (value) GSUP_IE ts_GSUP_IE_Cause(integer cause) := { |
| 455 | tag := OSMO_GSUP_CAUSE_IE, |
| 456 | len := 0, /* overwritten */ |
| 457 | val := { |
| 458 | cause := cause |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | template GSUP_IE tr_GSUP_IE_Cause(template integer cause) := { |
| 463 | tag := OSMO_GSUP_CAUSE_IE, |
| 464 | len := ?, |
| 465 | val := { |
| 466 | cause := cause |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | template (value) GSUP_IE ts_GSUP_IE_AUTS(octetstring auts) := { |
| 471 | tag := OSMO_GSUP_AUTS_IE, |
| 472 | len := 0, /* overwritten */ |
| 473 | val := { |
| 474 | auts := auts |
| 475 | } |
| 476 | } |
| 477 | |
Alexander Couzens | d24973d | 2018-09-04 16:10:14 +0200 | [diff] [blame] | 478 | template GSUP_IE tr_GSUP_IE_AUTS(template octetstring auts) := { |
| 479 | tag := OSMO_GSUP_AUTS_IE, |
| 480 | len := ?, |
| 481 | val := { |
| 482 | auts := auts |
| 483 | } |
| 484 | } |
| 485 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 486 | template (value) GSUP_IE ts_GSUP_IE_RAND(octetstring rand) := { |
| 487 | tag := OSMO_GSUP_RAND_IE, |
| 488 | len := 0, /* overwritten */ |
| 489 | val := { |
| 490 | rand := rand |
| 491 | } |
| 492 | } |
| 493 | |
Alexander Couzens | d24973d | 2018-09-04 16:10:14 +0200 | [diff] [blame] | 494 | template GSUP_IE tr_GSUP_IE_RAND(template octetstring rand) := { |
| 495 | tag := OSMO_GSUP_RAND_IE, |
| 496 | len := ?, |
| 497 | val := { |
| 498 | rand := rand |
| 499 | } |
| 500 | } |
| 501 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 502 | template (value) GSUP_IE ts_GSUP_IE_SRES(octetstring sres) := { |
| 503 | tag := OSMO_GSUP_SRES_IE, |
| 504 | len := 0, /* overwritten */ |
| 505 | val := { |
| 506 | sres := sres |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | template (value) GSUP_IE ts_GSUP_IE_Kc(octetstring kc) := { |
| 511 | tag := OSMO_GSUP_KC_IE, |
| 512 | len := 0, /* overwritten */ |
| 513 | val := { |
| 514 | kc := kc |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | template (value) GSUP_IE ts_GSUP_IE_IK(octetstring ik) := { |
| 519 | tag := OSMO_GSUP_IK_IE, |
| 520 | len := 0, /* overwritten */ |
| 521 | val := { |
| 522 | ik := ik |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | template (value) GSUP_IE ts_GSUP_IE_CK(octetstring ck) := { |
| 527 | tag := OSMO_GSUP_CK_IE, |
| 528 | len := 0, /* overwritten */ |
| 529 | val := { |
| 530 | ck := ck |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | template (value) GSUP_IE ts_GSUP_IE_AUTN(octetstring autn) := { |
| 535 | tag := OSMO_GSUP_AUTN_IE, |
| 536 | len := 0, /* overwritten */ |
| 537 | val := { |
| 538 | autn := autn |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | template (value) GSUP_IE ts_GSUP_IE_RES(octetstring res) := { |
| 543 | tag := OSMO_GSUP_RES_IE, |
| 544 | len := 0, /* overwritten */ |
| 545 | val := { |
| 546 | res := res |
| 547 | } |
| 548 | } |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 549 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 550 | template (value) GSUP_IE ts_GSUP_IE_APN(octetstring apn) := { |
| 551 | tag := OSMO_GSUP_ACCESS_POINT_NAME_IE, |
| 552 | len := 0, /* overwritten */ |
| 553 | val := { |
| 554 | apn := apn |
| 555 | } |
| 556 | } |
| 557 | |
Harald Welte | 958f8b4 | 2018-03-01 23:40:17 +0100 | [diff] [blame] | 558 | template (value) GSUP_IE ts_GSUP_IE_CnDomain(GSUP_CnDomain dom) := { |
| 559 | tag := OSMO_GSUP_CN_DOMAIN_IE, |
| 560 | len := 0, /* overwritten */ |
| 561 | val := { |
| 562 | cn_domain := dom |
| 563 | } |
| 564 | } |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 565 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 566 | template (value) GSUP_IE ts_GSUP_IE_SessionId(OCT4 sid) := { |
| 567 | tag := OSMO_GSUP_SESSION_ID_IE, |
| 568 | len := 0, /* overwritten */ |
| 569 | val := { |
| 570 | session_id := sid |
| 571 | } |
| 572 | } |
| 573 | template GSUP_IE tr_GSUP_IE_SessionId(template OCT4 sid) := { |
| 574 | tag := OSMO_GSUP_SESSION_ID_IE, |
| 575 | len := ?, |
| 576 | val := { |
| 577 | session_id := sid |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | template (value) GSUP_IE ts_GSUP_IE_SessionState(GSUP_SessionState state) := { |
| 582 | tag := OSMO_GSUP_SESSION_STATE_IE, |
| 583 | len := 0, /* overwritten */ |
| 584 | val := { |
| 585 | session_state := state |
| 586 | } |
| 587 | } |
| 588 | template GSUP_IE tr_GSUP_IE_SessionState(template GSUP_SessionState state) := { |
| 589 | tag := OSMO_GSUP_SESSION_STATE_IE, |
| 590 | len := ?, |
| 591 | val := { |
| 592 | session_state := state |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := { |
| 597 | tag := OSMO_GSUP_SS_INFO_IE, |
| 598 | len := 0, /* overwritten */ |
| 599 | val := { |
| 600 | ss_info := ss |
| 601 | } |
| 602 | } |
| 603 | template GSUP_IE tr_GSUP_IE_SSInfo(template octetstring ss) := { |
| 604 | tag := OSMO_GSUP_SS_INFO_IE, |
| 605 | len := ?, |
| 606 | val := { |
| 607 | ss_info := ss |
| 608 | } |
| 609 | } |
| 610 | |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 611 | private function f_gen_ts_ss_ies( |
| 612 | hexstring imsi, |
| 613 | OCT4 sid, |
| 614 | GSUP_SessionState state, |
| 615 | template (omit) octetstring ss |
| 616 | ) return GSUP_IEs { |
| 617 | /* Mandatory IEs */ |
| 618 | var GSUP_IEs ies := { |
| 619 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 620 | valueof(ts_GSUP_IE_SessionId(sid)), |
| 621 | valueof(ts_GSUP_IE_SessionState(state)) |
| 622 | }; |
| 623 | |
| 624 | /* Optional SS payload */ |
| 625 | if (isvalue(ss)) { |
| 626 | ies[3] := valueof(ts_GSUP_IE_SSInfo(valueof(ss))); |
| 627 | } |
| 628 | |
| 629 | return ies; |
| 630 | } |
| 631 | private function f_gen_tr_ss_ies( |
| 632 | template hexstring imsi, |
| 633 | template OCT4 sid := ?, |
| 634 | template GSUP_SessionState state := ?, |
| 635 | template octetstring ss := ? |
| 636 | ) return template GSUP_IEs { |
| 637 | /* Mandatory IEs */ |
| 638 | var template GSUP_IEs ies := { |
| 639 | tr_GSUP_IE_IMSI(imsi), |
| 640 | tr_GSUP_IE_SessionId(sid), |
| 641 | tr_GSUP_IE_SessionState(state) |
| 642 | }; |
| 643 | |
| 644 | /* Optional SS payload */ |
| 645 | if (istemplatekind(ss, "*")) { |
| 646 | ies[3] := *; |
| 647 | } else if (not istemplatekind(ss, "omit")) { |
| 648 | ies[3] := tr_GSUP_IE_SSInfo(ss); |
| 649 | } |
| 650 | |
| 651 | return ies; |
| 652 | } |
| 653 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 654 | template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ( |
| 655 | hexstring imsi, |
| 656 | OCT4 sid, |
| 657 | GSUP_SessionState state, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 658 | template (omit) octetstring ss := omit |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 659 | ) := ts_GSUP( |
| 660 | OSMO_GSUP_MSGT_PROC_SS_REQUEST, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 661 | f_gen_ts_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 662 | ); |
| 663 | template GSUP_PDU tr_GSUP_PROC_SS_REQ( |
| 664 | template hexstring imsi, |
| 665 | template OCT4 sid := ?, |
| 666 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 667 | template octetstring ss := * |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 668 | ) := tr_GSUP( |
| 669 | OSMO_GSUP_MSGT_PROC_SS_REQUEST, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 670 | f_gen_tr_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 671 | ); |
| 672 | |
| 673 | template (value) GSUP_PDU ts_GSUP_PROC_SS_RES( |
| 674 | hexstring imsi, |
| 675 | OCT4 sid, |
| 676 | GSUP_SessionState state, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 677 | template (omit) octetstring ss := omit |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 678 | ) := ts_GSUP( |
| 679 | OSMO_GSUP_MSGT_PROC_SS_RESULT, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 680 | f_gen_ts_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 681 | ); |
| 682 | template GSUP_PDU tr_GSUP_PROC_SS_RES( |
| 683 | template hexstring imsi, |
| 684 | template OCT4 sid := ?, |
| 685 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 686 | template octetstring ss := * |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 687 | ) := tr_GSUP( |
| 688 | OSMO_GSUP_MSGT_PROC_SS_RESULT, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 689 | f_gen_tr_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 690 | ); |
| 691 | |
| 692 | template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR( |
| 693 | hexstring imsi, |
| 694 | OCT4 sid, |
Vadim Yanitskiy | 21c4233 | 2018-11-29 00:18:05 +0700 | [diff] [blame] | 695 | GSUP_SessionState state, |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 696 | integer cause |
| 697 | ) := ts_GSUP( |
| 698 | OSMO_GSUP_MSGT_PROC_SS_ERROR, |
| 699 | { |
| 700 | valueof(ts_GSUP_IE_IMSI(imsi)), |
Vadim Yanitskiy | 772a845 | 2018-11-29 02:17:37 +0700 | [diff] [blame] | 701 | valueof(ts_GSUP_IE_Cause(cause)), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 702 | valueof(ts_GSUP_IE_SessionId(sid)), |
Vadim Yanitskiy | 772a845 | 2018-11-29 02:17:37 +0700 | [diff] [blame] | 703 | valueof(ts_GSUP_IE_SessionState(state)) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 704 | } |
| 705 | ); |
| 706 | template GSUP_PDU tr_GSUP_PROC_SS_ERR( |
| 707 | template hexstring imsi, |
| 708 | template OCT4 sid := ?, |
Vadim Yanitskiy | 21c4233 | 2018-11-29 00:18:05 +0700 | [diff] [blame] | 709 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 710 | template integer cause := ? |
| 711 | ) := tr_GSUP( |
| 712 | OSMO_GSUP_MSGT_PROC_SS_ERROR, |
| 713 | { |
| 714 | tr_GSUP_IE_IMSI(imsi), |
Vadim Yanitskiy | 772a845 | 2018-11-29 02:17:37 +0700 | [diff] [blame] | 715 | tr_GSUP_IE_Cause(cause), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 716 | tr_GSUP_IE_SessionId(sid), |
Vadim Yanitskiy | 772a845 | 2018-11-29 02:17:37 +0700 | [diff] [blame] | 717 | tr_GSUP_IE_SessionState(state) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 718 | } |
| 719 | ); |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 720 | |
Harald Welte | f9d449e | 2018-06-24 22:27:47 +0200 | [diff] [blame] | 721 | function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) return boolean { |
| 722 | for (var integer i := 0; i < sizeof(msg.ies); i := i+1) { |
| 723 | if (msg.ies[i].tag == iei) { |
| 724 | ret := msg.ies[i].val; |
| 725 | return true; |
| 726 | } |
| 727 | } |
| 728 | return false; |
| 729 | } |
| 730 | |
| 731 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 732 | } with { encode "RAW"; variant "FIELDORDER(msb)" } |