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), |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 32 | OSMO_GSUP_PDP_ADDRESS_IE ('11'O), |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 33 | OSMO_GSUP_ACCESS_POINT_NAME_IE ('12'O), |
| 34 | OSMO_GSUP_PDP_QOS_IE ('13'O), |
| 35 | OSMO_GSUP_CHARG_CHAR_IE ('14'O), |
| 36 | |
| 37 | OSMO_GSUP_RAND_IE ('20'O), |
| 38 | OSMO_GSUP_SRES_IE ('21'O), |
| 39 | OSMO_GSUP_KC_IE ('22'O), |
| 40 | OSMO_GSUP_IK_IE ('23'O), |
| 41 | OSMO_GSUP_CK_IE ('24'O), |
| 42 | OSMO_GSUP_AUTN_IE ('25'O), |
| 43 | OSMO_GSUP_AUTS_IE ('26'O), |
| 44 | OSMO_GSUP_RES_IE ('27'O), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 45 | OSMO_GSUP_CN_DOMAIN_IE ('28'O), |
Harald Welte | 0a1fd0e | 2019-12-03 20:01:08 +0100 | [diff] [blame] | 46 | OSMO_GSUP_SUPPORTED_RAT_TYPES_IE ('29'O), |
| 47 | OSMO_GSUP_CURRENT_RAT_TYPE_IE ('2a'O), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 48 | |
| 49 | OSMO_GSUP_SESSION_ID_IE ('30'O), |
| 50 | OSMO_GSUP_SESSION_STATE_IE ('31'O), |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 51 | OSMO_GSUP_SS_INFO_IE ('35'O), |
| 52 | |
| 53 | /* SM related IEs (see 3GPP TS 29.002, section 7.6.8) */ |
| 54 | OSMO_GSUP_SM_RP_MR_IE ('40'O), |
| 55 | OSMO_GSUP_SM_RP_DA_IE ('41'O), |
| 56 | OSMO_GSUP_SM_RP_OA_IE ('42'O), |
| 57 | OSMO_GSUP_SM_RP_UI_IE ('43'O), |
| 58 | OSMO_GSUP_SM_RP_CAUSE_IE ('44'O), |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 59 | OSMO_GSUP_SM_RP_MMS_IE ('45'O), |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 60 | OSMO_GSUP_SM_ALERT_RSN_IE ('46'O), |
| 61 | |
| 62 | OSMO_GSUP_IMEI_IE ('50'O), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 63 | OSMO_GSUP_IMEI_RESULT_IE ('51'O), |
Alexander Couzens | 752f86b | 2020-01-10 07:56:31 +0100 | [diff] [blame] | 64 | OSMO_GSUP_NUM_VECTORS_REQ_IE ('52'O), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 65 | |
| 66 | OSMO_GSUP_MESSAGE_CLASS_IE ('0a'O), |
| 67 | |
| 68 | OSMO_GSUP_SOURCE_NAME_IE ('60'O), |
| 69 | OSMO_GSUP_DESTINATION_NAME_IE ('61'O), |
| 70 | OSMO_GSUP_AN_APDU_IE ('62'O), |
| 71 | OSMO_GSUP_CAUSE_RR_IE ('63'O), |
| 72 | OSMO_GSUP_CAUSE_BSSAP_IE ('64'O), |
| 73 | OSMO_GSUP_CAUSE_SM_IE ('65'O) |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 74 | } with { variant "FIELDLENGTH(8)" }; |
| 75 | |
| 76 | type enumerated GSUP_MessageType { |
| 77 | OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST ('00000100'B), |
| 78 | OSMO_GSUP_MSGT_UPDATE_LOCATION_ERROR ('00000101'B), |
| 79 | OSMO_GSUP_MSGT_UPDATE_LOCATION_RESULT ('00000110'B), |
| 80 | |
| 81 | OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST ('00001000'B), |
| 82 | OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR ('00001001'B), |
| 83 | OSMO_GSUP_MSGT_SEND_AUTH_INFO_RESULT ('00001010'B), |
| 84 | |
| 85 | OSMO_GSUP_MSGT_AUTH_FAIL_REPORT ('00001011'B), |
| 86 | |
| 87 | OSMO_GSUP_MSGT_PURGE_MS_REQUEST ('00001100'B), |
| 88 | OSMO_GSUP_MSGT_PURGE_MS_ERROR ('00001101'B), |
| 89 | OSMO_GSUP_MSGT_PURGE_MS_RESULT ('00001110'B), |
| 90 | |
| 91 | OSMO_GSUP_MSGT_INSERT_DATA_REQUEST ('00010000'B), |
| 92 | OSMO_GSUP_MSGT_INSERT_DATA_ERROR ('00010001'B), |
| 93 | OSMO_GSUP_MSGT_INSERT_DATA_RESULT ('00010010'B), |
| 94 | |
| 95 | OSMO_GSUP_MSGT_DELETE_DATA_REQUEST ('00010100'B), |
| 96 | OSMO_GSUP_MSGT_DELETE_DATA_ERROR ('00010101'B), |
| 97 | OSMO_GSUP_MSGT_DELETE_DATA_RESULT ('00010110'B), |
| 98 | |
| 99 | OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST ('00011100'B), |
| 100 | OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR ('00011101'B), |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 101 | OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT ('00011110'B), |
| 102 | |
| 103 | OSMO_GSUP_MSGT_PROC_SS_REQUEST ('00100000'B), |
| 104 | OSMO_GSUP_MSGT_PROC_SS_ERROR ('00100001'B), |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 105 | OSMO_GSUP_MSGT_PROC_SS_RESULT ('00100010'B), |
| 106 | |
| 107 | OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST ('00100100'B), |
| 108 | OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR ('00100101'B), |
| 109 | OSMO_GSUP_MSGT_MO_FORWARD_SM_RESULT ('00100110'B), |
| 110 | |
| 111 | OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST ('00101000'B), |
| 112 | OSMO_GSUP_MSGT_MT_FORWARD_SM_ERROR ('00101001'B), |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 113 | OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT ('00101010'B), |
| 114 | |
| 115 | OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST ('00101100'B), |
| 116 | OSMO_GSUP_MSGT_READY_FOR_SM_ERROR ('00101101'B), |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 117 | OSMO_GSUP_MSGT_READY_FOR_SM_RESULT ('00101110'B), |
| 118 | |
| 119 | OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST ('00110000'B), |
| 120 | OSMO_GSUP_MSGT_CHECK_IMEI_ERROR ('00110001'B), |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 121 | OSMO_GSUP_MSGT_CHECK_IMEI_RESULT ('00110010'B), |
| 122 | |
| 123 | OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_REQUEST ('00110100'B), |
| 124 | OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_ERROR ('00110101'B), |
| 125 | OSMO_GSUP_MSGT_E_PREPARE_HANDOVER_RESULT ('00110110'B), |
| 126 | |
| 127 | OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_REQUEST ('00111000'B), |
| 128 | OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_ERROR ('00111001'B), |
| 129 | OSMO_GSUP_MSGT_E_PREPARE_SUBSEQUENT_HANDOVER_RESULT ('00111010'B), |
| 130 | |
| 131 | OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_REQUEST ('00111100'B), |
| 132 | OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_ERROR ('00111101'B), |
| 133 | OSMO_GSUP_MSGT_E_SEND_END_SIGNAL_RESULT ('00111110'B), |
| 134 | |
| 135 | OSMO_GSUP_MSGT_E_PROCESS_ACCESS_SIGNALLING_REQUEST ('01000000'B), |
| 136 | OSMO_GSUP_MSGT_E_FORWARD_ACCESS_SIGNALLING_REQUEST ('01000100'B), |
| 137 | |
| 138 | OSMO_GSUP_MSGT_E_CLOSE ('01000111'B), |
| 139 | OSMO_GSUP_MSGT_E_ABORT ('01001011'B), |
| 140 | |
Pau Espin Pedrol | afe3e19 | 2023-10-19 16:55:56 +0200 | [diff] [blame] | 141 | OSMO_GSUP_MSGT_E_ROUTING_ERROR ('01001110'B), |
| 142 | |
| 143 | OSMO_GSUP_MSGT_EPDG_TUNNEL_REQUEST ('01010000'B), |
| 144 | OSMO_GSUP_MSGT_EPDG_TUNNEL_ERROR ('01010001'B), |
| 145 | OSMO_GSUP_MSGT_EPDG_TUNNEL_RESULT ('01010010'B) |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 146 | } with { variant "FIELDLENGTH(8)" }; |
| 147 | |
| 148 | type enumerated GSUP_CancelType { |
Alexander Couzens | 4786b3f | 2018-09-16 03:33:30 +0200 | [diff] [blame] | 149 | OSMO_GSUP_CANCEL_TYPE_UPDATE (0), |
| 150 | OSMO_GSUP_CANCEL_TYPE_WITHDRAW (1) |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 151 | } with { variant "FIELDLENGTH(8)" }; |
| 152 | |
| 153 | type enumerated GSUP_CnDomain { |
| 154 | OSMO_GSUP_CN_DOMAIN_PS (1), |
| 155 | OSMO_GSUP_CN_DOMAIN_CS (2) |
| 156 | } with { variant "FIELDLENGTH(8)" }; |
| 157 | |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 158 | type enumerated GSUP_IMEIResult { |
| 159 | OSMO_GSUP_IMEI_RESULT_ACK (0), |
| 160 | OSMO_GSUP_IMEI_RESULT_NACK (1) |
| 161 | } with { variant "FIELDLENGTH(8)" }; |
| 162 | |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 163 | type enumerated GSUP_SessionState { |
| 164 | OSMO_GSUP_SESSION_STATE_NONE (0), |
| 165 | OSMO_GSUP_SESSION_STATE_BEGIN (1), |
| 166 | OSMO_GSUP_SESSION_STATE_CONTINUE (2), |
| 167 | OSMO_GSUP_SESSION_STATE_END (3) |
| 168 | } with { variant "FIELDLENGTH(8)" }; |
| 169 | |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 170 | type enumerated GSUP_Message_Class { |
| 171 | OSMO_GSUP_MESSAGE_CLASS_UNSET (0), |
| 172 | OSMO_GSUP_MESSAGE_CLASS_SUBSCRIBER_MANAGEMENT (1), |
| 173 | OSMO_GSUP_MESSAGE_CLASS_SMS (2), |
| 174 | OSMO_GSUP_MESSAGE_CLASS_USSD (3), |
Pau Espin Pedrol | 2f66a59 | 2024-01-17 18:49:44 +0100 | [diff] [blame] | 175 | OSMO_GSUP_MESSAGE_CLASS_INTER_MSC (4), |
| 176 | OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG (5) |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 177 | } with { variant "FIELDLENGTH(8)" }; |
| 178 | |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 179 | type record GSUP_MSISDN { |
| 180 | uint8_t len, |
| 181 | hexstring digits optional |
| 182 | } with { variant (len) "LENGTHTO(digits)" }; |
| 183 | |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 184 | type record GSUP_IMEI { |
| 185 | uint8_t len, |
| 186 | hexstring digits optional |
| 187 | } with { variant (len) "LENGTHTO(digits)" }; |
| 188 | |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 189 | type enumerated GSUP_AN_PROTO { |
| 190 | OSMO_GSUP_AN_PROTO_48006 (1), |
| 191 | OSMO_GSUP_AN_PROTO_25413 (2) |
| 192 | } with { variant "FIELDLENGTH(8)" }; |
| 193 | |
| 194 | type record GSUP_AN_APDU { |
| 195 | GSUP_AN_PROTO proto, |
| 196 | octetstring pdu |
| 197 | }; |
| 198 | |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 199 | type union GSUP_PDP_Address { |
| 200 | GSUP_PDP_Address_IPv4 ipv4, |
| 201 | GSUP_PDP_Address_IPv6 ipv6, |
| 202 | GSUP_PDP_Address_IPv4v6 ipv4v6, |
| 203 | GSUP_PDP_Address_unknown other |
| 204 | } with { variant "TAG(ipv4, pdp_typenum = '21'O; |
| 205 | ipv6, pdp_typenum = '57'O; |
| 206 | ipv4v6, pdp_typenum = '8D'O; |
| 207 | other, OTHERWISE;)" }; |
| 208 | |
| 209 | type record GSUP_PDP_Address_IPv4 { |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 210 | BIT4 spare, |
Pau Espin Pedrol | a518d05 | 2024-01-30 12:35:33 +0100 | [diff] [blame] | 211 | BIT4 pdp_typeorg, |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 212 | OCT1 pdp_typenum, |
| 213 | OCT4 ipv4_address optional |
| 214 | }; |
| 215 | |
| 216 | type record GSUP_PDP_Address_IPv6 { |
Pau Espin Pedrol | a518d05 | 2024-01-30 12:35:33 +0100 | [diff] [blame] | 217 | BIT4 spare, |
| 218 | BIT4 pdp_typeorg, |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 219 | OCT1 pdp_typenum, |
| 220 | OCT16 ipv6_address optional |
| 221 | }; |
| 222 | |
| 223 | type record GSUP_PDP_Address_IPv4v6 { |
Pau Espin Pedrol | a518d05 | 2024-01-30 12:35:33 +0100 | [diff] [blame] | 224 | BIT4 spare, |
| 225 | BIT4 pdp_typeorg, |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 226 | OCT1 pdp_typenum, |
| 227 | OCT4 ipv4_address optional, |
| 228 | OCT16 ipv6_address optional |
| 229 | }; |
| 230 | |
| 231 | type record GSUP_PDP_Address_unknown { |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 232 | BIT4 spare, |
Pau Espin Pedrol | a518d05 | 2024-01-30 12:35:33 +0100 | [diff] [blame] | 233 | BIT4 pdp_typeorg, |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 234 | OCT1 pdp_typenum, |
| 235 | octetstring addr optional |
| 236 | }; |
| 237 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 238 | type record GSUP_IE { |
| 239 | GSUP_IEI tag, |
| 240 | uint8_t len, |
| 241 | GSUP_IeValue val |
| 242 | } with { variant (len) "LENGTHTO(val)" |
| 243 | variant (val) "CROSSTAG(imsi, tag = OSMO_GSUP_IMSI_IE; |
| 244 | cause, tag = OSMO_GSUP_CAUSE_IE; |
| 245 | cancel_type, tag = OSMO_GSUP_CANCEL_TYPE_IE; |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 246 | auth_tuple, tag = OSMO_GSUP_AUTH_TUPLE_IE; |
Pau Espin Pedrol | bb76d7a | 2024-01-22 19:56:13 +0100 | [diff] [blame] | 247 | pdp_info_compl, tag = OSMO_GSUP_PDP_INFO_COMPL_IE; |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 248 | auts, tag = OSMO_GSUP_AUTS_IE; |
| 249 | rand, tag = OSMO_GSUP_RAND_IE; |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 250 | sres, tag = OSMO_GSUP_SRES_IE; |
| 251 | kc, tag = OSMO_GSUP_KC_IE; |
| 252 | ik, tag = OSMO_GSUP_IK_IE; |
| 253 | ck, tag = OSMO_GSUP_CK_IE; |
| 254 | autn, tag = OSMO_GSUP_AUTN_IE; |
| 255 | res, tag = OSMO_GSUP_RES_IE; |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 256 | msisdn, tag = OSMO_GSUP_MSISDN_IE; |
| 257 | hlr_number, tag = OSMO_GSUP_HLR_NUMBER_IE; |
| 258 | cn_domain, tag = OSMO_GSUP_CN_DOMAIN_IE; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 259 | pdp_info, tag = OSMO_GSUP_PDP_INFO_IE; |
| 260 | apn, tag = OSMO_GSUP_ACCESS_POINT_NAME_IE; |
| 261 | pdp_qos, tag = OSMO_GSUP_PDP_QOS_IE; |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 262 | pdp_address, tag = OSMO_GSUP_PDP_ADDRESS_IE; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 263 | charg_char, tag = OSMO_GSUP_CHARG_CHAR_IE; |
Alexander Couzens | 25d2849 | 2023-04-26 19:30:04 +0200 | [diff] [blame] | 264 | pdp_ctx_id, tag = OSMO_GSUP_PDP_CONTEXT_ID_IE; |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 265 | session_state, tag = OSMO_GSUP_SESSION_STATE_IE; |
| 266 | session_id, tag = OSMO_GSUP_SESSION_ID_IE; |
| 267 | ss_info, tag = OSMO_GSUP_SS_INFO_IE; |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 268 | sm_rp_mr, tag = OSMO_GSUP_SM_RP_MR_IE; |
| 269 | sm_rp_da, tag = OSMO_GSUP_SM_RP_DA_IE; |
| 270 | sm_rp_oa, tag = OSMO_GSUP_SM_RP_OA_IE; |
| 271 | sm_rp_ui, tag = OSMO_GSUP_SM_RP_UI_IE; |
| 272 | sm_rp_cause, tag = OSMO_GSUP_SM_RP_CAUSE_IE; |
| 273 | sm_rp_mms, tag = OSMO_GSUP_SM_RP_MMS_IE; |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 274 | sm_alert_rsn, tag = OSMO_GSUP_SM_ALERT_RSN_IE; |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 275 | imei, tag = OSMO_GSUP_IMEI_IE; |
| 276 | imei_result, tag = OSMO_GSUP_IMEI_RESULT_IE; |
Alexander Couzens | 752f86b | 2020-01-10 07:56:31 +0100 | [diff] [blame] | 277 | num_auth_vectors, tag = OSMO_GSUP_NUM_VECTORS_REQ_IE; |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 278 | message_class, tag = OSMO_GSUP_MESSAGE_CLASS_IE; |
| 279 | source_name, tag = OSMO_GSUP_SOURCE_NAME_IE; |
| 280 | destination_name, tag = OSMO_GSUP_DESTINATION_NAME_IE; |
| 281 | an_apdu, tag = OSMO_GSUP_AN_APDU_IE; |
| 282 | cause_rr, tag = OSMO_GSUP_CAUSE_RR_IE; |
| 283 | cause_bssap, tag = OSMO_GSUP_CAUSE_BSSAP_IE; |
| 284 | cause_sm, tag = OSMO_GSUP_CAUSE_SM_IE; |
Harald Welte | 0a1fd0e | 2019-12-03 20:01:08 +0100 | [diff] [blame] | 285 | supported_rat_types, tag = OSMO_GSUP_SUPPORTED_RAT_TYPES_IE; |
| 286 | current_rat_type, tag = OSMO_GSUP_CURRENT_RAT_TYPE_IE; |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 287 | )" |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 288 | }; |
| 289 | |
| 290 | type record of GSUP_IE GSUP_IEs; |
| 291 | |
Harald Welte | 8eebb6c | 2019-08-22 12:40:03 +0200 | [diff] [blame] | 292 | type enumerated GSUP_RatType { |
| 293 | RAT_TYPE_UNKNOWN (0), |
| 294 | RAT_TYPE_GERAN_A (1), |
| 295 | RAT_TYPE_UTRAN_Iu (2), |
| 296 | RAT_TYPE_EUTRAN_SGs (3) |
| 297 | } with { variant "FIELDLENGTH(8)" }; |
| 298 | |
| 299 | type record of GSUP_RatType GSUP_RatTypes; |
| 300 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 301 | type union GSUP_IeValue { |
| 302 | hexstring imsi, |
| 303 | integer cause, |
| 304 | GSUP_CancelType cancel_type, |
Pau Espin Pedrol | bb76d7a | 2024-01-22 19:56:13 +0100 | [diff] [blame] | 305 | octetstring pdp_info_compl, |
| 306 | //octetstring freeze_ptmsi, |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 307 | GSUP_IEs auth_tuple, |
| 308 | octetstring auts, |
| 309 | octetstring rand, |
Harald Welte | 77a8eba | 2018-01-22 21:22:32 +0100 | [diff] [blame] | 310 | octetstring sres, |
| 311 | octetstring kc, |
| 312 | octetstring ik, |
| 313 | octetstring ck, |
| 314 | octetstring autn, |
| 315 | octetstring res, |
Harald Welte | 3f95be8 | 2018-01-27 00:48:13 +0100 | [diff] [blame] | 316 | GSUP_MSISDN msisdn, |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 317 | octetstring hlr_number, |
| 318 | GSUP_CnDomain cn_domain, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 319 | /* PDP context + nested IEs */ |
| 320 | GSUP_IEs pdp_info, |
Alexander Couzens | 25d2849 | 2023-04-26 19:30:04 +0200 | [diff] [blame] | 321 | OCT1 pdp_ctx_id, |
Harald Welte | eded9ad | 2018-02-17 20:57:34 +0100 | [diff] [blame] | 322 | octetstring apn, |
| 323 | octetstring pdp_qos, |
Pau Espin Pedrol | 7b7a1e8 | 2024-01-19 20:49:28 +0100 | [diff] [blame] | 324 | GSUP_PDP_Address pdp_address, |
Vadim Yanitskiy | b761d14 | 2018-06-02 21:05:04 +0700 | [diff] [blame] | 325 | octetstring charg_char, |
| 326 | /* Session information */ |
| 327 | GSUP_SessionState session_state, |
| 328 | OCT4 session_id, |
| 329 | /* Supplementary Services */ |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 330 | octetstring ss_info, |
| 331 | /* Short Message Service */ |
| 332 | OCT1 sm_rp_mr, |
| 333 | GSUP_SM_RP_DA sm_rp_da, |
| 334 | GSUP_SM_RP_OA sm_rp_oa, |
| 335 | octetstring sm_rp_ui, |
| 336 | OCT1 sm_rp_cause, |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 337 | OCT1 sm_rp_mms, |
Oliver Smith | c574829 | 2019-02-22 15:02:48 +0100 | [diff] [blame] | 338 | GSUP_SM_ALERT_RSN_Type sm_alert_rsn, |
| 339 | |
| 340 | GSUP_IMEI imei, |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 341 | GSUP_IMEIResult imei_result, |
Alexander Couzens | 752f86b | 2020-01-10 07:56:31 +0100 | [diff] [blame] | 342 | OCT1 num_auth_vectors, |
Neels Hofmeyr | 0ac6315 | 2019-05-07 01:20:17 +0200 | [diff] [blame] | 343 | |
| 344 | GSUP_Message_Class message_class, |
| 345 | |
| 346 | octetstring source_name, |
| 347 | octetstring destination_name, |
| 348 | |
| 349 | GSUP_AN_APDU an_apdu, |
| 350 | |
| 351 | OCT1 cause_rr, |
| 352 | OCT1 cause_bssap, |
Harald Welte | 8eebb6c | 2019-08-22 12:40:03 +0200 | [diff] [blame] | 353 | OCT1 cause_sm, |
| 354 | |
Harald Welte | 0a1fd0e | 2019-12-03 20:01:08 +0100 | [diff] [blame] | 355 | GSUP_RatTypes supported_rat_types, |
| 356 | GSUP_RatType current_rat_type |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 357 | }; |
| 358 | |
| 359 | type record GSUP_PDU { |
| 360 | GSUP_MessageType msg_type, |
| 361 | GSUP_IEs ies |
| 362 | }; |
| 363 | |
Alexander Couzens | 25d2849 | 2023-04-26 19:30:04 +0200 | [diff] [blame] | 364 | type record of GSUP_PDU GSUP_PDUs; |
| 365 | |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 366 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 367 | external function enc_GSUP_PDU(in GSUP_PDU msg) return octetstring |
| 368 | with { extension "prototype(convert) encode(RAW)" }; |
| 369 | |
| 370 | external function dec_GSUP_PDU(in octetstring msg) return GSUP_PDU |
| 371 | with { extension "prototype(convert) decode(RAW)" }; |
| 372 | |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 373 | /* See 3GPP TS 24.011, figures 8.5 and 8.6 */ |
| 374 | type record GSUP_SM_RP_Addr { |
| 375 | BIT1 ext, /* Extension? */ |
| 376 | BIT3 ton, /* Type of Number */ |
| 377 | BIT4 npi, /* Numbering Plan Identification */ |
| 378 | hexstring number length (1..20) |
| 379 | } with { |
| 380 | variant "PADDING(yes)"; |
| 381 | variant "PADDING_PATTERN('1111'B)" |
| 382 | }; |
| 383 | |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 384 | /** |
| 385 | * SM-RP-DA represents the SM Destination Address, see 7.6.8.1. |
| 386 | * It can be either of the following: |
| 387 | * - IMSI |
| 388 | * - LMSI (not implemented) |
| 389 | * - MSISDN |
| 390 | * - roaming number (not implemented) |
| 391 | * - service centre address |
| 392 | */ |
| 393 | type union GSUP_SM_RP_DA_ID { |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 394 | hexstring imsi, |
| 395 | GSUP_SM_RP_Addr msisdn, |
| 396 | GSUP_SM_RP_Addr smsc_addr |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 397 | }; |
| 398 | |
| 399 | type record GSUP_SM_RP_DA { |
| 400 | GSUP_SM_RP_ODA_IdType id_type, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 401 | GSUP_SM_RP_DA_ID id_enc optional |
Vadim Yanitskiy | f1f39bd | 2018-12-14 08:00:33 +0700 | [diff] [blame] | 402 | } with { variant (id_enc) "CROSSTAG( |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 403 | imsi, id_type = OSMO_GSUP_SM_RP_ODA_ID_IMSI; |
| 404 | msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN; |
| 405 | smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR; |
| 406 | /* FIXME: how to handle noSM-RP-DA? */ |
| 407 | )" |
| 408 | }; |
| 409 | |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 410 | /** |
| 411 | * SM-RP-OA represents the SM Originating Address, see 7.6.8.2. |
| 412 | * It can be either of the following: |
| 413 | * - MSISDN |
| 414 | * - service centre address |
| 415 | */ |
| 416 | type union GSUP_SM_RP_OA_ID { |
Vadim Yanitskiy | a52347c | 2019-12-12 17:32:33 +0900 | [diff] [blame] | 417 | GSUP_SM_RP_Addr msisdn, |
| 418 | GSUP_SM_RP_Addr smsc_addr |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 419 | }; |
| 420 | |
| 421 | type record GSUP_SM_RP_OA { |
| 422 | GSUP_SM_RP_ODA_IdType id_type, |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 423 | GSUP_SM_RP_OA_ID id_enc optional |
Vadim Yanitskiy | f1f39bd | 2018-12-14 08:00:33 +0700 | [diff] [blame] | 424 | } with { variant (id_enc) "CROSSTAG( |
Vadim Yanitskiy | 8a1d4b6 | 2018-09-23 20:28:23 +0700 | [diff] [blame] | 425 | msisdn, id_type = OSMO_GSUP_SM_RP_ODA_ID_MSISDN; |
| 426 | smsc_addr, id_type = OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR; |
| 427 | /* FIXME: how to handle noSM-RP-OA? */ |
| 428 | )" |
| 429 | }; |
| 430 | |
Vadim Yanitskiy | 88e2323 | 2018-11-13 03:04:02 +0700 | [diff] [blame] | 431 | /* SM Alert Reason types, see 7.6.8.8 */ |
| 432 | type enumerated GSUP_SM_ALERT_RSN_Type { |
| 433 | GSUP_SM_ALERT_RSN_TYPE_NONE ('00'O), |
| 434 | GSUP_SM_ALERT_RSN_TYPE_MS_PRESENT ('01'O), |
| 435 | GSUP_SM_ALERT_RSN_TYPE_MEM_AVAIL ('02'O) |
| 436 | } with { variant "FIELDLENGTH(8)" }; |
| 437 | |
Pau Espin Pedrol | 8f1403a | 2024-01-18 20:08:43 +0100 | [diff] [blame] | 438 | /* Possible identity types for SM-RP-{OA|DA} IEs */ |
| 439 | type enumerated GSUP_SM_RP_ODA_IdType { |
| 440 | OSMO_GSUP_SM_RP_ODA_ID_NONE ('00'O), |
| 441 | OSMO_GSUP_SM_RP_ODA_ID_IMSI ('01'O), |
| 442 | OSMO_GSUP_SM_RP_ODA_ID_MSISDN ('02'O), |
| 443 | OSMO_GSUP_SM_RP_ODA_ID_SMSC_ADDR ('03'O), |
| 444 | /* Special value for noSM-RP-DA and noSM-RP-OA */ |
| 445 | OSMO_GSUP_SM_RP_ODA_ID_NULL ('FF'O) |
| 446 | } with { variant "FIELDLENGTH(8)" }; |
Harald Welte | f9d449e | 2018-06-24 22:27:47 +0200 | [diff] [blame] | 447 | |
Harald Welte | df32723 | 2017-12-28 22:51:51 +0100 | [diff] [blame] | 448 | } with { encode "RAW"; variant "FIELDORDER(msb)" } |