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