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