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