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), |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 46 | OSMO_GSUP_SS_INFO_IE ('35'O), |
| 47 | |
| 48 | /* SM related IEs (see 3GPP TS 29.002, section 7.6.8) */ |
| 49 | OSMO_GSUP_SM_RP_MR_IE ('40'O), |
| 50 | OSMO_GSUP_SM_RP_DA_IE ('41'O), |
| 51 | OSMO_GSUP_SM_RP_OA_IE ('42'O), |
| 52 | OSMO_GSUP_SM_RP_UI_IE ('43'O), |
| 53 | OSMO_GSUP_SM_RP_CAUSE_IE ('44'O), |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 54 | OSMO_GSUP_SM_RP_MMS_IE ('45'O), |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 55 | OSMO_GSUP_SM_ALERT_RSN_IE ('46'O), |
| 56 | |
| 57 | OSMO_GSUP_IMEI_IE ('50'O), |
| 58 | OSMO_GSUP_IMEI_RESULT_IE ('51'O) |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 59 | } with { variant "FIELDLENGTH(8)" }; |
| 60 | |
| 61 | type enumerated GSUP_MessageType { |
| 62 | OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST ('00000100'B), |
| 63 | OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR ('00000101'B), |
| 64 | OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT ('00000110'B), |
| 65 | |
| 66 | OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST ('00001000'B), |
| 67 | OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR ('00001001'B), |
| 68 | OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT ('00001010'B), |
| 69 | |
| 70 | OSMO_GSUP_MSGT_AUTH_FAIL_REPORT ('00001011'B), |
| 71 | |
| 72 | OSMO_GSUP_MSGT_PURGE_MS_REQUEST ('00001100'B), |
| 73 | OSMO_GSUP_MSGT_PURGE_MS_ERROR ('00001101'B), |
| 74 | OSMO_GSUP_MSGT_PURGE_MS_RESULT ('00001110'B), |
| 75 | |
| 76 | OSMO_GSUP_MSGT_INSERT_DATA_REQUEST ('00010000'B), |
| 77 | OSMO_GSUP_MSGT_INSERT_DATA_ERROR ('00010001'B), |
| 78 | OSMO_GSUP_MSGT_INSERT_DATA_RESULT ('00010010'B), |
| 79 | |
| 80 | OSMO_GSUP_MSGT_DELETE_DATA_REQUEST ('00010100'B), |
| 81 | OSMO_GSUP_MSGT_DELETE_DATA_ERROR ('00010101'B), |
| 82 | OSMO_GSUP_MSGT_DELETE_DATA_RESULT ('00010110'B), |
| 83 | |
| 84 | OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST ('00011100'B), |
| 85 | OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR ('00011101'B), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 86 | OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT ('00011110'B), |
| 87 | |
| 88 | OSMO_GSUP_MSGT_PROC_SS_REQUEST ('00100000'B), |
| 89 | OSMO_GSUP_MSGT_PROC_SS_ERROR ('00100001'B), |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 90 | OSMO_GSUP_MSGT_PROC_SS_RESULT ('00100010'B), |
| 91 | |
| 92 | OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST ('00100100'B), |
| 93 | OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR ('00100101'B), |
| 94 | OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT ('00100110'B), |
| 95 | |
| 96 | OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST ('00101000'B), |
| 97 | OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR ('00101001'B), |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 98 | OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT ('00101010'B), |
| 99 | |
| 100 | OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST ('00101100'B), |
| 101 | OSMO_GSUP_MSGT_READY_FOR_SM_ERROR ('00101101'B), |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 102 | OSMO_GSUP_MSGT_READY_FOR_SM_RESULT ('00101110'B), |
| 103 | |
| 104 | OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST ('00110000'B), |
| 105 | OSMO_GSUP_MSGT_CHECK_IMEI_ERROR ('00110001'B), |
| 106 | OSMO_GSUP_MSGT_CHECK_IMEI_RESULT ('00110010'B) |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 107 | } with { variant "FIELDLENGTH(8)" }; |
| 108 | |
| 109 | type enumerated GSUP_CancelType { |
Alexander Couzens | 4786b3f | 2018-09-16 03:33:30 +0200 | [diff] [blame] | 110 | OSMO_GSUP_CANCEL_TYPE_UPDATE (0), |
| 111 | OSMO_GSUP_CANCEL_TYPE_WITHDRAW (1) |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 112 | } with { variant "FIELDLENGTH(8)" }; |
| 113 | |
| 114 | type enumerated GSUP_CnDomain { |
| 115 | OSMO_GSUP_CN_DOMAIN_PS (1), |
| 116 | OSMO_GSUP_CN_DOMAIN_CS (2) |
| 117 | } with { variant "FIELDLENGTH(8)" }; |
| 118 | |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 119 | type enumerated GSUP_IMEIResult { |
| 120 | OSMO_GSUP_IMEI_RESULT_ACK (0), |
| 121 | OSMO_GSUP_IMEI_RESULT_NACK (1) |
| 122 | } with { variant "FIELDLENGTH(8)" }; |
| 123 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 124 | type enumerated GSUP_SessionState { |
| 125 | OSMO_GSUP_SESSION_STATE_NONE (0), |
| 126 | OSMO_GSUP_SESSION_STATE_BEGIN (1), |
| 127 | OSMO_GSUP_SESSION_STATE_CONTINUE (2), |
| 128 | OSMO_GSUP_SESSION_STATE_END (3) |
| 129 | } with { variant "FIELDLENGTH(8)" }; |
| 130 | |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 131 | type record GSUP_MSISDN { |
| 132 | uint8_t len, |
| 133 | hexstring digits optional |
| 134 | } with { variant (len) "LENGTHTO(digits)" }; |
| 135 | |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 136 | type record GSUP_IMEI { |
| 137 | uint8_t len, |
| 138 | hexstring digits optional |
| 139 | } with { variant (len) "LENGTHTO(digits)" }; |
| 140 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 141 | type record GSUP_IE { |
| 142 | GSUP_IEI tag, |
| 143 | uint8_t len, |
| 144 | GSUP_IeValue val |
| 145 | } with { variant (len) "LENGTHTO(val)" |
| 146 | variant (val) "CROSSTAG(imsi, tag = OSMO_GSUP_IMSI_IE; |
| 147 | cause, tag = OSMO_GSUP_CAUSE_IE; |
| 148 | cancel_type, tag = OSMO_GSUP_CANCEL_TYPE_IE; |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 149 | auth_tuple, tag = OSMO_GSUP_AUTH_TUPLE_IE; |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 150 | auts, tag = OSMO_GSUP_AUTS_IE; |
| 151 | rand, tag = OSMO_GSUP_RAND_IE; |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 152 | sres, tag = OSMO_GSUP_SRES_IE; |
| 153 | kc, tag = OSMO_GSUP_KC_IE; |
| 154 | ik, tag = OSMO_GSUP_IK_IE; |
| 155 | ck, tag = OSMO_GSUP_CK_IE; |
| 156 | autn, tag = OSMO_GSUP_AUTN_IE; |
| 157 | res, tag = OSMO_GSUP_RES_IE; |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 158 | msisdn, tag = OSMO_GSUP_MSISDN_IE; |
| 159 | hlr_number, tag = OSMO_GSUP_HLR_NUMBER_IE; |
| 160 | cn_domain, tag = OSMO_GSUP_CN_DOMAIN_IE; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 161 | pdp_info, tag = OSMO_GSUP_PDP_INFO_IE; |
| 162 | apn, tag = OSMO_GSUP_ACCESS_POINT_NAME_IE; |
| 163 | pdp_qos, tag = OSMO_GSUP_PDP_QOS_IE; |
| 164 | pdp_type, tag = OSMO_GSUP_PDP_TYPE_IE; |
| 165 | charg_char, tag = OSMO_GSUP_CHARG_CHAR_IE; |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 166 | session_state, tag = OSMO_GSUP_SESSION_STATE_IE; |
| 167 | session_id, tag = OSMO_GSUP_SESSION_ID_IE; |
| 168 | ss_info, tag = OSMO_GSUP_SS_INFO_IE; |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 169 | sm_rp_mr, tag = OSMO_GSUP_SM_RP_MR_IE; |
| 170 | sm_rp_da, tag = OSMO_GSUP_SM_RP_DA_IE; |
| 171 | sm_rp_oa, tag = OSMO_GSUP_SM_RP_OA_IE; |
| 172 | sm_rp_ui, tag = OSMO_GSUP_SM_RP_UI_IE; |
| 173 | sm_rp_cause, tag = OSMO_GSUP_SM_RP_CAUSE_IE; |
| 174 | sm_rp_mms, tag = OSMO_GSUP_SM_RP_MMS_IE; |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 175 | sm_alert_rsn, tag = OSMO_GSUP_SM_ALERT_RSN_IE; |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 176 | imei, tag = OSMO_GSUP_IMEI_IE; |
| 177 | imei_result, tag = OSMO_GSUP_IMEI_RESULT_IE; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 178 | )" |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 179 | }; |
| 180 | |
| 181 | type record of GSUP_IE GSUP_IEs; |
| 182 | |
| 183 | type union GSUP_IeValue { |
| 184 | hexstring imsi, |
| 185 | integer cause, |
| 186 | GSUP_CancelType cancel_type, |
| 187 | //boolean pdp_info_compl, |
| 188 | //boolean freeze_ptmsi, |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 189 | GSUP_IEs auth_tuple, |
| 190 | octetstring auts, |
| 191 | octetstring rand, |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 192 | octetstring sres, |
| 193 | octetstring kc, |
| 194 | octetstring ik, |
| 195 | octetstring ck, |
| 196 | octetstring autn, |
| 197 | octetstring res, |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 198 | GSUP_MSISDN msisdn, |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 199 | octetstring hlr_number, |
| 200 | GSUP_CnDomain cn_domain, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 201 | /* PDP context + nested IEs */ |
| 202 | GSUP_IEs pdp_info, |
| 203 | octetstring apn, |
| 204 | octetstring pdp_qos, |
| 205 | OCT2 pdp_type, |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 206 | octetstring charg_char, |
| 207 | /* Session information */ |
| 208 | GSUP_SessionState session_state, |
| 209 | OCT4 session_id, |
| 210 | /* Supplementary Services */ |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 211 | octetstring ss_info, |
| 212 | /* Short Message Service */ |
| 213 | OCT1 sm_rp_mr, |
| 214 | GSUP_SM_RP_DA sm_rp_da, |
| 215 | GSUP_SM_RP_OA sm_rp_oa, |
| 216 | octetstring sm_rp_ui, |
| 217 | OCT1 sm_rp_cause, |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 218 | OCT1 sm_rp_mms, |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 219 | GSUP_SM_ALERT_RSN_Type sm_alert_rsn, |
| 220 | |
| 221 | GSUP_IMEI imei, |
| 222 | GSUP_IMEIResult imei_result |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 223 | }; |
| 224 | |
| 225 | type record GSUP_PDU { |
| 226 | GSUP_MessageType msg_type, |
| 227 | GSUP_IEs ies |
| 228 | }; |
| 229 | |
| 230 | external function enc_GSUP_PDU(in GSUP_PDU msg) return octetstring |
| 231 | with { extension "prototype(convert) encode(RAW)" }; |
| 232 | |
| 233 | external function dec_GSUP_PDU(in octetstring msg) return GSUP_PDU |
| 234 | with { extension "prototype(convert) decode(RAW)" }; |
| 235 | |
Harald Welte | 2f562b1 | 2018-01-24 20:52:38 +0100 | [diff] [blame] | 236 | function f_gsup_postprocess_decoded(inout GSUP_PDU gsup) { |
| 237 | if (gsup.ies[0].tag == OSMO_GSUP_IMSI_IE) { |
| 238 | /* if last digit is 'F', then there's an odd number of digits and we must strip the F */ |
| 239 | var integer num_digits := lengthof(gsup.ies[0].val.imsi); |
| 240 | if (gsup.ies[0].val.imsi[num_digits-1] == 'F'H) { |
| 241 | gsup.ies[0].val.imsi := substr(gsup.ies[0].val.imsi, 0, num_digits-1); |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | function f_gsup_preprocess_encoded(inout GSUP_PDU gsup) { |
| 247 | if (ischosen(gsup.ies[0].val.imsi)) { |
| 248 | /* if number of digits is odd, add a 'F' as padding at the end */ |
| 249 | var integer num_digits := lengthof(gsup.ies[0].val.imsi); |
| 250 | if (num_digits rem 2 == 1) { |
| 251 | gsup.ies[0].val.imsi := gsup.ies[0].val.imsi & 'F'H; |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 256 | template (value) GSUP_MSISDN ts_GSUP_MSISDN(hexstring digits, |
| 257 | BIT3 ton := '000'B, |
| 258 | BIT4 npi := '0000'B) := { |
| 259 | len := 0, /* overwritten */ |
| 260 | /* numberingPlanIdentification := npi, |
| 261 | typeOfNumber := ton, |
| 262 | ext1 := '0'B, */ |
| 263 | digits := digits |
| 264 | } |
| 265 | |
| 266 | template GSUP_MSISDN tr_GSUP_MSISDN(template hexstring digits, |
| 267 | template BIT3 ton := ?, |
| 268 | template BIT4 npi := ?) := { |
| 269 | len := ?, |
| 270 | /* numberingPlanIdentification := npi, |
| 271 | typeOfNumber := ton, |
| 272 | ext1 := '0'B, */ |
| 273 | digits := digits |
| 274 | } |
| 275 | |
| 276 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 277 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 278 | template GSUP_IE ts_GSUP_IE_AuthTuple2G(octetstring rand, octetstring sres, |
| 279 | octetstring kc) := { |
| 280 | tag := OSMO_GSUP_AUTH_TUPLE_IE, |
| 281 | len := 0, /* overwritten */ |
| 282 | val := { |
| 283 | auth_tuple := { |
| 284 | valueof(ts_GSUP_IE_RAND(rand)), |
| 285 | valueof(ts_GSUP_IE_SRES(sres)), |
| 286 | valueof(ts_GSUP_IE_Kc(kc)) |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | template GSUP_IE ts_GSUP_IE_AuthTuple2G3G(octetstring rand, octetstring sres, |
| 292 | octetstring kc, octetstring ik, |
| 293 | octetstring ck, octetstring autn, |
| 294 | octetstring res) := { |
| 295 | tag := OSMO_GSUP_AUTH_TUPLE_IE, |
| 296 | len := 0, /* overwritten */ |
| 297 | val := { |
| 298 | auth_tuple := { |
| 299 | valueof(ts_GSUP_IE_RAND(rand)), |
| 300 | valueof(ts_GSUP_IE_SRES(sres)), |
| 301 | valueof(ts_GSUP_IE_Kc(kc)), |
| 302 | valueof(ts_GSUP_IE_IK(ik)), |
| 303 | valueof(ts_GSUP_IE_CK(ck)), |
| 304 | valueof(ts_GSUP_IE_AUTN(autn)), |
| 305 | valueof(ts_GSUP_IE_RES(res)) |
| 306 | } |
| 307 | } |
| 308 | } |
| 309 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 310 | template GSUP_IE ts_GSUP_IE_PdpInfo(octetstring apn, octetstring pdp_type, octetstring pdp_qos) := { |
| 311 | tag := OSMO_GSUP_PDP_INFO_IE, |
| 312 | len := 0, /* overwritten */ |
| 313 | val := { |
| 314 | pdp_info := { |
| 315 | valueof(ts_GSUP_IE_APN(apn)), |
| 316 | valueof(ts_GSUP_IE_PDP_TYPE(pdp_type)), |
| 317 | valueof(ts_GSUP_IE_PDP_QOS(pdp_qos)) |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | template (value) GSUP_IE ts_GSUP_IE_PDP_TYPE(OCT2 pdp_type) := { |
| 323 | tag := OSMO_GSUP_PDP_TYPE_IE, |
| 324 | len := 0, |
| 325 | val := { |
| 326 | pdp_type := pdp_type |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | template (value) GSUP_IE ts_GSUP_IE_PDP_QOS(octetstring pdp_qos) := { |
| 331 | tag := OSMO_GSUP_PDP_QOS_IE, |
| 332 | len := 0, |
| 333 | val := { |
| 334 | pdp_qos := pdp_qos |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 339 | template GSUP_PDU tr_GSUP(template GSUP_MessageType msgt := ?, template GSUP_IEs ies := *) := { |
| 340 | msg_type := msgt, |
| 341 | ies := ies |
| 342 | } |
| 343 | |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 344 | template GSUP_PDU tr_GSUP_IMSI(template GSUP_MessageType msgt := ?, template hexstring imsi) := { |
| 345 | msg_type := msgt, |
| 346 | ies := { tr_GSUP_IE_IMSI(imsi), * } |
| 347 | } |
| 348 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 349 | template GSUP_PDU ts_GSUP(GSUP_MessageType msgt, GSUP_IEs ies := {}) := { |
| 350 | msg_type := msgt, |
| 351 | ies := ies |
| 352 | } |
| 353 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 354 | template (value) GSUP_PDU ts_GSUP_SAI_REQ(hexstring imsi) := |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 355 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 356 | |
Harald Welte | ef9fa87 | 2018-01-22 03:00:17 +0100 | [diff] [blame] | 357 | template GSUP_PDU tr_GSUP_SAI_REQ(template hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 358 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, imsi); |
Harald Welte | ef9fa87 | 2018-01-22 03:00:17 +0100 | [diff] [blame] | 359 | |
Alexander Couzens | d24973d | 2018-09-04 16:10:14 +0200 | [diff] [blame] | 360 | template GSUP_PDU tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC( |
| 361 | template hexstring imsi, |
| 362 | template octetstring auts, |
| 363 | template octetstring rand) := |
| 364 | tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST, { |
| 365 | tr_GSUP_IE_IMSI(imsi), |
| 366 | tr_GSUP_IE_AUTS(auts), |
| 367 | tr_GSUP_IE_RAND(rand), |
| 368 | * |
| 369 | }); |
| 370 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 371 | template (value) GSUP_PDU ts_GSUP_SAI_RES(hexstring imsi, GSUP_IE auth_tuple) := |
| 372 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, { |
| 373 | valueof(ts_GSUP_IE_IMSI(imsi)), auth_tuple }); |
| 374 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 375 | 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] | 376 | tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, { |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 377 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 378 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 379 | template (value) GSUP_PDU ts_GSUP_SAI_ERR(hexstring imsi, integer cause) := |
| 380 | ts_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR, { |
| 381 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) }); |
Harald Welte | 071ed73 | 2018-01-23 19:53:52 +0100 | [diff] [blame] | 382 | |
| 383 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 384 | template GSUP_PDU tr_GSUP_SAI_RES(template hexstring imsi) := |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 385 | tr_GSUP(OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT, { |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 386 | tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE(OSMO_GSUP_AUTH_TUPLE_IE), * }); |
| 387 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 388 | template (value) GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi) := |
| 389 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, { |
| 390 | valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 391 | |
Harald Welte | dfe94dd | 2018-01-21 13:55:22 +0100 | [diff] [blame] | 392 | template GSUP_PDU tr_GSUP_UL_REQ(template hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 393 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, imsi); |
Harald Welte | dfe94dd | 2018-01-21 13:55:22 +0100 | [diff] [blame] | 394 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 395 | template (value) GSUP_PDU ts_GSUP_UL_RES(hexstring imsi) := |
Harald Welte | dfe94dd | 2018-01-21 13:55:22 +0100 | [diff] [blame] | 396 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, { valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 397 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 398 | template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi) := |
| 399 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, imsi); |
| 400 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 401 | template (value) GSUP_PDU ts_GSUP_UL_ERR(hexstring imsi, integer cause) := |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 402 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, { |
| 403 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) }); |
| 404 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 405 | template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?) := |
| 406 | tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, { |
| 407 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 408 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 409 | template (value) GSUP_PDU ts_GSUP_ISD_REQ(hexstring imsi, hexstring msisdn) := |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 410 | ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, { |
| 411 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_MSISDN(msisdn)) }); |
| 412 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 413 | template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?) := |
| 414 | tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, { |
Harald Welte | 8f6ac16 | 2018-03-01 22:43:28 +0100 | [diff] [blame] | 415 | tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_MSISDN(msisdn), * }); |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 416 | |
| 417 | template (value) GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi) := |
| 418 | ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, { |
| 419 | valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 420 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 421 | template GSUP_PDU tr_GSUP_ISD_RES(template hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 422 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, imsi); |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 423 | |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 424 | template GSUP_PDU tr_GSUP_AUTH_FAIL_IND(hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 425 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT, imsi); |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 426 | |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 427 | template (value) GSUP_PDU ts_GSUP_CL_REQ(hexstring imsi, GSUP_CancelType ctype) := |
| 428 | ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST, { |
| 429 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CancelType(ctype)) }); |
| 430 | |
| 431 | template GSUP_PDU tr_GSUP_CL_RES(template hexstring imsi) := |
| 432 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, imsi); |
| 433 | |
| 434 | template GSUP_PDU tr_GSUP_CL_ERR(template hexstring imsi, template integer cause := ?) := |
| 435 | tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR, { |
Alexander Couzens | 4cfff3a | 2018-05-22 17:08:36 +0200 | [diff] [blame] | 436 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause), * }); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 437 | |
Harald Welte | 958f8b4 | 2018-03-01 23:40:17 +0100 | [diff] [blame] | 438 | template (value) GSUP_PDU ts_GSUP_PURGE_MS_REQ(hexstring imsi, GSUP_CnDomain dom) := |
| 439 | ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, { |
| 440 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) }); |
| 441 | |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 442 | template GSUP_PDU tr_GSUP_PURGE_MS_REQ(template hexstring imsi, template GSUP_CnDomain dom := ?) := |
| 443 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, { |
| 444 | tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_CnDomain(dom) }); |
| 445 | |
| 446 | template (value) GSUP_PDU ts_GSUP_PURGE_MS_RES(hexstring imsi) := |
| 447 | ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, { |
| 448 | valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 449 | |
Harald Welte | 958f8b4 | 2018-03-01 23:40:17 +0100 | [diff] [blame] | 450 | template GSUP_PDU tr_GSUP_PURGE_MS_RES(template hexstring imsi) := |
| 451 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, { |
| 452 | tr_GSUP_IE_IMSI(imsi), * }); |
| 453 | |
| 454 | template GSUP_PDU tr_GSUP_PURGE_MS_ERR(template hexstring imsi, template integer cause) := |
| 455 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_ERROR, { |
| 456 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 457 | |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 458 | |
| 459 | template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := { |
| 460 | tag := OSMO_GSUP_CANCEL_TYPE_IE, |
| 461 | len := 0, /* overwritten */ |
| 462 | val := { |
| 463 | cancel_type := ctype |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) := |
| 468 | tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype}); |
| 469 | |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 470 | template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) := |
| 471 | tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain}); |
| 472 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 473 | template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := { |
| 474 | tag := iei, |
| 475 | len := ?, |
| 476 | val := val |
| 477 | } |
| 478 | |
| 479 | template (value) GSUP_IE ts_GSUP_IE_IMSI(hexstring imsi) := { |
| 480 | tag := OSMO_GSUP_IMSI_IE, |
| 481 | len := 0, /* overwritten */ |
| 482 | val := { |
| 483 | imsi := imsi |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | template GSUP_IE tr_GSUP_IE_IMSI(template hexstring imsi) := { |
| 488 | tag := OSMO_GSUP_IMSI_IE, |
| 489 | len := ?, |
| 490 | val := { |
| 491 | imsi := imsi |
| 492 | } |
| 493 | } |
| 494 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 495 | template (value) GSUP_IE ts_GSUP_IE_MSISDN(hexstring msisdn) := { |
| 496 | tag := OSMO_GSUP_MSISDN_IE, |
| 497 | len := 0, /* overwritten */ |
| 498 | val := { |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 499 | msisdn := ts_GSUP_MSISDN(msisdn) |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 500 | } |
| 501 | } |
| 502 | |
| 503 | template GSUP_IE tr_GSUP_IE_MSISDN(template hexstring msisdn) := { |
| 504 | tag := OSMO_GSUP_MSISDN_IE, |
| 505 | len := ?, |
| 506 | val := { |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 507 | msisdn := tr_GSUP_MSISDN(msisdn) |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 508 | } |
| 509 | } |
| 510 | |
| 511 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 512 | template (value) GSUP_IE ts_GSUP_IE_Cause(integer cause) := { |
| 513 | tag := OSMO_GSUP_CAUSE_IE, |
| 514 | len := 0, /* overwritten */ |
| 515 | val := { |
| 516 | cause := cause |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | template GSUP_IE tr_GSUP_IE_Cause(template integer cause) := { |
| 521 | tag := OSMO_GSUP_CAUSE_IE, |
| 522 | len := ?, |
| 523 | val := { |
| 524 | cause := cause |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | template (value) GSUP_IE ts_GSUP_IE_AUTS(octetstring auts) := { |
| 529 | tag := OSMO_GSUP_AUTS_IE, |
| 530 | len := 0, /* overwritten */ |
| 531 | val := { |
| 532 | auts := auts |
| 533 | } |
| 534 | } |
| 535 | |
Alexander Couzens | d24973d | 2018-09-04 16:10:14 +0200 | [diff] [blame] | 536 | template GSUP_IE tr_GSUP_IE_AUTS(template octetstring auts) := { |
| 537 | tag := OSMO_GSUP_AUTS_IE, |
| 538 | len := ?, |
| 539 | val := { |
| 540 | auts := auts |
| 541 | } |
| 542 | } |
| 543 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 544 | template (value) GSUP_IE ts_GSUP_IE_RAND(octetstring rand) := { |
| 545 | tag := OSMO_GSUP_RAND_IE, |
| 546 | len := 0, /* overwritten */ |
| 547 | val := { |
| 548 | rand := rand |
| 549 | } |
| 550 | } |
| 551 | |
Alexander Couzens | d24973d | 2018-09-04 16:10:14 +0200 | [diff] [blame] | 552 | template GSUP_IE tr_GSUP_IE_RAND(template octetstring rand) := { |
| 553 | tag := OSMO_GSUP_RAND_IE, |
| 554 | len := ?, |
| 555 | val := { |
| 556 | rand := rand |
| 557 | } |
| 558 | } |
| 559 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 560 | template (value) GSUP_IE ts_GSUP_IE_SRES(octetstring sres) := { |
| 561 | tag := OSMO_GSUP_SRES_IE, |
| 562 | len := 0, /* overwritten */ |
| 563 | val := { |
| 564 | sres := sres |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | template (value) GSUP_IE ts_GSUP_IE_Kc(octetstring kc) := { |
| 569 | tag := OSMO_GSUP_KC_IE, |
| 570 | len := 0, /* overwritten */ |
| 571 | val := { |
| 572 | kc := kc |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | template (value) GSUP_IE ts_GSUP_IE_IK(octetstring ik) := { |
| 577 | tag := OSMO_GSUP_IK_IE, |
| 578 | len := 0, /* overwritten */ |
| 579 | val := { |
| 580 | ik := ik |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | template (value) GSUP_IE ts_GSUP_IE_CK(octetstring ck) := { |
| 585 | tag := OSMO_GSUP_CK_IE, |
| 586 | len := 0, /* overwritten */ |
| 587 | val := { |
| 588 | ck := ck |
| 589 | } |
| 590 | } |
| 591 | |
| 592 | template (value) GSUP_IE ts_GSUP_IE_AUTN(octetstring autn) := { |
| 593 | tag := OSMO_GSUP_AUTN_IE, |
| 594 | len := 0, /* overwritten */ |
| 595 | val := { |
| 596 | autn := autn |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | template (value) GSUP_IE ts_GSUP_IE_RES(octetstring res) := { |
| 601 | tag := OSMO_GSUP_RES_IE, |
| 602 | len := 0, /* overwritten */ |
| 603 | val := { |
| 604 | res := res |
| 605 | } |
| 606 | } |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 607 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 608 | template (value) GSUP_IE ts_GSUP_IE_APN(octetstring apn) := { |
| 609 | tag := OSMO_GSUP_ACCESS_POINT_NAME_IE, |
| 610 | len := 0, /* overwritten */ |
| 611 | val := { |
| 612 | apn := apn |
| 613 | } |
| 614 | } |
| 615 | |
Harald Welte | 958f8b4 | 2018-03-01 23:40:17 +0100 | [diff] [blame] | 616 | template (value) GSUP_IE ts_GSUP_IE_CnDomain(GSUP_CnDomain dom) := { |
| 617 | tag := OSMO_GSUP_CN_DOMAIN_IE, |
| 618 | len := 0, /* overwritten */ |
| 619 | val := { |
| 620 | cn_domain := dom |
| 621 | } |
| 622 | } |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 623 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 624 | template (value) GSUP_IE ts_GSUP_IE_SessionId(OCT4 sid) := { |
| 625 | tag := OSMO_GSUP_SESSION_ID_IE, |
| 626 | len := 0, /* overwritten */ |
| 627 | val := { |
| 628 | session_id := sid |
| 629 | } |
| 630 | } |
| 631 | template GSUP_IE tr_GSUP_IE_SessionId(template OCT4 sid) := { |
| 632 | tag := OSMO_GSUP_SESSION_ID_IE, |
| 633 | len := ?, |
| 634 | val := { |
| 635 | session_id := sid |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | template (value) GSUP_IE ts_GSUP_IE_SessionState(GSUP_SessionState state) := { |
| 640 | tag := OSMO_GSUP_SESSION_STATE_IE, |
| 641 | len := 0, /* overwritten */ |
| 642 | val := { |
| 643 | session_state := state |
| 644 | } |
| 645 | } |
| 646 | template GSUP_IE tr_GSUP_IE_SessionState(template GSUP_SessionState state) := { |
| 647 | tag := OSMO_GSUP_SESSION_STATE_IE, |
| 648 | len := ?, |
| 649 | val := { |
| 650 | session_state := state |
| 651 | } |
| 652 | } |
| 653 | |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 654 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_MR(OCT1 ref) := { |
| 655 | tag := OSMO_GSUP_SM_RP_MR_IE, |
| 656 | len := 0, /* overwritten */ |
| 657 | val := { |
| 658 | sm_rp_mr := ref |
| 659 | } |
| 660 | } |
| 661 | template GSUP_IE tr_GSUP_IE_SM_RP_MR(template OCT1 ref) := { |
| 662 | tag := OSMO_GSUP_SM_RP_MR_IE, |
| 663 | len := ?, |
| 664 | val := { |
| 665 | sm_rp_mr := ref |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_CAUSE(OCT1 cause) := { |
| 670 | tag := OSMO_GSUP_SM_RP_CAUSE_IE, |
| 671 | len := 0, /* overwritten */ |
| 672 | val := { |
| 673 | sm_rp_cause := cause |
| 674 | } |
| 675 | } |
| 676 | template GSUP_IE tr_GSUP_IE_SM_RP_CAUSE(template OCT1 cause) := { |
| 677 | tag := OSMO_GSUP_SM_RP_CAUSE_IE, |
| 678 | len := ?, |
| 679 | val := { |
| 680 | sm_rp_cause := cause |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_MMS(OCT1 mms) := { |
| 685 | tag := OSMO_GSUP_SM_RP_MMS_IE, |
| 686 | len := 0, /* overwritten */ |
| 687 | val := { |
| 688 | sm_rp_mms := mms |
| 689 | } |
| 690 | } |
| 691 | template GSUP_IE tr_GSUP_IE_SM_RP_MMS(template OCT1 mms) := { |
| 692 | tag := OSMO_GSUP_SM_RP_MMS_IE, |
| 693 | len := ?, |
| 694 | val := { |
| 695 | sm_rp_mms := mms |
| 696 | } |
| 697 | } |
| 698 | |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 699 | template (value) GSUP_IE ts_GSUP_IE_IMEI_IE(GSUP_IMEI imei) := { |
| 700 | tag := OSMO_GSUP_IMEI_IE, |
| 701 | len := 0, /* overwritten */ |
| 702 | val := { |
| 703 | imei := imei |
| 704 | } |
| 705 | } |
| 706 | template GSUP_IE tr_GSUP_IE_IMEI_IE(template GSUP_IMEI imei) := { |
| 707 | tag := OSMO_GSUP_IMEI_IE, |
| 708 | len := ?, |
| 709 | val := { |
| 710 | imei := imei |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | template (value) GSUP_IE ts_GSUP_IE_IMEI_RESULT_IE(GSUP_IMEIResult result) := { |
| 715 | tag := OSMO_GSUP_IMEI_RESULT_IE, |
| 716 | len := 0, /* overwritten */ |
| 717 | val := { |
| 718 | imei_result := result |
| 719 | } |
| 720 | } |
| 721 | template GSUP_IE tr_GSUP_IE_IMEI_RESULT_IE(template GSUP_IMEIResult result) := { |
| 722 | tag := OSMO_GSUP_IMEI_RESULT_IE, |
| 723 | len := ?, |
| 724 | val := { |
| 725 | imei_result := result |
| 726 | } |
| 727 | } |
| 728 | |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 729 | /* Possible identity types for SM-RP-{OA|DA} IEs */ |
| 730 | type enumerated GSUP_SM_RP_ODA_IdType { |
| 731 | OSMO_GSUP_SM_RP_ODA_ID_NONE ('00'O), |
| 732 | OSMO_GSUP_SM_RP_ODA_ID_IMSI ('01'O), |
| 733 | OSMO_GSUP_SM_RP_ODA_ID_MSISDN ('02'O), |
| 734 | OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR ('03'O), |
| 735 | /* Special value for noSM-RP-DA and noSM-RP-OA */ |
| 736 | OSMO_GSUP_SM_RP_ODA_ID_NULL ('FF'O) |
| 737 | } with { variant "FIELDLENGTH(8)" }; |
| 738 | |
| 739 | /** |
| 740 | * SM-RP-DA represents the SM Destination Address, see 7.6.8.1. |
| 741 | * It can be either of the following: |
| 742 | * - IMSI |
| 743 | * - LMSI (not implemented) |
| 744 | * - MSISDN |
| 745 | * - roaming number (not implemented) |
| 746 | * - service centre address |
| 747 | */ |
| 748 | type union GSUP_SM_RP_DA_ID { |
| 749 | hexstring imsi, |
| 750 | hexstring msisdn, |
| 751 | hexstring smsc_addr |
| 752 | }; |
| 753 | |
| 754 | type record GSUP_SM_RP_DA { |
| 755 | GSUP_SM_RP_ODA_IdType id_type, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 756 | GSUP_SM_RP_DA_ID id_enc optional |
Vadim Yanitskiy | f1f39bd | 2018-12-14 08:00:33 +0700 | [diff] [blame] | 757 | } with { variant (id_enc) "CROSSTAG( |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 758 | imsi, id_type = OSMO_GSUP_SM_RP_ODA_ID_IMSI; |
| 759 | msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN; |
| 760 | smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR; |
| 761 | /* FIXME: how to handle noSM-RP-DA? */ |
| 762 | )" |
| 763 | }; |
| 764 | |
| 765 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_IMSI(hexstring imsi) := { |
| 766 | id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 767 | id_enc := { imsi := imsi } |
| 768 | } |
| 769 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_IMSI(template hexstring imsi) := { |
| 770 | id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 771 | id_enc := { imsi := imsi } |
| 772 | } |
| 773 | |
| 774 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_MSISDN(hexstring msisdn) := { |
| 775 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 776 | id_enc := { msisdn := msisdn } |
| 777 | } |
| 778 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_MSISDN(template hexstring msisdn) := { |
| 779 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 780 | id_enc := { msisdn := msisdn } |
| 781 | } |
| 782 | |
| 783 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_SMSC_ADDR(hexstring smsc_addr) := { |
| 784 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 785 | id_enc := { smsc_addr := smsc_addr } |
| 786 | } |
| 787 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_SMSC_ADDR(template hexstring smsc_addr) := { |
| 788 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 789 | id_enc := { smsc_addr := smsc_addr } |
| 790 | } |
| 791 | |
| 792 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_NULL := { |
| 793 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 794 | id_enc := omit |
| 795 | } |
| 796 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_NULL := { |
| 797 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 798 | id_enc := omit |
| 799 | } |
| 800 | |
| 801 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_DA(GSUP_SM_RP_DA val) := { |
| 802 | tag := OSMO_GSUP_SM_RP_DA_IE, |
| 803 | len := 0, /* overwritten */ |
| 804 | val := { |
| 805 | sm_rp_da := val |
| 806 | } |
| 807 | } |
| 808 | template GSUP_IE tr_GSUP_IE_SM_RP_DA(template GSUP_SM_RP_DA val) := { |
| 809 | tag := OSMO_GSUP_SM_RP_DA_IE, |
| 810 | len := ?, |
| 811 | val := { |
| 812 | sm_rp_da := val |
| 813 | } |
| 814 | } |
| 815 | |
| 816 | /** |
| 817 | * SM-RP-OA represents the SM Originating Address, see 7.6.8.2. |
| 818 | * It can be either of the following: |
| 819 | * - MSISDN |
| 820 | * - service centre address |
| 821 | */ |
| 822 | type union GSUP_SM_RP_OA_ID { |
| 823 | hexstring msisdn, |
| 824 | hexstring smsc_addr |
| 825 | }; |
| 826 | |
| 827 | type record GSUP_SM_RP_OA { |
| 828 | GSUP_SM_RP_ODA_IdType id_type, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 829 | GSUP_SM_RP_OA_ID id_enc optional |
Vadim Yanitskiy | f1f39bd | 2018-12-14 08:00:33 +0700 | [diff] [blame] | 830 | } with { variant (id_enc) "CROSSTAG( |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 831 | msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN; |
| 832 | smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR; |
| 833 | /* FIXME: how to handle noSM-RP-OA? */ |
| 834 | )" |
| 835 | }; |
| 836 | |
| 837 | template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_MSISDN(hexstring msisdn) := { |
| 838 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 839 | id_enc := { msisdn := msisdn } |
| 840 | } |
| 841 | template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_MSISDN(template hexstring msisdn) := { |
| 842 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 843 | id_enc := { msisdn := msisdn } |
| 844 | } |
| 845 | |
| 846 | template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_SMSC_ADDR(hexstring smsc_addr) := { |
| 847 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 848 | id_enc := { smsc_addr := smsc_addr } |
| 849 | } |
| 850 | template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_SMSC_ADDR(template hexstring smsc_addr) := { |
| 851 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 852 | id_enc := { smsc_addr := smsc_addr } |
| 853 | } |
| 854 | |
| 855 | template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_NULL := { |
| 856 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 857 | id_enc := omit |
| 858 | } |
| 859 | template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_NULL := { |
| 860 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 861 | id_enc := omit |
| 862 | } |
| 863 | |
| 864 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_OA(GSUP_SM_RP_OA val) := { |
| 865 | tag := OSMO_GSUP_SM_RP_OA_IE, |
| 866 | len := 0, /* overwritten */ |
| 867 | val := { |
| 868 | sm_rp_oa := val |
| 869 | } |
| 870 | } |
| 871 | template GSUP_IE tr_GSUP_IE_SM_RP_OA(template GSUP_SM_RP_OA val) := { |
| 872 | tag := OSMO_GSUP_SM_RP_OA_IE, |
| 873 | len := ?, |
| 874 | val := { |
| 875 | sm_rp_oa := val |
| 876 | } |
| 877 | } |
| 878 | |
| 879 | /* SM-RP-UI represents the SM TPDU, see 7.6.8.4 */ |
| 880 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_UI(octetstring val) := { |
| 881 | tag := OSMO_GSUP_SM_RP_UI_IE, |
| 882 | len := 0, /* overwritten */ |
| 883 | val := { |
| 884 | sm_rp_ui := val |
| 885 | } |
| 886 | } |
| 887 | template GSUP_IE tr_GSUP_IE_SM_RP_UI(template octetstring val) := { |
| 888 | tag := OSMO_GSUP_SM_RP_UI_IE, |
| 889 | len := ?, |
| 890 | val := { |
| 891 | sm_rp_ui := val |
| 892 | } |
| 893 | } |
| 894 | |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 895 | /* SM Alert Reason types, see 7.6.8.8 */ |
| 896 | type enumerated GSUP_SM_ALERT_RSN_Type { |
| 897 | GSUP_SM_ALERT_RSN_TYPE_NONE ('00'O), |
| 898 | GSUP_SM_ALERT_RSN_TYPE_MS_PRESENT ('01'O), |
| 899 | GSUP_SM_ALERT_RSN_TYPE_MEM_AVAIL ('02'O) |
| 900 | } with { variant "FIELDLENGTH(8)" }; |
| 901 | |
| 902 | /* SM Alert Reason IE (used in READY-FOR-SM), see 7.6.8.8 */ |
| 903 | template (value) GSUP_IE ts_GSUP_IE_SM_ALERT_RSN(GSUP_SM_ALERT_RSN_Type rsn) := { |
| 904 | tag := OSMO_GSUP_SM_ALERT_RSN_IE, |
| 905 | len := 0, /* overwritten */ |
| 906 | val := { |
| 907 | sm_alert_rsn := rsn |
| 908 | } |
| 909 | } |
| 910 | template GSUP_IE tr_GSUP_IE_SM_ALERT_RSN(template GSUP_SM_ALERT_RSN_Type rsn) := { |
| 911 | tag := OSMO_GSUP_SM_ALERT_RSN_IE, |
| 912 | len := ?, |
| 913 | val := { |
| 914 | sm_alert_rsn := rsn |
| 915 | } |
| 916 | } |
| 917 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 918 | template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := { |
| 919 | tag := OSMO_GSUP_SS_INFO_IE, |
| 920 | len := 0, /* overwritten */ |
| 921 | val := { |
| 922 | ss_info := ss |
| 923 | } |
| 924 | } |
| 925 | template GSUP_IE tr_GSUP_IE_SSInfo(template octetstring ss) := { |
| 926 | tag := OSMO_GSUP_SS_INFO_IE, |
| 927 | len := ?, |
| 928 | val := { |
| 929 | ss_info := ss |
| 930 | } |
| 931 | } |
| 932 | |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 933 | private function f_gen_ts_ss_ies( |
| 934 | hexstring imsi, |
| 935 | OCT4 sid, |
| 936 | GSUP_SessionState state, |
| 937 | template (omit) octetstring ss |
| 938 | ) return GSUP_IEs { |
| 939 | /* Mandatory IEs */ |
| 940 | var GSUP_IEs ies := { |
| 941 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 942 | valueof(ts_GSUP_IE_SessionId(sid)), |
| 943 | valueof(ts_GSUP_IE_SessionState(state)) |
| 944 | }; |
| 945 | |
| 946 | /* Optional SS payload */ |
| 947 | if (isvalue(ss)) { |
| 948 | ies[3] := valueof(ts_GSUP_IE_SSInfo(valueof(ss))); |
| 949 | } |
| 950 | |
| 951 | return ies; |
| 952 | } |
| 953 | private function f_gen_tr_ss_ies( |
| 954 | template hexstring imsi, |
| 955 | template OCT4 sid := ?, |
| 956 | template GSUP_SessionState state := ?, |
| 957 | template octetstring ss := ? |
| 958 | ) return template GSUP_IEs { |
| 959 | /* Mandatory IEs */ |
| 960 | var template GSUP_IEs ies := { |
| 961 | tr_GSUP_IE_IMSI(imsi), |
| 962 | tr_GSUP_IE_SessionId(sid), |
| 963 | tr_GSUP_IE_SessionState(state) |
| 964 | }; |
| 965 | |
| 966 | /* Optional SS payload */ |
| 967 | if (istemplatekind(ss, "*")) { |
| 968 | ies[3] := *; |
| 969 | } else if (not istemplatekind(ss, "omit")) { |
| 970 | ies[3] := tr_GSUP_IE_SSInfo(ss); |
| 971 | } |
| 972 | |
| 973 | return ies; |
| 974 | } |
| 975 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 976 | template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ( |
| 977 | hexstring imsi, |
| 978 | OCT4 sid, |
| 979 | GSUP_SessionState state, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 980 | template (omit) octetstring ss := omit |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 981 | ) := ts_GSUP( |
| 982 | OSMO_GSUP_MSGT_PROC_SS_REQUEST, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 983 | f_gen_ts_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 984 | ); |
| 985 | template GSUP_PDU tr_GSUP_PROC_SS_REQ( |
| 986 | template hexstring imsi, |
| 987 | template OCT4 sid := ?, |
| 988 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 989 | template octetstring ss := * |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 990 | ) := tr_GSUP( |
| 991 | OSMO_GSUP_MSGT_PROC_SS_REQUEST, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 992 | f_gen_tr_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 993 | ); |
| 994 | |
| 995 | template (value) GSUP_PDU ts_GSUP_PROC_SS_RES( |
| 996 | hexstring imsi, |
| 997 | OCT4 sid, |
| 998 | GSUP_SessionState state, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 999 | template (omit) octetstring ss := omit |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1000 | ) := ts_GSUP( |
| 1001 | OSMO_GSUP_MSGT_PROC_SS_RESULT, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1002 | f_gen_ts_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1003 | ); |
| 1004 | template GSUP_PDU tr_GSUP_PROC_SS_RES( |
| 1005 | template hexstring imsi, |
| 1006 | template OCT4 sid := ?, |
| 1007 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1008 | template octetstring ss := * |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1009 | ) := tr_GSUP( |
| 1010 | OSMO_GSUP_MSGT_PROC_SS_RESULT, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1011 | f_gen_tr_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1012 | ); |
| 1013 | |
| 1014 | template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR( |
| 1015 | hexstring imsi, |
| 1016 | OCT4 sid, |
Vadim Yanitskiy | 21c4233 | 2018-11-29 00:18:05 +0700 | [diff] [blame] | 1017 | GSUP_SessionState state, |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1018 | integer cause |
| 1019 | ) := ts_GSUP( |
| 1020 | OSMO_GSUP_MSGT_PROC_SS_ERROR, |
| 1021 | { |
| 1022 | valueof(ts_GSUP_IE_IMSI(imsi)), |
Vadim Yanitskiy | 772a845 | 2018-11-29 02:17:37 +0700 | [diff] [blame] | 1023 | valueof(ts_GSUP_IE_Cause(cause)), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1024 | valueof(ts_GSUP_IE_SessionId(sid)), |
Vadim Yanitskiy | 772a845 | 2018-11-29 02:17:37 +0700 | [diff] [blame] | 1025 | valueof(ts_GSUP_IE_SessionState(state)) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1026 | } |
| 1027 | ); |
| 1028 | template GSUP_PDU tr_GSUP_PROC_SS_ERR( |
| 1029 | template hexstring imsi, |
| 1030 | template OCT4 sid := ?, |
Vadim Yanitskiy | 21c4233 | 2018-11-29 00:18:05 +0700 | [diff] [blame] | 1031 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1032 | template integer cause := ? |
| 1033 | ) := tr_GSUP( |
| 1034 | OSMO_GSUP_MSGT_PROC_SS_ERROR, |
| 1035 | { |
| 1036 | tr_GSUP_IE_IMSI(imsi), |
Vadim Yanitskiy | 772a845 | 2018-11-29 02:17:37 +0700 | [diff] [blame] | 1037 | tr_GSUP_IE_Cause(cause), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1038 | tr_GSUP_IE_SessionId(sid), |
Vadim Yanitskiy | 772a845 | 2018-11-29 02:17:37 +0700 | [diff] [blame] | 1039 | tr_GSUP_IE_SessionState(state) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1040 | } |
| 1041 | ); |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 1042 | |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1043 | template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_REQ( |
| 1044 | hexstring imsi, |
| 1045 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1046 | GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1047 | GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1048 | octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */ |
| 1049 | ) := ts_GSUP( |
| 1050 | OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST, |
| 1051 | { |
| 1052 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1053 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1054 | valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)), |
| 1055 | valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)), |
| 1056 | valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)) |
| 1057 | } |
| 1058 | ); |
| 1059 | template GSUP_PDU tr_GSUP_MO_FORWARD_SM_REQ( |
| 1060 | template hexstring imsi := ?, |
| 1061 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1062 | template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1063 | template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1064 | template octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */ |
| 1065 | ) := tr_GSUP( |
| 1066 | OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST, |
| 1067 | { |
| 1068 | tr_GSUP_IE_IMSI(imsi), |
| 1069 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1070 | tr_GSUP_IE_SM_RP_DA(sm_rp_da), |
| 1071 | tr_GSUP_IE_SM_RP_OA(sm_rp_oa), |
| 1072 | tr_GSUP_IE_SM_RP_UI(sm_rp_ui) |
| 1073 | } |
| 1074 | ); |
| 1075 | |
| 1076 | template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_RES( |
| 1077 | hexstring imsi, |
| 1078 | OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1079 | ) := ts_GSUP( |
| 1080 | OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT, |
| 1081 | { |
| 1082 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1083 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)) |
| 1084 | } |
| 1085 | ); |
| 1086 | template GSUP_PDU tr_GSUP_MO_FORWARD_SM_RES( |
| 1087 | template hexstring imsi := ?, |
| 1088 | template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1089 | ) := tr_GSUP( |
| 1090 | OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT, |
| 1091 | { |
| 1092 | tr_GSUP_IE_IMSI(imsi), |
| 1093 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr) |
| 1094 | } |
| 1095 | ); |
| 1096 | |
| 1097 | template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_ERR( |
| 1098 | hexstring imsi, |
| 1099 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1100 | OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1101 | ) := ts_GSUP( |
| 1102 | OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR, |
| 1103 | { |
| 1104 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1105 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1106 | valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)) |
| 1107 | } |
| 1108 | ); |
| 1109 | template GSUP_PDU tr_GSUP_MO_FORWARD_SM_ERR( |
| 1110 | template hexstring imsi := ?, |
| 1111 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1112 | template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1113 | ) := tr_GSUP( |
| 1114 | OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR, |
| 1115 | { |
| 1116 | tr_GSUP_IE_IMSI(imsi), |
| 1117 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1118 | tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause) |
| 1119 | } |
| 1120 | ); |
| 1121 | |
| 1122 | template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_REQ( |
| 1123 | hexstring imsi, |
| 1124 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1125 | GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1126 | GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1127 | octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */ |
| 1128 | OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */ |
| 1129 | ) := ts_GSUP( |
| 1130 | OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST, |
| 1131 | { |
| 1132 | /** |
| 1133 | * TODO: add MT-specific fields (and IEs): |
| 1134 | * - smDeliveryTimer |
| 1135 | * - smDeliveryStartTime |
| 1136 | */ |
| 1137 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1138 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1139 | valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)), |
| 1140 | valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)), |
| 1141 | valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)), |
| 1142 | valueof(ts_GSUP_IE_SM_RP_MMS(sm_rp_mms)) |
| 1143 | } |
| 1144 | ); |
| 1145 | template GSUP_PDU tr_GSUP_MT_FORWARD_SM_REQ( |
| 1146 | template hexstring imsi := ?, |
| 1147 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1148 | template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1149 | template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1150 | template octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */ |
| 1151 | template OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */ |
| 1152 | ) := tr_GSUP( |
| 1153 | OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST, |
| 1154 | { |
| 1155 | /** |
| 1156 | * TODO: add MT-specific fields (and IEs): |
| 1157 | * - smDeliveryTimer |
| 1158 | * - smDeliveryStartTime |
| 1159 | */ |
| 1160 | tr_GSUP_IE_IMSI(imsi), |
| 1161 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1162 | tr_GSUP_IE_SM_RP_DA(sm_rp_da), |
| 1163 | tr_GSUP_IE_SM_RP_OA(sm_rp_oa), |
| 1164 | tr_GSUP_IE_SM_RP_UI(sm_rp_ui), |
| 1165 | tr_GSUP_IE_SM_RP_MMS(sm_rp_mms) |
| 1166 | } |
| 1167 | ); |
| 1168 | |
| 1169 | template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_RES( |
| 1170 | hexstring imsi, |
| 1171 | OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1172 | ) := ts_GSUP( |
| 1173 | OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT, |
| 1174 | { |
| 1175 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1176 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)) |
| 1177 | } |
| 1178 | ); |
| 1179 | template GSUP_PDU tr_GSUP_MT_FORWARD_SM_RES( |
| 1180 | template hexstring imsi := ?, |
| 1181 | template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1182 | ) := tr_GSUP( |
| 1183 | OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT, |
| 1184 | { |
| 1185 | tr_GSUP_IE_IMSI(imsi), |
| 1186 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr) |
| 1187 | } |
| 1188 | ); |
| 1189 | |
| 1190 | template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_ERR( |
| 1191 | hexstring imsi, |
| 1192 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1193 | OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1194 | ) := ts_GSUP( |
| 1195 | OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR, |
| 1196 | { |
| 1197 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1198 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1199 | valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)) |
| 1200 | } |
| 1201 | ); |
| 1202 | template GSUP_PDU tr_GSUP_MT_FORWARD_SM_ERR( |
| 1203 | template hexstring imsi := ?, |
| 1204 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1205 | template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1206 | ) := tr_GSUP( |
| 1207 | OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR, |
| 1208 | { |
| 1209 | tr_GSUP_IE_IMSI(imsi), |
| 1210 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1211 | tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause) |
| 1212 | } |
| 1213 | ); |
| 1214 | |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 1215 | template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_REQ( |
| 1216 | hexstring imsi, |
| 1217 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1218 | GSUP_SM_ALERT_RSN_Type sm_alert_rsn /* SM Alert Reason, see 7.6.8.8 */ |
| 1219 | ) := ts_GSUP( |
| 1220 | OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST, |
| 1221 | { |
| 1222 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1223 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1224 | valueof(ts_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn)) |
| 1225 | } |
| 1226 | ); |
| 1227 | template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_REQ( |
| 1228 | template hexstring imsi := ?, |
| 1229 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1230 | template GSUP_SM_ALERT_RSN_Type sm_alert_rsn := ? /* SM Alert Reason, see 7.6.8.8 */ |
| 1231 | ) := tr_GSUP( |
| 1232 | OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST, |
| 1233 | { |
| 1234 | tr_GSUP_IE_IMSI(imsi), |
| 1235 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1236 | tr_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn) |
| 1237 | } |
| 1238 | ); |
| 1239 | |
| 1240 | template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_RES( |
| 1241 | hexstring imsi, |
| 1242 | OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1243 | ) := ts_GSUP( |
| 1244 | OSMO_GSUP_MSGT_READY_FOR_SM_RESULT, |
| 1245 | { |
| 1246 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1247 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)) |
| 1248 | } |
| 1249 | ); |
| 1250 | template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_RES( |
| 1251 | template hexstring imsi := ?, |
| 1252 | template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1253 | ) := tr_GSUP( |
| 1254 | OSMO_GSUP_MSGT_READY_FOR_SM_RESULT, |
| 1255 | { |
| 1256 | tr_GSUP_IE_IMSI(imsi), |
| 1257 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr) |
| 1258 | } |
| 1259 | ); |
| 1260 | |
| 1261 | template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_ERR( |
| 1262 | hexstring imsi, |
| 1263 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1264 | OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1265 | ) := ts_GSUP( |
| 1266 | OSMO_GSUP_MSGT_READY_FOR_SM_ERROR, |
| 1267 | { |
| 1268 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1269 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1270 | valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)) |
| 1271 | } |
| 1272 | ); |
| 1273 | template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_ERR( |
| 1274 | template hexstring imsi := ?, |
| 1275 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1276 | template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1277 | ) := tr_GSUP( |
| 1278 | OSMO_GSUP_MSGT_READY_FOR_SM_ERROR, |
| 1279 | { |
| 1280 | tr_GSUP_IE_IMSI(imsi), |
| 1281 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1282 | tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause) |
| 1283 | } |
| 1284 | ); |
| 1285 | |
Harald Welte | f9d449e | 2018-06-24 22:27:47 +0200 | [diff] [blame] | 1286 | function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) return boolean { |
| 1287 | for (var integer i := 0; i < sizeof(msg.ies); i := i+1) { |
| 1288 | if (msg.ies[i].tag == iei) { |
| 1289 | ret := msg.ies[i].val; |
| 1290 | return true; |
| 1291 | } |
| 1292 | } |
| 1293 | return false; |
| 1294 | } |
| 1295 | |
| 1296 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 1297 | } with { encode "RAW"; variant "FIELDORDER(msb)" } |