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 | |
Oliver Smith | 62a1c63 | 2020-01-15 15:58:54 +0100 | [diff] [blame] | 498 | template (value) GSUP_PDU ts_GSUP_UL_REQ(hexstring imsi, GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS) := |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 499 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, { |
Oliver Smith | 62a1c63 | 2020-01-15 15:58:54 +0100 | [diff] [blame] | 500 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) }); |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 501 | |
Harald Welte | dfe94dd | 2018-01-21 13:55:22 +0100 | [diff] [blame] | 502 | template GSUP_PDU tr_GSUP_UL_REQ(template hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 503 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST, imsi); |
Harald Welte | dfe94dd | 2018-01-21 13:55:22 +0100 | [diff] [blame] | 504 | |
Oliver Smith | 07786da | 2020-01-29 14:48:19 +0100 | [diff] [blame] | 505 | template (value) GSUP_PDU ts_GSUP_UL_RES(hexstring imsi, octetstring destination_name := ''O) := |
| 506 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, { valueof(ts_GSUP_IE_IMSI(imsi)), |
| 507 | valueof(ts_GSUP_IE_Destination_Name(destination_name))}); |
Harald Welte | dfe94dd | 2018-01-21 13:55:22 +0100 | [diff] [blame] | 508 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 509 | template GSUP_PDU tr_GSUP_UL_RES(template hexstring imsi) := |
| 510 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT, imsi); |
| 511 | |
Harald Welte | 6aa04e3 | 2018-01-27 15:35:19 +0100 | [diff] [blame] | 512 | template (value) GSUP_PDU ts_GSUP_UL_ERR(hexstring imsi, integer cause) := |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 513 | ts_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, { |
| 514 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) }); |
| 515 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 516 | template GSUP_PDU tr_GSUP_UL_ERR(template hexstring imsi, template integer cause := ?) := |
| 517 | tr_GSUP(OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR, { |
| 518 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 519 | |
Oliver Smith | 07786da | 2020-01-29 14:48:19 +0100 | [diff] [blame] | 520 | 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] | 521 | ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, { |
Oliver Smith | 07786da | 2020-01-29 14:48:19 +0100 | [diff] [blame] | 522 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_MSISDN(msisdn)), |
| 523 | valueof(ts_GSUP_IE_Destination_Name(destination_name))}); |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 524 | |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 525 | template GSUP_PDU tr_GSUP_ISD_REQ(template hexstring imsi, template hexstring msisdn := ?) := |
| 526 | tr_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_REQUEST, { |
Harald Welte | 8f6ac16 | 2018-03-01 22:43:28 +0100 | [diff] [blame] | 527 | tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_MSISDN(msisdn), * }); |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 528 | |
Oliver Smith | 07786da | 2020-01-29 14:48:19 +0100 | [diff] [blame] | 529 | template (value) GSUP_PDU ts_GSUP_ISD_RES(hexstring imsi, octetstring destination_name := ''O) := |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 530 | ts_GSUP(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, { |
Oliver Smith | 07786da | 2020-01-29 14:48:19 +0100 | [diff] [blame] | 531 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 532 | valueof(ts_GSUP_IE_Destination_Name(destination_name))}); |
Harald Welte | c2c5255 | 2018-03-01 21:20:39 +0100 | [diff] [blame] | 533 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 534 | template GSUP_PDU tr_GSUP_ISD_RES(template hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 535 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_INSERT_DATA_RESULT, imsi); |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 536 | |
Harald Welte | c638f4d | 2018-01-24 22:00:36 +0100 | [diff] [blame] | 537 | template GSUP_PDU tr_GSUP_AUTH_FAIL_IND(hexstring imsi) := |
Harald Welte | 8a1dd53 | 2018-01-27 15:38:18 +0100 | [diff] [blame] | 538 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_AUTH_FAIL_REPORT, imsi); |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 539 | |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 540 | template (value) GSUP_PDU ts_GSUP_CL_REQ(hexstring imsi, GSUP_CancelType ctype) := |
| 541 | ts_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST, { |
| 542 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CancelType(ctype)) }); |
| 543 | |
| 544 | template GSUP_PDU tr_GSUP_CL_RES(template hexstring imsi) := |
| 545 | tr_GSUP_IMSI(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT, imsi); |
| 546 | |
| 547 | template GSUP_PDU tr_GSUP_CL_ERR(template hexstring imsi, template integer cause := ?) := |
| 548 | tr_GSUP(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR, { |
Alexander Couzens | 4cfff3a | 2018-05-22 17:08:36 +0200 | [diff] [blame] | 549 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause), * }); |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 550 | |
Harald Welte | 958f8b4 | 2018-03-01 23:40:17 +0100 | [diff] [blame] | 551 | template (value) GSUP_PDU ts_GSUP_PURGE_MS_REQ(hexstring imsi, GSUP_CnDomain dom) := |
| 552 | ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, { |
| 553 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_CnDomain(dom)) }); |
| 554 | |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 555 | template GSUP_PDU tr_GSUP_PURGE_MS_REQ(template hexstring imsi, template GSUP_CnDomain dom := ?) := |
| 556 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_REQUEST, { |
| 557 | tr_GSUP_IE_IMSI(imsi), *, tr_GSUP_IE_CnDomain(dom) }); |
| 558 | |
| 559 | template (value) GSUP_PDU ts_GSUP_PURGE_MS_RES(hexstring imsi) := |
| 560 | ts_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, { |
| 561 | valueof(ts_GSUP_IE_IMSI(imsi)) }); |
| 562 | |
Harald Welte | 958f8b4 | 2018-03-01 23:40:17 +0100 | [diff] [blame] | 563 | template GSUP_PDU tr_GSUP_PURGE_MS_RES(template hexstring imsi) := |
| 564 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_RESULT, { |
| 565 | tr_GSUP_IE_IMSI(imsi), * }); |
| 566 | |
| 567 | template GSUP_PDU tr_GSUP_PURGE_MS_ERR(template hexstring imsi, template integer cause) := |
| 568 | tr_GSUP(OSMO_GSUP_MSGT_PURGE_MS_ERROR, { |
| 569 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 570 | |
Oliver Smith | 936dbe6 | 2019-06-04 15:54:17 +0200 | [diff] [blame] | 571 | template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_REQ(hexstring imsi, hexstring imei) := |
| 572 | ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, { |
| 573 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI(imei)) }); |
| 574 | |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 575 | template GSUP_PDU tr_GSUP_CHECK_IMEI_REQ( |
| 576 | template hexstring imsi, |
| 577 | template hexstring imei |
| 578 | ) := tr_GSUP( |
| 579 | OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST, |
| 580 | { |
| 581 | tr_GSUP_IE_IMSI(imsi), |
| 582 | tr_GSUP_IE_IMEI(imei), |
| 583 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT) |
| 584 | } |
| 585 | ); |
| 586 | |
| 587 | template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_RES(hexstring imsi, GSUP_IMEIResult result) := |
| 588 | ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, { |
| 589 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_IMEI_Result(result)) }); |
| 590 | |
Oliver Smith | 936dbe6 | 2019-06-04 15:54:17 +0200 | [diff] [blame] | 591 | template GSUP_PDU tr_GSUP_CHECK_IMEI_RES(template hexstring imsi, template GSUP_IMEIResult result) := |
| 592 | tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_RESULT, { |
| 593 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_IMEI_Result(result) }); |
| 594 | |
Oliver Smith | 1d118ff | 2019-07-03 10:57:35 +0200 | [diff] [blame] | 595 | template (value) GSUP_PDU ts_GSUP_CHECK_IMEI_ERR(hexstring imsi, integer cause) := |
| 596 | ts_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, { |
| 597 | valueof(ts_GSUP_IE_IMSI(imsi)), valueof(ts_GSUP_IE_Cause(cause)) }); |
| 598 | |
Oliver Smith | 936dbe6 | 2019-06-04 15:54:17 +0200 | [diff] [blame] | 599 | template GSUP_PDU tr_GSUP_CHECK_IMEI_ERR(template hexstring imsi, template integer cause) := |
| 600 | tr_GSUP(OSMO_GSUP_MSGT_CHECK_IMEI_ERROR, { |
| 601 | tr_GSUP_IE_IMSI(imsi), tr_GSUP_IE_Cause(cause) }); |
| 602 | |
Harald Welte | 167458a | 2018-01-27 15:58:16 +0100 | [diff] [blame] | 603 | |
| 604 | template (value) GSUP_IE ts_GSUP_IE_CancelType(GSUP_CancelType ctype) := { |
| 605 | tag := OSMO_GSUP_CANCEL_TYPE_IE, |
| 606 | len := 0, /* overwritten */ |
| 607 | val := { |
| 608 | cancel_type := ctype |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | template GSUP_IE tr_GSUP_IE_CancelType(template GSUP_CancelType ctype) := |
| 613 | tr_GSUP_IE(OSMO_GSUP_CANCEL_TYPE_IE, GSUP_IeValue:{cancel_type:=ctype}); |
| 614 | |
Harald Welte | 6abb9fe | 2018-02-17 15:24:48 +0100 | [diff] [blame] | 615 | template GSUP_IE tr_GSUP_IE_CnDomain(template GSUP_CnDomain domain) := |
| 616 | tr_GSUP_IE(OSMO_GSUP_CN_DOMAIN_IE, GSUP_IeValue:{cn_domain:=domain}); |
| 617 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 618 | template GSUP_IE tr_GSUP_IE(template GSUP_IEI iei, template GSUP_IeValue val := ?) := { |
| 619 | tag := iei, |
| 620 | len := ?, |
| 621 | val := val |
| 622 | } |
| 623 | |
| 624 | template (value) GSUP_IE ts_GSUP_IE_IMSI(hexstring imsi) := { |
| 625 | tag := OSMO_GSUP_IMSI_IE, |
| 626 | len := 0, /* overwritten */ |
| 627 | val := { |
| 628 | imsi := imsi |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | template GSUP_IE tr_GSUP_IE_IMSI(template hexstring imsi) := { |
| 633 | tag := OSMO_GSUP_IMSI_IE, |
| 634 | len := ?, |
| 635 | val := { |
| 636 | imsi := imsi |
| 637 | } |
| 638 | } |
| 639 | |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 640 | template (value) GSUP_IE ts_GSUP_IE_MSISDN(hexstring msisdn) := { |
| 641 | tag := OSMO_GSUP_MSISDN_IE, |
| 642 | len := 0, /* overwritten */ |
| 643 | val := { |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 644 | msisdn := ts_GSUP_MSISDN(msisdn) |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 645 | } |
| 646 | } |
| 647 | |
| 648 | template GSUP_IE tr_GSUP_IE_MSISDN(template hexstring msisdn) := { |
| 649 | tag := OSMO_GSUP_MSISDN_IE, |
| 650 | len := ?, |
| 651 | val := { |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 652 | msisdn := tr_GSUP_MSISDN(msisdn) |
Harald Welte | 6ff8190 | 2018-01-21 19:09:08 +0100 | [diff] [blame] | 653 | } |
| 654 | } |
| 655 | |
| 656 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 657 | template (value) GSUP_IE ts_GSUP_IE_Cause(integer cause) := { |
| 658 | tag := OSMO_GSUP_CAUSE_IE, |
| 659 | len := 0, /* overwritten */ |
| 660 | val := { |
| 661 | cause := cause |
| 662 | } |
| 663 | } |
| 664 | |
| 665 | template GSUP_IE tr_GSUP_IE_Cause(template integer cause) := { |
| 666 | tag := OSMO_GSUP_CAUSE_IE, |
| 667 | len := ?, |
| 668 | val := { |
| 669 | cause := cause |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | template (value) GSUP_IE ts_GSUP_IE_AUTS(octetstring auts) := { |
| 674 | tag := OSMO_GSUP_AUTS_IE, |
| 675 | len := 0, /* overwritten */ |
| 676 | val := { |
| 677 | auts := auts |
| 678 | } |
| 679 | } |
| 680 | |
Alexander Couzens | d24973d | 2018-09-04 16:10:14 +0200 | [diff] [blame] | 681 | template GSUP_IE tr_GSUP_IE_AUTS(template octetstring auts) := { |
| 682 | tag := OSMO_GSUP_AUTS_IE, |
| 683 | len := ?, |
| 684 | val := { |
| 685 | auts := auts |
| 686 | } |
| 687 | } |
| 688 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 689 | template (value) GSUP_IE ts_GSUP_IE_RAND(octetstring rand) := { |
| 690 | tag := OSMO_GSUP_RAND_IE, |
| 691 | len := 0, /* overwritten */ |
| 692 | val := { |
| 693 | rand := rand |
| 694 | } |
| 695 | } |
| 696 | |
Alexander Couzens | d24973d | 2018-09-04 16:10:14 +0200 | [diff] [blame] | 697 | template GSUP_IE tr_GSUP_IE_RAND(template octetstring rand) := { |
| 698 | tag := OSMO_GSUP_RAND_IE, |
| 699 | len := ?, |
| 700 | val := { |
| 701 | rand := rand |
| 702 | } |
| 703 | } |
| 704 | |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 705 | template (value) GSUP_IE ts_GSUP_IE_SRES(octetstring sres) := { |
| 706 | tag := OSMO_GSUP_SRES_IE, |
| 707 | len := 0, /* overwritten */ |
| 708 | val := { |
| 709 | sres := sres |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | template (value) GSUP_IE ts_GSUP_IE_Kc(octetstring kc) := { |
| 714 | tag := OSMO_GSUP_KC_IE, |
| 715 | len := 0, /* overwritten */ |
| 716 | val := { |
| 717 | kc := kc |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | template (value) GSUP_IE ts_GSUP_IE_IK(octetstring ik) := { |
| 722 | tag := OSMO_GSUP_IK_IE, |
| 723 | len := 0, /* overwritten */ |
| 724 | val := { |
| 725 | ik := ik |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | template (value) GSUP_IE ts_GSUP_IE_CK(octetstring ck) := { |
| 730 | tag := OSMO_GSUP_CK_IE, |
| 731 | len := 0, /* overwritten */ |
| 732 | val := { |
| 733 | ck := ck |
| 734 | } |
| 735 | } |
| 736 | |
| 737 | template (value) GSUP_IE ts_GSUP_IE_AUTN(octetstring autn) := { |
| 738 | tag := OSMO_GSUP_AUTN_IE, |
| 739 | len := 0, /* overwritten */ |
| 740 | val := { |
| 741 | autn := autn |
| 742 | } |
| 743 | } |
| 744 | |
| 745 | template (value) GSUP_IE ts_GSUP_IE_RES(octetstring res) := { |
| 746 | tag := OSMO_GSUP_RES_IE, |
| 747 | len := 0, /* overwritten */ |
| 748 | val := { |
| 749 | res := res |
| 750 | } |
| 751 | } |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 752 | |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 753 | template (value) GSUP_IE ts_GSUP_IE_APN(octetstring apn) := { |
| 754 | tag := OSMO_GSUP_ACCESS_POINT_NAME_IE, |
| 755 | len := 0, /* overwritten */ |
| 756 | val := { |
| 757 | apn := apn |
| 758 | } |
| 759 | } |
| 760 | |
Harald Welte | 958f8b4 | 2018-03-01 23:40:17 +0100 | [diff] [blame] | 761 | template (value) GSUP_IE ts_GSUP_IE_CnDomain(GSUP_CnDomain dom) := { |
| 762 | tag := OSMO_GSUP_CN_DOMAIN_IE, |
| 763 | len := 0, /* overwritten */ |
| 764 | val := { |
| 765 | cn_domain := dom |
| 766 | } |
| 767 | } |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 768 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 769 | template (value) GSUP_IE ts_GSUP_IE_SessionId(OCT4 sid) := { |
| 770 | tag := OSMO_GSUP_SESSION_ID_IE, |
| 771 | len := 0, /* overwritten */ |
| 772 | val := { |
| 773 | session_id := sid |
| 774 | } |
| 775 | } |
| 776 | template GSUP_IE tr_GSUP_IE_SessionId(template OCT4 sid) := { |
| 777 | tag := OSMO_GSUP_SESSION_ID_IE, |
| 778 | len := ?, |
| 779 | val := { |
| 780 | session_id := sid |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | template (value) GSUP_IE ts_GSUP_IE_SessionState(GSUP_SessionState state) := { |
| 785 | tag := OSMO_GSUP_SESSION_STATE_IE, |
| 786 | len := 0, /* overwritten */ |
| 787 | val := { |
| 788 | session_state := state |
| 789 | } |
| 790 | } |
| 791 | template GSUP_IE tr_GSUP_IE_SessionState(template GSUP_SessionState state) := { |
| 792 | tag := OSMO_GSUP_SESSION_STATE_IE, |
| 793 | len := ?, |
| 794 | val := { |
| 795 | session_state := state |
| 796 | } |
| 797 | } |
| 798 | |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 799 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_MR(OCT1 ref) := { |
| 800 | tag := OSMO_GSUP_SM_RP_MR_IE, |
| 801 | len := 0, /* overwritten */ |
| 802 | val := { |
| 803 | sm_rp_mr := ref |
| 804 | } |
| 805 | } |
| 806 | template GSUP_IE tr_GSUP_IE_SM_RP_MR(template OCT1 ref) := { |
| 807 | tag := OSMO_GSUP_SM_RP_MR_IE, |
| 808 | len := ?, |
| 809 | val := { |
| 810 | sm_rp_mr := ref |
| 811 | } |
| 812 | } |
| 813 | |
| 814 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_CAUSE(OCT1 cause) := { |
| 815 | tag := OSMO_GSUP_SM_RP_CAUSE_IE, |
| 816 | len := 0, /* overwritten */ |
| 817 | val := { |
| 818 | sm_rp_cause := cause |
| 819 | } |
| 820 | } |
| 821 | template GSUP_IE tr_GSUP_IE_SM_RP_CAUSE(template OCT1 cause) := { |
| 822 | tag := OSMO_GSUP_SM_RP_CAUSE_IE, |
| 823 | len := ?, |
| 824 | val := { |
| 825 | sm_rp_cause := cause |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_MMS(OCT1 mms) := { |
| 830 | tag := OSMO_GSUP_SM_RP_MMS_IE, |
| 831 | len := 0, /* overwritten */ |
| 832 | val := { |
| 833 | sm_rp_mms := mms |
| 834 | } |
| 835 | } |
| 836 | template GSUP_IE tr_GSUP_IE_SM_RP_MMS(template OCT1 mms) := { |
| 837 | tag := OSMO_GSUP_SM_RP_MMS_IE, |
| 838 | len := ?, |
| 839 | val := { |
| 840 | sm_rp_mms := mms |
| 841 | } |
| 842 | } |
| 843 | |
Oliver Smith | 936dbe6 | 2019-06-04 15:54:17 +0200 | [diff] [blame] | 844 | template (value) GSUP_IE ts_GSUP_IE_IMEI(hexstring imei) := { |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 845 | tag := OSMO_GSUP_IMEI_IE, |
| 846 | len := 0, /* overwritten */ |
| 847 | val := { |
Oliver Smith | 936dbe6 | 2019-06-04 15:54:17 +0200 | [diff] [blame] | 848 | imei := ts_GSUP_IMEI(imei) |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 849 | } |
| 850 | } |
Oliver Smith | 936dbe6 | 2019-06-04 15:54:17 +0200 | [diff] [blame] | 851 | template GSUP_IE tr_GSUP_IE_IMEI(template hexstring imei) := { |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 852 | tag := OSMO_GSUP_IMEI_IE, |
| 853 | len := ?, |
| 854 | val := { |
Oliver Smith | 936dbe6 | 2019-06-04 15:54:17 +0200 | [diff] [blame] | 855 | imei := tr_GSUP_IMEI(imei) |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 856 | } |
| 857 | } |
| 858 | |
Oliver Smith | 936dbe6 | 2019-06-04 15:54:17 +0200 | [diff] [blame] | 859 | template (value) GSUP_IE ts_GSUP_IE_IMEI_Result(GSUP_IMEIResult result) := { |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 860 | tag := OSMO_GSUP_IMEI_RESULT_IE, |
| 861 | len := 0, /* overwritten */ |
| 862 | val := { |
| 863 | imei_result := result |
| 864 | } |
| 865 | } |
Oliver Smith | 936dbe6 | 2019-06-04 15:54:17 +0200 | [diff] [blame] | 866 | template GSUP_IE tr_GSUP_IE_IMEI_Result(template GSUP_IMEIResult result) := { |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 867 | tag := OSMO_GSUP_IMEI_RESULT_IE, |
| 868 | len := ?, |
| 869 | val := { |
| 870 | imei_result := result |
| 871 | } |
| 872 | } |
| 873 | |
Alexander Couzens | 752f86b | 2020-01-10 07:56:31 +0100 | [diff] [blame] | 874 | template (value) GSUP_IE ts_GSUP_IE_NUM_VECTORS_REQ(OCT1 num) := { |
| 875 | tag := OSMO_GSUP_NUM_VECTORS_REQ_IE, |
| 876 | len := 0, /* overwritten */ |
| 877 | val := { |
| 878 | num_auth_vectors := num |
| 879 | } |
| 880 | } |
| 881 | template GSUP_IE tr_GSUP_IE_NUM_VECTORS_REQ(template OCT1 num) := { |
| 882 | tag := OSMO_GSUP_NUM_VECTORS_REQ_IE, |
| 883 | len := ?, |
| 884 | val := { |
| 885 | num_auth_vectors := num |
| 886 | } |
| 887 | } |
| 888 | |
| 889 | |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 890 | /* Possible identity types for SM-RP-{OA|DA} IEs */ |
| 891 | type enumerated GSUP_SM_RP_ODA_IdType { |
| 892 | OSMO_GSUP_SM_RP_ODA_ID_NONE ('00'O), |
| 893 | OSMO_GSUP_SM_RP_ODA_ID_IMSI ('01'O), |
| 894 | OSMO_GSUP_SM_RP_ODA_ID_MSISDN ('02'O), |
| 895 | OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR ('03'O), |
| 896 | /* Special value for noSM-RP-DA and noSM-RP-OA */ |
| 897 | OSMO_GSUP_SM_RP_ODA_ID_NULL ('FF'O) |
| 898 | } with { variant "FIELDLENGTH(8)" }; |
| 899 | |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 900 | /* See 3GPP TS 24.011, figures 8.5 and 8.6 */ |
| 901 | type record GSUP_SM_RP_Addr { |
| 902 | BIT1 ext, /* Extension? */ |
| 903 | BIT3 ton, /* Type of Number */ |
| 904 | BIT4 npi, /* Numbering Plan Identification */ |
| 905 | hexstring number length (1..20) |
| 906 | } with { |
| 907 | variant "PADDING(yes)"; |
| 908 | variant "PADDING_PATTERN('1111'B)" |
| 909 | }; |
| 910 | |
| 911 | private function f_pad_SM_RP_Addr(template hexstring number) |
| 912 | return template hexstring { |
| 913 | if (isvalue(number) and not istemplatekind(number, "omit")) { |
| 914 | return f_pad_bcd_number(valueof(number)); |
| 915 | } else { |
| 916 | return number; |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | template GSUP_SM_RP_Addr t_GSUP_SM_RP_Addr(template hexstring number, |
| 921 | template BIT4 npi := '0001'B, |
| 922 | template BIT3 ton := '001'B, |
| 923 | template BIT1 ext := '1'B) := { |
| 924 | ext := ext, |
| 925 | ton := ton, |
| 926 | npi := npi, |
| 927 | /* Work around TITAN's padding problems: encoding works fine, |
| 928 | * but it does not consider 'F'H as padding in decoded data. */ |
| 929 | number := f_pad_SM_RP_Addr(number) |
| 930 | } |
| 931 | |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 932 | /** |
| 933 | * SM-RP-DA represents the SM Destination Address, see 7.6.8.1. |
| 934 | * It can be either of the following: |
| 935 | * - IMSI |
| 936 | * - LMSI (not implemented) |
| 937 | * - MSISDN |
| 938 | * - roaming number (not implemented) |
| 939 | * - service centre address |
| 940 | */ |
| 941 | type union GSUP_SM_RP_DA_ID { |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 942 | hexstring imsi, |
| 943 | GSUP_SM_RP_Addr msisdn, |
| 944 | GSUP_SM_RP_Addr smsc_addr |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 945 | }; |
| 946 | |
| 947 | type record GSUP_SM_RP_DA { |
| 948 | GSUP_SM_RP_ODA_IdType id_type, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 949 | GSUP_SM_RP_DA_ID id_enc optional |
Vadim Yanitskiy | f1f39bd | 2018-12-14 08:00:33 +0700 | [diff] [blame] | 950 | } with { variant (id_enc) "CROSSTAG( |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 951 | imsi, id_type = OSMO_GSUP_SM_RP_ODA_ID_IMSI; |
| 952 | msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN; |
| 953 | smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR; |
| 954 | /* FIXME: how to handle noSM-RP-DA? */ |
| 955 | )" |
| 956 | }; |
| 957 | |
| 958 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_IMSI(hexstring imsi) := { |
| 959 | id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 960 | id_enc := { imsi := imsi } |
| 961 | } |
| 962 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_IMSI(template hexstring imsi) := { |
| 963 | id_type := OSMO_GSUP_SM_RP_ODA_ID_IMSI, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 964 | id_enc := { imsi := imsi } |
| 965 | } |
| 966 | |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 967 | 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] | 968 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 969 | id_enc := { msisdn := msisdn } |
| 970 | } |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 971 | 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] | 972 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 973 | id_enc := { msisdn := msisdn } |
| 974 | } |
| 975 | |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 976 | 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] | 977 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 978 | id_enc := { smsc_addr := smsc_addr } |
| 979 | } |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 980 | 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] | 981 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 982 | id_enc := { smsc_addr := smsc_addr } |
| 983 | } |
| 984 | |
| 985 | template (value) GSUP_SM_RP_DA ts_GSUP_SM_RP_DA_NULL := { |
| 986 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 987 | id_enc := omit |
| 988 | } |
| 989 | template GSUP_SM_RP_DA tr_GSUP_SM_RP_DA_NULL := { |
| 990 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 991 | id_enc := omit |
| 992 | } |
| 993 | |
| 994 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_DA(GSUP_SM_RP_DA val) := { |
| 995 | tag := OSMO_GSUP_SM_RP_DA_IE, |
| 996 | len := 0, /* overwritten */ |
| 997 | val := { |
| 998 | sm_rp_da := val |
| 999 | } |
| 1000 | } |
| 1001 | template GSUP_IE tr_GSUP_IE_SM_RP_DA(template GSUP_SM_RP_DA val) := { |
| 1002 | tag := OSMO_GSUP_SM_RP_DA_IE, |
| 1003 | len := ?, |
| 1004 | val := { |
| 1005 | sm_rp_da := val |
| 1006 | } |
| 1007 | } |
| 1008 | |
| 1009 | /** |
| 1010 | * SM-RP-OA represents the SM Originating Address, see 7.6.8.2. |
| 1011 | * It can be either of the following: |
| 1012 | * - MSISDN |
| 1013 | * - service centre address |
| 1014 | */ |
| 1015 | type union GSUP_SM_RP_OA_ID { |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 1016 | GSUP_SM_RP_Addr msisdn, |
| 1017 | GSUP_SM_RP_Addr smsc_addr |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1018 | }; |
| 1019 | |
| 1020 | type record GSUP_SM_RP_OA { |
| 1021 | GSUP_SM_RP_ODA_IdType id_type, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1022 | GSUP_SM_RP_OA_ID id_enc optional |
Vadim Yanitskiy | f1f39bd | 2018-12-14 08:00:33 +0700 | [diff] [blame] | 1023 | } with { variant (id_enc) "CROSSTAG( |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1024 | msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN; |
| 1025 | smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR; |
| 1026 | /* FIXME: how to handle noSM-RP-OA? */ |
| 1027 | )" |
| 1028 | }; |
| 1029 | |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 1030 | 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] | 1031 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1032 | id_enc := { msisdn := msisdn } |
| 1033 | } |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 1034 | 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] | 1035 | id_type := OSMO_GSUP_SM_RP_ODA_ID_MSISDN, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1036 | id_enc := { msisdn := msisdn } |
| 1037 | } |
| 1038 | |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 1039 | 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] | 1040 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1041 | id_enc := { smsc_addr := smsc_addr } |
| 1042 | } |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 1043 | 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] | 1044 | id_type := OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1045 | id_enc := { smsc_addr := smsc_addr } |
| 1046 | } |
| 1047 | |
| 1048 | template (value) GSUP_SM_RP_OA ts_GSUP_SM_RP_OA_NULL := { |
| 1049 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1050 | id_enc := omit |
| 1051 | } |
| 1052 | template GSUP_SM_RP_OA tr_GSUP_SM_RP_OA_NULL := { |
| 1053 | id_type := OSMO_GSUP_SM_RP_ODA_ID_NULL, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1054 | id_enc := omit |
| 1055 | } |
| 1056 | |
| 1057 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_OA(GSUP_SM_RP_OA val) := { |
| 1058 | tag := OSMO_GSUP_SM_RP_OA_IE, |
| 1059 | len := 0, /* overwritten */ |
| 1060 | val := { |
| 1061 | sm_rp_oa := val |
| 1062 | } |
| 1063 | } |
| 1064 | template GSUP_IE tr_GSUP_IE_SM_RP_OA(template GSUP_SM_RP_OA val) := { |
| 1065 | tag := OSMO_GSUP_SM_RP_OA_IE, |
| 1066 | len := ?, |
| 1067 | val := { |
| 1068 | sm_rp_oa := val |
| 1069 | } |
| 1070 | } |
| 1071 | |
| 1072 | /* SM-RP-UI represents the SM TPDU, see 7.6.8.4 */ |
| 1073 | template (value) GSUP_IE ts_GSUP_IE_SM_RP_UI(octetstring val) := { |
| 1074 | tag := OSMO_GSUP_SM_RP_UI_IE, |
| 1075 | len := 0, /* overwritten */ |
| 1076 | val := { |
| 1077 | sm_rp_ui := val |
| 1078 | } |
| 1079 | } |
| 1080 | template GSUP_IE tr_GSUP_IE_SM_RP_UI(template octetstring val) := { |
| 1081 | tag := OSMO_GSUP_SM_RP_UI_IE, |
| 1082 | len := ?, |
| 1083 | val := { |
| 1084 | sm_rp_ui := val |
| 1085 | } |
| 1086 | } |
| 1087 | |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 1088 | /* SM Alert Reason types, see 7.6.8.8 */ |
| 1089 | type enumerated GSUP_SM_ALERT_RSN_Type { |
| 1090 | GSUP_SM_ALERT_RSN_TYPE_NONE ('00'O), |
| 1091 | GSUP_SM_ALERT_RSN_TYPE_MS_PRESENT ('01'O), |
| 1092 | GSUP_SM_ALERT_RSN_TYPE_MEM_AVAIL ('02'O) |
| 1093 | } with { variant "FIELDLENGTH(8)" }; |
| 1094 | |
| 1095 | /* SM Alert Reason IE (used in READY-FOR-SM), see 7.6.8.8 */ |
| 1096 | template (value) GSUP_IE ts_GSUP_IE_SM_ALERT_RSN(GSUP_SM_ALERT_RSN_Type rsn) := { |
| 1097 | tag := OSMO_GSUP_SM_ALERT_RSN_IE, |
| 1098 | len := 0, /* overwritten */ |
| 1099 | val := { |
| 1100 | sm_alert_rsn := rsn |
| 1101 | } |
| 1102 | } |
| 1103 | template GSUP_IE tr_GSUP_IE_SM_ALERT_RSN(template GSUP_SM_ALERT_RSN_Type rsn) := { |
| 1104 | tag := OSMO_GSUP_SM_ALERT_RSN_IE, |
| 1105 | len := ?, |
| 1106 | val := { |
| 1107 | sm_alert_rsn := rsn |
| 1108 | } |
| 1109 | } |
| 1110 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1111 | template (value) GSUP_IE ts_GSUP_IE_SSInfo(octetstring ss) := { |
| 1112 | tag := OSMO_GSUP_SS_INFO_IE, |
| 1113 | len := 0, /* overwritten */ |
| 1114 | val := { |
| 1115 | ss_info := ss |
| 1116 | } |
| 1117 | } |
| 1118 | template GSUP_IE tr_GSUP_IE_SSInfo(template octetstring ss) := { |
| 1119 | tag := OSMO_GSUP_SS_INFO_IE, |
| 1120 | len := ?, |
| 1121 | val := { |
| 1122 | ss_info := ss |
| 1123 | } |
| 1124 | } |
| 1125 | |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1126 | template GSUP_IE tr_GSUP_IE_Message_Class(template GSUP_Message_Class val) := { |
| 1127 | tag := OSMO_GSUP_MESSAGE_CLASS_IE, |
| 1128 | len := ?, |
| 1129 | val := { |
| 1130 | message_class := val |
| 1131 | } |
| 1132 | } |
| 1133 | |
| 1134 | template (value) GSUP_IE ts_GSUP_IE_Message_Class(GSUP_Message_Class val) := { |
| 1135 | tag := OSMO_GSUP_MESSAGE_CLASS_IE, |
| 1136 | len := 0, /* overwritten */ |
| 1137 | val := { |
| 1138 | message_class := val |
| 1139 | } |
| 1140 | } |
| 1141 | |
| 1142 | template GSUP_IE tr_GSUP_IE_Source_Name(template octetstring name) := { |
| 1143 | tag := OSMO_GSUP_SOURCE_NAME_IE, |
| 1144 | len := ?, |
| 1145 | val := { |
| 1146 | source_name := name |
| 1147 | } |
| 1148 | } |
| 1149 | |
| 1150 | template (value) GSUP_IE ts_GSUP_IE_Source_Name(octetstring name) := { |
| 1151 | tag := OSMO_GSUP_SOURCE_NAME_IE, |
| 1152 | len := 0, /* overwritten */ |
| 1153 | val := { |
| 1154 | source_name := name |
| 1155 | } |
| 1156 | } |
| 1157 | |
| 1158 | template GSUP_IE tr_GSUP_IE_Destination_Name(template octetstring name) := { |
| 1159 | tag := OSMO_GSUP_DESTINATION_NAME_IE, |
| 1160 | len := ?, |
| 1161 | val := { |
| 1162 | destination_name := name |
| 1163 | } |
| 1164 | } |
| 1165 | |
| 1166 | template (value) GSUP_IE ts_GSUP_IE_Destination_Name(octetstring name) := { |
| 1167 | tag := OSMO_GSUP_DESTINATION_NAME_IE, |
| 1168 | len := 0, /* overwritten */ |
| 1169 | val := { |
| 1170 | destination_name := name |
| 1171 | } |
| 1172 | } |
| 1173 | |
| 1174 | template GSUP_IE tr_GSUP_IE_AN_APDU(template GSUP_AN_APDU an_apdu) := { |
| 1175 | tag := OSMO_GSUP_AN_APDU_IE, |
| 1176 | len := ?, |
| 1177 | val := { |
| 1178 | an_apdu := an_apdu |
| 1179 | } |
| 1180 | } |
| 1181 | |
| 1182 | template (value) GSUP_IE ts_GSUP_IE_AN_APDU(GSUP_AN_APDU an_apdu) := { |
| 1183 | tag := OSMO_GSUP_AN_APDU_IE, |
| 1184 | len := 0, /* overwritten */ |
| 1185 | val := { |
| 1186 | an_apdu := an_apdu |
| 1187 | } |
| 1188 | } |
| 1189 | |
Harald Welte | 0a1fd0e | 2019-12-03 20:01:08 +0100 | [diff] [blame] | 1190 | template (present) GSUP_IE tr_GSUP_IE_SUPPORTED_RAT_TYPES(template (present) GSUP_RatTypes ratt) := { |
| 1191 | tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE, |
Harald Welte | 8eebb6c | 2019-08-22 12:40:03 +0200 | [diff] [blame] | 1192 | len := ?, |
| 1193 | val := { |
Harald Welte | 0a1fd0e | 2019-12-03 20:01:08 +0100 | [diff] [blame] | 1194 | supported_rat_types := ratt |
Harald Welte | 8eebb6c | 2019-08-22 12:40:03 +0200 | [diff] [blame] | 1195 | } |
| 1196 | } |
Harald Welte | 0a1fd0e | 2019-12-03 20:01:08 +0100 | [diff] [blame] | 1197 | template (value) GSUP_IE ts_GSUP_IE_SUPPORTED_RAT_TYPES(GSUP_RatTypes ratt) := { |
| 1198 | tag := OSMO_GSUP_SUPPORTED_RAT_TYPES_IE, |
Harald Welte | 8eebb6c | 2019-08-22 12:40:03 +0200 | [diff] [blame] | 1199 | len := 0, /* overwritten */ |
| 1200 | val := { |
Harald Welte | 0a1fd0e | 2019-12-03 20:01:08 +0100 | [diff] [blame] | 1201 | supported_rat_types := ratt |
| 1202 | } |
| 1203 | } |
| 1204 | |
| 1205 | template (present) GSUP_IE tr_GSUP_IE_CURRENT_RAT_TYPE(template (present) GSUP_RatType ratt) := { |
| 1206 | tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE, |
| 1207 | len := ?, |
| 1208 | val := { |
| 1209 | current_rat_type := ratt |
| 1210 | } |
| 1211 | } |
| 1212 | template (value) GSUP_IE ts_GSUP_IE_CURRENT_RAT_TYPE(GSUP_RatType ratt) := { |
| 1213 | tag := OSMO_GSUP_CURRENT_RAT_TYPE_IE, |
| 1214 | len := 0, /* overwritten */ |
| 1215 | val := { |
| 1216 | current_rat_type := ratt |
Harald Welte | 8eebb6c | 2019-08-22 12:40:03 +0200 | [diff] [blame] | 1217 | } |
| 1218 | } |
| 1219 | |
| 1220 | |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1221 | private function f_gen_ts_ss_ies( |
| 1222 | hexstring imsi, |
| 1223 | OCT4 sid, |
| 1224 | GSUP_SessionState state, |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1225 | template (omit) octetstring ss := omit, |
| 1226 | template (omit) integer cause := omit |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1227 | ) return GSUP_IEs { |
| 1228 | /* Mandatory IEs */ |
| 1229 | var GSUP_IEs ies := { |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1230 | valueof(ts_GSUP_IE_IMSI(imsi)) |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1231 | }; |
| 1232 | |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1233 | /* Cause IE is needed for PROC_SS_ERR */ |
| 1234 | if (isvalue(cause)) { |
| 1235 | ies := ies & { valueof(ts_GSUP_IE_Cause(valueof(cause))) }; |
| 1236 | } |
| 1237 | |
| 1238 | /* Mandatory session IEs */ |
| 1239 | ies := ies & { valueof(ts_GSUP_IE_SessionId(sid)) }; |
| 1240 | ies := ies & { valueof(ts_GSUP_IE_SessionState(state)) }; |
| 1241 | |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1242 | /* Optional SS payload */ |
| 1243 | if (isvalue(ss)) { |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1244 | ies := ies & { valueof(ts_GSUP_IE_SSInfo(valueof(ss))) }; |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1245 | } |
| 1246 | |
| 1247 | return ies; |
| 1248 | } |
| 1249 | private function f_gen_tr_ss_ies( |
| 1250 | template hexstring imsi, |
| 1251 | template OCT4 sid := ?, |
| 1252 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1253 | template octetstring ss := omit, |
| 1254 | template integer cause := omit |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1255 | ) return template GSUP_IEs { |
| 1256 | /* Mandatory IEs */ |
| 1257 | var template GSUP_IEs ies := { |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1258 | tr_GSUP_IE_IMSI(imsi) |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1259 | }; |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1260 | var integer idx := 1; |
| 1261 | |
| 1262 | /* Cause IE is needed for PROC_SS_ERR */ |
| 1263 | if (istemplatekind(cause, "*")) { |
| 1264 | ies[idx] := *; |
| 1265 | idx := idx + 1; |
| 1266 | } else if (not istemplatekind(cause, "omit")) { |
| 1267 | ies[idx] := tr_GSUP_IE_Cause(cause); |
| 1268 | idx := idx + 1; |
| 1269 | } |
| 1270 | |
| 1271 | /* Mandatory session IEs */ |
| 1272 | ies[idx] := tr_GSUP_IE_SessionId(sid); |
| 1273 | ies[idx + 1] := tr_GSUP_IE_SessionState(state); |
| 1274 | idx := idx + 2; |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1275 | |
| 1276 | /* Optional SS payload */ |
| 1277 | if (istemplatekind(ss, "*")) { |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1278 | ies[idx] := *; |
| 1279 | idx := idx + 1; |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1280 | } else if (not istemplatekind(ss, "omit")) { |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1281 | ies[idx] := tr_GSUP_IE_SSInfo(ss); |
| 1282 | idx := idx + 1; |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1283 | } |
| 1284 | |
Harald Welte | 0622a9f | 2019-05-11 10:58:15 +0200 | [diff] [blame] | 1285 | /* the GSUP Message Class IE is optional, as old implementations don't have it yet */ |
| 1286 | var template GSUP_IEs ies2 := ies; |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1287 | ies2[idx] := tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_USSD); |
| 1288 | idx := idx + 1; |
Harald Welte | 0622a9f | 2019-05-11 10:58:15 +0200 | [diff] [blame] | 1289 | |
| 1290 | return (ies, ies2); |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1291 | } |
| 1292 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1293 | template (value) GSUP_PDU ts_GSUP_PROC_SS_REQ( |
| 1294 | hexstring imsi, |
| 1295 | OCT4 sid, |
| 1296 | GSUP_SessionState state, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1297 | template (omit) octetstring ss := omit |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1298 | ) := ts_GSUP( |
| 1299 | OSMO_GSUP_MSGT_PROC_SS_REQUEST, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1300 | f_gen_ts_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1301 | ); |
| 1302 | template GSUP_PDU tr_GSUP_PROC_SS_REQ( |
| 1303 | template hexstring imsi, |
| 1304 | template OCT4 sid := ?, |
| 1305 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1306 | template octetstring ss := * |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1307 | ) := tr_GSUP( |
| 1308 | OSMO_GSUP_MSGT_PROC_SS_REQUEST, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1309 | f_gen_tr_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1310 | ); |
| 1311 | |
| 1312 | template (value) GSUP_PDU ts_GSUP_PROC_SS_RES( |
| 1313 | hexstring imsi, |
| 1314 | OCT4 sid, |
| 1315 | GSUP_SessionState state, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1316 | template (omit) octetstring ss := omit |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1317 | ) := ts_GSUP( |
| 1318 | OSMO_GSUP_MSGT_PROC_SS_RESULT, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1319 | f_gen_ts_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1320 | ); |
| 1321 | template GSUP_PDU tr_GSUP_PROC_SS_RES( |
| 1322 | template hexstring imsi, |
| 1323 | template OCT4 sid := ?, |
| 1324 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1325 | template octetstring ss := * |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1326 | ) := tr_GSUP( |
| 1327 | OSMO_GSUP_MSGT_PROC_SS_RESULT, |
Vadim Yanitskiy | 911257e | 2018-06-21 04:18:54 +0700 | [diff] [blame] | 1328 | f_gen_tr_ss_ies(imsi, sid, state, ss) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1329 | ); |
| 1330 | |
| 1331 | template (value) GSUP_PDU ts_GSUP_PROC_SS_ERR( |
| 1332 | hexstring imsi, |
| 1333 | OCT4 sid, |
Vadim Yanitskiy | 21c4233 | 2018-11-29 00:18:05 +0700 | [diff] [blame] | 1334 | GSUP_SessionState state, |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1335 | integer cause |
| 1336 | ) := ts_GSUP( |
| 1337 | OSMO_GSUP_MSGT_PROC_SS_ERROR, |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1338 | f_gen_ts_ss_ies(imsi, sid, state, cause := cause) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1339 | ); |
| 1340 | template GSUP_PDU tr_GSUP_PROC_SS_ERR( |
| 1341 | template hexstring imsi, |
| 1342 | template OCT4 sid := ?, |
Vadim Yanitskiy | 21c4233 | 2018-11-29 00:18:05 +0700 | [diff] [blame] | 1343 | template GSUP_SessionState state := ?, |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1344 | template integer cause := ? |
| 1345 | ) := tr_GSUP( |
| 1346 | OSMO_GSUP_MSGT_PROC_SS_ERROR, |
Vadim Yanitskiy | 6c9fafc | 2019-06-15 02:51:22 +0700 | [diff] [blame] | 1347 | f_gen_tr_ss_ies(imsi, sid, state, cause := cause) |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 1348 | ); |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 1349 | |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1350 | template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_REQ( |
| 1351 | hexstring imsi, |
| 1352 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1353 | GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1354 | GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1355 | octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */ |
| 1356 | ) := ts_GSUP( |
| 1357 | OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST, |
| 1358 | { |
| 1359 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1360 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1361 | valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)), |
| 1362 | valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)), |
| 1363 | valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)) |
| 1364 | } |
| 1365 | ); |
| 1366 | template GSUP_PDU tr_GSUP_MO_FORWARD_SM_REQ( |
| 1367 | template hexstring imsi := ?, |
| 1368 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1369 | template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1370 | template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1371 | template octetstring sm_rp_ui /* SM TPDU, see 7.6.8.4 */ |
| 1372 | ) := tr_GSUP( |
| 1373 | OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST, |
| 1374 | { |
| 1375 | tr_GSUP_IE_IMSI(imsi), |
| 1376 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1377 | tr_GSUP_IE_SM_RP_DA(sm_rp_da), |
| 1378 | tr_GSUP_IE_SM_RP_OA(sm_rp_oa), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1379 | tr_GSUP_IE_SM_RP_UI(sm_rp_ui), |
| 1380 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS) |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1381 | } |
| 1382 | ); |
| 1383 | |
| 1384 | template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_RES( |
| 1385 | hexstring imsi, |
| 1386 | OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1387 | ) := ts_GSUP( |
| 1388 | OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT, |
| 1389 | { |
| 1390 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1391 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)) |
| 1392 | } |
| 1393 | ); |
| 1394 | template GSUP_PDU tr_GSUP_MO_FORWARD_SM_RES( |
| 1395 | template hexstring imsi := ?, |
| 1396 | template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1397 | ) := tr_GSUP( |
| 1398 | OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT, |
| 1399 | { |
| 1400 | tr_GSUP_IE_IMSI(imsi), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1401 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1402 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS) |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1403 | } |
| 1404 | ); |
| 1405 | |
| 1406 | template (value) GSUP_PDU ts_GSUP_MO_FORWARD_SM_ERR( |
| 1407 | hexstring imsi, |
| 1408 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1409 | OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1410 | ) := ts_GSUP( |
| 1411 | OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR, |
| 1412 | { |
| 1413 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1414 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1415 | valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)) |
| 1416 | } |
| 1417 | ); |
| 1418 | template GSUP_PDU tr_GSUP_MO_FORWARD_SM_ERR( |
| 1419 | template hexstring imsi := ?, |
| 1420 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1421 | template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1422 | ) := tr_GSUP( |
| 1423 | OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR, |
| 1424 | { |
| 1425 | tr_GSUP_IE_IMSI(imsi), |
| 1426 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1427 | tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause), |
| 1428 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS) |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1429 | } |
| 1430 | ); |
| 1431 | |
| 1432 | template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_REQ( |
| 1433 | hexstring imsi, |
| 1434 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1435 | GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1436 | GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1437 | octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */ |
| 1438 | OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */ |
| 1439 | ) := ts_GSUP( |
| 1440 | OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST, |
| 1441 | { |
| 1442 | /** |
| 1443 | * TODO: add MT-specific fields (and IEs): |
| 1444 | * - smDeliveryTimer |
| 1445 | * - smDeliveryStartTime |
| 1446 | */ |
| 1447 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1448 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1449 | valueof(ts_GSUP_IE_SM_RP_DA(sm_rp_da)), |
| 1450 | valueof(ts_GSUP_IE_SM_RP_OA(sm_rp_oa)), |
| 1451 | valueof(ts_GSUP_IE_SM_RP_UI(sm_rp_ui)), |
| 1452 | valueof(ts_GSUP_IE_SM_RP_MMS(sm_rp_mms)) |
| 1453 | } |
| 1454 | ); |
| 1455 | template GSUP_PDU tr_GSUP_MT_FORWARD_SM_REQ( |
| 1456 | template hexstring imsi := ?, |
| 1457 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1458 | template GSUP_SM_RP_DA sm_rp_da, /* Destination Address, see 7.6.8.1 */ |
| 1459 | template GSUP_SM_RP_OA sm_rp_oa, /* Originating Address, see 7.6.8.2 */ |
| 1460 | template octetstring sm_rp_ui, /* SM TPDU, see 7.6.8.4 */ |
| 1461 | template OCT1 sm_rp_mms /* MMS (More Messages to Send), see 7.6.8.7 */ |
| 1462 | ) := tr_GSUP( |
| 1463 | OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST, |
| 1464 | { |
| 1465 | /** |
| 1466 | * TODO: add MT-specific fields (and IEs): |
| 1467 | * - smDeliveryTimer |
| 1468 | * - smDeliveryStartTime |
| 1469 | */ |
| 1470 | tr_GSUP_IE_IMSI(imsi), |
| 1471 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1472 | tr_GSUP_IE_SM_RP_DA(sm_rp_da), |
| 1473 | tr_GSUP_IE_SM_RP_OA(sm_rp_oa), |
| 1474 | tr_GSUP_IE_SM_RP_UI(sm_rp_ui), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1475 | tr_GSUP_IE_SM_RP_MMS(sm_rp_mms), |
| 1476 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS) |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1477 | } |
| 1478 | ); |
| 1479 | |
| 1480 | template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_RES( |
| 1481 | hexstring imsi, |
| 1482 | OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1483 | ) := ts_GSUP( |
| 1484 | OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT, |
| 1485 | { |
| 1486 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1487 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)) |
| 1488 | } |
| 1489 | ); |
| 1490 | template GSUP_PDU tr_GSUP_MT_FORWARD_SM_RES( |
| 1491 | template hexstring imsi := ?, |
| 1492 | template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1493 | ) := tr_GSUP( |
| 1494 | OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT, |
| 1495 | { |
| 1496 | tr_GSUP_IE_IMSI(imsi), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1497 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1498 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS) |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1499 | } |
| 1500 | ); |
| 1501 | |
| 1502 | template (value) GSUP_PDU ts_GSUP_MT_FORWARD_SM_ERR( |
| 1503 | hexstring imsi, |
| 1504 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1505 | OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1506 | ) := ts_GSUP( |
| 1507 | OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR, |
| 1508 | { |
| 1509 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1510 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1511 | valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)) |
| 1512 | } |
| 1513 | ); |
| 1514 | template GSUP_PDU tr_GSUP_MT_FORWARD_SM_ERR( |
| 1515 | template hexstring imsi := ?, |
| 1516 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1517 | template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1518 | ) := tr_GSUP( |
| 1519 | OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR, |
| 1520 | { |
| 1521 | tr_GSUP_IE_IMSI(imsi), |
| 1522 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1523 | tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause), |
| 1524 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS) |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 1525 | } |
| 1526 | ); |
| 1527 | |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 1528 | template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_REQ( |
| 1529 | hexstring imsi, |
| 1530 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1531 | GSUP_SM_ALERT_RSN_Type sm_alert_rsn /* SM Alert Reason, see 7.6.8.8 */ |
| 1532 | ) := ts_GSUP( |
| 1533 | OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST, |
| 1534 | { |
| 1535 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1536 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1537 | valueof(ts_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn)) |
| 1538 | } |
| 1539 | ); |
| 1540 | template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_REQ( |
| 1541 | template hexstring imsi := ?, |
| 1542 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1543 | template GSUP_SM_ALERT_RSN_Type sm_alert_rsn := ? /* SM Alert Reason, see 7.6.8.8 */ |
| 1544 | ) := tr_GSUP( |
| 1545 | OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST, |
| 1546 | { |
| 1547 | tr_GSUP_IE_IMSI(imsi), |
| 1548 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1549 | tr_GSUP_IE_SM_ALERT_RSN(sm_alert_rsn), |
| 1550 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS) |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 1551 | } |
| 1552 | ); |
| 1553 | |
| 1554 | template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_RES( |
| 1555 | hexstring imsi, |
| 1556 | OCT1 sm_rp_mr /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1557 | ) := ts_GSUP( |
| 1558 | OSMO_GSUP_MSGT_READY_FOR_SM_RESULT, |
| 1559 | { |
| 1560 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1561 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)) |
| 1562 | } |
| 1563 | ); |
| 1564 | template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_RES( |
| 1565 | template hexstring imsi := ?, |
| 1566 | template OCT1 sm_rp_mr := ? /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1567 | ) := tr_GSUP( |
| 1568 | OSMO_GSUP_MSGT_READY_FOR_SM_RESULT, |
| 1569 | { |
| 1570 | tr_GSUP_IE_IMSI(imsi), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1571 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
| 1572 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS) |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 1573 | } |
| 1574 | ); |
| 1575 | |
| 1576 | template (value) GSUP_PDU ts_GSUP_MO_READY_FOR_SM_ERR( |
| 1577 | hexstring imsi, |
| 1578 | OCT1 sm_rp_mr, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1579 | OCT1 sm_rp_cause /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1580 | ) := ts_GSUP( |
| 1581 | OSMO_GSUP_MSGT_READY_FOR_SM_ERROR, |
| 1582 | { |
| 1583 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1584 | valueof(ts_GSUP_IE_SM_RP_MR(sm_rp_mr)), |
| 1585 | valueof(ts_GSUP_IE_SM_RP_CAUSE(sm_rp_cause)) |
| 1586 | } |
| 1587 | ); |
| 1588 | template GSUP_PDU tr_GSUP_MO_READY_FOR_SM_ERR( |
| 1589 | template hexstring imsi := ?, |
| 1590 | template OCT1 sm_rp_mr := ?, /* Message Reference, see GSM TS 04.11, 8.2.3 */ |
| 1591 | template OCT1 sm_rp_cause := ? /* RP-Cause value, see GSM TS 04.11, 8.2.5.4 */ |
| 1592 | ) := tr_GSUP( |
| 1593 | OSMO_GSUP_MSGT_READY_FOR_SM_ERROR, |
| 1594 | { |
| 1595 | tr_GSUP_IE_IMSI(imsi), |
| 1596 | tr_GSUP_IE_SM_RP_MR(sm_rp_mr), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1597 | tr_GSUP_IE_SM_RP_CAUSE(sm_rp_cause), |
| 1598 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_SMS) |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 1599 | } |
| 1600 | ); |
| 1601 | |
Harald Welte | 8eebb6c | 2019-08-22 12:40:03 +0200 | [diff] [blame] | 1602 | function f_gsup_find_nested_ie(GSUP_IEs ies, GSUP_IEI iei, out GSUP_IeValue ret) return boolean { |
| 1603 | for (var integer i := 0; i < sizeof(ies); i := i+1) { |
| 1604 | if (ies[i].tag == iei) { |
| 1605 | ret := ies[i].val; |
Harald Welte | f9d449e | 2018-06-24 22:27:47 +0200 | [diff] [blame] | 1606 | return true; |
| 1607 | } |
| 1608 | } |
Harald Welte | 8eebb6c | 2019-08-22 12:40:03 +0200 | [diff] [blame] | 1609 | return false; |
| 1610 | } |
| 1611 | |
| 1612 | function f_gsup_find_ie(GSUP_PDU msg, GSUP_IEI iei, out GSUP_IeValue ret) return boolean { |
| 1613 | return f_gsup_find_nested_ie(msg.ies, iei, ret); |
Harald Welte | f9d449e | 2018-06-24 22:27:47 +0200 | [diff] [blame] | 1614 | } |
| 1615 | |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 1616 | template GSUP_AN_APDU t_GSUP_AN_APDU( |
| 1617 | template GSUP_AN_PROTO an_proto := ?, |
| 1618 | template octetstring pdu := ? |
| 1619 | ) := { |
| 1620 | proto := an_proto, |
| 1621 | pdu := pdu |
| 1622 | }; |
| 1623 | |
| 1624 | template GSUP_PDU tr_GSUP_E_AN_APDU( |
| 1625 | template GSUP_MessageType msgt, |
| 1626 | template hexstring imsi := ?, |
| 1627 | template octetstring source_name := ?, |
| 1628 | template octetstring destination_name := ?, |
| 1629 | template GSUP_AN_APDU an_apdu := ? |
| 1630 | ) := tr_GSUP( |
| 1631 | msgt, |
| 1632 | { |
| 1633 | tr_GSUP_IE_IMSI(imsi), |
| 1634 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC), |
| 1635 | tr_GSUP_IE_Source_Name(source_name), |
| 1636 | tr_GSUP_IE_Destination_Name(destination_name), |
| 1637 | tr_GSUP_IE_AN_APDU(an_apdu) |
| 1638 | } |
| 1639 | ); |
| 1640 | |
| 1641 | template GSUP_PDU tr_GSUP_E_NO_PDU( |
| 1642 | template GSUP_MessageType msgt, |
| 1643 | template hexstring imsi := ?, |
| 1644 | template octetstring source_name := ?, |
| 1645 | template octetstring destination_name := ? |
| 1646 | ) := tr_GSUP( |
| 1647 | msgt, |
| 1648 | { |
| 1649 | tr_GSUP_IE_IMSI(imsi), |
| 1650 | tr_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC), |
| 1651 | tr_GSUP_IE_Source_Name(source_name), |
| 1652 | tr_GSUP_IE_Destination_Name(destination_name) |
| 1653 | } |
| 1654 | ); |
| 1655 | |
| 1656 | template (value) GSUP_PDU ts_GSUP_E_AN_APDU( |
| 1657 | GSUP_MessageType msgt, |
| 1658 | hexstring imsi, |
| 1659 | octetstring source_name, |
| 1660 | octetstring destination_name, |
| 1661 | GSUP_AN_APDU an_apdu |
| 1662 | ) := ts_GSUP( |
| 1663 | msgt, |
| 1664 | { |
| 1665 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1666 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)), |
| 1667 | valueof(ts_GSUP_IE_Source_Name(source_name)), |
| 1668 | valueof(ts_GSUP_IE_Destination_Name(destination_name)), |
| 1669 | valueof(ts_GSUP_IE_AN_APDU(an_apdu)) |
| 1670 | } |
| 1671 | ); |
| 1672 | |
| 1673 | template (value) GSUP_PDU ts_GSUP_E_PrepareHandoverResult( |
| 1674 | hexstring imsi, |
| 1675 | hexstring msisdn, |
| 1676 | octetstring source_name, |
| 1677 | octetstring destination_name, |
| 1678 | GSUP_AN_APDU an_apdu |
| 1679 | ) := ts_GSUP( |
| 1680 | OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT, |
| 1681 | { |
| 1682 | valueof(ts_GSUP_IE_IMSI(imsi)), |
| 1683 | valueof(ts_GSUP_IE_MSISDN(msisdn)), |
| 1684 | valueof(ts_GSUP_IE_Message_Class(OSMO_GSUP_MESSAGE_CLASS_INTER_MSC)), |
| 1685 | valueof(ts_GSUP_IE_Source_Name(source_name)), |
| 1686 | valueof(ts_GSUP_IE_Destination_Name(destination_name)), |
| 1687 | valueof(ts_GSUP_IE_AN_APDU(an_apdu)) |
| 1688 | } |
| 1689 | ); |
Harald Welte | f9d449e | 2018-06-24 22:27:47 +0200 | [diff] [blame] | 1690 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 1691 | } with { encode "RAW"; variant "FIELDORDER(msb)" } |