blob: d9a5662648f63c450bd62bdc3db0098abb45c76e [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 {
708 PacketDlAssignment dl_assignment,
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200709 PacketMeasOrder meas_order,
Harald Welte484160b2017-07-28 13:30:24 +0200710 PacketUlAssignment ul_assignment,
711 PacketPagingReq paging,
712 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200713 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700714 PacketPwrControlTA pwr_ta,
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100715 PacketCellChangeContinue cell_chg_continue,
716 PacketNeighbourCellData neighbour_cell_data,
Harald Welte422f0722017-08-01 00:27:06 +0200717 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200718 } with { variant "" };
719
720 type record RlcmacDlCtrlMsg {
721 RlcmacDlCtrlMsgType msg_type,
722 RlcmacDlCtrlUnion u
723 } with {
724 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200725 meas_order, msg_type = PACKET_MEASUREMENT_ORDER;
Harald Welte484160b2017-07-28 13:30:24 +0200726 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
727 paging, msg_type = PACKET_PAGING_REQUEST;
728 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200729 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700730 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100731 cell_chg_continue,msg_type = PACKET_CELL_CHANGE_CONTINUE;
732 neighbour_cell_data,msg_type = PACKET_NEIGHBOUR_CELL_DATA;
Harald Welte422f0722017-08-01 00:27:06 +0200733 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200734 )"
735 };
736
737 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
738 with { extension "prototype(convert) encode(RAW)" };
739 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
740 with { extension "prototype(convert) decode(RAW)" };
741
742
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100743 /* 11.2.6 Packet Downlink Ack/Nack */
Harald Welte484160b2017-07-28 13:30:24 +0200744 type record ILevel {
745 BIT1 presence,
746 uint4_t i_level optional
747 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
748 type record length(8) of ILevel ILevels;
749 type record ChannelQualityReport {
750 uint6_t c_value,
751 uint3_t rxqual,
752 uint6_t sign_var,
753 ILevels i_levels
754 } with { variant "" };
755 type record PacketDlAckNack {
756 uint5_t dl_tfi,
757 AckNackDescription ack_nack_desc,
758 BIT1 chreq_desc_presence,
759 ChannelReqDescription chreq_desc optional,
760 ChannelQualityReport ch_qual_rep
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100761 } with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)" };
762
763 /* 11.2.6a Egprs Packet Downlink Ack/Nack */
764 type record EgprsBEPLinkQualityMeasurements {
765 BIT1 gmsk_presence,
766 BIT5 gmsk_mean_bep optional,
767 BIT3 gmsk_cv_bep optional,
768 BIT1 psk8_presence,
769 BIT5 psk8_mean_bep optional,
770 BIT3 psk8_cv_bep optional
771 } with { variant (gmsk_mean_bep) "PRESENCE(gmsk_presence = '1'B)"
772 variant (gmsk_cv_bep) "PRESENCE(gmsk_presence = '1'B)"
773 variant (psk8_mean_bep) "PRESENCE(psk8_presence = '1'B)"
774 variant (psk8_cv_bep) "PRESENCE(psk8_presence = '1'B)"
775 };
776 /* 12.5.4 EGPRS Timeslot Link Quality Measurements IE */
777 type record BEPMeas {
778 BIT1 presence,
779 BIT1 is_8psk optional,
780 uint4_t bep_meas optional
781 } with { variant (is_8psk) "PRESENCE(presence = '1'B)"
782 variant (bep_meas) "PRESENCE(presence = '1'B)"
783 };
784 type record length(8) of BEPMeas BEPMeasLi;
785 type record EgprsTimeslotLinkQualityMeasurements {
786 BIT1 bep_measurements_presence,
787 BEPMeasLi bep_meas optional,
788 BIT1 i_measurements_presence,
789 ILevels i_meas optional
790 } with { variant (bep_meas) "PRESENCE(bep_measurements_presence = '1'B)"
791 variant (i_meas) "PRESENCE(i_measurements_presence = '1'B)"
792 };
793 /* Table 12.5.1.1 : EGPRS Channel Quality Report Information elements */
794 type record EgprsChannelQualityReport {
795 EgprsBEPLinkQualityMeasurements bep_link_qual_meas,
796 uint6_t c_value,
797 EgprsTimeslotLinkQualityMeasurements ts_link_qual_meas
Harald Welte484160b2017-07-28 13:30:24 +0200798 } with { variant "" };
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100799 type record EgprsPacketDlAckNack {
800 uint5_t dl_tfi,
801 BIT1 ms_oom,
802 BIT1 egprs_ch_qual_rep_presence,
803 EgprsChannelQualityReport egprs_ch_qual_rep optional,
804 BIT1 chreq_desc_presence,
805 ChannelReqDescription chreq_desc optional,
806 BIT1 pfi_presence,
807 BIT7 pfi optional,
808 BIT1 epdan_presence('0'B),
809 /* TODO: Implement EPD A/N */
810 EgprsAckNackDescriptionIE ack_nack_desc_ie
811 } with { variant (chreq_desc) "PRESENCE(chreq_desc_presence = '1'B)"
812 variant (egprs_ch_qual_rep) "PRESENCE(egprs_ch_qual_rep_presence = '1'B)"
813 variant (pfi) "PRESENCE(pfi_presence = '1'B)"
814 };
Harald Welte484160b2017-07-28 13:30:24 +0200815
816 /* 11.2.2 Packet Control Acknowledgement */
817 type enumerated CtrlAck {
818 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
819 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
820 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
821 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
822 } with { variant "FIELDLENGTH(2)" };
823 type record PacketCtrlAck {
824 GprsTlli tlli,
825 CtrlAck ctrl_ack
826 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100827 } with { variant ""
828 variant (tlli) "BYTEORDER(first)"
829 };
Harald Welte484160b2017-07-28 13:30:24 +0200830
831 /* 1.2.8b Packet Uplink Dummy Control Block */
832 type record PacketUlDummy {
833 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100834 } with { variant ""
835 variant (tlli) "BYTEORDER(first)"
836 };
Harald Welte484160b2017-07-28 13:30:24 +0200837
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200838 /* 11.2.9 Packet Measurement Report */
839 type record NCMeasurement {
840 uint6_t frequency_n,
841 BIT1 bsic_n_presence,
842 BIT6 bsic_n optional,
843 uint6_t rxlev_n
844 } with {
845 variant (bsic_n) "PRESENCE(bsic_n_presence = '1'B)"
846 };
847 type record of NCMeasurement NCMeasurementList;
848 type record NCMeasurementReport {
849 BIT1 nc_mode,
850 uint6_t rxlev_serving_cell,
851 BIT1 zero ('0'B), /*The value '1' was allocated in an earlier version of the protocol and shall not be used.*/
852 uint3_t num_nc_measurements,
853 NCMeasurementList nm_measurements
854 } with {
855 variant (num_nc_measurements) "LENGTHTO(nm_measurements)"
856 variant (num_nc_measurements) "UNIT(elements)"
857 };
858 type record PacketMeasReport {
859 GprsTlli tlli,
860 BIT1 psi5_change_mark_presence,
861 BIT2 psi5_change_mark optional,
862 BIT1 additions_99 ('0'B), /* TODO: 1 -> support Additions 99 onwards */
863 NCMeasurementReport nc_meas_report optional
864 } with {
865 variant (tlli) "BYTEORDER(first)"
866 variant (psi5_change_mark) "PRESENCE(psi5_change_mark_presence = '1'B)"
867 variant (nc_meas_report) "PRESENCE(additions_99 = '0'B)"
868 };
869
Pau Espin Pedrol8f245712020-04-24 18:47:30 +0200870 /* TS 44.060 sec 12.30 MS Radio Access Capability 2
871 * (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 +0200872 type union MSRadioAccCap2 {
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100873 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200874 };
875
876 /* Table 11.2.16.2 Access Type */
877 type enumerated RlcAccessType {
878 RLC_ACC_TYPE_TWO_PHASE ('00'B),
879 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
880 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
881 RLC_ACC_TYPE_MM ('11'B)
882 } with { variant "FIELDLENGTH(2)" };
883
884 type union PacketResourceReqID {
885 GlobalTfi gtfi,
886 GprsTlli tlli
887 } with { variant (tlli) "BYTEORDER(first)" };
888
889 /* 11.2.16 Packet Resource Request */
890 type record PacketResourceReq {
891 BIT1 acc_type_presence,
892 RlcAccessType acc_type optional,
893 BIT1 id_type,
894 PacketResourceReqID id,
895 BIT1 ms_rac2_presence,
896 MSRadioAccCap2 ms_rac2 optional,
897 ChannelReqDescription ch_req_desc,
898 BIT1 change_mark_presence,
899 BIT2 change_mark optional,
900 BIT6 C_val,
901 BIT1 sign_var_presence,
902 BIT6 sign_var optional,
903 ILevels I_levels
904 /* TODO: additional contents for further Releases (starting from 1999) */
905 } with {
906 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
907 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
908 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
909 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
910 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
911 };
912
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100913 /* 11.2.3a Packet Cell Change Notification */
914 type record NCMeasurementItem {
915 uint6_t freq,
916 BIT1 bsic_presence,
917 uint6_t bsic optional,
918 uint6_t rxlev
919 } with {
920 variant (bsic) "PRESENCE(bsic_presence = '1'B)"
921 };
922 type record of NCMeasurementItem NCMeasurements;
923 type record CCNMesurementReport {
924 uint6_t rxlev_servig_cell,
925 BIT1 zero ('0'B),
926 uint3_t num_meas,
927 NCMeasurements meas
928 } with { variant "" };
929 type record PacketCellChangeNotification {
930 GlobalTfi gtfi,
931 /* TODO: support 3g/4g in these bits */
932 BIT1 arfcn_bsic_presence,
933 uint10_t arfcn optional,
934 uint6_t bsic optional,
935 BIT1 ba_psi3_presence,
936 BIT1 ba_used optional,
937 BIT2 psi3_change_mark optional,
938 BIT1 pmo_used,
939 BIT1 pccn_sending,
940 CCNMesurementReport ccn_meas_rep
941 /* TODO: Rel6 additions for 3G support */
942 } with {
943 variant (arfcn) "PRESENCE(arfcn_bsic_presence = '0'B)"
944 variant (bsic) "PRESENCE(arfcn_bsic_presence = '0'B)"
945 variant (ba_used) "PRESENCE(ba_psi3_presence = '0'B)"
946 variant (psi3_change_mark) "PRESENCE(ba_psi3_presence = '1'B)"
947 };
948
Harald Welte484160b2017-07-28 13:30:24 +0200949 /* 11.2.0.2 */
950 type union RlcmacUlCtrlUnion {
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100951 PacketCtrlAck ctrl_ack,
952 PacketDlAckNack dl_ack_nack,
953 EgprsPacketDlAckNack dl_ack_nack_egprs,
954 PacketUlDummy ul_dummy,
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200955 PacketMeasReport meas_report,
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100956 PacketResourceReq resource_req,
957 PacketCellChangeNotification cell_chg_notif,
958 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200959 } with { variant "" };
960
961 type record RlcmacUlCtrlMsg {
962 RlcmacUlCtrlMsgType msg_type,
963 RlcmacUlCtrlUnion u
964 } with {
965 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
966 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100967 dl_ack_nack_egprs, msg_type = PACKET_EGPRS_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200968 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Pau Espin Pedrol52c54852021-06-17 17:07:33 +0200969 meas_report, msg_type = PACKET_MEASUREMENT_REPORT;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200970 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Pau Espin Pedrol9df362a2021-01-08 17:14:03 +0100971 cell_chg_notif, msg_type = PACKET_CELL_CHANGE_NOTIFICATION;
Harald Welte422f0722017-08-01 00:27:06 +0200972 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200973 )"
974 };
975
976 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
977 with { extension "prototype(convert) encode(RAW)" };
978 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
979 with { extension "prototype(convert) decode(RAW)" };
980
981 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
982
983 /* 12.3 Ack/Nack Description */
984 type record AckNackDescription {
985 BIT1 final_ack,
986 uint7_t starting_seq_nr,
987 ReceivedBlockBitmap receive_block_bitmap
988 } with { variant "" };
989
Pau Espin Pedrolafdd28d2020-11-12 21:02:18 +0100990 /* 12.3.1 Egprs Ack/Nack Description */
991 type bitstring UncompressedReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
992 type record EgprsAckNackDescription {
993 BIT1 final_ack,
994 BIT1 begin_window,
995 BIT1 end_window,
996 uint11_t starting_seq_nr,
997 BIT1 compressed,
998 /* TODO: CompressedReceivedBlockBitmap urbb optional, */
999 UncompressedReceivedBlockBitmap urbb optional
1000 } with { variant (urbb) "PRESENCE(compressed = '0'B)" };
1001 type record EgprsAckNackDescriptionIE {
1002 BIT1 len_present,
1003 uint8_t len optional,
1004 EgprsAckNackDescription acknack_desc
1005 } with { variant (len) "PRESENCE(len_present = '1'B)"
1006 variant (len) "LENGTHTO(acknack_desc)"
1007 variant (len) "UNIT(bits)"
1008 };
1009
1010
Harald Welte484160b2017-07-28 13:30:24 +02001011 /* 12.7 Channel Request Description */
1012 type enumerated RlcMode {
1013 RLC_MODE_ACKNOWLEDGED (0),
1014 RLC_MODE_UNACKNOWLEDGED (1)
1015 } with { variant "FIELDLENGTH(1)" };
1016 type enumerated LlcPduType {
1017 LLC_PDU_IS_SACK_OR_ACK (0),
1018 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
1019 } with { variant "FIELDLENGTH(1)" };
1020 type record ChannelReqDescription {
1021 uint4_t peak_tput_class,
1022 uint2_t priority,
1023 RlcMode rlc_mode,
1024 LlcPduType llc_pdu_type,
1025 uint16_t RlcOctetCount
1026 } with { variant "" };
1027
1028 /* 12.8 Frequency Parameters */
1029 type record FreqIndirect {
1030 uint6_t maio,
1031 uint4_t ma_number,
1032 BIT1 change_mark1_present,
1033 uint2_t change_mark1 optional,
1034 BIT1 change_mark2_present,
1035 uint2_t change_mark2 optional
1036 } with {
1037 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
1038 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
1039 };
1040 type record FreqDirect1 {
1041 uint6_t maio,
Pau Espin Pedrol28652d82021-02-09 20:20:17 +01001042 GprsMobileAllocation mobile_allocation
Harald Welte484160b2017-07-28 13:30:24 +02001043 }
1044 type record FreqDirect2 {
1045 uint6_t maio,
1046 uint6_t hsn,
1047 uint4_t ma_freq_len,
1048 octetstring m1_freq_list
1049 } with {
Vadim Yanitskiycb33c742020-07-21 02:43:57 +07001050 variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
Harald Welte484160b2017-07-28 13:30:24 +02001051 };
1052 type record FrequencyParameters {
1053 uint3_t tsc,
1054 BIT2 presence,
1055 uint10_t arfcn optional,
1056 FreqIndirect indirect optional,
1057 FreqDirect1 direct1 optional,
1058 FreqDirect2 direct2 optional
1059 } with {
1060 variant (arfcn) "PRESENCE(presence = '00'B)"
1061 variant (indirect) "PRESENCE(presence = '01'B)"
1062 variant (direct1) "PRESENCE(presence = '10'B)"
1063 variant (direct2) "PRESENCE(presence = '11'B)"
1064 };
1065
Pau Espin Pedrol28652d82021-02-09 20:20:17 +01001066 /* 12.9a GPRS Power Control Parameters */
1067 type record GprsPowerControlParameters {
1068 uint4_t alpha,
1069 BIT5 t_avg_w,
1070 BIT5 t_avg_t,
1071 BIT1 pc_meas_chan,
1072 BIT4 n_avg_i
1073 };
1074
Harald Welte484160b2017-07-28 13:30:24 +02001075 /* 12.10 Global TFI */
1076 type record GlobalTfi {
1077 boolean is_dl_tfi,
1078 uint5_t tfi
1079 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
1080
1081 /* 12.10a GPRS Mobile Allocation */
1082 type record RflNumberList {
1083 uint4_t rfl_number,
1084 BIT1 presence,
1085 RflNumberList rfl_number_list optional
1086 } with {
1087 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
1088 };
Pau Espin Pedrol28652d82021-02-09 20:20:17 +01001089 type record GprsMobileAllocation {
Harald Welte484160b2017-07-28 13:30:24 +02001090 uint6_t hsn,
1091 BIT1 rfl_number_list_present,
1092 RflNumberList rfl_number_list optional,
1093 BIT1 ma_present,
1094 uint6_t ma_length optional,
Vadim Yanitskiy06c41612020-07-23 04:45:37 +07001095 bitstring ma_bitmap length(1..64) optional
Harald Welte484160b2017-07-28 13:30:24 +02001096 /* TODO: ARFCN index list */
1097 } with {
1098 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
1099 variant (ma_length) "PRESENCE(ma_present = '0'B)"
1100 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
Vadim Yanitskiy06c41612020-07-23 04:45:37 +07001101 variant (ma_length) "LENGTHTO(ma_bitmap)-1, UNIT(bits)"
Vadim Yanitskiy9fa1db52020-07-21 03:14:51 +07001102 variant (ma_bitmap) "BYTEORDER(first), BITORDER(msb)"
1103 };
Harald Welte484160b2017-07-28 13:30:24 +02001104
1105 /* 12.11 Packet Request Reference */
1106 type record PacketRequestReference {
1107 uint11_t ra_info,
1108 uint16_t frame_nr
1109 } with { variant "" };
1110
1111 /* 12.12 Packet Timing Advance */
1112 type record PacketTimingAdvance {
1113 BIT1 val_present,
1114 uint6_t val optional,
1115 BIT1 idx_present,
1116 uint4_t idx optional,
1117 uint3_t timeslot_nr optional
1118 } with {
1119 variant (val) "PRESENCE(val_present = '1'B)"
1120 variant (idx) "PRESENCE(idx_present = '1'B)"
1121 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
1122 };
1123
1124 /* 12.13 Power Control Parameters */
1125 type record ZeroOneGamma {
1126 BIT1 gamma_present,
Vadim Yanitskiy4728e092020-07-22 14:10:45 +07001127 uint5_t gamma optional
Harald Welte484160b2017-07-28 13:30:24 +02001128 } with {
1129 variant (gamma) "PRESENCE (gamma_present = '1'B)"
1130 };
1131 type record length(8) of ZeroOneGamma ZeroOneGammas;
1132 type record PowerControlParameters {
1133 uint4_t alpha,
1134 ZeroOneGammas gamma
1135 } with { variant "" };
1136
1137 /* 12.14 Persistence Level */
1138 type record length(4) of uint4_t PersistenceLevels;
1139
1140 /* 12.20 Page Mode */
1141 type enumerated PageMode {
1142 PAGE_MODE_NORMAL ('00'B),
1143 PAGE_MODE_EXTENDED ('01'B),
1144 PAGE_MODE_REORG ('10'B),
1145 PAGE_MODE_SAME ('11'B)
1146 } with { variant "FIELDLENGTH(2)" };
1147
1148 /* 12.21 Starting Frame Number */
1149 type record StartingFnDesc {
1150 BIT1 presence,
1151 uint16_t absolute_starting_time optional,
1152 uint13_t relative_k optional
1153 } with {
1154 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
1155 variant (relative_k) "PRESENCE(presence = '1'B)"
1156 };
1157
Pau Espin Pedrol28652d82021-02-09 20:20:17 +01001158 /* 12.24 GPRS Cell Options */
1159 type record ExtensionInformation {
1160 BIT1 egprs_supported,
1161 BIT1 egprs_pkt_channel_req optional,
1162 BIT4 bep_period optional,
1163 BIT1 pfc_feature_mode,
1164 BIT1 dtm_support,
1165 BIT1 bss_paging_coordination,
1166 /* REL-4 extension */
1167 BIT1 ccn_active optional,
1168 BIT1 nw_ext_utbf optional
1169 /* TODO: REL-6 extension */
1170 /* TODO: REL-7 extension */
1171 /* TODO: REL-10 extension */
1172 } with {
1173 variant (egprs_pkt_channel_req) "PRESENCE(egprs_supported = '1'B)"
1174 variant (bep_period) "PRESENCE(egprs_supported = '1'B)"
1175 };
1176 type record GprsCellOptions {
1177 BIT2 nmo,
1178 BIT3 t3168,
1179 BIT3 t3192,
1180 BIT3 drx_timer_max,
1181 BIT1 access_burst_type,
1182 BIT1 control_ack_type,
1183 uint4_t bs_cv_max,
1184 BIT1 pan_presence,
1185 uint3_t pan_dec optional,
1186 uint3_t pan_inc optional,
1187 BIT3 pan_max optional,
1188 BIT1 ext_info_presence,
1189 BIT6 ext_info_length optional,
1190 ExtensionInformation ext_info optional
1191 } with {
1192 variant (pan_dec) "PRESENCE(pan_presence = '1'B)"
1193 variant (pan_inc) "PRESENCE(pan_presence = '1'B)"
1194 variant (pan_max) "PRESENCE(pan_presence = '1'B)"
1195 variant (ext_info_length) "PRESENCE(ext_info_presence = '1'B)"
1196 variant (ext_info) "PRESENCE(ext_info_presence = '1'B)"
1197 /* TODO: mark REL-4 and upwards in ext_info as omit based on ext_info_length ? */
1198 };
1199
Vadim Yanitskiy3911d112020-04-01 22:31:30 +07001200 /* 3GPP TS 44.060, table 11.2.5a.2 "EGPRS PACKET CHANNEL REQUEST" */
1201 type union EGPRSPktChRequest {
1202 EGPRSPktChRequest_MC5P2RB3 one_phase,
1203 EGPRSPktChRequest_NOB3P2RB3 short, // deprecated
1204 EGPRSPktChRequest_MCG3P2RB3 one_phase_red,
1205 EGPRSPktChRequest_P2RB3 two_phase,
1206 EGPRSPktChRequest_RB5 signalling,
1207 EGPRSPktChRequest_RB5 one_phase_unack,
1208 EGPRSPktChRequest_RB5 dedicated,
1209 EGPRSPktChRequest_RB5 emergency,
1210 EGPRSPktChRequest_P2RB3 two_phase_ipa,
1211 EGPRSPktChRequest_RB5 signalling_ipa
1212 } with {
1213 variant "TAG (
1214 one_phase, tag = '0'B;
1215 short, tag = '100'B;
1216 one_phase_red, tag = '101'B;
1217 two_phase, tag = '110000'B;
1218 signalling, tag = '110011'B;
1219 one_phase_unack, tag = '110101'B;
1220 dedicated, tag = '110110'B;
1221 emergency, tag = '110111'B;
1222 two_phase_ipa, tag = '111000'B;
1223 signalling_ipa, tag = '111001'B;
1224 )"
1225 };
1226
1227 private type record EGPRSPktChRequest_MC5P2RB3 {
1228 BIT1 tag,
1229 BIT5 multislot_class,
1230 BIT2 priority,
1231 BIT3 random_bits
1232 };
1233
1234 private type record EGPRSPktChRequest_NOB3P2RB3 {
1235 BIT3 tag,
1236 BIT3 nr_of_blocks,
1237 BIT2 priority,
1238 BIT3 random_bits
1239 };
1240
1241 private type record EGPRSPktChRequest_MCG3P2RB3 {
1242 BIT3 tag,
1243 BIT3 multislot_class_group,
1244 BIT2 priority,
1245 BIT3 random_bits
1246 };
1247
1248 private type record EGPRSPktChRequest_P2RB3 {
1249 BIT6 tag,
1250 BIT2 priority,
1251 BIT3 random_bits
1252 };
1253
1254 private type record EGPRSPktChRequest_RB5 {
1255 BIT6 tag,
1256 BIT5 random_bits
1257 };
1258
1259 /* TITAN violates length restrictions on returned type, so we cannot do '... return BIT11'.
1260 * Keep this function private as it returns octet-aligned bitstring (+5 padding bits). */
1261 private external function enc_EGPRSPktChRequestInternal(in EGPRSPktChRequest req) return bitstring
1262 with { extension "prototype(convert) encode(RAW)" };
1263
1264 function enc_EGPRSPktChRequest2bits(in EGPRSPktChRequest req) return BIT11
1265 {
1266 var bitstring ra11_pad := enc_EGPRSPktChRequestInternal(req);
1267 return substr(ra11_pad, 0, 11); /* TITAN adds 5 padding bits */
1268 }
1269
1270 function enc_EGPRSPktChRequest2uint(in EGPRSPktChRequest req) return uint16_t
1271 {
1272 var BIT11 ra11 := enc_EGPRSPktChRequest2bits(req);
1273 return bit2int(ra11);
1274 }
1275
Harald Welte7024baa2018-03-02 23:37:51 +01001276
Harald Welte484160b2017-07-28 13:30:24 +02001277} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };