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