blob: b62dcb92606a61a7f8b5a4afb0d645d7315acd41 [file] [log] [blame]
Harald Welte9419c8a2017-07-30 04:07:05 +02001/* Encoding/Decoding routines for GSM System Information messages
Harald Welte34b5a952019-05-27 11:54:11 +02002 * 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 Welte9419c8a2017-07-30 04:07:05 +020012
13module GSM_RR_Types {
14
15 import from General_Types all;
16 import from Osmocom_Types all;
17 import from GSM_Types all;
Vadim Yanitskiy150d6d12022-10-20 19:10:04 +070018 import from GSM_RestOctets all;
Harald Welte9419c8a2017-07-30 04:07:05 +020019 import from RLCMAC_CSN1_Types all;
Vadim Yanitskiy98bb2d52020-03-28 00:57:21 +070020 import from MobileL3_CommonIE_Types all;
Vadim Yanitskiy27b38012020-09-01 05:14:46 +070021 import from MobileL3_RRM_Types all;
Harald Welte9419c8a2017-07-30 04:07:05 +020022
23 /* Table 10.4.1 of Section 10.4 / 3GPP TS 44.018 */
24 type enumerated RrMessageType {
25 ADDITIONAL_ASSIGNMENT ('00111011'B),
26 IMMEDIATE_ASSIGNMENT ('00111111'B),
27 IMMEDIATE_ASSIGNMENT_EXTENDED ('00111001'B),
28 IMMEDIATE_ASSIGNMENT_REJECT ('00111010'B),
29 IMMEDIATE_PACKET_ASSIGNMENT ('01101001'B),
30
31 CIPHERING_MODE_COMMAND ('00110101'B),
32 CIPHERING_MODE_COMPLETE ('00110010'B),
33
34 CONFIGURATION_CHANGE_COMMAND ('00110000'B),
35 CONFIGURATION_CHANGE_ACK ('00110001'B),
36 CONFIGURATION_CHANGE_REJECT ('00110011'B),
37
38 ASSIGNMENT_COMMAND ('00101110'B),
39 ASSIGNMENT_COMPLETE ('00101001'B),
40 ASSIGNMENT_FAILURE ('00101111'B),
41 HANDOVER_COMMAND ('00101011'B),
42 HANDOVER_COMPLETE ('00101100'B),
43 HANDOVER_FAILURE ('00101000'B),
44 PHYSICAL_INFORMATION ('00101101'B),
45
46 CHANNEL_RELEASE ('00001101'B),
47 PARTIAL_RELEASE ('00001010'B),
48 PARTIAL_RELEASE_COMPLETE ('00001111'B),
49
50 PAGING_REQUEST_TYPE_1 ('00100001'B),
51 PAGING_REQUEST_TYPE_2 ('00100010'B),
52 PAGING_REQUEST_TYPE_3 ('00100100'B),
53 PAGING_RESPONSE ('00100111'B),
54 NOTIFICATION_NCH ('00100000'B),
55 NOTIFICATION_RESPOSNE ('00100110'B),
56
57 SYSTEM_INFORMATION_TYPE_8 ('00011000'B),
58 SYSTEM_INFORMATION_TYPE_1 ('00011001'B),
59 SYSTEM_INFORMATION_TYPE_2 ('00011010'B),
60 SYSTEM_INFORMATION_TYPE_3 ('00011011'B),
61 SYSTEM_INFORMATION_TYPE_4 ('00011100'B),
62 SYSTEM_INFORMATION_TYPE_5 ('00011101'B),
63 SYSTEM_INFORMATION_TYPE_6 ('00011110'B),
64 SYSTEM_INFORMATION_TYPE_7 ('00011111'B),
65 SYSTEM_INFORMATION_TYPE_2bis ('00000010'B),
66 SYSTEM_INFORMATION_TYPE_2ter ('00000011'B),
67 SYSTEM_INFORMATION_TYPE_2quater ('00000111'B),
68 SYSTEM_INFORMATION_TYPE_5bis ('00000101'B),
69 SYSTEM_INFORMATION_TYPE_5ter ('00000110'B),
70 SYSTEM_INFORMATION_TYPE_9 ('00000100'B),
71 SYSTEM_INFORMATION_TYPE_13 ('00000000'B),
72
73 SYSTEM_INFORMATION_TYPE_16 ('00111101'B),
74 SYSTEM_INFORMATION_TYPE_17 ('00111110'B),
75
76 CHANNEL_MODE_MODIFY ('00010000'B),
77 RR_STATUS ('00010010'B),
78 CHANNEL_MODE_MODIFY_ACKNOWLEDGE ('00010111'B),
79 FREQUENCY_REDEFINITION ('00010100'B),
80 MEASUREMENT_REPORT ('00010101'B),
81 CLASSMARK_CHANGE ('00010110'B),
82 CLASSMARK_ENQUIRY ('00010011'B),
83 EXTENDED_MEASUREMENT_REPORT ('00110110'B),
84 EXTENDED_MEASUREMENT_ORDER ('00110111'B),
85 GPRS_SUSPENSION_REQUEST ('00110100'B),
86 //MBMS_ANNOUNCEMENT ('00010110'B), duplicate?
87 //SERVICE_INFORMATION ('00110110'B), duplicate?
88
89 APPLICATION_INFORMATION ('00111000'B),
90
91 SYSTEM_INFORMATION_TYPE_14 ('00000001'B),
92 SYSTEM_INFORMATION_TYPE_15 ('01000011'B),
93 SYSTEM_INFORMATION_TYPE_18 ('01000000'B),
94 SYSTEM_INFORMATION_TYPE_19 ('01000001'B),
95 SYSTEM_INFORMATION_TYPE_20 ('01000010'B),
96 SYSTEM_INFORMATION_TYPE_13alt ('01000100'B),
97 SYSTEM_INFORMATION_TYPE_2n ('01000101'B),
98 SYSTEM_INFORMATION_TYPE_21 ('01000110'B),
99 SYSTEM_INFORMATION_TYPE_22 ('01000111'B),
100 SYSTEM_INFORMATION_TYPE_23 ('01001111'B),
101
102 DTM_ASSIGNMENT_FAILURE ('01001000'B),
103 DTM_REJECT ('01001001'B),
104 DTM_REQUEST ('01001010'B),
105 PACKET_ASSIGNMENT ('01001011'B),
106 DTM_ASSIGNMENT_COMMAND ('01001100'B),
107 DTM_INFORMATION ('01001101'B),
108 PACKET_INFORMATION ('01001110'B),
109
110 UTRAN_CLASSMARK_CHANGE ('01100000'B),
111 CDMA2000_CLASSMARK_CHANGE ('01100010'B),
112 INTERSYS_TO_UTRAN_HO_CMD ('01100011'B),
113 INTERSYS_TO_CDMA2000_HO_CMD ('01100100'B),
114 GERAN_IU_MODE_CLASSMARK_CHG ('01100101'B),
115 INTERSYS_TO_EUTRAN_HO_CMD ('01100110'B)
116 } with { variant "FIELDLENGTH(8)" };
117
Neels Hofmeyr95a5edc2020-07-11 02:57:04 +0200118 type enumerated RR_Cause {
119 GSM48_RR_CAUSE_NORMAL ('00'O),
120 GSM48_RR_CAUSE_ABNORMAL_UNSPEC ('01'O),
121 GSM48_RR_CAUSE_ABNORMAL_UNACCT ('02'O),
122 GSM48_RR_CAUSE_ABNORMAL_TIMER ('03'O),
123 GSM48_RR_CAUSE_ABNORMAL_NOACT ('04'O),
124 GSM48_RR_CAUSE_PREMPTIVE_REL ('05'O),
125 GSM48_RR_CAUSE_HNDOVER_IMP ('08'O),
126 GSM48_RR_CAUSE_CHAN_MODE_UNACCT ('09'O),
127 GSM48_RR_CAUSE_FREQ_NOT_IMPL ('0a'O),
128 GSM48_RR_CAUSE_CALL_CLEARED ('41'O),
129 GSM48_RR_CAUSE_SEMANT_INCORR ('5f'O),
130 GSM48_RR_CAUSE_INVALID_MAND_INF ('60'O),
131 GSM48_RR_CAUSE_MSG_TYPE_N ('61'O),
132 GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT('62'O),
133 GSM48_RR_CAUSE_COND_IE_ERROR ('64'O),
134 GSM48_RR_CAUSE_NO_CELL_ALLOC_A ('65'O),
135 GSM48_RR_CAUSE_PROT_ERROR_UNSPC ('6f'O)
136 } with { variant "FIELDLENGTH(8)" };
137
Harald Welte9419c8a2017-07-30 04:07:05 +0200138 type octetstring RestOctets with { variant "PADDING(yes), PADDING_PATTERN('00101011'B)" };
Harald Welte9419c8a2017-07-30 04:07:05 +0200139
140 type record L2PseudoLength {
141 uint6_t l2_plen,
142 BIT2 zero_one
143 } with { variant "" };
144
Harald Weltef8df4cb2018-03-10 15:15:08 +0100145 template L2PseudoLength tr_L2Pseudolength(template uint6_t len) := {
146 l2_plen := len,
147 zero_one := '01'B
148 };
149
150 template (value) L2PseudoLength ts_L2Pseudolength(uint6_t len) := {
Harald Welte9419c8a2017-07-30 04:07:05 +0200151 l2_plen := len,
152 zero_one := '01'B
153 };
154
155 type record RrHeader {
156 L2PseudoLength l2_plen,
157 uint4_t skip_indicator,
158 uint4_t rr_protocol_discriminator,
159 RrMessageType message_type
160 } with { variant "" };
161
162 template RrHeader t_RrHeader(RrMessageType msg_type, template uint6_t len) := {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100163 l2_plen := tr_L2Pseudolength(len),
Harald Welte9419c8a2017-07-30 04:07:05 +0200164 skip_indicator := 0,
165 rr_protocol_discriminator := 6,
166 message_type := msg_type
167 };
168
Harald Weltef8df4cb2018-03-10 15:15:08 +0100169 template (value) RrHeader ts_RrHeader(RrMessageType msg_type, uint6_t len) := {
170 l2_plen := ts_L2Pseudolength(len),
171 skip_indicator := 0,
172 rr_protocol_discriminator := 6,
173 message_type := msg_type
174 };
175
176
Harald Welte9419c8a2017-07-30 04:07:05 +0200177 type record RrL3Header {
178 uint4_t skip_indicator,
179 uint4_t rr_protocol_discriminator,
180 RrMessageType message_type
181 } with { variant "" };
182
Harald Weltecbc947f2018-02-22 00:26:55 +0100183 template RrL3Header t_RrL3Header(RrMessageType msg_type) := {
184 skip_indicator := 0,
185 rr_protocol_discriminator := 6,
186 message_type := msg_type
187 }
188
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200189 /* TS 44.004 7.2.1 */
190 type record SacchL1Header {
191 uint2_t reserved,
192 boolean fpc,
193 uint5_t ms_power_lvl,
194 uint8_t actual_ta
195 } with { variant "FIELDORDER(msb)" };
196
Vadim Yanitskiy79da4ce2020-10-17 15:48:47 +0700197 external function enc_SacchL1Header(in SacchL1Header hdr) return octetstring
198 with { extension "prototype(convert) encode(RAW)" };
199 external function dec_SacchL1Header(in octetstring stream) return SacchL1Header
200 with { extension "prototype(convert) decode(RAW)" };
201
Vadim Yanitskiy68c4cff2022-07-30 23:45:02 +0700202 template (value) SacchL1Header
203 ts_SacchL1Header(uint5_t ms_power_lvl,
204 uint8_t actual_ta,
205 boolean fpc := false) := {
Pau Espin Pedrol0aad5962018-09-28 16:03:55 +0200206 reserved := 0,
207 fpc := fpc,
208 ms_power_lvl := ms_power_lvl,
209 actual_ta := actual_ta
210 };
211
Harald Welte9419c8a2017-07-30 04:07:05 +0200212 type record MaioHsn {
Vadim Yanitskiyff0072c2020-05-27 01:35:39 +0700213 uint6_t maio,
214 uint6_t hsn
Harald Welte9419c8a2017-07-30 04:07:05 +0200215 } with { variant "" };
216
Vadim Yanitskiy5bcd9192020-07-06 20:18:11 +0700217 /* It's more handy to pass HSN first, so the arguments' order is reversed. */
218 template (value) MaioHsn ts_HsnMaio(template (value) uint6_t hsn,
219 template (value) uint6_t maio) := {
220 maio := maio,
221 hsn := hsn
222 };
223 template MaioHsn tr_HsnMaio(template (present) uint6_t hsn,
224 template (present) uint6_t maio) := {
225 maio := maio,
226 hsn := hsn
227 };
228
Harald Welte9419c8a2017-07-30 04:07:05 +0200229 /* TS 24.008 10.5.1.2 */
230 type uint4_t CipheringKeySeqNr (0..7);
231
Harald Welte9419c8a2017-07-30 04:07:05 +0200232 /* TS 24.008 10.5.1.4 */
233 type enumerated MobileIdentityType {
234 MI_TYPE_NONE (0),
235 MI_TYPE_IMSI,
236 MI_TYPE_IMEI,
237 MI_TYPE_IMEISV,
238 MI_TYPE_TMSI,
239 MI_TYPE_TMGI
240 } with { variant "FIELDLENGTH(3)" };
241
Harald Welte9419c8a2017-07-30 04:07:05 +0200242 /* TS 24.008 10.5.1.5 */
243 type record MsClassmark1 {
244 BIT1 spare,
245 uint2_t rev_level,
246 boolean es_ind,
247 boolean a51,
248 uint3_t rf_pwr_cap
249 } with { variant "" };
250
251 /* TS 24.008 10.5.1.6 */
252 type record MsClassmark2 {
253 BIT1 spare,
254 uint2_t rev_level,
255 boolean es_ind,
256 boolean a51,
257 uint3_t rf_pwr_cap,
258 BIT1 spare1,
259 boolean ps_cap,
260 uint2_t ss_screen_ind,
261 boolean sm_cap,
262 boolean vbs,
263 boolean vgcs,
264 boolean fc,
265 boolean cm3,
266 BIT1 spare2,
267 boolean lcsva_cap,
268 boolean ucs2,
269 boolean solsa,
270 boolean cmsp,
271 boolean a53,
272 boolean a52
273 } with { variant "" };
274 type record MsClassmark2LV {
275 uint8_t len,
276 MsClassmark2 cm2
277 } with { variant (len) "LENGTHTO(cm2)" };
278
279
280 /* 44.018 10.5.2.5 */
281 type record ChannelDescription {
282 RslChannelNr chan_nr,
283 uint3_t tsc,
284 boolean h,
285 uint12_t arfcn optional,
286 MaioHsn maio_hsn optional
287 } with { variant (arfcn) "PRESENCE(h = false)"
288 variant (maio_hsn) "PRESENCE(h = true)" };
289
290 type record ChannelDescriptionTV {
291 OCT1 iei,
292 ChannelDescription v
293 } with { variant "" };
294
295 /* 10.5.2.21 */
Vadim Yanitskiy3b464a92020-08-25 03:55:32 +0700296 type record MobileAllocationLV {
Harald Welte9419c8a2017-07-30 04:07:05 +0200297 uint8_t len,
Vadim Yanitskiy7d6eef32020-08-29 02:56:58 +0700298 bitstring ma length (0..64)
Vadim Yanitskiy3ddb3ab2020-07-20 04:29:53 +0700299 } with {
300 variant (len) "LENGTHTO(ma)"
Vadim Yanitskiye2a6fdf2020-07-23 04:53:02 +0700301 variant (ma) "BYTEORDER(first), BITORDER(msb)"
Vadim Yanitskiy3ddb3ab2020-07-20 04:29:53 +0700302 };
Harald Welte9419c8a2017-07-30 04:07:05 +0200303
Vadim Yanitskiy74e1f6b2020-08-25 03:59:45 +0700304 type record MobileAllocationTLV {
305 OCT1 iei ('72'O),
306 MobileAllocationLV v
307 } with { variant "" };
308
Harald Welte9419c8a2017-07-30 04:07:05 +0200309 /* 10.5.2.25a */
Harald Welte1b9b7702017-07-30 04:19:14 +0200310 type record PktChDesc0Ind {
311 uint6_t maio,
312 BIT1 ma_number_ind,
313 BIT1 change_mark1_valid,
314 BIT2 change_mark1
315 } with { variant "" };
316 type record PktChDesc0 {
317 BIT1 hopping,
318 BIT1 spare ('0'B),
319 uint10_t arfcn optional,
320 PktChDesc0Ind indirect optional
321 } with {
322 variant (arfcn) "PRESENCE(hopping = '0'B)"
323 variant (indirect) "PRESENCE(hopping = '1'B)"
324 };
325 type record PktChDesc1 {
326 uint6_t maio,
327 uint6_t hsn
328 } with { variant "" };
329 type record PacketChannelDescription {
330 uint5_t channel_Type_spare,
331 uint3_t tn,
332 uint3_t tsc,
333 BIT1 presence,
334 PktChDesc0 zero optional,
335 PktChDesc1 one optional
336 } with {
337 variant (zero) "PRESENCE(presence = '0'B)"
338 variant (one) "PRESENCE(presence = '1'B)"
339 };
Harald Welte9419c8a2017-07-30 04:07:05 +0200340
341 /* 10.5.2.25b */
342 type record DedicatedModeOrTbf {
343 BIT1 spare,
344 boolean tma,
345 boolean downlink,
346 boolean tbf
347 } with { variant "" };
348
349 /* 10.5.2.26 */
350 type enumerated PageMode {
351 PAGE_MODE_NORMAL,
352 PAGE_MODE_EXTENDED,
353 PAGE_MODE_REORGANIZATION,
354 PAGE_MODE_SAME_AS_BEFORE
355 } with { variant "FIELDLENGTH(4)" };
356
357 /* 10.5.2.30 */
358 type record RequestReference {
359 bitstring ra length(8),
360 uint5_t t1p,
361 uint6_t t3,
362 uint5_t t2
363 } with { variant "" };
364
365 template RequestReference t_RequestReference(template bitstring ra, template uint5_t t1p, template uint6_t t3, template uint5_t t2) := {
366 ra := ra,
367 t1p := t1p,
368 t3 := t3,
369 t2 := t2
370 }
371
372 /* compute the expected request reference for given RA + FN */
373 function f_compute_ReqRef(uint8_t ra, GsmFrameNumber fn) return RequestReference {
374 var RequestReference req_ref := { ra := int2bit(ra, 8) };
375 req_ref.t1p := (fn / 1326) mod 32;
376 req_ref.t2 := fn mod 26;
377 req_ref.t3 := fn mod 51;
378 return req_ref
379 }
Harald Weltee8d750e2018-06-10 21:41:35 +0200380 function tr_compute_ReqRef(template uint8_t ra, template GsmFrameNumber fn)
381 return template RequestReference {
382 var template RequestReference req_ref;
383 if (istemplatekind(ra, "?")) {
384 req_ref.ra := ?;
385 } else {
386 req_ref.ra := int2bit(valueof(ra), 8);
387 }
388 if (istemplatekind(fn, "?")) {
389 req_ref.t1p := ?;
390 req_ref.t2 := ?;
391 req_ref.t3 := ?;
392 } else {
393 var GsmFrameNumber fn_v := valueof(fn);
394 req_ref.t1p := (fn_v / 1326) mod 32;
395 req_ref.t2 := fn_v mod 26;
396 req_ref.t3 := fn_v mod 51;
397 }
398 return req_ref;
399 }
Harald Welte9419c8a2017-07-30 04:07:05 +0200400
401 /* 10.5.2.40 */
402 type integer TimingAdvance (0..219);
403
404 /* 10.5.2.43 */
405 type uint8_t WaitIndication;
406
407 /* 10.5.2.76 */
408 type record FeatureIndicator {
Vadim Yanitskiyc3cebd32020-05-22 02:43:22 +0700409 BIT2 peo_bcch_change_mark,
410 boolean cs_ir,
411 boolean ps_ir
412 } with {
413 variant (cs_ir) "FIELDLENGTH(1)"
414 variant (ps_ir) "FIELDLENGTH(1)"
415 };
Harald Welte9419c8a2017-07-30 04:07:05 +0200416
417 /* 24.008 10.5.5.6 */
418 type record DrxParameter {
419 uint8_t split_pg_cycle_code,
420 uint4_t drx_cycle_len_coeff,
421 boolean split_on_ccch,
422 uint3_t non_drx_timer
423 } with { variant "" };
424
Harald Weltecbc947f2018-02-22 00:26:55 +0100425 type record MeasurementResults {
426 BIT1 ba_used,
427 BIT1 dtx_used,
428 uint6_t rxlev_full_srv_cell,
429 BIT1 threeg_ba_used,
430 BIT1 meas_valid,
431 uint6_t rxlev_sub_srv_cell,
432 BIT1 si23_ba_used,
433 uint3_t rxqual_full_srv_cell,
434 uint3_t rxqual_sub_srv_cell,
435 uint3_t no_ncell_m,
436 NcellReports ncell_reports optional
437 } with { variant (no_ncell_m) "LENGTHTO(ncell_reports)"
438 variant (no_ncell_m) "UNIT(elements)"
Vadim Yanitskiy9cbb86f2021-11-04 18:50:22 +0300439 /* FIXME: pad to 16 octets */
Harald Weltecbc947f2018-02-22 00:26:55 +0100440 };
441
442 type record NcellReport {
443 uint6_t rxlev,
444 uint5_t bcch_freq,
445 uint6_t bsic
446 } with { variant ""};
447 type record of NcellReport NcellReports;
448
Harald Welte9419c8a2017-07-30 04:07:05 +0200449
Vadim Yanitskiy27b38012020-09-01 05:14:46 +0700450 /* 3GPP TS 44.018, section 9.1.2 (minimalistic implementation) */
451 type record AssignmentCommand {
452 ChannelDescription chan_desc,
453 PowerCommand_V power_cmd,
454 FrequencyList_TLV freq_list_at optional,
455 CellChannelDescription_TV cell_chan_desc optional,
456 /* TODO: Multislot Allocation IE */
457 ChannelMode_TV chan1_mode optional,
458 ChannelMode_TV chan2_mode optional,
459 /* TODO: Mode of Channel Set 3..8 IE */
460 MobileAllocationTLV mobile_allocation optional
461 /* TODO: more optional IEs... */
462 } with {
463 variant "TAG(
464 freq_list_at, elementIdentifier = '05'O;
465 cell_chan_desc, elementIdentifier = '62'O;
466 chan1_mode, elementIdentifier = '63'O;
467 chan2_mode, elementIdentifier = '11'O;
468 mobile_allocation, iei = '72'O;
469 )"
470 };
471
Vadim Yanitskiy5fec37c2020-09-02 17:19:47 +0700472 /* 3GPP TS 44.018, section 9.1.15 (minimalistic implementation) */
473 type record HandoverCommand {
474 CellDescriptionV cell_desc,
475 ChannelDescription chan_desc,
476 OCT1 ho_ref,
477 PowerCommandAndAccesstype_V power_cmd_acc_type,
478 FrequencyList_TLV freq_list_at optional,
479 CellChannelDescription_TV cell_chan_desc optional,
480 ChannelMode_TV chan1_mode optional,
481 ChannelMode_TV chan2_mode optional,
482 /* TODO: Mode of Channel Set 3..8 IE */
483 MobileAllocationTLV mobile_allocation optional
484 /* TODO: more optional IEs... */
485 } with {
486 variant "TAG(
487 freq_list_at, elementIdentifier = '05'O;
488 cell_chan_desc, elementIdentifier = '62'O;
489 chan1_mode, elementIdentifier = '63'O;
490 chan2_mode, elementIdentifier = '11'O;
491 mobile_allocation, iei = '72'O;
492 )"
493 };
494
495 /* 10.5.2.2 Cell Description IE */
496 type record CellDescriptionV {
497 uint3_t bcc, /* PLMN colour code */
498 uint3_t ncc, /* BS colour code */
499 uint10_t bcch_arfcn
500 } with { variant "FIELDORDER(lsb)" };
501
Vadim Yanitskiy27b38012020-09-01 05:14:46 +0700502
Harald Welte9419c8a2017-07-30 04:07:05 +0200503 /* 9.1.18 */
504 type record ImmediateAssignment {
505 DedicatedModeOrTbf ded_or_tbf,
506 PageMode page_mode,
507 ChannelDescription chan_desc optional,
508 PacketChannelDescription pkt_chan_desc optional,
509 RequestReference req_ref,
510 TimingAdvance timing_advance,
Vadim Yanitskiy3b464a92020-08-25 03:55:32 +0700511 MobileAllocationLV mobile_allocation,
Harald Welte9419c8a2017-07-30 04:07:05 +0200512 /* TODO: starting time TLV */
Vadim Yanitskiyf10bb452019-09-05 13:53:01 +0200513 IaRestOctets rest_octets
Harald Welte9419c8a2017-07-30 04:07:05 +0200514 } with { variant (chan_desc) "PRESENCE(ded_or_tbf.tbf = false)"
Vadim Yanitskiya4aacc22019-09-09 04:41:12 +0200515 variant (pkt_chan_desc) "PRESENCE(ded_or_tbf.tbf = true)" };
Harald Welte9419c8a2017-07-30 04:07:05 +0200516
517 /* 9.1.20 */
518 type record ReqRefWaitInd {
519 RequestReference req_ref,
520 WaitIndication wait_ind
521 } with { variant "" };
522 type record length(4) of ReqRefWaitInd ReqRefWaitInd4;
523 type record ImmediateAssignmentReject {
524 FeatureIndicator feature_ind,
525 PageMode page_mode,
Vadim Yanitskiy7ef121d2020-05-22 03:04:22 +0700526 ReqRefWaitInd4 payload,
527 IARRestOctets rest_octets
Harald Welte9419c8a2017-07-30 04:07:05 +0200528 } with { variant "" };
529
Harald Weltecbc947f2018-02-22 00:26:55 +0100530 /* 9.1.21 */
531 type record MeasurementReport {
532 MeasurementResults meas_res
533 } with { variant "" };
534
Harald Welte9419c8a2017-07-30 04:07:05 +0200535 /* 9.1.22 */
536 type record PagingRequestType1 {
537 ChannelNeeded12 chan_needed,
538 PageMode page_mode,
539 MobileIdentityLV mi1,
540 MobileIdentityTLV mi2 optional,
541 RestOctets rest_octets
Vadim Yanitskiy98bb2d52020-03-28 00:57:21 +0700542 } with { variant "TAG(mi2, elementIdentifier = '0010111'B)" };
Harald Welte9419c8a2017-07-30 04:07:05 +0200543
544 /* 9.1.23 */
545 type record PagingRequestType2 {
546 ChannelNeeded12 chan_needed,
547 PageMode page_mode,
548 GsmTmsi mi1,
549 GsmTmsi mi2,
550 MobileIdentityTLV mi3 optional,
551 RestOctets rest_octets
Vadim Yanitskiy98bb2d52020-03-28 00:57:21 +0700552 } with { variant "TAG(mi3, elementIdentifier = '0010111'B)" };
Harald Welte9419c8a2017-07-30 04:07:05 +0200553
554 /* 9.1.24 */
555 type record length(4) of GsmTmsi GsmTmsi4;
556 type record PagingRequestType3 {
557 ChannelNeeded12 chan_needed,
558 PageMode page_mode,
559 GsmTmsi4 mi,
560 RestOctets rest_octets
561 } with { variant "" };
562
Harald Welte9419c8a2017-07-30 04:07:05 +0200563 type union RrUnion {
564/*
565 SystemInformationType1 si1,
566 SystemInformationType2 si2,
567 SystemInformationType2bis si2bis,
568 SystemInformationType2ter si2ter,
Harald Welte82ccef72018-02-25 16:17:33 +0100569 SystemInformationType3 si3,
Harald Welte9419c8a2017-07-30 04:07:05 +0200570 SystemInformationType4 si4,
571 SystemInformationType5 si5,
572 SystemInformationType5bis si5bis,
573 SystemInformationType5ter si5ter,
574 SystemInformationType6 si6,
575*/
576 ImmediateAssignment imm_ass,
577 ImmediateAssignmentReject imm_ass_rej,
578 PagingRequestType1 pag_req_1,
579 PagingRequestType2 pag_req_2,
580 PagingRequestType3 pag_req_3,
581 octetstring other
582 } with { variant "" };
583
584 /* Special RR Message on BCCH / CCCH Dowlink */
585
586 type record GsmRrMessage {
587 RrHeader header,
588 RrUnion payload
589 } with { variant (payload) "CROSSTAG(
590/*
591 si1, header.message_type = SYSTEM_INFORMATION_TYPE_1;
592 si2, header.message_type = SYSTEM_INFORMATION_TYPE_2;
593 si2bis, header.message_type = SYSTEM_INFORMATION_TYPE_2bis;
594 si2ter, header.message_type = SYSTEM_INFORMATION_TYPE_2ter;
595 si3, header.message_type = SYSTEM_INFORMATION_TYPE_3;
596 si4, header.message_type = SYSTEM_INFORMATION_TYPE_4;
597 si5, header.message_type = SYSTEM_INFORMATION_TYPE_5;
598 si5bis, header.message_type = SYSTEM_INFORMATION_TYPE_5bis;
599 si5ter, header.message_type = SYSTEM_INFORMATION_TYPE_5ter;
600 si6, header.message_type = SYSTEM_INFORMATION_TYPE_6;
601*/
602 imm_ass, header.message_type = IMMEDIATE_ASSIGNMENT;
603 imm_ass_rej, header.message_type = IMMEDIATE_ASSIGNMENT_REJECT;
604 pag_req_1, header.message_type = PAGING_REQUEST_TYPE_1;
605 pag_req_2, header.message_type = PAGING_REQUEST_TYPE_2;
606 pag_req_3, header.message_type = PAGING_REQUEST_TYPE_3;
607 other, OTHERWISE;
Vadim Yanitskiya4aacc22019-09-09 04:41:12 +0200608 )"
609 /* Total message length: 184 = 23 * 8. Pad spare bits with '2B'O. */
610 variant "PADDING(184), PADDING_PATTERN('00101011'B)"
611 };
Harald Welte9419c8a2017-07-30 04:07:05 +0200612
613 external function enc_GsmRrMessage(in GsmRrMessage msg) return octetstring
614 with { extension "prototype(convert) encode(RAW)" };
615 external function dec_GsmRrMessage(in octetstring stream) return GsmRrMessage
616 with { extension "prototype(convert) decode(RAW)" };
617
618 /* Normal L3 Message on Dedicated Channel */
619
620 /* 9.1.25 Paging Response */
621 type record PagingResponse {
622 uint4_t spare_half_octet,
623 CipheringKeySeqNr cksn,
624 MsClassmark2LV cm2,
625 MobileIdentityLV mi,
626 uint8_t addl_upd_par optional
627 } with { variant "" };
628
629 type union RrL3Union {
Vadim Yanitskiy480c2ac2020-09-01 05:43:06 +0700630 PagingResponse paging_response,
631 MeasurementReport meas_rep,
632 AssignmentCommand ass_cmd,
Vadim Yanitskiy5fec37c2020-09-02 17:19:47 +0700633 HandoverCommand ho_cmd,
Vadim Yanitskiy480c2ac2020-09-01 05:43:06 +0700634 octetstring other
Harald Welte9419c8a2017-07-30 04:07:05 +0200635 };
636
637 type record GsmRrL3Message {
638 RrL3Header header,
639 RrL3Union payload
640 } with { variant (payload) "CROSSTAG(
641 paging_response, header.message_type = PAGING_RESPONSE;
Harald Weltecbc947f2018-02-22 00:26:55 +0100642 meas_rep, header.message_type = MEASUREMENT_REPORT;
Vadim Yanitskiy27b38012020-09-01 05:14:46 +0700643 ass_cmd, header.message_type = ASSIGNMENT_COMMAND;
Vadim Yanitskiy5fec37c2020-09-02 17:19:47 +0700644 ho_cmd, header.message_type = HANDOVER_COMMAND;
Harald Welte9419c8a2017-07-30 04:07:05 +0200645 other, OTHERWISE;
646 )" }
647
Harald Weltecbc947f2018-02-22 00:26:55 +0100648 external function enc_GsmRrL3Message(in GsmRrL3Message msg) return octetstring
649 with { extension "prototype(convert) encode(RAW)" };
650 external function dec_GsmRrL3Message(in octetstring stream) return GsmRrL3Message
651 with { extension "prototype(convert) decode(RAW)" };
652
653
Vadim Yanitskiy7091e8d2019-09-09 01:07:37 +0200654 template PacketDlAssign tr_PacketDlAssign(template GprsTlli tlli) := {
655 tlli := tlli,
656 group1_present := ?,
657 group1 := *,
658 ta_index_present := ?,
659 ta_index := *,
660 tbf_starting_time_present := ?,
661 tbf_starting_time := *,
662 p0_present := ?,
663 p0 := *,
664 pr_mode := *
665 };
666
667 template IaRestOctets tr_IaRestOctets_DLAss(template PacketDlAssign dl_ass) := {
668 presence := '11'B, /* HH */
669 ll := omit, lh := omit, hl := omit,
670 hh := {
671 pa_disc := '0'B, /* Packet Assignment (0) */
672 pa := {
673 uldl := {
674 ass_disc := '1'B, /* Downlink Assignment (1) */
675 ass := { dl := dl_ass }
676 }
677 }
678 }
679 };
680
681 template PacketUlAssign tr_PacketUlDynAssign(template uint5_t tfi := ?,
682 template BIT1 polling := ?,
683 template uint3_t usf := ?,
684 template BIT1 usf_granularity := ?,
685 template ChCodingCommand cs := ?) := {
Vadim Yanitskiy06ca64d2019-09-29 20:17:10 +0700686 presence := '1'B, /* Dynamic Block Allocation */
Vadim Yanitskiy7091e8d2019-09-09 01:07:37 +0200687 dynamic := {
688 tfi_assignment := tfi,
689 polling := polling,
Vadim Yanitskiy06ca64d2019-09-29 20:17:10 +0700690 spare := '0'B, /* Dynamic Block Allocation (mandatory after Rel-4) */
Vadim Yanitskiy7091e8d2019-09-09 01:07:37 +0200691 usf := usf,
692 usf_granularity := usf_granularity,
693 p0_present := ?,
694 p0 := *,
695 pr_mode := *,
696 ch_coding_cmd := cs,
697 tlli_block_chan_coding := ?,
698 alpha_present := ?,
699 alpha := *,
700 gamma := ?,
701 /* TODO: add to parameters */
702 ta_index_present := ?,
703 ta_index := *,
704 tbf_starting_time_present := ?,
705 tbf_starting_time := *
706 },
707 single := omit
708 };
709
710 template PacketUlAssign tr_PacketUlSglAssign := {
Vadim Yanitskiy06ca64d2019-09-29 20:17:10 +0700711 presence := '0'B, /* Single Block Allocation */
Vadim Yanitskiy7091e8d2019-09-09 01:07:37 +0200712 dynamic := omit,
713 single := {
714 alpha_present := ?,
715 alpha := *,
716 gamma := ?,
717 padding := '01'B,
718 tbf_starting_time := ?
719 }
720 };
721
722 template IaRestOctets tr_IaRestOctets_ULAss(template PacketUlAssign ul_ass) := {
723 presence := '11'B, /* HH */
724 ll := omit, lh := omit, hl := omit,
725 hh := {
726 pa_disc := '0'B, /* Packet Assignment (0) */
727 pa := {
728 uldl := {
729 ass_disc := '0'B, /* Uplink Assignment (0) */
730 ass := { ul := ul_ass }
731 }
732 }
733 }
734 };
735
Vadim Yanitskiya0b47cf2020-04-02 01:50:18 +0700736 template EgprsUlAss tr_EgprsUlAssDynamic(template (present) BIT5 ext_ra := ?,
737 template EgprsUlAssignDyn dyn_ass := ?) := {
738 ext_ra := ext_ra,
739 ats_present := ?,
740 ats := *,
741 presence := '1'B,
742 dynamic := dyn_ass,
743 multiblock := omit
744 };
745 template EgprsUlAss tr_EgprsUlAssMultiblock(template (present) BIT5 ext_ra := ?,
746 template EgprsUlAssignMultiblock mb_ass := ?) := {
747 ext_ra := ext_ra,
748 ats_present := ?,
749 ats := *,
750 presence := '0'B,
751 dynamic := omit,
752 multiblock := mb_ass
753 };
754
755 template IaRestOctets tr_IaRestOctets_EGPRSULAss(template EgprsUlAss ul_ass) := {
756 presence := '01'B, /* LH */
757 ll := omit,
758 lh := {
759 presence := '00'B,
760 egprs_ul := ul_ass,
761 multiblock_dl_ass := omit
762 },
763 hl := omit,
764 hh := omit
765 };
766
Harald Weltee8d750e2018-06-10 21:41:35 +0200767 template (value) GsmRrMessage ts_IMM_ASS(uint8_t ra, GsmFrameNumber fn, TimingAdvance ta,
Vadim Yanitskiy3b464a92020-08-25 03:55:32 +0700768 ChannelDescription ch_desc, MobileAllocationLV ma) := {
Harald Weltebae6be82020-08-21 12:42:18 +0200769 header := ts_RrHeader(IMMEDIATE_ASSIGNMENT, 0),
Harald Weltecbc947f2018-02-22 00:26:55 +0100770 payload := {
771 imm_ass := {
772 ded_or_tbf := {
773 spare := '0'B,
774 tma := false,
775 downlink := false,
776 tbf := false
777 },
778 page_mode := PAGE_MODE_NORMAL,
779 chan_desc := ch_desc,
780 pkt_chan_desc := omit,
781 req_ref := f_compute_ReqRef(ra, fn),
782 timing_advance := ta,
783 mobile_allocation := ma,
Vadim Yanitskiyf10bb452019-09-05 13:53:01 +0200784 rest_octets := {
785 presence := '00'B, /* LL */
786 ll := {
Vadim Yanitskiyb021ed42020-04-27 23:25:13 +0700787 compressed_irat_ho_info_ind := '0'B /* L */
Vadim Yanitskiy9b2a3e82019-09-08 15:37:15 +0200788 },
789 lh := omit, hl := omit, hh := omit
Vadim Yanitskiyf10bb452019-09-05 13:53:01 +0200790 }
Harald Weltecbc947f2018-02-22 00:26:55 +0100791 }
792 }
793 };
794
Harald Weltee8d750e2018-06-10 21:41:35 +0200795 template GsmRrMessage tr_IMM_ASS(template uint8_t ra := ?, template GsmFrameNumber fn := ?,
796 template TimingAdvance ta := ?,
797 template ChannelDescription ch_desc := ?,
Neels Hofmeyrb07b2952021-08-07 04:23:14 +0200798 template MobileAllocationLV ma := ?,
799 template PageMode page_mode := PAGE_MODE_NORMAL) := {
Vadim Yanitskiyd4205c32019-09-09 16:15:37 +0200800 header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?),
Harald Weltee8d750e2018-06-10 21:41:35 +0200801 payload := {
802 imm_ass := {
803 ded_or_tbf := {
804 spare := '0'B,
805 tma := false,
806 downlink := false,
807 tbf := false
808 },
Neels Hofmeyrb07b2952021-08-07 04:23:14 +0200809 page_mode := page_mode,
Harald Weltee8d750e2018-06-10 21:41:35 +0200810 chan_desc := ch_desc,
811 pkt_chan_desc := omit,
812 req_ref := tr_compute_ReqRef(ra, fn),
813 timing_advance := ta,
814 mobile_allocation := ma,
Vadim Yanitskiyf10bb452019-09-05 13:53:01 +0200815 rest_octets := ?
Harald Weltee8d750e2018-06-10 21:41:35 +0200816 }
817 }
818 };
819
Vadim Yanitskiy6edd4f52019-09-09 01:51:09 +0200820 /* TODO: implement send version of this template */
821 template GsmRrMessage tr_IMM_TBF_ASS(template boolean dl := ?,
822 template uint8_t ra := ?,
823 template GsmFrameNumber fn := ?,
824 template TimingAdvance ta := ?,
825 template PacketChannelDescription ch_desc := ?,
Vadim Yanitskiy3b464a92020-08-25 03:55:32 +0700826 template MobileAllocationLV ma := ?,
Vadim Yanitskiy6edd4f52019-09-09 01:51:09 +0200827 template IaRestOctets rest := ?) := {
828 header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?),
829 payload := {
830 imm_ass := {
831 ded_or_tbf := {
832 spare := ?,
833 tma := ?,
834 downlink := dl,
835 tbf := true
836 },
837 page_mode := ?,
838 chan_desc := omit,
839 pkt_chan_desc := ch_desc,
840 req_ref := tr_compute_ReqRef(ra, fn),
841 timing_advance := ta,
Vadim Yanitskiycf1ed3f2020-07-20 04:01:43 +0700842 mobile_allocation := ma,
Vadim Yanitskiy6edd4f52019-09-09 01:51:09 +0200843 rest_octets := rest
844 }
845 }
846 };
Harald Weltee8d750e2018-06-10 21:41:35 +0200847
Vadim Yanitskiy9781ecb2020-03-28 03:59:41 +0700848 template GsmRrMessage tr_PAG_REQ1(template MobileIdentityLV mi1 := ?,
849 template MobileIdentityTLV mi2 := omit) := {
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +0100850 header := t_RrHeader(PAGING_REQUEST_TYPE_1, ?),
851 payload := {
852 pag_req_1 := {
853 chan_needed := {
854 second := ?,
855 first := ?
856 },
857 page_mode := PAGE_MODE_NORMAL,
858 mi1 := mi1,
Vadim Yanitskiy9781ecb2020-03-28 03:59:41 +0700859 mi2 := mi2,
Pau Espin Pedrol88bf5372019-12-09 21:12:28 +0100860 rest_octets := ?
861 }
862 }
863 };
864
Vadim Yanitskiyf9e31d22021-11-06 18:43:28 +0300865 template (value) MeasurementResults
866 ts_MeasurementResults(template (value) uint6_t rxl_f := 63,
867 template (value) uint6_t rxl_s := 63,
868 template (value) uint3_t rxq_f := 0,
869 template (value) uint3_t rxq_s := 0,
870 boolean dtx_used := false,
871 boolean valid := true,
872 template (omit) NcellReports reps := omit) := {
873 ba_used := '0'B,
874 dtx_used := bool2bit(dtx_used),
875 rxlev_full_srv_cell := rxl_f,
876 threeg_ba_used := '0'B,
877 meas_valid := bool2bit(not valid),
878 rxlev_sub_srv_cell := rxl_s,
879 si23_ba_used := '0'B,
880 rxqual_full_srv_cell := rxq_f,
881 rxqual_sub_srv_cell := rxq_s,
882 no_ncell_m := 0,
883 ncell_reports := reps
884 };
885
Vadim Yanitskiybc8ebce2020-11-11 19:31:56 +0700886 template (value) GsmRrL3Message ts_MEAS_REP(boolean valid,
887 template (value) uint6_t rxl_f,
888 template (value) uint6_t rxl_s,
889 template (value) uint3_t rxq_f := 0,
890 template (value) uint3_t rxq_s := 0,
891 template (omit) NcellReports reps := omit) := {
Harald Weltecbc947f2018-02-22 00:26:55 +0100892 header := t_RrL3Header(MEASUREMENT_REPORT),
893 payload := {
894 meas_rep := {
895 meas_res := {
896 ba_used := '0'B,
897 dtx_used := '0'B,
898 rxlev_full_srv_cell := rxl_f,
899 threeg_ba_used := '0'B,
Harald Welteeb1e6812018-02-22 18:43:48 +0100900 meas_valid := bool2bit(not valid),
Harald Weltecbc947f2018-02-22 00:26:55 +0100901 rxlev_sub_srv_cell := rxl_s,
902 si23_ba_used := '0'B,
903 rxqual_full_srv_cell := rxq_f,
904 rxqual_sub_srv_cell := rxq_s,
905 no_ncell_m := 0,
906 ncell_reports := reps
907 }
908 }
909 }
910 };
911
Vadim Yanitskiy16e24aa2020-05-22 03:32:00 +0700912 template GsmRrMessage tr_IMM_ASS_REJ(template FeatureIndicator feature_ind := ?,
913 template ReqRefWaitInd4 rr_wi_list := ?,
914 template IARRestOctets rest_octets := ?) := {
915 header := t_RrHeader(IMMEDIATE_ASSIGNMENT_REJECT, ?),
916 payload := {
917 imm_ass_rej := {
918 feature_ind := feature_ind,
919 page_mode := ?,
920 payload := rr_wi_list,
921 rest_octets := rest_octets
922 }
923 }
924 };
925
926 template ReqRefWaitInd tr_ReqRefWaitInd(template RequestReference ref := ?,
927 template WaitIndication wi := ?) := {
928 req_ref := ref,
929 wait_ind := wi
930 };
931
932 template IARRestOctets tr_IARRestOctets(template ExtRAList ext_ra_list := ?,
933 template uint3_t rcc := ?) := {
934 ext_ra_list := ext_ra_list,
935 rel13_ind := ?,
936 rcc := rcc ifpresent
937 };
938
939 template ExtRAOpt tr_ExtRAOpt(template BIT5 ext_ra := ?) := {
940 presence := '1'B, // L/H
941 ext_ra := ext_ra
942 };
943
Vadim Yanitskiyf7181ed2020-07-14 20:12:02 +0700944 template (value) ChannelDescription ts_ChanDescH0(template (value) RslChannelNr chan_nr,
945 template (value) uint12_t arfcn,
946 template (value) uint3_t tsc := 7) := {
947 chan_nr := chan_nr,
948 tsc := tsc,
949 h := false,
950 arfcn := arfcn,
951 maio_hsn := omit
952 }
Vadim Yanitskiyc3156ed2020-08-29 17:49:27 +0700953 template ChannelDescription tr_ChanDescH0(template (present) RslChannelNr chan_nr := ?,
954 template (present) uint12_t arfcn := ?,
955 template (present) uint3_t tsc := ?) := {
956 chan_nr := chan_nr,
957 tsc := tsc,
958 h := false,
959 arfcn := arfcn,
960 maio_hsn := omit
961 }
Vadim Yanitskiyf7181ed2020-07-14 20:12:02 +0700962
963 template (value) ChannelDescription ts_ChanDescH1(template (value) RslChannelNr chan_nr,
964 template (value) MaioHsn maio_hsn,
965 template (value) uint3_t tsc := 7) := {
966 chan_nr := chan_nr,
967 tsc := tsc,
968 h := true,
969 arfcn := omit,
970 maio_hsn := maio_hsn
971 }
Vadim Yanitskiyc3156ed2020-08-29 17:49:27 +0700972 template ChannelDescription tr_ChanDescH1(template (present) RslChannelNr chan_nr := ?,
973 template (present) MaioHsn maio_hsn := ?,
974 template (present) uint3_t tsc := ?) := {
975 chan_nr := chan_nr,
976 tsc := tsc,
977 h := true,
978 arfcn := omit,
979 maio_hsn := maio_hsn
980 }
Vadim Yanitskiyf7181ed2020-07-14 20:12:02 +0700981
Neels Hofmeyr0edf4ac2020-07-10 17:33:24 +0200982
983 /* Templates for the RR Channel Release message's "Cell selection indicator after release of all TCH and SDCCH" IE.
984 * See 3GPP TS 44.018 9.1.7 and 10.5.2.1e */
985
986 /* 3GPP TS 44.018 10.5.2.1e, Cell Selection Indicator after release of all TCH and SDCCH value part */
987 type record CellSelIndValue {
988 BIT3 discr,
989 CellSelIndValueEnum value_list,
990 BIT1 value_list_term ('0'B)
991 } with {
992 variant (value_list) "CROSSTAG(
993 gsm, discr='000'B;
994 utran_fdd, discr='001'B;
995 utran_tdd, discr='010'B;
996 eutran, discr='011'B;
997 )"
998 };
999
1000 /* 3GPP TS 44.018 10.5.2.1e, Cell Selection Indicator after release of all TCH and SDCCH value part */
1001 private type union CellSelIndValueEnum {
1002 CellSelIndValue_GSM_Descrs gsm,
1003 CellSelIndValue_UTRAN_Descrs utran_fdd,
1004 CellSelIndValue_UTRAN_Descrs utran_tdd,
1005 CellSelIndValue_EUTRAN_Descrs eutran
1006 } with { variant "" };
1007
1008 type record of CellSelIndValue_GSM_Descr CellSelIndValue_GSM_Descrs;
1009 /* 3GPP TS 44.018 10.5.2.1e, GSM Description struct */
1010 type record CellSelIndValue_GSM_Descr {
1011 BIT1 item_ind ('1'B),
1012 BIT1 band_indicator,
1013 uint10_t arfcn,
1014 uint6_t bsic
1015 } with {
1016 variant "PRESENCE(item_ind = '1'B)"
1017 };
1018
1019 type record of CellSelIndValue_UTRAN_Descr CellSelIndValue_UTRAN_Descrs;
1020 /* 3GPP TS 44.018 10.5.2.1e, UTRAN {FDD,TDD} Description struct */
1021 type record CellSelIndValue_UTRAN_Descr {
1022 BIT1 item_ind ('1'B),
1023 BIT1 bandwidth_presence,
1024 uint3_t bandwidth optional,
1025 uint14_t arfcn,
1026 BIT1 cell_info_presence,
1027 UTRAN_CellInfo cell_info optional
1028 } with {
1029 variant "PRESENCE(item_ind = '1'B)"
1030 variant (bandwidth) "PRESENCE(bandwidth_presence = '1'B)"
1031 variant (cell_info) "PRESENCE(cell_info_presence = '1'B)"
1032 };
1033 type record UTRAN_CellInfo {
1034 BIT1 indic0,
1035 uint5_t nr_of_cells,
1036 // TODO: define cell_information_field
1037 octetstring cell_information_field
1038 } with { variant "" };
1039
1040 type record of CellSelIndValue_EUTRAN_Descr CellSelIndValue_EUTRAN_Descrs;
1041 /* 3GPP TS 44.018 10.5.2.1e, E-UTRAN Description struct */
1042 type record CellSelIndValue_EUTRAN_Descr {
1043 BIT1 item_ind ('1'B),
1044 uint16_t earfcn,
1045 BIT1 meas_bw_presence,
1046 uint3_t meas_bw optional,
1047 BIT1 not_allowed_cells_presence,
1048 // define not_allowed_cells
1049 octetstring not_allowed_cells optional,
1050 BIT1 target_pcid_presence,
1051 uint9_t target_pcid optional
1052 } with {
1053 variant "PRESENCE(item_ind = '1'B)"
1054 variant (meas_bw) "PRESENCE(meas_bw_presence = '1'B)"
1055 variant (not_allowed_cells) "PRESENCE(not_allowed_cells_presence = '1'B)"
1056 variant (target_pcid) "PRESENCE(target_pcid_presence = '1'B)"
1057 };
1058
1059 template CellSelIndValue tr_CellSelIndValue_EUTRAN(
1060 template CellSelIndValue_EUTRAN_Descrs cells := {})
1061 := {
1062 discr := '011'B,
1063 value_list := {
1064 eutran := cells
1065 },
1066 value_list_term := '0'B
1067 };
1068
1069 template CellSelIndValue_EUTRAN_Descr tr_CellSelIndValue_EUTRAN_Descr(
1070 template (present) uint16_t earfcn,
1071 template (present) BIT1 meas_bw_presence := ?,
1072 template uint3_t meas_bw := *)
1073 := {
1074 item_ind := '1'B,
1075 earfcn := earfcn,
1076 meas_bw_presence := meas_bw_presence,
1077 meas_bw := meas_bw,
1078 not_allowed_cells_presence := '0'B,
1079 not_allowed_cells := omit,
1080 target_pcid_presence := '0'B,
1081 target_pcid := omit
1082 };
1083
1084 external function enc_CellSelIndValue(in CellSelIndValue ro) return octetstring
1085 with { extension "prototype(convert) encode(RAW)" };
1086 external function dec_CellSelIndValue(in octetstring stream) return CellSelIndValue
1087 with { extension "prototype(convert) decode(RAW)" };
1088
Vadim Yanitskiye05d7162020-05-02 16:58:46 +07001089} with { encode "RAW" ; variant "FIELDORDER(msb)" }