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