Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 1 | /* Encoding/Decoding routines for GSM System Information messages |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 2 | * according to 3GPP TS 44.018 Version 12.3.0 Release 12 |
| 3 | * |
| 4 | * (C) 2017-2019 Harald Welte <laforge@gnumonks.org> |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | */ |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 12 | |
| 13 | module GSM_RR_Types { |
| 14 | |
| 15 | import from General_Types all; |
| 16 | import from Osmocom_Types all; |
| 17 | import from GSM_Types all; |
| 18 | import from RLCMAC_CSN1_Types all; |
Vadim Yanitskiy | 98bb2d5 | 2020-03-28 00:57:21 +0700 | [diff] [blame] | 19 | import from MobileL3_CommonIE_Types all; |
Vadim Yanitskiy | 27b3801 | 2020-09-01 05:14:46 +0700 | [diff] [blame] | 20 | import from MobileL3_RRM_Types all; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 21 | |
| 22 | /* Table 10.4.1 of Section 10.4 / 3GPP TS 44.018 */ |
| 23 | type enumerated RrMessageType { |
| 24 | ADDITIONAL_ASSIGNMENT ('00111011'B), |
| 25 | IMMEDIATE_ASSIGNMENT ('00111111'B), |
| 26 | IMMEDIATE_ASSIGNMENT_EXTENDED ('00111001'B), |
| 27 | IMMEDIATE_ASSIGNMENT_REJECT ('00111010'B), |
| 28 | IMMEDIATE_PACKET_ASSIGNMENT ('01101001'B), |
| 29 | |
| 30 | CIPHERING_MODE_COMMAND ('00110101'B), |
| 31 | CIPHERING_MODE_COMPLETE ('00110010'B), |
| 32 | |
| 33 | CONFIGURATION_CHANGE_COMMAND ('00110000'B), |
| 34 | CONFIGURATION_CHANGE_ACK ('00110001'B), |
| 35 | CONFIGURATION_CHANGE_REJECT ('00110011'B), |
| 36 | |
| 37 | ASSIGNMENT_COMMAND ('00101110'B), |
| 38 | ASSIGNMENT_COMPLETE ('00101001'B), |
| 39 | ASSIGNMENT_FAILURE ('00101111'B), |
| 40 | HANDOVER_COMMAND ('00101011'B), |
| 41 | HANDOVER_COMPLETE ('00101100'B), |
| 42 | HANDOVER_FAILURE ('00101000'B), |
| 43 | PHYSICAL_INFORMATION ('00101101'B), |
| 44 | |
| 45 | CHANNEL_RELEASE ('00001101'B), |
| 46 | PARTIAL_RELEASE ('00001010'B), |
| 47 | PARTIAL_RELEASE_COMPLETE ('00001111'B), |
| 48 | |
| 49 | PAGING_REQUEST_TYPE_1 ('00100001'B), |
| 50 | PAGING_REQUEST_TYPE_2 ('00100010'B), |
| 51 | PAGING_REQUEST_TYPE_3 ('00100100'B), |
| 52 | PAGING_RESPONSE ('00100111'B), |
| 53 | NOTIFICATION_NCH ('00100000'B), |
| 54 | NOTIFICATION_RESPOSNE ('00100110'B), |
| 55 | |
| 56 | SYSTEM_INFORMATION_TYPE_8 ('00011000'B), |
| 57 | SYSTEM_INFORMATION_TYPE_1 ('00011001'B), |
| 58 | SYSTEM_INFORMATION_TYPE_2 ('00011010'B), |
| 59 | SYSTEM_INFORMATION_TYPE_3 ('00011011'B), |
| 60 | SYSTEM_INFORMATION_TYPE_4 ('00011100'B), |
| 61 | SYSTEM_INFORMATION_TYPE_5 ('00011101'B), |
| 62 | SYSTEM_INFORMATION_TYPE_6 ('00011110'B), |
| 63 | SYSTEM_INFORMATION_TYPE_7 ('00011111'B), |
| 64 | SYSTEM_INFORMATION_TYPE_2bis ('00000010'B), |
| 65 | SYSTEM_INFORMATION_TYPE_2ter ('00000011'B), |
| 66 | SYSTEM_INFORMATION_TYPE_2quater ('00000111'B), |
| 67 | SYSTEM_INFORMATION_TYPE_5bis ('00000101'B), |
| 68 | SYSTEM_INFORMATION_TYPE_5ter ('00000110'B), |
| 69 | SYSTEM_INFORMATION_TYPE_9 ('00000100'B), |
| 70 | SYSTEM_INFORMATION_TYPE_13 ('00000000'B), |
| 71 | |
| 72 | SYSTEM_INFORMATION_TYPE_16 ('00111101'B), |
| 73 | SYSTEM_INFORMATION_TYPE_17 ('00111110'B), |
| 74 | |
| 75 | CHANNEL_MODE_MODIFY ('00010000'B), |
| 76 | RR_STATUS ('00010010'B), |
| 77 | CHANNEL_MODE_MODIFY_ACKNOWLEDGE ('00010111'B), |
| 78 | FREQUENCY_REDEFINITION ('00010100'B), |
| 79 | MEASUREMENT_REPORT ('00010101'B), |
| 80 | CLASSMARK_CHANGE ('00010110'B), |
| 81 | CLASSMARK_ENQUIRY ('00010011'B), |
| 82 | EXTENDED_MEASUREMENT_REPORT ('00110110'B), |
| 83 | EXTENDED_MEASUREMENT_ORDER ('00110111'B), |
| 84 | GPRS_SUSPENSION_REQUEST ('00110100'B), |
| 85 | //MBMS_ANNOUNCEMENT ('00010110'B), duplicate? |
| 86 | //SERVICE_INFORMATION ('00110110'B), duplicate? |
| 87 | |
| 88 | APPLICATION_INFORMATION ('00111000'B), |
| 89 | |
| 90 | SYSTEM_INFORMATION_TYPE_14 ('00000001'B), |
| 91 | SYSTEM_INFORMATION_TYPE_15 ('01000011'B), |
| 92 | SYSTEM_INFORMATION_TYPE_18 ('01000000'B), |
| 93 | SYSTEM_INFORMATION_TYPE_19 ('01000001'B), |
| 94 | SYSTEM_INFORMATION_TYPE_20 ('01000010'B), |
| 95 | SYSTEM_INFORMATION_TYPE_13alt ('01000100'B), |
| 96 | SYSTEM_INFORMATION_TYPE_2n ('01000101'B), |
| 97 | SYSTEM_INFORMATION_TYPE_21 ('01000110'B), |
| 98 | SYSTEM_INFORMATION_TYPE_22 ('01000111'B), |
| 99 | SYSTEM_INFORMATION_TYPE_23 ('01001111'B), |
| 100 | |
| 101 | DTM_ASSIGNMENT_FAILURE ('01001000'B), |
| 102 | DTM_REJECT ('01001001'B), |
| 103 | DTM_REQUEST ('01001010'B), |
| 104 | PACKET_ASSIGNMENT ('01001011'B), |
| 105 | DTM_ASSIGNMENT_COMMAND ('01001100'B), |
| 106 | DTM_INFORMATION ('01001101'B), |
| 107 | PACKET_INFORMATION ('01001110'B), |
| 108 | |
| 109 | UTRAN_CLASSMARK_CHANGE ('01100000'B), |
| 110 | CDMA2000_CLASSMARK_CHANGE ('01100010'B), |
| 111 | INTERSYS_TO_UTRAN_HO_CMD ('01100011'B), |
| 112 | INTERSYS_TO_CDMA2000_HO_CMD ('01100100'B), |
| 113 | GERAN_IU_MODE_CLASSMARK_CHG ('01100101'B), |
| 114 | INTERSYS_TO_EUTRAN_HO_CMD ('01100110'B) |
| 115 | } with { variant "FIELDLENGTH(8)" }; |
| 116 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 117 | type enumerated RR_Cause { |
| 118 | GSM48_RR_CAUSE_NORMAL ('00'O), |
| 119 | GSM48_RR_CAUSE_ABNORMAL_UNSPEC ('01'O), |
| 120 | GSM48_RR_CAUSE_ABNORMAL_UNACCT ('02'O), |
| 121 | GSM48_RR_CAUSE_ABNORMAL_TIMER ('03'O), |
| 122 | GSM48_RR_CAUSE_ABNORMAL_NOACT ('04'O), |
| 123 | GSM48_RR_CAUSE_PREMPTIVE_REL ('05'O), |
| 124 | GSM48_RR_CAUSE_HNDOVER_IMP ('08'O), |
| 125 | GSM48_RR_CAUSE_CHAN_MODE_UNACCT ('09'O), |
| 126 | GSM48_RR_CAUSE_FREQ_NOT_IMPL ('0a'O), |
| 127 | GSM48_RR_CAUSE_CALL_CLEARED ('41'O), |
| 128 | GSM48_RR_CAUSE_SEMANT_INCORR ('5f'O), |
| 129 | GSM48_RR_CAUSE_INVALID_MAND_INF ('60'O), |
| 130 | GSM48_RR_CAUSE_MSG_TYPE_N ('61'O), |
| 131 | GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT('62'O), |
| 132 | GSM48_RR_CAUSE_COND_IE_ERROR ('64'O), |
| 133 | GSM48_RR_CAUSE_NO_CELL_ALLOC_A ('65'O), |
| 134 | GSM48_RR_CAUSE_PROT_ERROR_UNSPC ('6f'O) |
| 135 | } with { variant "FIELDLENGTH(8)" }; |
| 136 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 137 | type octetstring RestOctets with { variant "PADDING(yes), PADDING_PATTERN('00101011'B)" }; |
| 138 | type hexstring GsmBcdString with { variant "HEXORDER(low)" }; |
| 139 | type GsmBcdString BcdMccMnc with { variant "FIELDLENGTH(6)" }; |
| 140 | |
| 141 | type record L2PseudoLength { |
| 142 | uint6_t l2_plen, |
| 143 | BIT2 zero_one |
| 144 | } with { variant "" }; |
| 145 | |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 146 | template L2PseudoLength tr_L2Pseudolength(template uint6_t len) := { |
| 147 | l2_plen := len, |
| 148 | zero_one := '01'B |
| 149 | }; |
| 150 | |
| 151 | template (value) L2PseudoLength ts_L2Pseudolength(uint6_t len) := { |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 152 | l2_plen := len, |
| 153 | zero_one := '01'B |
| 154 | }; |
| 155 | |
| 156 | type record RrHeader { |
| 157 | L2PseudoLength l2_plen, |
| 158 | uint4_t skip_indicator, |
| 159 | uint4_t rr_protocol_discriminator, |
| 160 | RrMessageType message_type |
| 161 | } with { variant "" }; |
| 162 | |
| 163 | template RrHeader t_RrHeader(RrMessageType msg_type, template uint6_t len) := { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 164 | l2_plen := tr_L2Pseudolength(len), |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 165 | skip_indicator := 0, |
| 166 | rr_protocol_discriminator := 6, |
| 167 | message_type := msg_type |
| 168 | }; |
| 169 | |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 170 | template (value) RrHeader ts_RrHeader(RrMessageType msg_type, uint6_t len) := { |
| 171 | l2_plen := ts_L2Pseudolength(len), |
| 172 | skip_indicator := 0, |
| 173 | rr_protocol_discriminator := 6, |
| 174 | message_type := msg_type |
| 175 | }; |
| 176 | |
| 177 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 178 | type record RrL3Header { |
| 179 | uint4_t skip_indicator, |
| 180 | uint4_t rr_protocol_discriminator, |
| 181 | RrMessageType message_type |
| 182 | } with { variant "" }; |
| 183 | |
Harald Welte | cbc947f | 2018-02-22 00:26:55 +0100 | [diff] [blame] | 184 | template RrL3Header t_RrL3Header(RrMessageType msg_type) := { |
| 185 | skip_indicator := 0, |
| 186 | rr_protocol_discriminator := 6, |
| 187 | message_type := msg_type |
| 188 | } |
| 189 | |
Pau Espin Pedrol | 0aad596 | 2018-09-28 16:03:55 +0200 | [diff] [blame] | 190 | /* TS 44.004 7.2.1 */ |
| 191 | type record SacchL1Header { |
| 192 | uint2_t reserved, |
| 193 | boolean fpc, |
| 194 | uint5_t ms_power_lvl, |
| 195 | uint8_t actual_ta |
| 196 | } with { variant "FIELDORDER(msb)" }; |
| 197 | |
| 198 | template (value) SacchL1Header ts_SacchL1Header(uint5_t ms_power_lvl, boolean fpc, uint8_t actual_ta) := { |
| 199 | reserved := 0, |
| 200 | fpc := fpc, |
| 201 | ms_power_lvl := ms_power_lvl, |
| 202 | actual_ta := actual_ta |
| 203 | }; |
| 204 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 205 | type record MaioHsn { |
Vadim Yanitskiy | ff0072c | 2020-05-27 01:35:39 +0700 | [diff] [blame] | 206 | uint6_t maio, |
| 207 | uint6_t hsn |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 208 | } with { variant "" }; |
| 209 | |
Vadim Yanitskiy | 5bcd919 | 2020-07-06 20:18:11 +0700 | [diff] [blame] | 210 | /* It's more handy to pass HSN first, so the arguments' order is reversed. */ |
| 211 | template (value) MaioHsn ts_HsnMaio(template (value) uint6_t hsn, |
| 212 | template (value) uint6_t maio) := { |
| 213 | maio := maio, |
| 214 | hsn := hsn |
| 215 | }; |
| 216 | template MaioHsn tr_HsnMaio(template (present) uint6_t hsn, |
| 217 | template (present) uint6_t maio) := { |
| 218 | maio := maio, |
| 219 | hsn := hsn |
| 220 | }; |
| 221 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 222 | /* TS 24.008 10.5.1.1 */ |
| 223 | type uint16_t CellIdentity; |
| 224 | |
| 225 | /* TS 24.008 10.5.1.2 */ |
| 226 | type uint4_t CipheringKeySeqNr (0..7); |
| 227 | |
| 228 | /* 24.008 10.5.1.3 */ |
| 229 | type record LocationAreaIdentification { |
| 230 | BcdMccMnc mcc_mnc, |
| 231 | uint16_t lac |
Vadim Yanitskiy | e05d716 | 2020-05-02 16:58:46 +0700 | [diff] [blame] | 232 | } with { variant "" }; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 233 | |
| 234 | /* TS 24.008 10.5.1.4 */ |
| 235 | type enumerated MobileIdentityType { |
| 236 | MI_TYPE_NONE (0), |
| 237 | MI_TYPE_IMSI, |
| 238 | MI_TYPE_IMEI, |
| 239 | MI_TYPE_IMEISV, |
| 240 | MI_TYPE_TMSI, |
| 241 | MI_TYPE_TMGI |
| 242 | } with { variant "FIELDLENGTH(3)" }; |
| 243 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 244 | /* TS 24.008 10.5.1.5 */ |
| 245 | type record MsClassmark1 { |
| 246 | BIT1 spare, |
| 247 | uint2_t rev_level, |
| 248 | boolean es_ind, |
| 249 | boolean a51, |
| 250 | uint3_t rf_pwr_cap |
| 251 | } with { variant "" }; |
| 252 | |
| 253 | /* TS 24.008 10.5.1.6 */ |
| 254 | type record MsClassmark2 { |
| 255 | BIT1 spare, |
| 256 | uint2_t rev_level, |
| 257 | boolean es_ind, |
| 258 | boolean a51, |
| 259 | uint3_t rf_pwr_cap, |
| 260 | BIT1 spare1, |
| 261 | boolean ps_cap, |
| 262 | uint2_t ss_screen_ind, |
| 263 | boolean sm_cap, |
| 264 | boolean vbs, |
| 265 | boolean vgcs, |
| 266 | boolean fc, |
| 267 | boolean cm3, |
| 268 | BIT1 spare2, |
| 269 | boolean lcsva_cap, |
| 270 | boolean ucs2, |
| 271 | boolean solsa, |
| 272 | boolean cmsp, |
| 273 | boolean a53, |
| 274 | boolean a52 |
| 275 | } with { variant "" }; |
| 276 | type record MsClassmark2LV { |
| 277 | uint8_t len, |
| 278 | MsClassmark2 cm2 |
| 279 | } with { variant (len) "LENGTHTO(cm2)" }; |
| 280 | |
| 281 | |
| 282 | /* 44.018 10.5.2.5 */ |
| 283 | type record ChannelDescription { |
| 284 | RslChannelNr chan_nr, |
| 285 | uint3_t tsc, |
| 286 | boolean h, |
| 287 | uint12_t arfcn optional, |
| 288 | MaioHsn maio_hsn optional |
| 289 | } with { variant (arfcn) "PRESENCE(h = false)" |
| 290 | variant (maio_hsn) "PRESENCE(h = true)" }; |
| 291 | |
| 292 | type record ChannelDescriptionTV { |
| 293 | OCT1 iei, |
| 294 | ChannelDescription v |
| 295 | } with { variant "" }; |
| 296 | |
| 297 | /* 10.5.2.21 */ |
Vadim Yanitskiy | 3b464a9 | 2020-08-25 03:55:32 +0700 | [diff] [blame] | 298 | type record MobileAllocationLV { |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 299 | uint8_t len, |
Vadim Yanitskiy | 7d6eef3 | 2020-08-29 02:56:58 +0700 | [diff] [blame] | 300 | bitstring ma length (0..64) |
Vadim Yanitskiy | 3ddb3ab | 2020-07-20 04:29:53 +0700 | [diff] [blame] | 301 | } with { |
| 302 | variant (len) "LENGTHTO(ma)" |
Vadim Yanitskiy | e2a6fdf | 2020-07-23 04:53:02 +0700 | [diff] [blame] | 303 | variant (ma) "BYTEORDER(first), BITORDER(msb)" |
Vadim Yanitskiy | 3ddb3ab | 2020-07-20 04:29:53 +0700 | [diff] [blame] | 304 | }; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 305 | |
Vadim Yanitskiy | 74e1f6b | 2020-08-25 03:59:45 +0700 | [diff] [blame] | 306 | type record MobileAllocationTLV { |
| 307 | OCT1 iei ('72'O), |
| 308 | MobileAllocationLV v |
| 309 | } with { variant "" }; |
| 310 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 311 | /* 10.5.2.25a */ |
Harald Welte | 1b9b770 | 2017-07-30 04:19:14 +0200 | [diff] [blame] | 312 | type record PktChDesc0Ind { |
| 313 | uint6_t maio, |
| 314 | BIT1 ma_number_ind, |
| 315 | BIT1 change_mark1_valid, |
| 316 | BIT2 change_mark1 |
| 317 | } with { variant "" }; |
| 318 | type record PktChDesc0 { |
| 319 | BIT1 hopping, |
| 320 | BIT1 spare ('0'B), |
| 321 | uint10_t arfcn optional, |
| 322 | PktChDesc0Ind indirect optional |
| 323 | } with { |
| 324 | variant (arfcn) "PRESENCE(hopping = '0'B)" |
| 325 | variant (indirect) "PRESENCE(hopping = '1'B)" |
| 326 | }; |
| 327 | type record PktChDesc1 { |
| 328 | uint6_t maio, |
| 329 | uint6_t hsn |
| 330 | } with { variant "" }; |
| 331 | type record PacketChannelDescription { |
| 332 | uint5_t channel_Type_spare, |
| 333 | uint3_t tn, |
| 334 | uint3_t tsc, |
| 335 | BIT1 presence, |
| 336 | PktChDesc0 zero optional, |
| 337 | PktChDesc1 one optional |
| 338 | } with { |
| 339 | variant (zero) "PRESENCE(presence = '0'B)" |
| 340 | variant (one) "PRESENCE(presence = '1'B)" |
| 341 | }; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 342 | |
| 343 | /* 10.5.2.25b */ |
| 344 | type record DedicatedModeOrTbf { |
| 345 | BIT1 spare, |
| 346 | boolean tma, |
| 347 | boolean downlink, |
| 348 | boolean tbf |
| 349 | } with { variant "" }; |
| 350 | |
| 351 | /* 10.5.2.26 */ |
| 352 | type enumerated PageMode { |
| 353 | PAGE_MODE_NORMAL, |
| 354 | PAGE_MODE_EXTENDED, |
| 355 | PAGE_MODE_REORGANIZATION, |
| 356 | PAGE_MODE_SAME_AS_BEFORE |
| 357 | } with { variant "FIELDLENGTH(4)" }; |
| 358 | |
| 359 | /* 10.5.2.30 */ |
| 360 | type record RequestReference { |
| 361 | bitstring ra length(8), |
| 362 | uint5_t t1p, |
| 363 | uint6_t t3, |
| 364 | uint5_t t2 |
| 365 | } with { variant "" }; |
| 366 | |
| 367 | template RequestReference t_RequestReference(template bitstring ra, template uint5_t t1p, template uint6_t t3, template uint5_t t2) := { |
| 368 | ra := ra, |
| 369 | t1p := t1p, |
| 370 | t3 := t3, |
| 371 | t2 := t2 |
| 372 | } |
| 373 | |
| 374 | /* compute the expected request reference for given RA + FN */ |
| 375 | function f_compute_ReqRef(uint8_t ra, GsmFrameNumber fn) return RequestReference { |
| 376 | var RequestReference req_ref := { ra := int2bit(ra, 8) }; |
| 377 | req_ref.t1p := (fn / 1326) mod 32; |
| 378 | req_ref.t2 := fn mod 26; |
| 379 | req_ref.t3 := fn mod 51; |
| 380 | return req_ref |
| 381 | } |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 382 | function tr_compute_ReqRef(template uint8_t ra, template GsmFrameNumber fn) |
| 383 | return template RequestReference { |
| 384 | var template RequestReference req_ref; |
| 385 | if (istemplatekind(ra, "?")) { |
| 386 | req_ref.ra := ?; |
| 387 | } else { |
| 388 | req_ref.ra := int2bit(valueof(ra), 8); |
| 389 | } |
| 390 | if (istemplatekind(fn, "?")) { |
| 391 | req_ref.t1p := ?; |
| 392 | req_ref.t2 := ?; |
| 393 | req_ref.t3 := ?; |
| 394 | } else { |
| 395 | var GsmFrameNumber fn_v := valueof(fn); |
| 396 | req_ref.t1p := (fn_v / 1326) mod 32; |
| 397 | req_ref.t2 := fn_v mod 26; |
| 398 | req_ref.t3 := fn_v mod 51; |
| 399 | } |
| 400 | return req_ref; |
| 401 | } |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 402 | |
| 403 | /* 10.5.2.40 */ |
| 404 | type integer TimingAdvance (0..219); |
| 405 | |
| 406 | /* 10.5.2.43 */ |
| 407 | type uint8_t WaitIndication; |
| 408 | |
| 409 | /* 10.5.2.76 */ |
| 410 | type record FeatureIndicator { |
Vadim Yanitskiy | c3cebd3 | 2020-05-22 02:43:22 +0700 | [diff] [blame] | 411 | BIT2 peo_bcch_change_mark, |
| 412 | boolean cs_ir, |
| 413 | boolean ps_ir |
| 414 | } with { |
| 415 | variant (cs_ir) "FIELDLENGTH(1)" |
| 416 | variant (ps_ir) "FIELDLENGTH(1)" |
| 417 | }; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 418 | |
| 419 | /* 24.008 10.5.5.6 */ |
| 420 | type record DrxParameter { |
| 421 | uint8_t split_pg_cycle_code, |
| 422 | uint4_t drx_cycle_len_coeff, |
| 423 | boolean split_on_ccch, |
| 424 | uint3_t non_drx_timer |
| 425 | } with { variant "" }; |
| 426 | |
| 427 | /* 24.008 10.5.5.15 */ |
| 428 | type record RoutingAreaIdentification { |
| 429 | LocationAreaIdentification lai, |
| 430 | uint8_t rac |
| 431 | } with { variant "" }; |
| 432 | |
Harald Welte | b16516c | 2019-03-21 21:31:41 +0100 | [diff] [blame] | 433 | external function enc_RoutingAreaIdentification(RoutingAreaIdentification rai) return octetstring |
| 434 | with { extension "prototype(convert)" extension "encode(RAW)" } |
| 435 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 436 | /* 44.018 10.5.2.16 */ |
| 437 | type record IaRestOctHL { |
| 438 | uint6_t freq_par_len, |
| 439 | BIT2 padding ('00'B) optional, |
| 440 | uint6_t maio optional, |
| 441 | octetstring mobile_allocation optional |
| 442 | } with { |
| 443 | variant (freq_par_len) "LENGTHTO(mobile_allocation,maio,padding)" |
| 444 | /* |
| 445 | variant (padding) "PRESENCE(freq_par_len != 0)" |
| 446 | variant (maio) "PRESENCE(freq_par_len != 0)" |
| 447 | variant (mobile_allocation) "PRESENCE(freq_par_len != 0)" |
| 448 | */ |
| 449 | }; |
Vadim Yanitskiy | 7091e8d | 2019-09-09 01:07:37 +0200 | [diff] [blame] | 450 | type record SecondPartAssign { |
Vadim Yanitskiy | b021ed4 | 2020-04-27 23:25:13 +0700 | [diff] [blame] | 451 | BIT1 r99, /* L / H */ |
Vadim Yanitskiy | 7091e8d | 2019-09-09 01:07:37 +0200 | [diff] [blame] | 452 | BIT1 presence optional, |
| 453 | BIT5 ext_ra optional |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 454 | } with { |
Vadim Yanitskiy | b021ed4 | 2020-04-27 23:25:13 +0700 | [diff] [blame] | 455 | variant (r99) "CSN.1 L/H" |
Vadim Yanitskiy | 7091e8d | 2019-09-09 01:07:37 +0200 | [diff] [blame] | 456 | variant (presence) "PRESENCE(r99 = '1'B)" /* H */ |
| 457 | variant (ext_ra) "PRESENCE(presence = '1'B)" |
Vadim Yanitskiy | e05d716 | 2020-05-02 16:58:46 +0700 | [diff] [blame] | 458 | /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562488 */ |
| 459 | variant (ext_ra) "BYTEORDER(last)" // FIXME: should be first |
Vadim Yanitskiy | 7091e8d | 2019-09-09 01:07:37 +0200 | [diff] [blame] | 460 | }; |
| 461 | type union PacketUlDlAssignUnion { |
| 462 | PacketUlAssign ul, |
| 463 | PacketDlAssign dl |
| 464 | }; |
| 465 | type record PacketUlDlAssign { |
| 466 | BIT1 ass_disc, |
| 467 | PacketUlDlAssignUnion ass |
| 468 | } with { |
| 469 | variant (ass) "CROSSTAG(dl, ass_disc = '1'B; ul, ass_disc = '0'B)" |
| 470 | }; |
| 471 | type union PacketAssignUnion { |
| 472 | SecondPartAssign spa, |
| 473 | PacketUlDlAssign uldl |
| 474 | }; |
| 475 | type record IaRestOctHH { |
| 476 | /* Packet Assignment discriminator: |
| 477 | * Packet Uplink / Downlink Assignment (0) |
| 478 | * Second Part Packet Assignment (1) */ |
| 479 | BIT1 pa_disc, |
| 480 | PacketAssignUnion pa |
| 481 | } with { |
| 482 | variant (pa) "CROSSTAG(spa, pa_disc = '1'B; uldl, pa_disc = '0'B)" |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 483 | }; |
| 484 | type record PacketUlAssignDyn { |
| 485 | uint5_t tfi_assignment, |
| 486 | BIT1 polling, |
| 487 | BIT1 spare ('0'B), |
| 488 | uint3_t usf, |
| 489 | BIT1 usf_granularity, |
| 490 | BIT1 p0_present, |
| 491 | uint4_t p0 optional, |
| 492 | BIT1 pr_mode optional, |
| 493 | ChCodingCommand ch_coding_cmd, |
| 494 | BIT1 tlli_block_chan_coding, |
| 495 | BIT1 alpha_present, |
| 496 | uint4_t alpha optional, |
| 497 | uint5_t gamma, |
| 498 | BIT1 ta_index_present, |
| 499 | uint4_t ta_index optional, |
| 500 | BIT1 tbf_starting_time_present, |
| 501 | uint16_t tbf_starting_time optional |
| 502 | } with { |
| 503 | variant (p0) "PRESENCE(p0_present = '1'B)" |
| 504 | variant (pr_mode) "PRESENCE(p0_present = '1'B)" |
| 505 | variant (alpha) "PRESENCE(alpha_present = '1'B)" |
| 506 | variant (ta_index) "PRESENCE(ta_index_present = '1'B)" |
| 507 | variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)" |
| 508 | }; |
| 509 | type record PacketUlAssignSgl { |
| 510 | BIT1 alpha_present, |
| 511 | uint4_t alpha optional, |
| 512 | uint5_t gamma, |
| 513 | BIT2 padding ('01'B), |
| 514 | uint16_t tbf_starting_time |
| 515 | /* TODO: P0 / PR_MODE */ |
| 516 | } with { |
| 517 | variant (alpha) "PRESENCE(alpha_present = '1'B)" |
| 518 | }; |
| 519 | type record PacketUlAssign { |
| 520 | BIT1 presence, |
| 521 | PacketUlAssignDyn dynamic optional, |
| 522 | PacketUlAssignSgl single optional |
| 523 | /* TODO: Estended RA, PFI */ |
| 524 | } with { |
| 525 | variant (dynamic) "PRESENCE(presence = '1'B)" |
| 526 | variant (single) "PRESENCE(presence = '0'B)" |
| 527 | }; |
| 528 | type record PacketDlAssG1 { |
| 529 | uint5_t tfi_assignment, |
| 530 | BIT1 rlc_mode, |
| 531 | BIT1 alpha_present, |
| 532 | uint4_t alpha optional, |
| 533 | uint5_t gamma, |
| 534 | BIT1 polling, |
| 535 | BIT1 ta_valid |
| 536 | } with { variant "" }; |
| 537 | type record PacketDlAssign { |
| 538 | GprsTlli tlli, |
| 539 | BIT1 group1_present, |
| 540 | PacketDlAssG1 group1 optional, |
| 541 | BIT1 ta_index_present, |
| 542 | uint4_t ta_index optional, |
| 543 | BIT1 tbf_starting_time_present, |
| 544 | uint16_t tbf_starting_time optional, |
| 545 | BIT1 p0_present, |
| 546 | uint4_t p0 optional, |
| 547 | BIT1 pr_mode optional |
| 548 | /* TODO: EGPRS window size, etc. */ |
| 549 | } with { |
| 550 | variant (group1) "PRESENCE(group1_present = '1'B)" |
| 551 | variant (ta_index) "PRESENCE(ta_index_present = '1'B)" |
| 552 | variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)" |
| 553 | variant (p0) "PRESENCE(p0_present = '1'B)" |
| 554 | variant (pr_mode) "PRESENCE(p0_present = '1'B)" |
| 555 | }; |
| 556 | type record IaRestOctLL { |
| 557 | BIT1 compressed_irat_ho_info_ind |
Vadim Yanitskiy | b021ed4 | 2020-04-27 23:25:13 +0700 | [diff] [blame] | 558 | } with { |
| 559 | variant (compressed_irat_ho_info_ind) "CSN.1 L/H" |
| 560 | }; |
Pau Espin Pedrol | 461ed61 | 2019-12-30 20:18:34 +0100 | [diff] [blame] | 561 | type record EgprsUlAssignDyn { |
| 562 | uint5_t tfi_assignment, |
| 563 | BIT1 polling, |
| 564 | BIT1 spare ('0'B), |
| 565 | uint3_t usf, |
| 566 | BIT1 usf_granularity, |
| 567 | BIT1 p0_present, |
| 568 | uint4_t p0 optional, |
| 569 | BIT1 pr_mode optional, |
| 570 | EgprsChCodingCommand egprs_ch_coding_cmd, |
| 571 | BIT1 tlli_block_chan_coding, |
| 572 | BIT1 bep_period2_present, |
| 573 | BIT4 bep_period2 optional, |
| 574 | BIT1 resegment, |
| 575 | EgprsWindowSize egprs_window_size, |
| 576 | BIT1 alpha_present, |
| 577 | uint4_t alpha optional, |
| 578 | uint5_t gamma, |
| 579 | BIT1 ta_index_present, |
| 580 | uint4_t ta_index optional, |
| 581 | BIT1 tbf_starting_time_present, |
| 582 | uint16_t tbf_starting_time optional |
| 583 | /* TODO: Additions for Rel-7 */ |
| 584 | } with { |
| 585 | variant (p0) "PRESENCE(p0_present = '1'B)" |
| 586 | variant (pr_mode) "PRESENCE(p0_present = '1'B)" |
| 587 | variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)" |
| 588 | variant (alpha) "PRESENCE(alpha_present = '1'B)" |
| 589 | variant (ta_index) "PRESENCE(ta_index_present = '1'B)" |
| 590 | variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)" |
| 591 | }; |
| 592 | type record EgprsUlAssignMultiblock { |
| 593 | BIT1 alpha_present, |
| 594 | uint4_t alpha optional, |
| 595 | uint5_t gamma, |
| 596 | uint16_t tbf_starting_time, |
| 597 | BIT2 nr_radio_blocks_allocated, |
| 598 | BIT1 p0_present, |
| 599 | uint4_t p0 optional, |
| 600 | BIT1 spare ('0'B) optional, |
| 601 | BIT1 pr_mode optional |
| 602 | /* TDO: Additions for Rel-6 */ |
| 603 | } with { |
| 604 | variant (alpha) "PRESENCE(alpha_present = '1'B)" |
| 605 | variant (p0) "PRESENCE(p0_present = '1'B)" |
| 606 | variant (spare) "PRESENCE(p0_present = '1'B)" |
| 607 | variant (pr_mode) "PRESENCE(p0_present = '1'B)" |
| 608 | }; |
| 609 | /* 3GPP TS 44.018 version 13.3.2 10.5.2.16, "EGPRS Packet Uplink Assignment" */ |
| 610 | type record EgprsUlAss { |
| 611 | BIT5 ext_ra, |
| 612 | BIT1 ats_present, |
| 613 | AccessTechnologiesRequestRepetition ats optional, |
| 614 | BIT1 presence, |
| 615 | EgprsUlAssignDyn dynamic optional, |
| 616 | EgprsUlAssignMultiblock multiblock optional |
| 617 | } with { |
| 618 | variant (ats) "PRESENCE(ats_present = '1'B)" |
| 619 | variant (dynamic) "PRESENCE(presence = '1'B)" |
| 620 | variant (multiblock) "PRESENCE(presence = '0'B)" |
Vadim Yanitskiy | e05d716 | 2020-05-02 16:58:46 +0700 | [diff] [blame] | 621 | /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562488 */ |
| 622 | variant (ext_ra) "BYTEORDER(last)" // FIXME: should be first |
Pau Espin Pedrol | 461ed61 | 2019-12-30 20:18:34 +0100 | [diff] [blame] | 623 | }; |
| 624 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 625 | type octetstring MblkDlAss; /* TODO */ |
| 626 | type record IaRestOctLH { |
| 627 | BIT2 presence, |
| 628 | EgprsUlAss egprs_ul optional, |
| 629 | MblkDlAss multiblock_dl_ass optional |
| 630 | } with { |
| 631 | variant (egprs_ul) "PRESENCE(presence = '00'B)" |
| 632 | variant (multiblock_dl_ass) "PRESENCE(presence = '01'B)" |
| 633 | }; |
| 634 | type record IaRestOctets { |
| 635 | BIT2 presence, |
| 636 | IaRestOctLL ll optional, |
| 637 | IaRestOctLH lh optional, |
| 638 | IaRestOctHL hl optional, |
Vadim Yanitskiy | 9b2a3e8 | 2019-09-08 15:37:15 +0200 | [diff] [blame] | 639 | IaRestOctHH hh optional |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 640 | } with { |
Vadim Yanitskiy | b021ed4 | 2020-04-27 23:25:13 +0700 | [diff] [blame] | 641 | variant (presence) "CSN.1 L/H" |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 642 | variant (ll) "PRESENCE(presence = '00'B)" |
| 643 | variant (lh) "PRESENCE(presence = '01'B)" |
| 644 | variant (hl) "PRESENCE(presence = '10'B)" |
| 645 | variant (hh) "PRESENCE(presence = '11'B)" |
Vadim Yanitskiy | 9b2a3e8 | 2019-09-08 15:37:15 +0200 | [diff] [blame] | 646 | variant "PADDING(yes), PADDING_PATTERN('00101011'B)" |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 647 | }; |
| 648 | |
Harald Welte | cbc947f | 2018-02-22 00:26:55 +0100 | [diff] [blame] | 649 | type record MeasurementResults { |
| 650 | BIT1 ba_used, |
| 651 | BIT1 dtx_used, |
| 652 | uint6_t rxlev_full_srv_cell, |
| 653 | BIT1 threeg_ba_used, |
| 654 | BIT1 meas_valid, |
| 655 | uint6_t rxlev_sub_srv_cell, |
| 656 | BIT1 si23_ba_used, |
| 657 | uint3_t rxqual_full_srv_cell, |
| 658 | uint3_t rxqual_sub_srv_cell, |
| 659 | uint3_t no_ncell_m, |
| 660 | NcellReports ncell_reports optional |
| 661 | } with { variant (no_ncell_m) "LENGTHTO(ncell_reports)" |
| 662 | variant (no_ncell_m) "UNIT(elements)" |
| 663 | variant "PADDING(yes)" |
| 664 | variant "FIELDLENGTH(16)" |
| 665 | }; |
| 666 | |
| 667 | type record NcellReport { |
| 668 | uint6_t rxlev, |
| 669 | uint5_t bcch_freq, |
| 670 | uint6_t bsic |
| 671 | } with { variant ""}; |
| 672 | type record of NcellReport NcellReports; |
| 673 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 674 | |
Vadim Yanitskiy | 27b3801 | 2020-09-01 05:14:46 +0700 | [diff] [blame] | 675 | /* 3GPP TS 44.018, section 9.1.2 (minimalistic implementation) */ |
| 676 | type record AssignmentCommand { |
| 677 | ChannelDescription chan_desc, |
| 678 | PowerCommand_V power_cmd, |
| 679 | FrequencyList_TLV freq_list_at optional, |
| 680 | CellChannelDescription_TV cell_chan_desc optional, |
| 681 | /* TODO: Multislot Allocation IE */ |
| 682 | ChannelMode_TV chan1_mode optional, |
| 683 | ChannelMode_TV chan2_mode optional, |
| 684 | /* TODO: Mode of Channel Set 3..8 IE */ |
| 685 | MobileAllocationTLV mobile_allocation optional |
| 686 | /* TODO: more optional IEs... */ |
| 687 | } with { |
| 688 | variant "TAG( |
| 689 | freq_list_at, elementIdentifier = '05'O; |
| 690 | cell_chan_desc, elementIdentifier = '62'O; |
| 691 | chan1_mode, elementIdentifier = '63'O; |
| 692 | chan2_mode, elementIdentifier = '11'O; |
| 693 | mobile_allocation, iei = '72'O; |
| 694 | )" |
| 695 | }; |
| 696 | |
| 697 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 698 | /* 9.1.18 */ |
| 699 | type record ImmediateAssignment { |
| 700 | DedicatedModeOrTbf ded_or_tbf, |
| 701 | PageMode page_mode, |
| 702 | ChannelDescription chan_desc optional, |
| 703 | PacketChannelDescription pkt_chan_desc optional, |
| 704 | RequestReference req_ref, |
| 705 | TimingAdvance timing_advance, |
Vadim Yanitskiy | 3b464a9 | 2020-08-25 03:55:32 +0700 | [diff] [blame] | 706 | MobileAllocationLV mobile_allocation, |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 707 | /* TODO: starting time TLV */ |
Vadim Yanitskiy | f10bb45 | 2019-09-05 13:53:01 +0200 | [diff] [blame] | 708 | IaRestOctets rest_octets |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 709 | } with { variant (chan_desc) "PRESENCE(ded_or_tbf.tbf = false)" |
Vadim Yanitskiy | a4aacc2 | 2019-09-09 04:41:12 +0200 | [diff] [blame] | 710 | variant (pkt_chan_desc) "PRESENCE(ded_or_tbf.tbf = true)" }; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 711 | |
| 712 | /* 9.1.20 */ |
| 713 | type record ReqRefWaitInd { |
| 714 | RequestReference req_ref, |
| 715 | WaitIndication wait_ind |
| 716 | } with { variant "" }; |
| 717 | type record length(4) of ReqRefWaitInd ReqRefWaitInd4; |
| 718 | type record ImmediateAssignmentReject { |
| 719 | FeatureIndicator feature_ind, |
| 720 | PageMode page_mode, |
Vadim Yanitskiy | 7ef121d | 2020-05-22 03:04:22 +0700 | [diff] [blame] | 721 | ReqRefWaitInd4 payload, |
| 722 | IARRestOctets rest_octets |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 723 | } with { variant "" }; |
| 724 | |
Vadim Yanitskiy | 7ef121d | 2020-05-22 03:04:22 +0700 | [diff] [blame] | 725 | /* 10.5.2.17 IAR (Immediate Assignment Reject) Rest Octets */ |
| 726 | type record IARRestOctets { |
| 727 | ExtRAList ext_ra_list, |
| 728 | BIT1 rel13_ind, // L/H |
| 729 | uint3_t rcc optional |
| 730 | /* Addition in Rel-15: PEO IMM Cell Group Details struct */ |
| 731 | } with { |
| 732 | variant (rel13_ind) "CSN.1 L/H" |
| 733 | variant (rcc) "PRESENCE(rel13_ind = '1'B)" |
| 734 | |
| 735 | /* The TITAN's RAW encoder generates an octet-aligned octetstring, |
| 736 | * so we should make sure that unused bits contain proper padding. */ |
| 737 | variant "PADDING(yes), PADDING_PATTERN('00101011'B)" |
| 738 | }; |
| 739 | |
| 740 | /* Optional extended RA: 0 | 1 < Extended RA 1 : bit (5) > */ |
| 741 | type record ExtRAOpt { |
| 742 | BIT1 presence, // L/H |
| 743 | BIT5 ext_ra optional |
| 744 | } with { |
| 745 | variant (presence) "CSN.1 L/H" |
| 746 | variant (ext_ra) "PRESENCE(presence = '1'B)" |
| 747 | /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562488 */ |
| 748 | variant (ext_ra) "BYTEORDER(last)" |
| 749 | }; |
| 750 | |
| 751 | type record length(4) of ExtRAOpt ExtRAList; |
| 752 | |
Harald Welte | cbc947f | 2018-02-22 00:26:55 +0100 | [diff] [blame] | 753 | /* 9.1.21 */ |
| 754 | type record MeasurementReport { |
| 755 | MeasurementResults meas_res |
| 756 | } with { variant "" }; |
| 757 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 758 | /* 9.1.22 */ |
| 759 | type record PagingRequestType1 { |
| 760 | ChannelNeeded12 chan_needed, |
| 761 | PageMode page_mode, |
| 762 | MobileIdentityLV mi1, |
| 763 | MobileIdentityTLV mi2 optional, |
| 764 | RestOctets rest_octets |
Vadim Yanitskiy | 98bb2d5 | 2020-03-28 00:57:21 +0700 | [diff] [blame] | 765 | } with { variant "TAG(mi2, elementIdentifier = '0010111'B)" }; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 766 | |
| 767 | /* 9.1.23 */ |
| 768 | type record PagingRequestType2 { |
| 769 | ChannelNeeded12 chan_needed, |
| 770 | PageMode page_mode, |
| 771 | GsmTmsi mi1, |
| 772 | GsmTmsi mi2, |
| 773 | MobileIdentityTLV mi3 optional, |
| 774 | RestOctets rest_octets |
Vadim Yanitskiy | 98bb2d5 | 2020-03-28 00:57:21 +0700 | [diff] [blame] | 775 | } with { variant "TAG(mi3, elementIdentifier = '0010111'B)" }; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 776 | |
| 777 | /* 9.1.24 */ |
| 778 | type record length(4) of GsmTmsi GsmTmsi4; |
| 779 | type record PagingRequestType3 { |
| 780 | ChannelNeeded12 chan_needed, |
| 781 | PageMode page_mode, |
| 782 | GsmTmsi4 mi, |
| 783 | RestOctets rest_octets |
| 784 | } with { variant "" }; |
| 785 | |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 786 | type union RrUnion { |
| 787 | /* |
| 788 | SystemInformationType1 si1, |
| 789 | SystemInformationType2 si2, |
| 790 | SystemInformationType2bis si2bis, |
| 791 | SystemInformationType2ter si2ter, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 792 | SystemInformationType3 si3, |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 793 | SystemInformationType4 si4, |
| 794 | SystemInformationType5 si5, |
| 795 | SystemInformationType5bis si5bis, |
| 796 | SystemInformationType5ter si5ter, |
| 797 | SystemInformationType6 si6, |
| 798 | */ |
| 799 | ImmediateAssignment imm_ass, |
| 800 | ImmediateAssignmentReject imm_ass_rej, |
| 801 | PagingRequestType1 pag_req_1, |
| 802 | PagingRequestType2 pag_req_2, |
| 803 | PagingRequestType3 pag_req_3, |
| 804 | octetstring other |
| 805 | } with { variant "" }; |
| 806 | |
| 807 | /* Special RR Message on BCCH / CCCH Dowlink */ |
| 808 | |
| 809 | type record GsmRrMessage { |
| 810 | RrHeader header, |
| 811 | RrUnion payload |
| 812 | } with { variant (payload) "CROSSTAG( |
| 813 | /* |
| 814 | si1, header.message_type = SYSTEM_INFORMATION_TYPE_1; |
| 815 | si2, header.message_type = SYSTEM_INFORMATION_TYPE_2; |
| 816 | si2bis, header.message_type = SYSTEM_INFORMATION_TYPE_2bis; |
| 817 | si2ter, header.message_type = SYSTEM_INFORMATION_TYPE_2ter; |
| 818 | si3, header.message_type = SYSTEM_INFORMATION_TYPE_3; |
| 819 | si4, header.message_type = SYSTEM_INFORMATION_TYPE_4; |
| 820 | si5, header.message_type = SYSTEM_INFORMATION_TYPE_5; |
| 821 | si5bis, header.message_type = SYSTEM_INFORMATION_TYPE_5bis; |
| 822 | si5ter, header.message_type = SYSTEM_INFORMATION_TYPE_5ter; |
| 823 | si6, header.message_type = SYSTEM_INFORMATION_TYPE_6; |
| 824 | */ |
| 825 | imm_ass, header.message_type = IMMEDIATE_ASSIGNMENT; |
| 826 | imm_ass_rej, header.message_type = IMMEDIATE_ASSIGNMENT_REJECT; |
| 827 | pag_req_1, header.message_type = PAGING_REQUEST_TYPE_1; |
| 828 | pag_req_2, header.message_type = PAGING_REQUEST_TYPE_2; |
| 829 | pag_req_3, header.message_type = PAGING_REQUEST_TYPE_3; |
| 830 | other, OTHERWISE; |
Vadim Yanitskiy | a4aacc2 | 2019-09-09 04:41:12 +0200 | [diff] [blame] | 831 | )" |
| 832 | /* Total message length: 184 = 23 * 8. Pad spare bits with '2B'O. */ |
| 833 | variant "PADDING(184), PADDING_PATTERN('00101011'B)" |
| 834 | }; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 835 | |
| 836 | external function enc_GsmRrMessage(in GsmRrMessage msg) return octetstring |
| 837 | with { extension "prototype(convert) encode(RAW)" }; |
| 838 | external function dec_GsmRrMessage(in octetstring stream) return GsmRrMessage |
| 839 | with { extension "prototype(convert) decode(RAW)" }; |
| 840 | |
| 841 | /* Normal L3 Message on Dedicated Channel */ |
| 842 | |
| 843 | /* 9.1.25 Paging Response */ |
| 844 | type record PagingResponse { |
| 845 | uint4_t spare_half_octet, |
| 846 | CipheringKeySeqNr cksn, |
| 847 | MsClassmark2LV cm2, |
| 848 | MobileIdentityLV mi, |
| 849 | uint8_t addl_upd_par optional |
| 850 | } with { variant "" }; |
| 851 | |
| 852 | type union RrL3Union { |
Vadim Yanitskiy | 480c2ac | 2020-09-01 05:43:06 +0700 | [diff] [blame] | 853 | PagingResponse paging_response, |
| 854 | MeasurementReport meas_rep, |
| 855 | AssignmentCommand ass_cmd, |
| 856 | octetstring other |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 857 | }; |
| 858 | |
| 859 | type record GsmRrL3Message { |
| 860 | RrL3Header header, |
| 861 | RrL3Union payload |
| 862 | } with { variant (payload) "CROSSTAG( |
| 863 | paging_response, header.message_type = PAGING_RESPONSE; |
Harald Welte | cbc947f | 2018-02-22 00:26:55 +0100 | [diff] [blame] | 864 | meas_rep, header.message_type = MEASUREMENT_REPORT; |
Vadim Yanitskiy | 27b3801 | 2020-09-01 05:14:46 +0700 | [diff] [blame] | 865 | ass_cmd, header.message_type = ASSIGNMENT_COMMAND; |
Harald Welte | 9419c8a | 2017-07-30 04:07:05 +0200 | [diff] [blame] | 866 | other, OTHERWISE; |
| 867 | )" } |
| 868 | |
Harald Welte | cbc947f | 2018-02-22 00:26:55 +0100 | [diff] [blame] | 869 | external function enc_GsmRrL3Message(in GsmRrL3Message msg) return octetstring |
| 870 | with { extension "prototype(convert) encode(RAW)" }; |
| 871 | external function dec_GsmRrL3Message(in octetstring stream) return GsmRrL3Message |
| 872 | with { extension "prototype(convert) decode(RAW)" }; |
| 873 | |
| 874 | |
Vadim Yanitskiy | 7091e8d | 2019-09-09 01:07:37 +0200 | [diff] [blame] | 875 | template PacketDlAssign tr_PacketDlAssign(template GprsTlli tlli) := { |
| 876 | tlli := tlli, |
| 877 | group1_present := ?, |
| 878 | group1 := *, |
| 879 | ta_index_present := ?, |
| 880 | ta_index := *, |
| 881 | tbf_starting_time_present := ?, |
| 882 | tbf_starting_time := *, |
| 883 | p0_present := ?, |
| 884 | p0 := *, |
| 885 | pr_mode := * |
| 886 | }; |
| 887 | |
| 888 | template IaRestOctets tr_IaRestOctets_DLAss(template PacketDlAssign dl_ass) := { |
| 889 | presence := '11'B, /* HH */ |
| 890 | ll := omit, lh := omit, hl := omit, |
| 891 | hh := { |
| 892 | pa_disc := '0'B, /* Packet Assignment (0) */ |
| 893 | pa := { |
| 894 | uldl := { |
| 895 | ass_disc := '1'B, /* Downlink Assignment (1) */ |
| 896 | ass := { dl := dl_ass } |
| 897 | } |
| 898 | } |
| 899 | } |
| 900 | }; |
| 901 | |
| 902 | template PacketUlAssign tr_PacketUlDynAssign(template uint5_t tfi := ?, |
| 903 | template BIT1 polling := ?, |
| 904 | template uint3_t usf := ?, |
| 905 | template BIT1 usf_granularity := ?, |
| 906 | template ChCodingCommand cs := ?) := { |
Vadim Yanitskiy | 06ca64d | 2019-09-29 20:17:10 +0700 | [diff] [blame] | 907 | presence := '1'B, /* Dynamic Block Allocation */ |
Vadim Yanitskiy | 7091e8d | 2019-09-09 01:07:37 +0200 | [diff] [blame] | 908 | dynamic := { |
| 909 | tfi_assignment := tfi, |
| 910 | polling := polling, |
Vadim Yanitskiy | 06ca64d | 2019-09-29 20:17:10 +0700 | [diff] [blame] | 911 | spare := '0'B, /* Dynamic Block Allocation (mandatory after Rel-4) */ |
Vadim Yanitskiy | 7091e8d | 2019-09-09 01:07:37 +0200 | [diff] [blame] | 912 | usf := usf, |
| 913 | usf_granularity := usf_granularity, |
| 914 | p0_present := ?, |
| 915 | p0 := *, |
| 916 | pr_mode := *, |
| 917 | ch_coding_cmd := cs, |
| 918 | tlli_block_chan_coding := ?, |
| 919 | alpha_present := ?, |
| 920 | alpha := *, |
| 921 | gamma := ?, |
| 922 | /* TODO: add to parameters */ |
| 923 | ta_index_present := ?, |
| 924 | ta_index := *, |
| 925 | tbf_starting_time_present := ?, |
| 926 | tbf_starting_time := * |
| 927 | }, |
| 928 | single := omit |
| 929 | }; |
| 930 | |
| 931 | template PacketUlAssign tr_PacketUlSglAssign := { |
Vadim Yanitskiy | 06ca64d | 2019-09-29 20:17:10 +0700 | [diff] [blame] | 932 | presence := '0'B, /* Single Block Allocation */ |
Vadim Yanitskiy | 7091e8d | 2019-09-09 01:07:37 +0200 | [diff] [blame] | 933 | dynamic := omit, |
| 934 | single := { |
| 935 | alpha_present := ?, |
| 936 | alpha := *, |
| 937 | gamma := ?, |
| 938 | padding := '01'B, |
| 939 | tbf_starting_time := ? |
| 940 | } |
| 941 | }; |
| 942 | |
| 943 | template IaRestOctets tr_IaRestOctets_ULAss(template PacketUlAssign ul_ass) := { |
| 944 | presence := '11'B, /* HH */ |
| 945 | ll := omit, lh := omit, hl := omit, |
| 946 | hh := { |
| 947 | pa_disc := '0'B, /* Packet Assignment (0) */ |
| 948 | pa := { |
| 949 | uldl := { |
| 950 | ass_disc := '0'B, /* Uplink Assignment (0) */ |
| 951 | ass := { ul := ul_ass } |
| 952 | } |
| 953 | } |
| 954 | } |
| 955 | }; |
| 956 | |
Vadim Yanitskiy | a0b47cf | 2020-04-02 01:50:18 +0700 | [diff] [blame] | 957 | template EgprsUlAss tr_EgprsUlAssDynamic(template (present) BIT5 ext_ra := ?, |
| 958 | template EgprsUlAssignDyn dyn_ass := ?) := { |
| 959 | ext_ra := ext_ra, |
| 960 | ats_present := ?, |
| 961 | ats := *, |
| 962 | presence := '1'B, |
| 963 | dynamic := dyn_ass, |
| 964 | multiblock := omit |
| 965 | }; |
| 966 | template EgprsUlAss tr_EgprsUlAssMultiblock(template (present) BIT5 ext_ra := ?, |
| 967 | template EgprsUlAssignMultiblock mb_ass := ?) := { |
| 968 | ext_ra := ext_ra, |
| 969 | ats_present := ?, |
| 970 | ats := *, |
| 971 | presence := '0'B, |
| 972 | dynamic := omit, |
| 973 | multiblock := mb_ass |
| 974 | }; |
| 975 | |
| 976 | template IaRestOctets tr_IaRestOctets_EGPRSULAss(template EgprsUlAss ul_ass) := { |
| 977 | presence := '01'B, /* LH */ |
| 978 | ll := omit, |
| 979 | lh := { |
| 980 | presence := '00'B, |
| 981 | egprs_ul := ul_ass, |
| 982 | multiblock_dl_ass := omit |
| 983 | }, |
| 984 | hl := omit, |
| 985 | hh := omit |
| 986 | }; |
| 987 | |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 988 | template (value) GsmRrMessage ts_IMM_ASS(uint8_t ra, GsmFrameNumber fn, TimingAdvance ta, |
Vadim Yanitskiy | 3b464a9 | 2020-08-25 03:55:32 +0700 | [diff] [blame] | 989 | ChannelDescription ch_desc, MobileAllocationLV ma) := { |
Harald Welte | bae6be8 | 2020-08-21 12:42:18 +0200 | [diff] [blame] | 990 | header := ts_RrHeader(IMMEDIATE_ASSIGNMENT, 0), |
Harald Welte | cbc947f | 2018-02-22 00:26:55 +0100 | [diff] [blame] | 991 | payload := { |
| 992 | imm_ass := { |
| 993 | ded_or_tbf := { |
| 994 | spare := '0'B, |
| 995 | tma := false, |
| 996 | downlink := false, |
| 997 | tbf := false |
| 998 | }, |
| 999 | page_mode := PAGE_MODE_NORMAL, |
| 1000 | chan_desc := ch_desc, |
| 1001 | pkt_chan_desc := omit, |
| 1002 | req_ref := f_compute_ReqRef(ra, fn), |
| 1003 | timing_advance := ta, |
| 1004 | mobile_allocation := ma, |
Vadim Yanitskiy | f10bb45 | 2019-09-05 13:53:01 +0200 | [diff] [blame] | 1005 | rest_octets := { |
| 1006 | presence := '00'B, /* LL */ |
| 1007 | ll := { |
Vadim Yanitskiy | b021ed4 | 2020-04-27 23:25:13 +0700 | [diff] [blame] | 1008 | compressed_irat_ho_info_ind := '0'B /* L */ |
Vadim Yanitskiy | 9b2a3e8 | 2019-09-08 15:37:15 +0200 | [diff] [blame] | 1009 | }, |
| 1010 | lh := omit, hl := omit, hh := omit |
Vadim Yanitskiy | f10bb45 | 2019-09-05 13:53:01 +0200 | [diff] [blame] | 1011 | } |
Harald Welte | cbc947f | 2018-02-22 00:26:55 +0100 | [diff] [blame] | 1012 | } |
| 1013 | } |
| 1014 | }; |
| 1015 | |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 1016 | template GsmRrMessage tr_IMM_ASS(template uint8_t ra := ?, template GsmFrameNumber fn := ?, |
| 1017 | template TimingAdvance ta := ?, |
| 1018 | template ChannelDescription ch_desc := ?, |
Vadim Yanitskiy | 3b464a9 | 2020-08-25 03:55:32 +0700 | [diff] [blame] | 1019 | template MobileAllocationLV ma := ?) := { |
Vadim Yanitskiy | d4205c3 | 2019-09-09 16:15:37 +0200 | [diff] [blame] | 1020 | header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?), |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 1021 | payload := { |
| 1022 | imm_ass := { |
| 1023 | ded_or_tbf := { |
| 1024 | spare := '0'B, |
| 1025 | tma := false, |
| 1026 | downlink := false, |
| 1027 | tbf := false |
| 1028 | }, |
| 1029 | page_mode := PAGE_MODE_NORMAL, |
| 1030 | chan_desc := ch_desc, |
| 1031 | pkt_chan_desc := omit, |
| 1032 | req_ref := tr_compute_ReqRef(ra, fn), |
| 1033 | timing_advance := ta, |
| 1034 | mobile_allocation := ma, |
Vadim Yanitskiy | f10bb45 | 2019-09-05 13:53:01 +0200 | [diff] [blame] | 1035 | rest_octets := ? |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 1036 | } |
| 1037 | } |
| 1038 | }; |
| 1039 | |
Vadim Yanitskiy | 6edd4f5 | 2019-09-09 01:51:09 +0200 | [diff] [blame] | 1040 | /* TODO: implement send version of this template */ |
| 1041 | template GsmRrMessage tr_IMM_TBF_ASS(template boolean dl := ?, |
| 1042 | template uint8_t ra := ?, |
| 1043 | template GsmFrameNumber fn := ?, |
| 1044 | template TimingAdvance ta := ?, |
| 1045 | template PacketChannelDescription ch_desc := ?, |
Vadim Yanitskiy | 3b464a9 | 2020-08-25 03:55:32 +0700 | [diff] [blame] | 1046 | template MobileAllocationLV ma := ?, |
Vadim Yanitskiy | 6edd4f5 | 2019-09-09 01:51:09 +0200 | [diff] [blame] | 1047 | template IaRestOctets rest := ?) := { |
| 1048 | header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?), |
| 1049 | payload := { |
| 1050 | imm_ass := { |
| 1051 | ded_or_tbf := { |
| 1052 | spare := ?, |
| 1053 | tma := ?, |
| 1054 | downlink := dl, |
| 1055 | tbf := true |
| 1056 | }, |
| 1057 | page_mode := ?, |
| 1058 | chan_desc := omit, |
| 1059 | pkt_chan_desc := ch_desc, |
| 1060 | req_ref := tr_compute_ReqRef(ra, fn), |
| 1061 | timing_advance := ta, |
Vadim Yanitskiy | cf1ed3f | 2020-07-20 04:01:43 +0700 | [diff] [blame] | 1062 | mobile_allocation := ma, |
Vadim Yanitskiy | 6edd4f5 | 2019-09-09 01:51:09 +0200 | [diff] [blame] | 1063 | rest_octets := rest |
| 1064 | } |
| 1065 | } |
| 1066 | }; |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 1067 | |
Vadim Yanitskiy | 9781ecb | 2020-03-28 03:59:41 +0700 | [diff] [blame] | 1068 | template GsmRrMessage tr_PAG_REQ1(template MobileIdentityLV mi1 := ?, |
| 1069 | template MobileIdentityTLV mi2 := omit) := { |
Pau Espin Pedrol | 88bf537 | 2019-12-09 21:12:28 +0100 | [diff] [blame] | 1070 | header := t_RrHeader(PAGING_REQUEST_TYPE_1, ?), |
| 1071 | payload := { |
| 1072 | pag_req_1 := { |
| 1073 | chan_needed := { |
| 1074 | second := ?, |
| 1075 | first := ? |
| 1076 | }, |
| 1077 | page_mode := PAGE_MODE_NORMAL, |
| 1078 | mi1 := mi1, |
Vadim Yanitskiy | 9781ecb | 2020-03-28 03:59:41 +0700 | [diff] [blame] | 1079 | mi2 := mi2, |
Pau Espin Pedrol | 88bf537 | 2019-12-09 21:12:28 +0100 | [diff] [blame] | 1080 | rest_octets := ? |
| 1081 | } |
| 1082 | } |
| 1083 | }; |
| 1084 | |
Harald Welte | cbc947f | 2018-02-22 00:26:55 +0100 | [diff] [blame] | 1085 | template (value) GsmRrL3Message ts_MEAS_REP(boolean valid, uint6_t rxl_f, uint6_t rxl_s, |
| 1086 | uint3_t rxq_f, uint3_t rxq_s, |
| 1087 | template (omit) NcellReports reps) := { |
| 1088 | header := t_RrL3Header(MEASUREMENT_REPORT), |
| 1089 | payload := { |
| 1090 | meas_rep := { |
| 1091 | meas_res := { |
| 1092 | ba_used := '0'B, |
| 1093 | dtx_used := '0'B, |
| 1094 | rxlev_full_srv_cell := rxl_f, |
| 1095 | threeg_ba_used := '0'B, |
Harald Welte | eb1e681 | 2018-02-22 18:43:48 +0100 | [diff] [blame] | 1096 | meas_valid := bool2bit(not valid), |
Harald Welte | cbc947f | 2018-02-22 00:26:55 +0100 | [diff] [blame] | 1097 | rxlev_sub_srv_cell := rxl_s, |
| 1098 | si23_ba_used := '0'B, |
| 1099 | rxqual_full_srv_cell := rxq_f, |
| 1100 | rxqual_sub_srv_cell := rxq_s, |
| 1101 | no_ncell_m := 0, |
| 1102 | ncell_reports := reps |
| 1103 | } |
| 1104 | } |
| 1105 | } |
| 1106 | }; |
| 1107 | |
Vadim Yanitskiy | 16e24aa | 2020-05-22 03:32:00 +0700 | [diff] [blame] | 1108 | template GsmRrMessage tr_IMM_ASS_REJ(template FeatureIndicator feature_ind := ?, |
| 1109 | template ReqRefWaitInd4 rr_wi_list := ?, |
| 1110 | template IARRestOctets rest_octets := ?) := { |
| 1111 | header := t_RrHeader(IMMEDIATE_ASSIGNMENT_REJECT, ?), |
| 1112 | payload := { |
| 1113 | imm_ass_rej := { |
| 1114 | feature_ind := feature_ind, |
| 1115 | page_mode := ?, |
| 1116 | payload := rr_wi_list, |
| 1117 | rest_octets := rest_octets |
| 1118 | } |
| 1119 | } |
| 1120 | }; |
| 1121 | |
| 1122 | template ReqRefWaitInd tr_ReqRefWaitInd(template RequestReference ref := ?, |
| 1123 | template WaitIndication wi := ?) := { |
| 1124 | req_ref := ref, |
| 1125 | wait_ind := wi |
| 1126 | }; |
| 1127 | |
| 1128 | template IARRestOctets tr_IARRestOctets(template ExtRAList ext_ra_list := ?, |
| 1129 | template uint3_t rcc := ?) := { |
| 1130 | ext_ra_list := ext_ra_list, |
| 1131 | rel13_ind := ?, |
| 1132 | rcc := rcc ifpresent |
| 1133 | }; |
| 1134 | |
| 1135 | template ExtRAOpt tr_ExtRAOpt(template BIT5 ext_ra := ?) := { |
| 1136 | presence := '1'B, // L/H |
| 1137 | ext_ra := ext_ra |
| 1138 | }; |
| 1139 | |
Vadim Yanitskiy | f7181ed | 2020-07-14 20:12:02 +0700 | [diff] [blame] | 1140 | template (value) ChannelDescription ts_ChanDescH0(template (value) RslChannelNr chan_nr, |
| 1141 | template (value) uint12_t arfcn, |
| 1142 | template (value) uint3_t tsc := 7) := { |
| 1143 | chan_nr := chan_nr, |
| 1144 | tsc := tsc, |
| 1145 | h := false, |
| 1146 | arfcn := arfcn, |
| 1147 | maio_hsn := omit |
| 1148 | } |
Vadim Yanitskiy | c3156ed | 2020-08-29 17:49:27 +0700 | [diff] [blame] | 1149 | template ChannelDescription tr_ChanDescH0(template (present) RslChannelNr chan_nr := ?, |
| 1150 | template (present) uint12_t arfcn := ?, |
| 1151 | template (present) uint3_t tsc := ?) := { |
| 1152 | chan_nr := chan_nr, |
| 1153 | tsc := tsc, |
| 1154 | h := false, |
| 1155 | arfcn := arfcn, |
| 1156 | maio_hsn := omit |
| 1157 | } |
Vadim Yanitskiy | f7181ed | 2020-07-14 20:12:02 +0700 | [diff] [blame] | 1158 | |
| 1159 | template (value) ChannelDescription ts_ChanDescH1(template (value) RslChannelNr chan_nr, |
| 1160 | template (value) MaioHsn maio_hsn, |
| 1161 | template (value) uint3_t tsc := 7) := { |
| 1162 | chan_nr := chan_nr, |
| 1163 | tsc := tsc, |
| 1164 | h := true, |
| 1165 | arfcn := omit, |
| 1166 | maio_hsn := maio_hsn |
| 1167 | } |
Vadim Yanitskiy | c3156ed | 2020-08-29 17:49:27 +0700 | [diff] [blame] | 1168 | template ChannelDescription tr_ChanDescH1(template (present) RslChannelNr chan_nr := ?, |
| 1169 | template (present) MaioHsn maio_hsn := ?, |
| 1170 | template (present) uint3_t tsc := ?) := { |
| 1171 | chan_nr := chan_nr, |
| 1172 | tsc := tsc, |
| 1173 | h := true, |
| 1174 | arfcn := omit, |
| 1175 | maio_hsn := maio_hsn |
| 1176 | } |
Vadim Yanitskiy | f7181ed | 2020-07-14 20:12:02 +0700 | [diff] [blame] | 1177 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1178 | |
| 1179 | /* Templates for the RR Channel Release message's "Cell selection indicator after release of all TCH and SDCCH" IE. |
| 1180 | * See 3GPP TS 44.018 9.1.7 and 10.5.2.1e */ |
| 1181 | |
| 1182 | /* 3GPP TS 44.018 10.5.2.1e, Cell Selection Indicator after release of all TCH and SDCCH value part */ |
| 1183 | type record CellSelIndValue { |
| 1184 | BIT3 discr, |
| 1185 | CellSelIndValueEnum value_list, |
| 1186 | BIT1 value_list_term ('0'B) |
| 1187 | } with { |
| 1188 | variant (value_list) "CROSSTAG( |
| 1189 | gsm, discr='000'B; |
| 1190 | utran_fdd, discr='001'B; |
| 1191 | utran_tdd, discr='010'B; |
| 1192 | eutran, discr='011'B; |
| 1193 | )" |
| 1194 | }; |
| 1195 | |
| 1196 | /* 3GPP TS 44.018 10.5.2.1e, Cell Selection Indicator after release of all TCH and SDCCH value part */ |
| 1197 | private type union CellSelIndValueEnum { |
| 1198 | CellSelIndValue_GSM_Descrs gsm, |
| 1199 | CellSelIndValue_UTRAN_Descrs utran_fdd, |
| 1200 | CellSelIndValue_UTRAN_Descrs utran_tdd, |
| 1201 | CellSelIndValue_EUTRAN_Descrs eutran |
| 1202 | } with { variant "" }; |
| 1203 | |
| 1204 | type record of CellSelIndValue_GSM_Descr CellSelIndValue_GSM_Descrs; |
| 1205 | /* 3GPP TS 44.018 10.5.2.1e, GSM Description struct */ |
| 1206 | type record CellSelIndValue_GSM_Descr { |
| 1207 | BIT1 item_ind ('1'B), |
| 1208 | BIT1 band_indicator, |
| 1209 | uint10_t arfcn, |
| 1210 | uint6_t bsic |
| 1211 | } with { |
| 1212 | variant "PRESENCE(item_ind = '1'B)" |
| 1213 | }; |
| 1214 | |
| 1215 | type record of CellSelIndValue_UTRAN_Descr CellSelIndValue_UTRAN_Descrs; |
| 1216 | /* 3GPP TS 44.018 10.5.2.1e, UTRAN {FDD,TDD} Description struct */ |
| 1217 | type record CellSelIndValue_UTRAN_Descr { |
| 1218 | BIT1 item_ind ('1'B), |
| 1219 | BIT1 bandwidth_presence, |
| 1220 | uint3_t bandwidth optional, |
| 1221 | uint14_t arfcn, |
| 1222 | BIT1 cell_info_presence, |
| 1223 | UTRAN_CellInfo cell_info optional |
| 1224 | } with { |
| 1225 | variant "PRESENCE(item_ind = '1'B)" |
| 1226 | variant (bandwidth) "PRESENCE(bandwidth_presence = '1'B)" |
| 1227 | variant (cell_info) "PRESENCE(cell_info_presence = '1'B)" |
| 1228 | }; |
| 1229 | type record UTRAN_CellInfo { |
| 1230 | BIT1 indic0, |
| 1231 | uint5_t nr_of_cells, |
| 1232 | // TODO: define cell_information_field |
| 1233 | octetstring cell_information_field |
| 1234 | } with { variant "" }; |
| 1235 | |
| 1236 | type record of CellSelIndValue_EUTRAN_Descr CellSelIndValue_EUTRAN_Descrs; |
| 1237 | /* 3GPP TS 44.018 10.5.2.1e, E-UTRAN Description struct */ |
| 1238 | type record CellSelIndValue_EUTRAN_Descr { |
| 1239 | BIT1 item_ind ('1'B), |
| 1240 | uint16_t earfcn, |
| 1241 | BIT1 meas_bw_presence, |
| 1242 | uint3_t meas_bw optional, |
| 1243 | BIT1 not_allowed_cells_presence, |
| 1244 | // define not_allowed_cells |
| 1245 | octetstring not_allowed_cells optional, |
| 1246 | BIT1 target_pcid_presence, |
| 1247 | uint9_t target_pcid optional |
| 1248 | } with { |
| 1249 | variant "PRESENCE(item_ind = '1'B)" |
| 1250 | variant (meas_bw) "PRESENCE(meas_bw_presence = '1'B)" |
| 1251 | variant (not_allowed_cells) "PRESENCE(not_allowed_cells_presence = '1'B)" |
| 1252 | variant (target_pcid) "PRESENCE(target_pcid_presence = '1'B)" |
| 1253 | }; |
| 1254 | |
| 1255 | template CellSelIndValue tr_CellSelIndValue_EUTRAN( |
| 1256 | template CellSelIndValue_EUTRAN_Descrs cells := {}) |
| 1257 | := { |
| 1258 | discr := '011'B, |
| 1259 | value_list := { |
| 1260 | eutran := cells |
| 1261 | }, |
| 1262 | value_list_term := '0'B |
| 1263 | }; |
| 1264 | |
| 1265 | template CellSelIndValue_EUTRAN_Descr tr_CellSelIndValue_EUTRAN_Descr( |
| 1266 | template (present) uint16_t earfcn, |
| 1267 | template (present) BIT1 meas_bw_presence := ?, |
| 1268 | template uint3_t meas_bw := *) |
| 1269 | := { |
| 1270 | item_ind := '1'B, |
| 1271 | earfcn := earfcn, |
| 1272 | meas_bw_presence := meas_bw_presence, |
| 1273 | meas_bw := meas_bw, |
| 1274 | not_allowed_cells_presence := '0'B, |
| 1275 | not_allowed_cells := omit, |
| 1276 | target_pcid_presence := '0'B, |
| 1277 | target_pcid := omit |
| 1278 | }; |
| 1279 | |
| 1280 | external function enc_CellSelIndValue(in CellSelIndValue ro) return octetstring |
| 1281 | with { extension "prototype(convert) encode(RAW)" }; |
| 1282 | external function dec_CellSelIndValue(in octetstring stream) return CellSelIndValue |
| 1283 | with { extension "prototype(convert) decode(RAW)" }; |
| 1284 | |
Vadim Yanitskiy | e05d716 | 2020-05-02 16:58:46 +0700 | [diff] [blame] | 1285 | } with { encode "RAW" ; variant "FIELDORDER(msb)" } |