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