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