blob: a4ed30762ce2c6c70654e8aa8cd023e376bdccea [file] [log] [blame]
Harald Welte484160b2017-07-28 13:30:24 +02001/* GPRS RLC/MAC Control Messages as per 3GPP TS 44.060 manually transcribed from the CSN.1 syntax, as no CSN.1
2 * tool for Eclipse TITAN could be found. Implements only the minimum necessary messages for Osmocom teseting
Harald Welte34b5a952019-05-27 11:54:11 +02003 * purposes. */
4
5/* (C) 2017-2018 Harald Welte <laforge@gnumonks.org>
6 * contributions by sysmocom - s.f.m.c. GmbH
7 * All rights reserved.
8 *
9 * Released under the terms of GNU General Public License, Version 2 or
10 * (at your option) any later version.
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 */
14
Harald Welte484160b2017-07-28 13:30:24 +020015module RLCMAC_CSN1_Types {
16 import from General_Types all;
17 import from Osmocom_Types all;
18 import from GSM_Types all;
Pau Espin Pedrol86904082019-12-30 20:21:00 +010019 import from MobileL3_GMM_SM_Types all;
Harald Welte484160b2017-07-28 13:30:24 +020020
21 /* TS 44.060 11.2.0.1 */
22 type enumerated RlcmacDlCtrlMsgType {
23 PACKET_ACCESS_REJECT ('100001'B),
24 PACKET_CELL_CHANGE_ORDER ('000001'B),
25 PACKET_DL_ASSIGNMENT ('000010'B),
26 PACKET_MEASUREMENT_ORDER ('000011'B),
27 PACKET_PAGING_REQUEST ('100010'B),
28 PACKET_PDCH_RELEASE ('100011'B),
29 PACKET_POLLING_REQUEST ('000100'B),
Vadim Yanitskiy759cb292019-09-30 20:08:11 +070030 PACKET_PWR_CONTROL_TA ('000101'B),
Harald Welte484160b2017-07-28 13:30:24 +020031 /* TODO */
32 PACKET_TBF_RELEASE ('001000'B),
33 PACKET_UL_ACK_NACK ('001001'B),
34 PACKET_UL_ASSIGNMENT ('001010'B),
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +010035 PACKET_CELL_CHANGE_CONTINUE ('001011'B),
36 PACKET_NEIGHBOUR_CELL_DATA ('001100'B),
Harald Welte484160b2017-07-28 13:30:24 +020037 PACKET_DL_DUMMY_CTRL ('100101'B)
38 } with { variant "FIELDLENGTH(6)" };
39
40 /* TS 44.060 11.2.0.2 */
41 type enumerated RlcmacUlCtrlMsgType {
42 PACKET_CELL_CHANGE_FEATURE ('000000'B),
43 PACKET_CONTROL_ACK ('000001'B),
44 PACKET_DL_ACK_NACK ('000010'B),
45 PACKET_UL_DUMMY_CTRL ('000011'B),
46 PACKET_MEASUREMENT_REPORT ('000100'B),
47 PACKET_ENH_MEASUREMENT_REPORT ('001010'B),
48 PACKET_RESOURCE_REQUEST ('000101'B),
49 PACKET_MOBILE_TBF_STATUS ('000110'B),
50 PACKET_PSI_STATUS ('000111'B),
51 PACKET_EGPRS_DL_ACK_NACK ('001000'B),
52 PACKET_PAUSE ('001001'B),
53 ADDITIONAL_MS_RA_CAPABILITIES ('001011'B),
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +010054 PACKET_CELL_CHANGE_NOTIFICATION ('001100'B),
Harald Welte484160b2017-07-28 13:30:24 +020055 PACKET_SI_STATUS ('001101'B),
56 PACKET_CS_REQUEST ('001110'B),
57 MBMS_SERVICE_REQUEST ('001111'B),
58 MBMS_DL_ACK_NACK ('010000'B)
59 } with { variant "FIELDLENGTH(6)" };
60
Pau Espin Pedrol2ec84fd2020-05-14 13:28:21 +020061 type enumerated EgprsChCodingCommand {
62 CH_CODING_MCS1 ('0000'B),
63 CH_CODING_MCS2 ('0001'B),
64 CH_CODING_MCS3 ('0010'B),
65 CH_CODING_MCS4 ('0011'B),
66 CH_CODING_MCS5 ('0100'B),
67 CH_CODING_MCS6 ('0101'B),
68 CH_CODING_MCS7 ('0110'B),
69 CH_CODING_MCS8 ('0111'B),
70 CH_CODING_MCS9 ('1000'B),
71 CH_CODING_MCS5_7 ('1001'B),
72 CH_CODING_MCS6_9 ('1010'B)
73 } with { variant "FIELDLENGTH(4)" };
74
75 /* TS 44.060 Table 12.5.2.1 */
76 type enumerated EgprsWindowSize { /* This probably needs to be moved to RLCMAC_CSN1_Types.ttcn */
77 EGPRS_WS_64 ('00000'B),
78 EGPRS_WS_96 ('00001'B),
79 EGPRS_WS_128 ('00010'B),
80 EGPRS_WS_160 ('00011'B),
81 EGPRS_WS_192 ('00100'B),
82 EGPRS_WS_224 ('00101'B),
83 EGPRS_WS_256 ('00110'B),
84 EGPRS_WS_288 ('00111'B),
85 EGPRS_WS_320 ('01000'B),
86 EGPRS_WS_352 ('01001'B),
87 EGPRS_WS_384 ('01010'B),
88 EGPRS_WS_416 ('01011'B),
89 EGPRS_WS_448 ('01100'B),
90 EGPRS_WS_480 ('01101'B),
91 EGPRS_WS_512 ('01110'B),
92 EGPRS_WS_544 ('01111'B),
93 EGPRS_WS_576 ('10000'B),
94 EGPRS_WS_608 ('10001'B),
95 EGPRS_WS_640 ('10010'B),
96 EGPRS_WS_672 ('10011'B),
97 EGPRS_WS_704 ('10100'B),
98 EGPRS_WS_736 ('10101'B),
99 EGPRS_WS_768 ('10110'B),
100 EGPRS_WS_800 ('10111'B),
101 EGPRS_WS_832 ('11000'B),
102 EGPRS_WS_864 ('11001'B),
103 EGPRS_WS_896 ('11010'B),
104 EGPRS_WS_928 ('11011'B),
105 EGPRS_WS_960 ('11100'B),
106 EGPRS_WS_992 ('11101'B),
107 EGPRS_WS_1024 ('11110'B)
108 } with { variant "FIELDLENGTH(5)" };
109
Harald Welte484160b2017-07-28 13:30:24 +0200110 type record NullGlobalTfi {
111 BIT1 presence ('0'B),
112 GlobalTfi global_tfi
113 } with { variant "" };
114
115 type record TenTlli {
116 BIT2 presence ('10'B),
117 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100118 } with { variant ""
119 variant (tlli) "BYTEORDER(first)"
120 };
Harald Welte484160b2017-07-28 13:30:24 +0200121
122 type union GlobalTfiOrTlli {
123 NullGlobalTfi global_tfi,
124 TenTlli tlli
125 };
126
127 /* 11.2.7 Packet Downlink Assignment */
128 type record PacketDlAssignment {
129 PageMode page_mode,
130 BIT1 pres1,
131 PersistenceLevels persistence_levels optional,
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200132 GlobalTfiOrTlli tfi_or_tlli,
133 BIT1 egprs2('0'B), /* TODO: implement union with egprs2 */
134 BIT2 mac_mode,
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700135 BIT1 rlc_mode,
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200136 BIT1 control_ack,
137 BIT8 timeslot_alloc,
138 PacketTimingAdvance pkt_ta,
139 BIT1 p0_present,
140 uint4_t p0 optional,
141 BIT1 reserved('0'B) optional,
142 BIT1 pr_mode optional,
143 BIT1 freq_par_present,
144 FrequencyParameters freq_par optional,
145 BIT1 dl_tfi_ass_present,
146 uint5_t dl_tfi_assignment optional,
147 BIT1 pwr_ctrl_present,
148 PowerControlParameters pwr_ctrl optional,
149 BIT1 tbf_starting_time_present,
150 StartingFnDesc tbf_starting_time optional,
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700151 /* The value '1' was allocated in an earlier version of the protocol */
152 BIT1 spare ('0'B),
153 /* Rel-{99,5,6,7,9,10,12,14} Additions (Matrioshka) */
154 PktDlAssRelAdditions rel_additions optional
Harald Welte484160b2017-07-28 13:30:24 +0200155 } with {
156 variant (persistence_levels) "PRESENCE(pres1 = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200157 variant (p0) "PRESENCE(p0_present = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200158 variant (reserved) "PRESENCE(p0_present = '1'B)"
159 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
160 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
161 variant (dl_tfi_assignment) "PRESENCE(dl_tfi_ass_present = '1'B)"
162 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
163 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700164 };
165
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200166 /* 11.2.9b Packet Measurement Order */
167 type enumerated NetworkControlOrder {
168 NC_0 ('00'B),
169 NC_1 ('01'B),
170 NC_2 ('10'B),
171 NC_RESET ('11'B)
172 } with { variant "FIELDLENGTH(2)" };
173 type record CellSelection {
174 BIT1 cell_barr_access_2,
175 BIT1 exc_acc,
176 BIT1 same_ra_as_serving_cell,
177 BIT1 gprs_rxlev_access_min_present ('0'B),
178 BIT1 gprs_temporary_offset_present ('0'B),
179 BIT1 gprs_reselct_offset_present ('0'B),
180 BIT1 hcs_params_present ('0'B),
181 BIT1 si13_pbcch_location_present ('0'B)
182 /* TODO: add optional parameters above^ */
183 };
184 type record AddFrequency {
185 uint10_t start_frequency,
186 uint6_t bsic,
187 BIT1 cell_sel_par_present,
188 CellSelection cell_sel_par optional,
189 uint5_t nr_of_frequencies,
190 uint3_t freq_diff_length
191 /* TODO: support Frequency diff list */
192 } with {
193 variant (cell_sel_par) "PRESENCE(cell_sel_par_present = '1'B)"
194 };
195 type record RepeatedAddFrequencyItem {
196 BIT1 presence,
197 AddFrequency item
198 } with { variant "PRESENCE(presence = '1'B)" };
199 type record of uint6_t FreqIndexList;
200 type record of RepeatedAddFrequencyItem RepeatedAddFrequencyItemList;
201 type record NCFrequencyList {
202 BIT1 removed_freq_present,
203 uint5_t nr_of_removed_freq optional,
204 FreqIndexList removed_freq_index optional,
205 RepeatedAddFrequencyItemList repeated_add_frequency optional,
206 BIT1 repeated_add_frequency_term ('0'B)
207 } with {
208 variant (nr_of_removed_freq) "PRESENCE(removed_freq_present = '1'B)"
209 variant (removed_freq_index) "PRESENCE(removed_freq_present = '1'B)"
210 variant (nr_of_removed_freq) "LENGTHTO(removed_freq_index)-1"
211 variant (nr_of_removed_freq) "UNIT(elements)"
212 };
213 type record NCMeasurementParameters {
214 NetworkControlOrder nco,
215 BIT1 nc_period_present,
216 uint3_t nc_non_drx_period optional,
217 uint3_t nc_reporting_period_i optional,
218 uint3_t nc_reporting_period_t optional,
219 BIT1 nc_freq_list_present,
220 NCFrequencyList nc_freq_list optional
221 } with {
222 variant (nc_non_drx_period) "PRESENCE(nc_period_present = '1'B)"
223 variant (nc_reporting_period_i) "PRESENCE(nc_period_present = '1'B)"
224 variant (nc_reporting_period_t) "PRESENCE(nc_period_present = '1'B)"
225 variant (nc_freq_list) "PRESENCE(nc_freq_list_present = '1'B)"
226 };
227 type record PacketMeasOrder {
228 PageMode page_mode,
229 GlobalTfiOrTlli tfi_or_tlli,
230 uint3_t pmo_index,
231 uint3_t pmo_count,
232 BIT1 nc_meas_param_present,
233 NCMeasurementParameters nc_meas_param optional,
234 BIT1 zero('0'B) /* The value '1' was allocated in an earlier version of the protocol and shall not be used. */
235 /* TODO: support Additions 98 onwards */
236 } with {
237 variant (nc_meas_param) "PRESENCE(nc_meas_param_present = '1'B)"
238 };
239
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700240 private type record PktDlAssRelAdditions {
241 BIT1 rel99_presence, // 0/1
242 PktDlAssR99Additions rel99 optional
243 } with {
244 variant (rel99) "PRESENCE(rel99_presence = '1'B)"
245 };
246
247 private type record PktDlAssR99Additions {
248 BIT1 egprs_present,
249 PktDlAssR99EGPRS egprs optional,
250 BIT1 pkt_ext_ta_present,
251 BIT2 pkt_ext_ta optional,
252 BIT1 compact_reduced_ma_present,
253 COMPACTreducedMA compact_reduced_ma optional
254 /* TODO: Additions for REL-5 */
255 } with {
256 variant (egprs) "PRESENCE(egprs_present = '1'B)"
Pau Espin Pedrol984d09f2020-05-19 18:51:58 +0200257 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
258 variant (compact_reduced_ma) "PRESENCE(compact_reduced_ma_present = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200259 };
260
Vadim Yanitskiy41b4dd82020-07-22 14:00:56 +0700261 private type record PktDlAssR99EGPRS {
262 EgprsWindowSize window_size,
263 BIT2 link_quality_meas_mode,
264 BIT1 bep_period2_present,
265 BIT4 bep_period2 optional
266 } with {
267 variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
268 };
269
Harald Welte484160b2017-07-28 13:30:24 +0200270 /* 11.2.29 Packet Uplink Assignment */
271 type record O_Gtfi {
272 BIT1 presence ('0'B),
273 GlobalTfi global_tfi
274 } with { variant "" };
275 type record IO_Tlli {
276 BIT2 presence ('10'B),
277 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100278 } with { variant ""
279 variant (tlli) "BYTEORDER(first)"
280 };
Harald Welte484160b2017-07-28 13:30:24 +0200281 type record IIO_Tqi {
282 BIT3 presence ('110'B),
283 PacketRequestReference pkt_req_ref
284 } with { variant "" };
285 type union PktUlAssUnion {
286 O_Gtfi global_tfi,
287 IO_Tlli tlli,
288 IIO_Tqi tqi
289 } with {
290 variant "TAG(global_tfi, presence = '0'B;
291 tlli, presence = '10'B;
292 tqi, presence = '110'B)"
293 };
294 type record DynamicAllocation {
295 BIT1 extd_dyn_alloc,
296 BIT1 p0_present,
297 uint4_t p0 optional,
298 BIT1 pr_mode optional,
299 BIT1 usf_granularity,
300 BIT1 ul_tfi_ass_present,
301 uint5_t ul_tfi_assignment optional,
302 BIT1 reserved ('0'B),
303 BIT1 tbf_starting_time_present,
304 StartingFnDesc tbf_starting_time optional,
305 TsAllocationUnion ts_allocation
306 } with {
307 variant (p0) "PRESENCE(p0_present = '1'B)"
308 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
309 variant (ul_tfi_assignment) "PRESENCE(ul_tfi_ass_present = '1'B)"
310 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
311 };
312 type record TsAllocationTs {
313 BIT1 presence,
314 uint3_t usf_tn optional
315 } with {
316 variant (usf_tn) "PRESENCE(presence = '1'B)"
317 };
318 type record length(8) of TsAllocationTs TsAllocationTsArr;
319 type record TnGamma {
320 BIT1 presence,
321 uint3_t usf_tn optional,
322 uint5_t gamma_tn optional
323 } with {
324 variant (usf_tn) "PRESENCE(presence = '1'B)"
325 variant (gamma_tn) "PRESENCE(presence = '1'B)"
326 };
327 type record length(8) of TnGamma TnGamma8;
328 type record TsAllocationPwr {
329 uint4_t alpha,
330 TnGamma tn_gamma
331 } with { variant "" };
332 type record TsAllocationUnion {
333 BIT1 presence,
334 TsAllocationTsArr ts optional,
335 TsAllocationPwr ts_with_pwr optional
336 } with {
337 variant (ts) "PRESENCE(presence = '0'B)"
338 variant (ts_with_pwr) "PRESENCE(presence = '1'B)"
339 };
340 type record SingleBlockAllocation {
341 uint3_t timeslot_nr,
342 BIT1 alpha_present,
343 uint4_t alpha optional,
344 uint5_t gamma_tn,
345 BIT1 p0_present,
346 uint4_t p0 optional,
347 BIT1 reserved ('0'B) optional,
348 BIT1 pr_mode optional,
349 StartingFnDesc tbf_starting_time
350 } with {
351 variant (alpha) "PRESENCE(alpha_present = '1'B)"
352 variant (p0) "PRESENCE(p0_present = '1'B)"
353 variant (reserved) "PRESENCE(p0_present = '1'B)"
354 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
355 };
356 type record PktUlAssGprs {
357 ChCodingCommand ch_coding_cmd,
358 BIT1 tlli_block_chan_coding,
359 PacketTimingAdvance pkt_ta,
360 BIT1 freq_par_present,
361 FrequencyParameters freq_par optional,
362 BIT2 alloc_present,
363 DynamicAllocation dyn_block_alloc optional,
364 SingleBlockAllocation sgl_block_alloc optional
365 } with {
366 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
367 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
368 variant (sgl_block_alloc) "PRESENCE(alloc_present = '10'B)"
369 };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200370 type record COMPACTreducedMA {
371 uint7_t ma_bitmap_length,
372 bitstring ma_bitmap,
373 BIT1 maio_2_present,
Vadim Yanitskiyfdbfd6e2020-07-22 14:38:20 +0700374 BIT6 maio_2 optional
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200375 } with {
376 variant (ma_bitmap_length) "LENGTHTO (ma_bitmap)"
377 variant (ma_bitmap_length) "UNIT(bits)"
378 variant (maio_2) "PRESENCE(maio_2_present = '1'B)"
379 };
Pau Espin Pedrol2ec84fd2020-05-14 13:28:21 +0200380 type record of AccessTechnologiesRequest AccessTechnologiesRequestRepetition
381 with { variant "EXTENSION_BIT(reverse)" };
382 type record AccessTechnologiesRequest
383 {
384 BIT4 accessTechnType,
385 BIT1 extensionBit
386 } with { variant "FIELDORDER(msb)" };
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200387 type record MultiBlockAllocation {
388 uint3_t timeslot_nr,
389 BIT1 alpha_gamma_present,
390 uint4_t alpha optional,
391 uint5_t gamma_tn optional,
392 BIT1 p0_present,
393 uint4_t p0 optional,
394 BIT1 reserved ('0'B) optional,
395 BIT1 pr_mode optional,
396 StartingFnDesc tbf_starting_time,
397 uint2_t num_radio_blocks_alloc
398 } with {
399 variant (alpha) "PRESENCE(alpha_gamma_present = '1'B)"
400 variant (gamma_tn) "PRESENCE(alpha_gamma_present = '1'B)"
401 variant (p0) "PRESENCE(p0_present = '1'B)"
402 variant (reserved) "PRESENCE(p0_present = '1'B)"
403 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
404 };
405 type record PktUlAssEgprs {
406 BIT2 dual_carrier('00'B), /*TODO 01 -- Message escape for dual carrier, RTTI, BTTI with FANR activated, EGPRS2 */
407 BIT1 tlli_present,
408 GprsTlli tlli optional,
409 BIT1 compact_reduced_ma_present,
410 COMPACTreducedMA compact_reduced_ma optional,
411 EgprsChCodingCommand chan_coding_cmd,
412 BIT1 resegment,
413 EgprsWindowSize window_size,
414 BIT1 ats_present,
415 AccessTechnologiesRequestRepetition ats optional, /* ? */
416 BIT1 arac_retrans_req,
417 BIT1 tlli_block_chan_coding,
418 BIT1 bep_period2_present,
419 BIT4 bep_period2 optional,
420 PacketTimingAdvance pkt_ta,
421 BIT1 pkt_ext_ta_present,
422 BIT2 pkt_ext_ta optional,
423 BIT1 freq_par_present,
424 FrequencyParameters freq_par optional,
425 BIT2 alloc_present,
426 DynamicAllocation dyn_block_alloc optional,
427 MultiBlockAllocation multi_block_alloc optional
428 /* TODO: Additions for Rel-5 and more */
429 } with {
430 variant (tlli) "PRESENCE(tlli_present = '1'B)"
431 variant (compact_reduced_ma) "PRESENCE(compact_reduced_ma_present = '1'B)"
432 variant (ats) "PRESENCE(ats_present = '1'B)"
433 variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
434 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
435 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
436 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
437 variant (multi_block_alloc) "PRESENCE(alloc_present = '10'B)"
438 };
Harald Welte484160b2017-07-28 13:30:24 +0200439 type record PacketUlAssignment {
440 PageMode page_mode,
441 BIT1 persistence_levels_present,
442 PersistenceLevels persistence_levels optional,
443 PktUlAssUnion identity,
444 BIT1 is_egprs, /* msg escape */
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200445 PktUlAssGprs gprs optional,
446 PktUlAssEgprs egprs optional
447 /* TODO: Table 11.2.29.1: PACKET UPLINK ASSIGNMENT information elements
448 https://www.etsi.org/deliver/etsi_ts/144000_144099/144060/09.03.00_60/ts_144060v090300p.pdf */
Harald Welte484160b2017-07-28 13:30:24 +0200449 } with {
450 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
451 variant (gprs) "PRESENCE(is_egprs = '0'B)"
Pau Espin Pedrol45b664b2020-05-14 15:16:40 +0200452 variant (egprs) "PRESENCE(is_egprs = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200453 };
454
455 /* 11.2.10 Packet Paging Request */
Stefan Sperling59c15d62018-10-10 11:09:25 +0200456 type record MobileIdentityLV_Paging {
457 /* Note that the size of 'len' differs from that of the Mobile Identify IE
458 * as defined in 3GPP TS 24.008 10.5.1.4 "Mobile Identity"; Paging Requests
459 * use only 4 bit to encode the length of a mobile identity, whereas the IE
460 * uses a byte. */
Harald Welte484160b2017-07-28 13:30:24 +0200461 uint4_t len,
462 octetstring mobile_id
Vadim Yanitskiy322c7932020-01-01 23:03:47 +0100463 } with {
464 variant (len) "LENGTHTO(mobile_id)"
465 variant (mobile_id) "BYTEORDER(first)"
466 };
Harald Welte484160b2017-07-28 13:30:24 +0200467 type record PageInfoPs {
468 BIT1 presence ('0'B),
469 BIT1 ptmsi_or_mobile_id,
470 GsmTmsi ptmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200471 MobileIdentityLV_Paging mobile_identity optional
Harald Welte484160b2017-07-28 13:30:24 +0200472 } with {
473 variant (ptmsi) "PRESENCE(ptmsi_or_mobile_id = '0'B)"
474 variant (mobile_identity) "PRESENCE(ptmsi_or_mobile_id = '1'B)"
475 };
476 type record PageInfoCs {
477 BIT1 presence ('1'B),
478 BIT1 tmsi_or_mobile_id,
479 GsmTmsi tmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200480 MobileIdentityLV_Paging mobile_identity optional,
Harald Welte484160b2017-07-28 13:30:24 +0200481 ChannelNeeded chan_needed,
482 BIT1 emlpp_prio_present,
483 uint3_t emlpp_prio optional
484 } with {
485 variant (tmsi) "PRESENCE(tmsi_or_mobile_id = '0'B)"
486 variant (mobile_identity) "PRESENCE(tmsi_or_mobile_id = '1'B)"
487 variant (emlpp_prio) "PRESENCE(emlpp_prio_present = '1'B)"
488 };
489 type union PageInfo {
490 PageInfoPs ps,
491 PageInfoCs cs
Vadim Yanitskiy5e518732020-01-01 21:27:18 +0100492 } with {
493 variant "TAG(ps, presence = '0'B; cs, presence = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200494 };
Vadim Yanitskiye94164d2020-10-31 05:46:03 +0700495 type record RepeatedPageInfoItem {
496 BIT1 presence,
497 PageInfo item
498 } with { variant "PRESENCE(presence = '1'B)" };
499 type record of RepeatedPageInfoItem RepeatedPageInfo;
Harald Welte484160b2017-07-28 13:30:24 +0200500 type record PacketPagingReq {
501 PageMode page_mode,
502 BIT1 persistence_levels_present,
503 PersistenceLevels persistence_levels optional,
504 BIT1 nln_present,
Oliver Smith8f9daab2019-10-09 09:27:19 +0200505 uint2_t nln optional,
Vadim Yanitskiye94164d2020-10-31 05:46:03 +0700506 RepeatedPageInfo repeated_pageinfo optional,
507 BIT1 repeated_pageinfo_term ('0'B)
Harald Welte484160b2017-07-28 13:30:24 +0200508 } with {
509 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
510 variant (nln) "PRESENCE(nln_present = '1'B)"
511 };
512
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200513 /* 12.26 Extension Bits IE */
514 type record ExtensionBits {
515 uint6_t extension_length,
516 bitstring spare_bits
517 } with {
518 variant (extension_length) "LENGTHTO(spare_bits) - 1"
519 variant (extension_length) "UNIT(bits)"
520 };
521
Harald Welte484160b2017-07-28 13:30:24 +0200522 /* 11.2.28 Uplink Ack/Nack */
523 type enumerated ChCodingCommand {
524 CH_CODING_CS1 ('00'B),
525 CH_CODING_CS2 ('01'B),
526 CH_CODING_CS3 ('10'B),
527 CH_CODING_CS4 ('11'B)
528 } with { variant "FIELDLENGTH(2)" };
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200529 type record UlAckNackGprsAdditionsRel99 {
530 BIT1 ext_pkt_ta_present,
531 BIT2 ext_pkt_ta optional,
532 boolean tbf_est
533 /* TODO: Rel5 ,... */
534 } with {
535 variant (ext_pkt_ta) "PRESENCE(ext_pkt_ta_present = '1'B)"
536 variant (tbf_est) "FIELDLENGTH(1)"
537 };
Harald Welte484160b2017-07-28 13:30:24 +0200538 type record UlAckNackGprs {
539 ChCodingCommand ch_coding_cmd,
540 AckNackDescription ack_nack_desc,
541 BIT1 cont_res_tlli_present,
542 GprsTlli cont_res_tlli optional,
543 BIT1 pkt_ta_present,
544 PacketTimingAdvance pkt_ta optional,
545 BIT1 pwr_ctrl_present,
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200546 PowerControlParameters pwr_ctrl optional,
547 BIT1 extension_bits_present,
548 ExtensionBits extension_bits optional,
549 BIT1 not_used ('0'B),
550 BIT1 rel99_present,
551 UlAckNackGprsAdditionsRel99 rel99 optional
Harald Welte484160b2017-07-28 13:30:24 +0200552 } with {
553 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
554 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
555 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Pau Espin Pedrol630c1cf2020-07-08 13:34:53 +0200556 variant (extension_bits) "PRESENCE(extension_bits_present = '1'B)"
557 variant (rel99) "PRESENCE(rel99_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100558 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200559 };
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200560 type record UlAckNackEgprs {
Pau Espin Pedrolf8fe2d22020-11-10 18:39:25 +0100561 BIT2 msg_excape ('00'B),
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200562 EgprsChCodingCommand ch_coding_cmd,
563 BIT1 resegment,
564 BIT1 preemptive_tx,
565 BIT1 prr_retrans_req,
566 BIT1 arac_retrans_req,
567 BIT1 cont_res_tlli_present,
568 GprsTlli cont_res_tlli optional,
569 BIT1 tbf_est,
570 BIT1 pkt_ta_present,
571 PacketTimingAdvance pkt_ta optional,
572 BIT1 pkt_ext_ta_present,
573 BIT2 pkt_ext_ta optional,
574 BIT1 pwr_ctrl_present,
575 PowerControlParameters pwr_ctrl optional
576 /* TODO: TS 44.060 12.3.1 EGPRS Ack/Nack Description */
577 /* EgprsAckNackDescription ack_nack_desc, */
578 /* BIT1 not_used('0'B) */
579 /* TODO: Extension Bits, Rel5 ,... */
580 } with {
581 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
582 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
583 variant (pkt_ext_ta) "PRESENCE(pkt_ext_ta_present = '1'B)"
584 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
585 variant (cont_res_tlli) "BYTEORDER(first)"
586 };
Harald Welte484160b2017-07-28 13:30:24 +0200587 type record PacketUlAckNack {
588 PageMode page_mode,
589 BIT2 msg_excape ('00'B),
590 uint5_t uplink_tfi,
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200591 BIT1 is_egprs,
592 UlAckNackGprs gprs optional,
593 UlAckNackEgprs egprs optional
Harald Welte484160b2017-07-28 13:30:24 +0200594 /* TODO: EGPRS */
Pau Espin Pedrol692222c2020-05-17 00:25:37 +0200595 } with {
596 variant (gprs) "PRESENCE(is_egprs = '0'B)"
597 variant (egprs) "PRESENCE(is_egprs = '1'B)"
598 };
Harald Welte484160b2017-07-28 13:30:24 +0200599
600 /* 11.2.8 Packet Downlink Dummy Control Block */
601 type record PacketDlDummy {
602 PageMode page_mode,
603 BIT1 persistence_levels_present,
604 PersistenceLevels persistence_levels optional
605 } with {
606 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
607 };
608
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700609 /* 11.9 Global Power Control Parameters */
610 type record GlobalPwrCtrlParams {
611 uint4_t alpha,
612 uint5_t t_avg_v,
613 uint5_t t_avg_t,
614 uint4_t pb,
615 BIT1 pc_meas_chan,
616 BIT1 spare ('0'B),
617 uint4_t n_avg_i
618 };
619
620 /* 12.12a Global Packet Timing Advance */
621 type record TimingAdvanceIdxTN {
622 uint4_t ta_idx,
623 uint3_t ts_num
624 };
625 type record GlobalPacketTA {
626 BIT1 ta_val_presence,
627 uint4_t ta_val optional,
628 BIT1 ul_presence,
629 TimingAdvanceIdxTN ul optional,
630 BIT1 dl_presence,
631 TimingAdvanceIdxTN dl optional
632 } with {
633 variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
634 variant (ul) "PRESENCE(ul_presence = '1'B)"
635 variant (dl) "PRESENCE(dl_presence = '1'B)"
636 };
637
638 /* 11.2.13 Packet Power Control/Timing Advance */
639 type record PacketPwrControlTAMsg {
640 BIT1 g_pwr_ctrl_presence,
641 GlobalPwrCtrlParams g_pwr_ctrl optional,
642 BIT1 split,
643 BIT1 split_desc optional,
644 GlobalPacketTA g_pkt_ta optional,
645 PowerControlParameters pwr_ctrl optional
646 /* TODO: additions for R99, REL-7, REL-12 */
647 } with {
648 variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
649 variant (split_desc) "PRESENCE(split = '1'B)"
650 /* FIXME: Fancy coding: either both IEs together, or one of them */
651 variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
652 variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
653 };
654 type record PacketPwrControlTA {
655 PageMode page_mode,
656 NullGlobalTfi global_tfi,
657 /* See 11.1.3.3 'Message escape' error label
658 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
659 BIT1 msg_escape,
660 PacketPwrControlTAMsg msg optional
661 } with {
662 variant (msg) "PRESENCE(msg_escape = '0'B)"
663 };
664
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100665 /* 11.2.2a Packet Cell Change Continue */
666 type record PacketCellChangeContinue {
667 PageMode page_mode,
668 BIT1 zero ('0'B),
669 GlobalTfi gtfi,
670 BIT1 arfcn_bsic_presence,
671 uint10_t arfcn optional,
672 uint6_t bsic optional,
673 uint2_t container_id optional
674 } with {
675 variant (arfcn) "PRESENCE(arfcn_bsic_presence = '1'B)"
676 variant (bsic) "PRESENCE(arfcn_bsic_presence = '1'B)"
677 variant (container_id) "PRESENCE(arfcn_bsic_presence = '1'B)"
678 };
679
680 /* 11.2.9e Packet Neighbour Cell Data */
681 type record PacketNeighbourCellDataContainer {
682 BIT3 pd,
683 uint5_t cd_length,
684 octetstring container_data
685 } with {
686 variant (cd_length) "LENGTHTO (container_data)"
687 variant (container_data) "BYTEORDER(first)"
688 };
689 type record of PacketNeighbourCellDataContainer PacketNeighbourCellDataContainerList
690 type record PacketNeighbourCellData {
691 PageMode page_mode,
692 BIT1 zero ('0'B),
693 GlobalTfi gtfi,
694 uint2_t container_id,
695 BIT1 spare ('0'B),
696 uint5_t container_index,
697 BIT1 arfcn_bsic_presence,
698 uint10_t arfcn optional,
699 uint6_t bsic optional,
700 PacketNeighbourCellDataContainerList container_list
701 } with {
702 variant (arfcn) "PRESENCE(arfcn_bsic_presence = '1'B)"
703 variant (bsic) "PRESENCE(arfcn_bsic_presence = '1'B)"
704 };
705
Harald Welte484160b2017-07-28 13:30:24 +0200706 /* 11.2.0.1 */
707 type union RlcmacDlCtrlUnion {
Pau Espin Pedrole8a94442021-11-15 17:05:46 +0100708 PacketAccessReject access_reject,
Harald Welte484160b2017-07-28 13:30:24 +0200709 PacketDlAssignment dl_assignment,
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200710 PacketMeasOrder meas_order,
Harald Welte484160b2017-07-28 13:30:24 +0200711 PacketUlAssignment ul_assignment,
712 PacketPagingReq paging,
713 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200714 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700715 PacketPwrControlTA pwr_ta,
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100716 PacketCellChangeContinue cell_chg_continue,
717 PacketNeighbourCellData neighbour_cell_data,
Harald Welte422f0722017-08-01 00:27:06 +0200718 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200719 } with { variant "" };
720
721 type record RlcmacDlCtrlMsg {
722 RlcmacDlCtrlMsgType msg_type,
723 RlcmacDlCtrlUnion u
724 } with {
Pau Espin Pedrole8a94442021-11-15 17:05:46 +0100725 variant (u) "CROSSTAG(access_reject, msg_type = PACKET_ACCESS_REJECT;
726 dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200727 meas_order, msg_type = PACKET_MEASUREMENT_ORDER;
Harald Welte484160b2017-07-28 13:30:24 +0200728 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
729 paging, msg_type = PACKET_PAGING_REQUEST;
730 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200731 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700732 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100733 cell_chg_continue,msg_type = PACKET_CELL_CHANGE_CONTINUE;
734 neighbour_cell_data,msg_type = PACKET_NEIGHBOUR_CELL_DATA;
Harald Welte422f0722017-08-01 00:27:06 +0200735 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200736 )"
737 };
738
739 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
740 with { extension "prototype(convert) encode(RAW)" };
741 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
742 with { extension "prototype(convert) decode(RAW)" };
743
Pau Espin Pedrole8a94442021-11-15 17:05:46 +0100744 /* 11.2.1 Packet Access Reject */
745 type record PacketAccessRejectIDSub {
746 BIT1 id_type,
747 PacketRequestReference req_ref optional,
748 GlobalTfi gtfi optional
749 } with { variant (req_ref) "PRESENCE(id_type = '0'B)"
750 variant (gtfi) "PRESENCE(id_type = '1'B)"
751 };
752 type union PacketAccessRejectID {
753 GprsTlli tlli,
754 PacketAccessRejectIDSub id_sub
755 } with { variant (tlli) "BYTEORDER(first)" };
756 type record PacketAccessRejectStruct {
757 BIT1 id_type,
758 PacketAccessRejectID id,
759 BIT1 wait_ind_presence,
760 uint8_t wait_ind optional,
761 BIT1 wait_ind_size optional
762 } with { variant (id) "CROSSTAG(tlli, id_type = '0'B; id_sub, id_type = '1'B)"
763 variant (wait_ind) "PRESENCE(wait_ind_presence = '1'B)"
764 variant (wait_ind_size) "PRESENCE(wait_ind_presence = '1'B)"
765 };
766 type record PacketAccessReject {
767 PageMode page_mode,
768 PacketAccessRejectStruct reject_struct
769 /* TODO: Additional Reject */
770 /* TODO: Rel5 additions */
771 } with { variant "" };
772
Harald Welte484160b2017-07-28 13:30:24 +0200773
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100774 /* 11.2.6 Packet Downlink Ack/Nack */
Harald Welte484160b2017-07-28 13:30:24 +0200775 type record ILevel {
776 BIT1 presence,
777 uint4_t i_level optional
778 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
779 type record length(8) of ILevel ILevels;
780 type record ChannelQualityReport {
781 uint6_t c_value,
782 uint3_t rxqual,
783 uint6_t sign_var,
784 ILevels i_levels
785 } with { variant "" };
786 type record PacketDlAckNack {
787 uint5_t dl_tfi,
788 AckNackDescription ack_nack_desc,
789 BIT1 chreq_desc_presence,
790 ChannelReqDescription chreq_desc optional,
791 ChannelQualityReport ch_qual_rep
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100792 } with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)" };
793
794 /* 11.2.6a Egprs Packet Downlink Ack/Nack */
795 type record EgprsBEPLinkQualityMeasurements {
796 BIT1 gmsk_presence,
797 BIT5 gmsk_mean_bep optional,
798 BIT3 gmsk_cv_bep optional,
799 BIT1 psk8_presence,
800 BIT5 psk8_mean_bep optional,
801 BIT3 psk8_cv_bep optional
802 } with { variant (gmsk_mean_bep) "PRESENCE(gmsk_presence = '1'B)"
803 variant (gmsk_cv_bep) "PRESENCE(gmsk_presence = '1'B)"
804 variant (psk8_mean_bep) "PRESENCE(psk8_presence = '1'B)"
805 variant (psk8_cv_bep) "PRESENCE(psk8_presence = '1'B)"
806 };
807 /* 12.5.4 EGPRS Timeslot Link Quality Measurements IE */
808 type record BEPMeas {
809 BIT1 presence,
810 BIT1 is_8psk optional,
811 uint4_t bep_meas optional
812 } with { variant (is_8psk) "PRESENCE(presence = '1'B)"
813 variant (bep_meas) "PRESENCE(presence = '1'B)"
814 };
815 type record length(8) of BEPMeas BEPMeasLi;
816 type record EgprsTimeslotLinkQualityMeasurements {
817 BIT1 bep_measurements_presence,
818 BEPMeasLi bep_meas optional,
819 BIT1 i_measurements_presence,
820 ILevels i_meas optional
821 } with { variant (bep_meas) "PRESENCE(bep_measurements_presence = '1'B)"
822 variant (i_meas) "PRESENCE(i_measurements_presence = '1'B)"
823 };
824 /* Table 12.5.1.1 : EGPRS Channel Quality Report Information elements */
825 type record EgprsChannelQualityReport {
826 EgprsBEPLinkQualityMeasurements bep_link_qual_meas,
827 uint6_t c_value,
828 EgprsTimeslotLinkQualityMeasurements ts_link_qual_meas
Harald Welte484160b2017-07-28 13:30:24 +0200829 } with { variant "" };
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100830 type record EgprsPacketDlAckNack {
831 uint5_t dl_tfi,
832 BIT1 ms_oom,
833 BIT1 egprs_ch_qual_rep_presence,
834 EgprsChannelQualityReport egprs_ch_qual_rep optional,
835 BIT1 chreq_desc_presence,
836 ChannelReqDescription chreq_desc optional,
837 BIT1 pfi_presence,
838 BIT7 pfi optional,
839 BIT1 epdan_presence('0'B),
840 /* TODO: Implement EPD A/N */
841 EgprsAckNackDescriptionIE ack_nack_desc_ie
842 } with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)"
843 variant (egprs_ch_qual_rep) "PRESENCE(egprs_ch_qual_rep_presence = '1'B)"
844 variant (pfi) "PRESENCE(pfi_presence = '1'B)"
845 };
Harald Welte484160b2017-07-28 13:30:24 +0200846
847 /* 11.2.2 Packet Control Acknowledgement */
848 type enumerated CtrlAck {
849 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
850 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
851 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
852 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
853 } with { variant "FIELDLENGTH(2)" };
854 type record PacketCtrlAck {
855 GprsTlli tlli,
856 CtrlAck ctrl_ack
857 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100858 } with { variant ""
859 variant (tlli) "BYTEORDER(first)"
860 };
Harald Welte484160b2017-07-28 13:30:24 +0200861
862 /* 1.2.8b Packet Uplink Dummy Control Block */
863 type record PacketUlDummy {
864 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100865 } with { variant ""
866 variant (tlli) "BYTEORDER(first)"
867 };
Harald Welte484160b2017-07-28 13:30:24 +0200868
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200869 /* 11.2.9 Packet Measurement Report */
870 type record NCMeasurement {
871 uint6_t frequency_n,
872 BIT1 bsic_n_presence,
873 BIT6 bsic_n optional,
874 uint6_t rxlev_n
875 } with {
876 variant (bsic_n) "PRESENCE(bsic_n_presence = '1'B)"
877 };
878 type record of NCMeasurement NCMeasurementList;
879 type record NCMeasurementReport {
880 BIT1 nc_mode,
881 uint6_t rxlev_serving_cell,
882 BIT1 zero ('0'B), /*The value '1' was allocated in an earlier version of the protocol and shall not be used.*/
883 uint3_t num_nc_measurements,
884 NCMeasurementList nm_measurements
885 } with {
886 variant (num_nc_measurements) "LENGTHTO(nm_measurements)"
887 variant (num_nc_measurements) "UNIT(elements)"
888 };
889 type record PacketMeasReport {
890 GprsTlli tlli,
891 BIT1 psi5_change_mark_presence,
892 BIT2 psi5_change_mark optional,
893 BIT1 additions_99 ('0'B), /* TODO: 1 -> support Additions 99 onwards */
894 NCMeasurementReport nc_meas_report optional
895 } with {
896 variant (tlli) "BYTEORDER(first)"
897 variant (psi5_change_mark) "PRESENCE(psi5_change_mark_presence = '1'B)"
898 variant (nc_meas_report) "PRESENCE(additions_99 = '0'B)"
899 };
900
Pau Espin Pedrol8f245712020-04-24 18:47:30 +0200901 /* TS 44.060 sec 12.30 MS Radio Access Capability 2
902 * (for value part, see 3GPP TS 24.008 sec 10.5.5.12a and table 10.5.146) */
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200903 type union MSRadioAccCap2 {
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100904 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200905 };
906
907 /* Table 11.2.16.2 Access Type */
908 type enumerated RlcAccessType {
909 RLC_ACC_TYPE_TWO_PHASE ('00'B),
910 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
911 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
912 RLC_ACC_TYPE_MM ('11'B)
913 } with { variant "FIELDLENGTH(2)" };
914
915 type union PacketResourceReqID {
916 GlobalTfi gtfi,
917 GprsTlli tlli
918 } with { variant (tlli) "BYTEORDER(first)" };
919
920 /* 11.2.16 Packet Resource Request */
921 type record PacketResourceReq {
922 BIT1 acc_type_presence,
923 RlcAccessType acc_type optional,
924 BIT1 id_type,
925 PacketResourceReqID id,
926 BIT1 ms_rac2_presence,
927 MSRadioAccCap2 ms_rac2 optional,
928 ChannelReqDescription ch_req_desc,
929 BIT1 change_mark_presence,
930 BIT2 change_mark optional,
931 BIT6 C_val,
932 BIT1 sign_var_presence,
933 BIT6 sign_var optional,
934 ILevels I_levels
935 /* TODO: additional contents for further Releases (starting from 1999) */
936 } with {
937 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
938 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
939 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
940 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
941 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
942 };
943
Philipp Maier48bfd562023-05-25 15:05:55 +0200944 /* 11.2.3a Packet Cell Change Notification, 3G Target Cell Struct (Rel-6 extension) */
945 type record UtranTargetCellFdd {
946 uint14_t arfcn,
947 BIT1 bandwidth_presence,
948 uint3_t bandwidth optional,
949 uint10_t scrambling_code
950 } with {
951 variant (bandwidth) "PRESENCE(bandwidth_presence = '1'B)"
952 };
953 type record UtranTargetCellTdd {
954 uint14_t arfcn,
955 BIT1 bandwidth_presence,
956 uint3_t bandwidth optional,
957 uint7_t cell_parameter,
958 BIT1 sync_case
959 } with {
960 variant (bandwidth) "PRESENCE(bandwidth_presence = '1'B)"
961 };
962 type record UtranTargetCell {
963 BIT1 fdd_presence,
964 UtranTargetCellFdd fdd optional,
965 BIT1 tdd_presence,
966 UtranTargetCellTdd tdd optional,
967 uint6_t reporting_quantity
968 } with {
969 variant (fdd) "PRESENCE(fdd_presence = '1'B)"
970 variant (tdd) "PRESENCE(tdd_presence = '1'B)"
971 };
972
973 /* 11.2.3a Packet Cell Change Notification, Eutran Target Cell Struct (Rel-8 extension) */
974 type record EutranTargetCell {
975 uint16_t earfcn,
976 BIT1 meas_bandwidth_presence,
977 uint3_t meas_bandwidth optional,
978 uint9_t phys_layer_cell_id,
979 uint6_t reporting_quantity
980 } with {
981 variant (meas_bandwidth) "PRESENCE(meas_bandwidth_presence = '1'B)"
982 };
983
984 /* 11.2.3a Packet Cell Change Notification, 3G CCN Measurement Report Struct (Rel-6 extension) */
985 type record of UtranCCNMeasReportItem UtranReportingQuantityList;
986 type record UtranCCNMeasReportItem {
987 uint7_t cell_list_index,
988 uint6_t reporting_quantity
989 } with { variant "" };
990 type record UtranCCNMeasReport {
991 uint3_t n_3g,
992 UtranReportingQuantityList cells
993 } with {
994 variant (n_3g) "LENGTHTO(cells) - 1"
995 variant (n_3g) "UNIT(elements)"
996 };
997
998 /* 11.2.3a Packet Cell Change Notification, E-UTRAN CCN Measurement Report Struct (Rel-8 extension) */
999 type record length(1..4) of EutranCCNMeasReportItem EutranReportingQuantityList;
1000 type record EutranCCNMeasReportItem {
1001 uint3_t frequency_list_index,
1002 uint9_t cell_identity,
1003 uint6_t reporting_quantity
1004 } with { variant "" };
1005 type record EutranCCNMeasReport {
1006 uint1_t utran_ba_used,
1007 uint2_t n_eutran,
1008 EutranReportingQuantityList cells
1009 } with {
1010 variant (n_eutran) "LENGTHTO(cells) - 1"
1011 variant (n_eutran) "UNIT(elements)"
1012 };
1013
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +01001014 type record NCMeasurementItem {
1015 uint6_t freq,
1016 BIT1 bsic_presence,
1017 uint6_t bsic optional,
1018 uint6_t rxlev
1019 } with {
1020 variant (bsic) "PRESENCE(bsic_presence = '1'B)"
1021 };
1022 type record of NCMeasurementItem NCMeasurements;
Philipp Maierdcba8d22023-06-15 12:48:36 +02001023 type record CCNMeasReport {
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +01001024 uint6_t rxlev_servig_cell,
1025 BIT1 zero ('0'B),
1026 uint3_t num_meas,
1027 NCMeasurements meas
1028 } with { variant "" };
Philipp Maier48bfd562023-05-25 15:05:55 +02001029
1030 /* 11.2.3a Packet Cell Change Notification, Rel-Additions (Matrioshka) */
1031 private type record PktCellChgNotifAdditions {
1032 BIT1 rel6_presence,
1033 PktCellChgNotifR6Additions rel6 optional
1034 } with {
1035 variant (rel6) "PRESENCE(rel6_presence = '1'B)"
1036 };
1037 private type record PktCellChgNotifR6Additions {
1038 BIT1 utran_ba_used_presence,
1039 uint1_t utran_ba_used optional,
1040 UtranCCNMeasReport utran_ccn_meas_rep
1041 } with {
1042 variant (utran_ba_used) "PRESENCE(utran_ba_used_presence = '1'B)"
1043 };
1044
1045 private type record PktCellChgNotifyU0 {
1046 BIT1 tag ('0'B),
1047 uint10_t arfcn,
1048 uint6_t bsic
1049 } with { variant "" };
1050 private type record PktCellChgNotifyU10 {
1051 BIT2 tag ('10'B),
1052 UtranTargetCell utran_target_cell
1053 } with { variant "" };
1054 private type record PktCellChgNotifyU110 {
1055 BIT3 tag ('110'B),
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +01001056 BIT1 arfcn_bsic_presence,
1057 uint10_t arfcn optional,
1058 uint6_t bsic optional,
Philipp Maier48bfd562023-05-25 15:05:55 +02001059 BIT1 utran_target_cell_presence,
1060 UtranTargetCell utran_target_cell optional,
1061 BIT1 eutran_target_cell_presence,
1062 EutranTargetCell eutran_target_cell optional,
1063 BIT1 eutran_ccn_meas_rep_presence,
1064 EutranCCNMeasReport eutran_ccn_meas_rep optional
1065 } with {
1066 variant (arfcn) "PRESENCE(arfcn_bsic_presence = '1'B)"
1067 variant (bsic) "PRESENCE(arfcn_bsic_presence = '1'B)"
1068 variant (utran_target_cell) "PRESENCE(utran_target_cell_presence = '1'B)"
1069 variant (eutran_target_cell) "PRESENCE(eutran_target_cell_presence = '1'B)"
1070 variant (eutran_ccn_meas_rep) "PRESENCE(eutran_ccn_meas_rep_presence = '1'B)"
1071 };
1072 private type union PktCellChgNotifyUnion {
1073 PktCellChgNotifyU0 u0,
1074 PktCellChgNotifyU10 u10, /* Rel-6 additions */
1075 PktCellChgNotifyU110 u110 /* Rel-8 additions */
1076 /* TODO: PktCellChgNotifyU1110 Rel-9 additions */
1077 /* TODO: Message escape : { 1111 } bit (*) = <no string> > */
1078 } with {
1079 variant "TAG(u0, tag = '0'B;
1080 u10, tag = '10'B;
1081 u110, tag = '110'B)"
1082 };
1083
1084 /* 11.2.3a Packet Cell Change Notification, message body */
1085 type record PacketCellChangeNotification {
1086 GlobalTfi gtfi,
1087 PktCellChgNotifyUnion u,
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +01001088 BIT1 ba_psi3_presence,
1089 BIT1 ba_used optional,
1090 BIT2 psi3_change_mark optional,
1091 BIT1 pmo_used,
1092 BIT1 pccn_sending,
Philipp Maierdcba8d22023-06-15 12:48:36 +02001093 CCNMeasReport ccn_meas_rep,
Philipp Maier48bfd562023-05-25 15:05:55 +02001094 /* Rel-Additions (Matrioshka) */
1095 PktCellChgNotifAdditions rel_additions optional
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +01001096 } with {
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +01001097 variant (ba_used) "PRESENCE(ba_psi3_presence = '0'B)"
1098 variant (psi3_change_mark) "PRESENCE(ba_psi3_presence = '1'B)"
1099 };
1100
Harald Welte484160b2017-07-28 13:30:24 +02001101 /* 11.2.0.2 */
1102 type union RlcmacUlCtrlUnion {
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +01001103 PacketCtrlAck ctrl_ack,
1104 PacketDlAckNack dl_ack_nack,
1105 EgprsPacketDlAckNack dl_ack_nack_egprs,
1106 PacketUlDummy ul_dummy,
Pau Espin Pedrol52c54852021-06-17 17:07:33 +02001107 PacketMeasReport meas_report,
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +01001108 PacketResourceReq resource_req,
1109 PacketCellChangeNotification cell_chg_notif,
1110 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +02001111 } with { variant "" };
1112
1113 type record RlcmacUlCtrlMsg {
1114 RlcmacUlCtrlMsgType msg_type,
1115 RlcmacUlCtrlUnion u
1116 } with {
1117 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
1118 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +01001119 dl_ack_nack_egprs, msg_type = PACKET_EGPRS_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +02001120 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Pau Espin Pedrol52c54852021-06-17 17:07:33 +02001121 meas_report, msg_type = PACKET_MEASUREMENT_REPORT;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +02001122 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +01001123 cell_chg_notif, msg_type = PACKET_CELL_CHANGE_NOTIFICATION;
Harald Welte422f0722017-08-01 00:27:06 +02001124 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +02001125 )"
1126 };
1127
1128 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
1129 with { extension "prototype(convert) encode(RAW)" };
1130 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
1131 with { extension "prototype(convert) decode(RAW)" };
1132
1133 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
1134
1135 /* 12.3 Ack/Nack Description */
1136 type record AckNackDescription {
1137 BIT1 final_ack,
1138 uint7_t starting_seq_nr,
1139 ReceivedBlockBitmap receive_block_bitmap
1140 } with { variant "" };
1141
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +01001142 /* 12.3.1 Egprs Ack/Nack Description */
1143 type bitstring UncompressedReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
1144 type record EgprsAckNackDescription {
1145 BIT1 final_ack,
1146 BIT1 begin_window,
1147 BIT1 end_window,
1148 uint11_t starting_seq_nr,
1149 BIT1 compressed,
1150 /* TODO: CompressedReceivedBlockBitmap urbb optional, */
1151 UncompressedReceivedBlockBitmap urbb optional
1152 } with { variant (urbb) "PRESENCE(compressed = '0'B)" };
1153 type record EgprsAckNackDescriptionIE {
1154 BIT1 len_present,
1155 uint8_t len optional,
1156 EgprsAckNackDescription acknack_desc
1157 } with { variant (len) "PRESENCE(len_present = '1'B)"
1158 variant (len) "LENGTHTO(acknack_desc)"
1159 variant (len) "UNIT(bits)"
1160 };
1161
1162
Harald Welte484160b2017-07-28 13:30:24 +02001163 /* 12.7 Channel Request Description */
1164 type enumerated RlcMode {
1165 RLC_MODE_ACKNOWLEDGED (0),
1166 RLC_MODE_UNACKNOWLEDGED (1)
1167 } with { variant "FIELDLENGTH(1)" };
1168 type enumerated LlcPduType {
1169 LLC_PDU_IS_SACK_OR_ACK (0),
1170 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
1171 } with { variant "FIELDLENGTH(1)" };
1172 type record ChannelReqDescription {
1173 uint4_t peak_tput_class,
1174 uint2_t priority,
1175 RlcMode rlc_mode,
1176 LlcPduType llc_pdu_type,
1177 uint16_t RlcOctetCount
1178 } with { variant "" };
1179
1180 /* 12.8 Frequency Parameters */
1181 type record FreqIndirect {
1182 uint6_t maio,
1183 uint4_t ma_number,
1184 BIT1 change_mark1_present,
1185 uint2_t change_mark1 optional,
1186 BIT1 change_mark2_present,
1187 uint2_t change_mark2 optional
1188 } with {
1189 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
1190 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
1191 };
1192 type record FreqDirect1 {
1193 uint6_t maio,
Pau Espin Pedrol28652d82021-02-09 20:20:17 +01001194 GprsMobileAllocation mobile_allocation
Harald Welte484160b2017-07-28 13:30:24 +02001195 }
1196 type record FreqDirect2 {
1197 uint6_t maio,
1198 uint6_t hsn,
1199 uint4_t ma_freq_len,
1200 octetstring m1_freq_list
1201 } with {
Vadim Yanitskiycb33c742020-07-21 02:43:57 +07001202 variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
Harald Welte484160b2017-07-28 13:30:24 +02001203 };
1204 type record FrequencyParameters {
1205 uint3_t tsc,
1206 BIT2 presence,
1207 uint10_t arfcn optional,
1208 FreqIndirect indirect optional,
1209 FreqDirect1 direct1 optional,
1210 FreqDirect2 direct2 optional
1211 } with {
1212 variant (arfcn) "PRESENCE(presence = '00'B)"
1213 variant (indirect) "PRESENCE(presence = '01'B)"
1214 variant (direct1) "PRESENCE(presence = '10'B)"
1215 variant (direct2) "PRESENCE(presence = '11'B)"
1216 };
1217
Pau Espin Pedrol28652d82021-02-09 20:20:17 +01001218 /* 12.9a GPRS Power Control Parameters */
1219 type record GprsPowerControlParameters {
1220 uint4_t alpha,
1221 BIT5 t_avg_w,
1222 BIT5 t_avg_t,
1223 BIT1 pc_meas_chan,
1224 BIT4 n_avg_i
1225 };
1226
Harald Welte484160b2017-07-28 13:30:24 +02001227 /* 12.10 Global TFI */
1228 type record GlobalTfi {
1229 boolean is_dl_tfi,
1230 uint5_t tfi
1231 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
1232
1233 /* 12.10a GPRS Mobile Allocation */
1234 type record RflNumberList {
1235 uint4_t rfl_number,
1236 BIT1 presence,
1237 RflNumberList rfl_number_list optional
1238 } with {
1239 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
1240 };
Pau Espin Pedrol28652d82021-02-09 20:20:17 +01001241 type record GprsMobileAllocation {
Harald Welte484160b2017-07-28 13:30:24 +02001242 uint6_t hsn,
1243 BIT1 rfl_number_list_present,
1244 RflNumberList rfl_number_list optional,
1245 BIT1 ma_present,
1246 uint6_t ma_length optional,
Vadim Yanitskiy06c41612020-07-23 04:45:37 +07001247 bitstring ma_bitmap length(1..64) optional
Harald Welte484160b2017-07-28 13:30:24 +02001248 /* TODO: ARFCN index list */
1249 } with {
1250 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
1251 variant (ma_length) "PRESENCE(ma_present = '0'B)"
1252 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
Vadim Yanitskiy06c41612020-07-23 04:45:37 +07001253 variant (ma_length) "LENGTHTO(ma_bitmap)-1, UNIT(bits)"
Vadim Yanitskiy9fa1db52020-07-21 03:14:51 +07001254 variant (ma_bitmap) "BYTEORDER(first), BITORDER(msb)"
1255 };
Harald Welte484160b2017-07-28 13:30:24 +02001256
1257 /* 12.11 Packet Request Reference */
1258 type record PacketRequestReference {
1259 uint11_t ra_info,
1260 uint16_t frame_nr
1261 } with { variant "" };
1262
1263 /* 12.12 Packet Timing Advance */
1264 type record PacketTimingAdvance {
1265 BIT1 val_present,
1266 uint6_t val optional,
1267 BIT1 idx_present,
1268 uint4_t idx optional,
1269 uint3_t timeslot_nr optional
1270 } with {
1271 variant (val) "PRESENCE(val_present = '1'B)"
1272 variant (idx) "PRESENCE(idx_present = '1'B)"
1273 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
1274 };
1275
1276 /* 12.13 Power Control Parameters */
1277 type record ZeroOneGamma {
1278 BIT1 gamma_present,
Vadim Yanitskiy4728e092020-07-22 14:10:45 +07001279 uint5_t gamma optional
Harald Welte484160b2017-07-28 13:30:24 +02001280 } with {
1281 variant (gamma) "PRESENCE (gamma_present = '1'B)"
1282 };
1283 type record length(8) of ZeroOneGamma ZeroOneGammas;
1284 type record PowerControlParameters {
1285 uint4_t alpha,
1286 ZeroOneGammas gamma
1287 } with { variant "" };
1288
1289 /* 12.14 Persistence Level */
1290 type record length(4) of uint4_t PersistenceLevels;
1291
1292 /* 12.20 Page Mode */
1293 type enumerated PageMode {
1294 PAGE_MODE_NORMAL ('00'B),
1295 PAGE_MODE_EXTENDED ('01'B),
1296 PAGE_MODE_REORG ('10'B),
1297 PAGE_MODE_SAME ('11'B)
1298 } with { variant "FIELDLENGTH(2)" };
1299
1300 /* 12.21 Starting Frame Number */
1301 type record StartingFnDesc {
1302 BIT1 presence,
1303 uint16_t absolute_starting_time optional,
1304 uint13_t relative_k optional
1305 } with {
1306 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
1307 variant (relative_k) "PRESENCE(presence = '1'B)"
1308 };
1309
Pau Espin Pedrol28652d82021-02-09 20:20:17 +01001310 /* 12.24 GPRS Cell Options */
1311 type record ExtensionInformation {
1312 BIT1 egprs_supported,
1313 BIT1 egprs_pkt_channel_req optional,
1314 BIT4 bep_period optional,
1315 BIT1 pfc_feature_mode,
1316 BIT1 dtm_support,
1317 BIT1 bss_paging_coordination,
1318 /* REL-4 extension */
1319 BIT1 ccn_active optional,
1320 BIT1 nw_ext_utbf optional
1321 /* TODO: REL-6 extension */
1322 /* TODO: REL-7 extension */
1323 /* TODO: REL-10 extension */
1324 } with {
1325 variant (egprs_pkt_channel_req) "PRESENCE(egprs_supported = '1'B)"
1326 variant (bep_period) "PRESENCE(egprs_supported = '1'B)"
1327 };
1328 type record GprsCellOptions {
1329 BIT2 nmo,
1330 BIT3 t3168,
1331 BIT3 t3192,
1332 BIT3 drx_timer_max,
1333 BIT1 access_burst_type,
1334 BIT1 control_ack_type,
1335 uint4_t bs_cv_max,
1336 BIT1 pan_presence,
1337 uint3_t pan_dec optional,
1338 uint3_t pan_inc optional,
1339 BIT3 pan_max optional,
1340 BIT1 ext_info_presence,
1341 BIT6 ext_info_length optional,
1342 ExtensionInformation ext_info optional
1343 } with {
1344 variant (pan_dec) "PRESENCE(pan_presence = '1'B)"
1345 variant (pan_inc) "PRESENCE(pan_presence = '1'B)"
1346 variant (pan_max) "PRESENCE(pan_presence = '1'B)"
1347 variant (ext_info_length) "PRESENCE(ext_info_presence = '1'B)"
1348 variant (ext_info) "PRESENCE(ext_info_presence = '1'B)"
1349 /* TODO: mark REL-4 and upwards in ext_info as omit based on ext_info_length ? */
1350 };
1351
Vadim Yanitskiy3911d112020-04-01 22:31:30 +07001352 /* 3GPP TS 44.060, table 11.2.5a.2 "EGPRS PACKET CHANNEL REQUEST" */
1353 type union EGPRSPktChRequest {
1354 EGPRSPktChRequest_MC5P2RB3 one_phase,
1355 EGPRSPktChRequest_NOB3P2RB3 short, // deprecated
1356 EGPRSPktChRequest_MCG3P2RB3 one_phase_red,
1357 EGPRSPktChRequest_P2RB3 two_phase,
1358 EGPRSPktChRequest_RB5 signalling,
1359 EGPRSPktChRequest_RB5 one_phase_unack,
1360 EGPRSPktChRequest_RB5 dedicated,
1361 EGPRSPktChRequest_RB5 emergency,
1362 EGPRSPktChRequest_P2RB3 two_phase_ipa,
1363 EGPRSPktChRequest_RB5 signalling_ipa
1364 } with {
1365 variant "TAG (
1366 one_phase, tag = '0'B;
1367 short, tag = '100'B;
1368 one_phase_red, tag = '101'B;
1369 two_phase, tag = '110000'B;
1370 signalling, tag = '110011'B;
1371 one_phase_unack, tag = '110101'B;
1372 dedicated, tag = '110110'B;
1373 emergency, tag = '110111'B;
1374 two_phase_ipa, tag = '111000'B;
1375 signalling_ipa, tag = '111001'B;
1376 )"
1377 };
1378
1379 private type record EGPRSPktChRequest_MC5P2RB3 {
1380 BIT1 tag,
1381 BIT5 multislot_class,
1382 BIT2 priority,
1383 BIT3 random_bits
1384 };
1385
1386 private type record EGPRSPktChRequest_NOB3P2RB3 {
1387 BIT3 tag,
1388 BIT3 nr_of_blocks,
1389 BIT2 priority,
1390 BIT3 random_bits
1391 };
1392
1393 private type record EGPRSPktChRequest_MCG3P2RB3 {
1394 BIT3 tag,
1395 BIT3 multislot_class_group,
1396 BIT2 priority,
1397 BIT3 random_bits
1398 };
1399
1400 private type record EGPRSPktChRequest_P2RB3 {
1401 BIT6 tag,
1402 BIT2 priority,
1403 BIT3 random_bits
1404 };
1405
1406 private type record EGPRSPktChRequest_RB5 {
1407 BIT6 tag,
1408 BIT5 random_bits
1409 };
1410
1411 /* TITAN violates length restrictions on returned type, so we cannot do '... return BIT11'.
1412 * Keep this function private as it returns octet-aligned bitstring (+5 padding bits). */
1413 private external function enc_EGPRSPktChRequestInternal(in EGPRSPktChRequest req) return bitstring
1414 with { extension "prototype(convert) encode(RAW)" };
1415
1416 function enc_EGPRSPktChRequest2bits(in EGPRSPktChRequest req) return BIT11
1417 {
1418 var bitstring ra11_pad := enc_EGPRSPktChRequestInternal(req);
1419 return substr(ra11_pad, 0, 11); /* TITAN adds 5 padding bits */
1420 }
1421
1422 function enc_EGPRSPktChRequest2uint(in EGPRSPktChRequest req) return uint16_t
1423 {
1424 var BIT11 ra11 := enc_EGPRSPktChRequest2bits(req);
1425 return bit2int(ra11);
1426 }
1427
Harald Welte7024baa2018-03-02 23:37:51 +01001428
Harald Welte484160b2017-07-28 13:30:24 +02001429} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };