blob: bca43511613104a640235db6a875f16d633433c2 [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),
35 PACKET_DL_DUMMY_CTRL ('100101'B)
36 } with { variant "FIELDLENGTH(6)" };
37
38 /* TS 44.060 11.2.0.2 */
39 type enumerated RlcmacUlCtrlMsgType {
40 PACKET_CELL_CHANGE_FEATURE ('000000'B),
41 PACKET_CONTROL_ACK ('000001'B),
42 PACKET_DL_ACK_NACK ('000010'B),
43 PACKET_UL_DUMMY_CTRL ('000011'B),
44 PACKET_MEASUREMENT_REPORT ('000100'B),
45 PACKET_ENH_MEASUREMENT_REPORT ('001010'B),
46 PACKET_RESOURCE_REQUEST ('000101'B),
47 PACKET_MOBILE_TBF_STATUS ('000110'B),
48 PACKET_PSI_STATUS ('000111'B),
49 PACKET_EGPRS_DL_ACK_NACK ('001000'B),
50 PACKET_PAUSE ('001001'B),
51 ADDITIONAL_MS_RA_CAPABILITIES ('001011'B),
52 PACKET_CELL_CANGE_NOTIFICATION ('001100'B),
53 PACKET_SI_STATUS ('001101'B),
54 PACKET_CS_REQUEST ('001110'B),
55 MBMS_SERVICE_REQUEST ('001111'B),
56 MBMS_DL_ACK_NACK ('010000'B)
57 } with { variant "FIELDLENGTH(6)" };
58
59 type record NullGlobalTfi {
60 BIT1 presence ('0'B),
61 GlobalTfi global_tfi
62 } with { variant "" };
63
64 type record TenTlli {
65 BIT2 presence ('10'B),
66 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +010067 } with { variant ""
68 variant (tlli) "BYTEORDER(first)"
69 };
Harald Welte484160b2017-07-28 13:30:24 +020070
71 type union GlobalTfiOrTlli {
72 NullGlobalTfi global_tfi,
73 TenTlli tlli
74 };
75
76 /* 11.2.7 Packet Downlink Assignment */
77 type record PacketDlAssignment {
78 PageMode page_mode,
79 BIT1 pres1,
80 PersistenceLevels persistence_levels optional,
81 GlobalTfiOrTlli tfi_or_tlli
82 /* TODO */
83 } with {
84 variant (persistence_levels) "PRESENCE(pres1 = '1'B)"
85 };
86
87 /* 11.2.29 Packet Uplink Assignment */
88 type record O_Gtfi {
89 BIT1 presence ('0'B),
90 GlobalTfi global_tfi
91 } with { variant "" };
92 type record IO_Tlli {
93 BIT2 presence ('10'B),
94 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +010095 } with { variant ""
96 variant (tlli) "BYTEORDER(first)"
97 };
Harald Welte484160b2017-07-28 13:30:24 +020098 type record IIO_Tqi {
99 BIT3 presence ('110'B),
100 PacketRequestReference pkt_req_ref
101 } with { variant "" };
102 type union PktUlAssUnion {
103 O_Gtfi global_tfi,
104 IO_Tlli tlli,
105 IIO_Tqi tqi
106 } with {
107 variant "TAG(global_tfi, presence = '0'B;
108 tlli, presence = '10'B;
109 tqi, presence = '110'B)"
110 };
111 type record DynamicAllocation {
112 BIT1 extd_dyn_alloc,
113 BIT1 p0_present,
114 uint4_t p0 optional,
115 BIT1 pr_mode optional,
116 BIT1 usf_granularity,
117 BIT1 ul_tfi_ass_present,
118 uint5_t ul_tfi_assignment optional,
119 BIT1 reserved ('0'B),
120 BIT1 tbf_starting_time_present,
121 StartingFnDesc tbf_starting_time optional,
122 TsAllocationUnion ts_allocation
123 } with {
124 variant (p0) "PRESENCE(p0_present = '1'B)"
125 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
126 variant (ul_tfi_assignment) "PRESENCE(ul_tfi_ass_present = '1'B)"
127 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
128 };
129 type record TsAllocationTs {
130 BIT1 presence,
131 uint3_t usf_tn optional
132 } with {
133 variant (usf_tn) "PRESENCE(presence = '1'B)"
134 };
135 type record length(8) of TsAllocationTs TsAllocationTsArr;
136 type record TnGamma {
137 BIT1 presence,
138 uint3_t usf_tn optional,
139 uint5_t gamma_tn optional
140 } with {
141 variant (usf_tn) "PRESENCE(presence = '1'B)"
142 variant (gamma_tn) "PRESENCE(presence = '1'B)"
143 };
144 type record length(8) of TnGamma TnGamma8;
145 type record TsAllocationPwr {
146 uint4_t alpha,
147 TnGamma tn_gamma
148 } with { variant "" };
149 type record TsAllocationUnion {
150 BIT1 presence,
151 TsAllocationTsArr ts optional,
152 TsAllocationPwr ts_with_pwr optional
153 } with {
154 variant (ts) "PRESENCE(presence = '0'B)"
155 variant (ts_with_pwr) "PRESENCE(presence = '1'B)"
156 };
157 type record SingleBlockAllocation {
158 uint3_t timeslot_nr,
159 BIT1 alpha_present,
160 uint4_t alpha optional,
161 uint5_t gamma_tn,
162 BIT1 p0_present,
163 uint4_t p0 optional,
164 BIT1 reserved ('0'B) optional,
165 BIT1 pr_mode optional,
166 StartingFnDesc tbf_starting_time
167 } with {
168 variant (alpha) "PRESENCE(alpha_present = '1'B)"
169 variant (p0) "PRESENCE(p0_present = '1'B)"
170 variant (reserved) "PRESENCE(p0_present = '1'B)"
171 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
172 };
173 type record PktUlAssGprs {
174 ChCodingCommand ch_coding_cmd,
175 BIT1 tlli_block_chan_coding,
176 PacketTimingAdvance pkt_ta,
177 BIT1 freq_par_present,
178 FrequencyParameters freq_par optional,
179 BIT2 alloc_present,
180 DynamicAllocation dyn_block_alloc optional,
181 SingleBlockAllocation sgl_block_alloc optional
182 } with {
183 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
184 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
185 variant (sgl_block_alloc) "PRESENCE(alloc_present = '10'B)"
186 };
187 type record PacketUlAssignment {
188 PageMode page_mode,
189 BIT1 persistence_levels_present,
190 PersistenceLevels persistence_levels optional,
191 PktUlAssUnion identity,
192 BIT1 is_egprs, /* msg escape */
193 PktUlAssGprs gprs optional
194 } with {
195 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
196 variant (gprs) "PRESENCE(is_egprs = '0'B)"
197 };
198
199 /* 11.2.10 Packet Paging Request */
Stefan Sperling59c15d62018-10-10 11:09:25 +0200200 type record MobileIdentityLV_Paging {
201 /* Note that the size of 'len' differs from that of the Mobile Identify IE
202 * as defined in 3GPP TS 24.008 10.5.1.4 "Mobile Identity"; Paging Requests
203 * use only 4 bit to encode the length of a mobile identity, whereas the IE
204 * uses a byte. */
Harald Welte484160b2017-07-28 13:30:24 +0200205 uint4_t len,
206 octetstring mobile_id
Vadim Yanitskiy322c7932020-01-01 23:03:47 +0100207 } with {
208 variant (len) "LENGTHTO(mobile_id)"
209 variant (mobile_id) "BYTEORDER(first)"
210 };
Harald Welte484160b2017-07-28 13:30:24 +0200211 type record PageInfoPs {
212 BIT1 presence ('0'B),
213 BIT1 ptmsi_or_mobile_id,
214 GsmTmsi ptmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200215 MobileIdentityLV_Paging mobile_identity optional
Harald Welte484160b2017-07-28 13:30:24 +0200216 } with {
217 variant (ptmsi) "PRESENCE(ptmsi_or_mobile_id = '0'B)"
218 variant (mobile_identity) "PRESENCE(ptmsi_or_mobile_id = '1'B)"
219 };
220 type record PageInfoCs {
221 BIT1 presence ('1'B),
222 BIT1 tmsi_or_mobile_id,
223 GsmTmsi tmsi optional,
Stefan Sperling59c15d62018-10-10 11:09:25 +0200224 MobileIdentityLV_Paging mobile_identity optional,
Harald Welte484160b2017-07-28 13:30:24 +0200225 ChannelNeeded chan_needed,
226 BIT1 emlpp_prio_present,
227 uint3_t emlpp_prio optional
228 } with {
229 variant (tmsi) "PRESENCE(tmsi_or_mobile_id = '0'B)"
230 variant (mobile_identity) "PRESENCE(tmsi_or_mobile_id = '1'B)"
231 variant (emlpp_prio) "PRESENCE(emlpp_prio_present = '1'B)"
232 };
233 type union PageInfo {
234 PageInfoPs ps,
235 PageInfoCs cs
Vadim Yanitskiy5e518732020-01-01 21:27:18 +0100236 } with {
237 variant "TAG(ps, presence = '0'B; cs, presence = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200238 };
239 type record PacketPagingReq {
240 PageMode page_mode,
241 BIT1 persistence_levels_present,
242 PersistenceLevels persistence_levels optional,
243 BIT1 nln_present,
Oliver Smith8f9daab2019-10-09 09:27:19 +0200244 uint2_t nln optional,
245 BIT1 repeated_pageinfo_present,
246 PageInfo repeated_pageinfo optional
Harald Welte484160b2017-07-28 13:30:24 +0200247 } with {
248 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
249 variant (nln) "PRESENCE(nln_present = '1'B)"
Oliver Smith8f9daab2019-10-09 09:27:19 +0200250 variant (repeated_pageinfo) "PRESENCE(repeated_pageinfo_present = '1'B)"
Harald Welte484160b2017-07-28 13:30:24 +0200251 };
252
253 /* 11.2.28 Uplink Ack/Nack */
254 type enumerated ChCodingCommand {
255 CH_CODING_CS1 ('00'B),
256 CH_CODING_CS2 ('01'B),
257 CH_CODING_CS3 ('10'B),
258 CH_CODING_CS4 ('11'B)
259 } with { variant "FIELDLENGTH(2)" };
260 type record UlAckNackGprs {
261 ChCodingCommand ch_coding_cmd,
262 AckNackDescription ack_nack_desc,
263 BIT1 cont_res_tlli_present,
264 GprsTlli cont_res_tlli optional,
265 BIT1 pkt_ta_present,
266 PacketTimingAdvance pkt_ta optional,
267 BIT1 pwr_ctrl_present,
268 PowerControlParameters pwr_ctrl optional
269 /* TODO: Extension Bits, Rel5 ,... */
270 } with {
271 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
272 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
273 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100274 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200275 };
276 type record PacketUlAckNack {
277 PageMode page_mode,
278 BIT2 msg_excape ('00'B),
279 uint5_t uplink_tfi,
280 BIT1 is_egprs ('0'B), /* msg escape */
281 UlAckNackGprs gprs optional
282 /* TODO: EGPRS */
283 } with { variant (gprs) "PRESENCE(is_egprs = '0'B)" };
284
285 /* 11.2.8 Packet Downlink Dummy Control Block */
286 type record PacketDlDummy {
287 PageMode page_mode,
288 BIT1 persistence_levels_present,
289 PersistenceLevels persistence_levels optional
290 } with {
291 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
292 };
293
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700294 /* 11.9 Global Power Control Parameters */
295 type record GlobalPwrCtrlParams {
296 uint4_t alpha,
297 uint5_t t_avg_v,
298 uint5_t t_avg_t,
299 uint4_t pb,
300 BIT1 pc_meas_chan,
301 BIT1 spare ('0'B),
302 uint4_t n_avg_i
303 };
304
305 /* 12.12a Global Packet Timing Advance */
306 type record TimingAdvanceIdxTN {
307 uint4_t ta_idx,
308 uint3_t ts_num
309 };
310 type record GlobalPacketTA {
311 BIT1 ta_val_presence,
312 uint4_t ta_val optional,
313 BIT1 ul_presence,
314 TimingAdvanceIdxTN ul optional,
315 BIT1 dl_presence,
316 TimingAdvanceIdxTN dl optional
317 } with {
318 variant (ta_val) "PRESENCE(ta_val_presence = '1'B)"
319 variant (ul) "PRESENCE(ul_presence = '1'B)"
320 variant (dl) "PRESENCE(dl_presence = '1'B)"
321 };
322
323 /* 11.2.13 Packet Power Control/Timing Advance */
324 type record PacketPwrControlTAMsg {
325 BIT1 g_pwr_ctrl_presence,
326 GlobalPwrCtrlParams g_pwr_ctrl optional,
327 BIT1 split,
328 BIT1 split_desc optional,
329 GlobalPacketTA g_pkt_ta optional,
330 PowerControlParameters pwr_ctrl optional
331 /* TODO: additions for R99, REL-7, REL-12 */
332 } with {
333 variant (g_pwr_ctrl) "PRESENCE(g_pwr_ctrl_presence = '1'B)"
334 variant (split_desc) "PRESENCE(split = '1'B)"
335 /* FIXME: Fancy coding: either both IEs together, or one of them */
336 variant (g_pkt_ta) "PRESENCE(split = '0'B, split_desc = '0'B)"
337 variant (pwr_ctrl) "PRESENCE(split = '0'B, split_desc = '1'B)"
338 };
339 type record PacketPwrControlTA {
340 PageMode page_mode,
341 NullGlobalTfi global_tfi,
342 /* See 11.1.3.3 'Message escape' error label
343 * 0 < Message body > ! < Message escape : 1 bit (*) = <no string> > */
344 BIT1 msg_escape,
345 PacketPwrControlTAMsg msg optional
346 } with {
347 variant (msg) "PRESENCE(msg_escape = '0'B)"
348 };
349
Harald Welte484160b2017-07-28 13:30:24 +0200350 /* 11.2.0.1 */
351 type union RlcmacDlCtrlUnion {
352 PacketDlAssignment dl_assignment,
353 PacketUlAssignment ul_assignment,
354 PacketPagingReq paging,
355 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200356 PacketDlDummy dl_dummy,
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700357 PacketPwrControlTA pwr_ta,
Harald Welte422f0722017-08-01 00:27:06 +0200358 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200359 } with { variant "" };
360
361 type record RlcmacDlCtrlMsg {
362 RlcmacDlCtrlMsgType msg_type,
363 RlcmacDlCtrlUnion u
364 } with {
365 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
366 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
367 paging, msg_type = PACKET_PAGING_REQUEST;
368 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200369 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
Vadim Yanitskiy759cb292019-09-30 20:08:11 +0700370 pwr_ta, msg_type = PACKET_PWR_CONTROL_TA;
Harald Welte422f0722017-08-01 00:27:06 +0200371 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200372 )"
373 };
374
375 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
376 with { extension "prototype(convert) encode(RAW)" };
377 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
378 with { extension "prototype(convert) decode(RAW)" };
379
380
381 /* 11.2.6 Packet Downlikn Ack/Nack */
382 type record ILevel {
383 BIT1 presence,
384 uint4_t i_level optional
385 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
386 type record length(8) of ILevel ILevels;
387 type record ChannelQualityReport {
388 uint6_t c_value,
389 uint3_t rxqual,
390 uint6_t sign_var,
391 ILevels i_levels
392 } with { variant "" };
393 type record PacketDlAckNack {
394 uint5_t dl_tfi,
395 AckNackDescription ack_nack_desc,
396 BIT1 chreq_desc_presence,
397 ChannelReqDescription chreq_desc optional,
398 ChannelQualityReport ch_qual_rep
399 } with { variant "" };
400
401 /* 11.2.2 Packet Control Acknowledgement */
402 type enumerated CtrlAck {
403 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
404 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
405 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
406 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
407 } with { variant "FIELDLENGTH(2)" };
408 type record PacketCtrlAck {
409 GprsTlli tlli,
410 CtrlAck ctrl_ack
411 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100412 } with { variant ""
413 variant (tlli) "BYTEORDER(first)"
414 };
Harald Welte484160b2017-07-28 13:30:24 +0200415
416 /* 1.2.8b Packet Uplink Dummy Control Block */
417 type record PacketUlDummy {
418 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100419 } with { variant ""
420 variant (tlli) "BYTEORDER(first)"
421 };
Harald Welte484160b2017-07-28 13:30:24 +0200422
Pau Espin Pedrol8f245712020-04-24 18:47:30 +0200423 /* TS 44.060 sec 12.30 MS Radio Access Capability 2
424 * (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 +0200425 type union MSRadioAccCap2 {
Pau Espin Pedrol86904082019-12-30 20:21:00 +0100426 MSRadioAccessCapabilityV msRadioAccessCapabilityV
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200427 };
428
429 /* Table 11.2.16.2 Access Type */
430 type enumerated RlcAccessType {
431 RLC_ACC_TYPE_TWO_PHASE ('00'B),
432 RLC_ACC_TYPE_PAG_RESPONSE ('01'B),
433 RLC_ACC_TYPE_CELL_UPDATE ('10'B),
434 RLC_ACC_TYPE_MM ('11'B)
435 } with { variant "FIELDLENGTH(2)" };
436
437 type union PacketResourceReqID {
438 GlobalTfi gtfi,
439 GprsTlli tlli
440 } with { variant (tlli) "BYTEORDER(first)" };
441
442 /* 11.2.16 Packet Resource Request */
443 type record PacketResourceReq {
444 BIT1 acc_type_presence,
445 RlcAccessType acc_type optional,
446 BIT1 id_type,
447 PacketResourceReqID id,
448 BIT1 ms_rac2_presence,
449 MSRadioAccCap2 ms_rac2 optional,
450 ChannelReqDescription ch_req_desc,
451 BIT1 change_mark_presence,
452 BIT2 change_mark optional,
453 BIT6 C_val,
454 BIT1 sign_var_presence,
455 BIT6 sign_var optional,
456 ILevels I_levels
457 /* TODO: additional contents for further Releases (starting from 1999) */
458 } with {
459 variant (acc_type) "PRESENCE(acc_type_presence = '1'B)"
460 variant (id) "CROSSTAG(gtfi, id_type = '0'B; tlli, id_type = '1'B)"
461 variant (ms_rac2) "PRESENCE(ms_rac2_presence = '1'B)"
462 variant (change_mark) "PRESENCE(change_mark_presence = '1'B)"
463 variant (sign_var) "PRESENCE(sign_var_presence = '1'B)"
464 };
465
Harald Welte484160b2017-07-28 13:30:24 +0200466 /* 11.2.0.2 */
467 type union RlcmacUlCtrlUnion {
468 PacketCtrlAck ctrl_ack,
469 PacketDlAckNack dl_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200470 PacketUlDummy ul_dummy,
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200471 PacketResourceReq resource_req,
Harald Welte422f0722017-08-01 00:27:06 +0200472 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200473 } with { variant "" };
474
475 type record RlcmacUlCtrlMsg {
476 RlcmacUlCtrlMsgType msg_type,
477 RlcmacUlCtrlUnion u
478 } with {
479 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
480 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200481 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
Vadim Yanitskiyc5248492019-09-14 16:11:33 +0200482 resource_req, msg_type = PACKET_RESOURCE_REQUEST;
Harald Welte422f0722017-08-01 00:27:06 +0200483 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200484 )"
485 };
486
487 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
488 with { extension "prototype(convert) encode(RAW)" };
489 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
490 with { extension "prototype(convert) decode(RAW)" };
491
492 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
493
494 /* 12.3 Ack/Nack Description */
495 type record AckNackDescription {
496 BIT1 final_ack,
497 uint7_t starting_seq_nr,
498 ReceivedBlockBitmap receive_block_bitmap
499 } with { variant "" };
500
501 /* 12.7 Channel Request Description */
502 type enumerated RlcMode {
503 RLC_MODE_ACKNOWLEDGED (0),
504 RLC_MODE_UNACKNOWLEDGED (1)
505 } with { variant "FIELDLENGTH(1)" };
506 type enumerated LlcPduType {
507 LLC_PDU_IS_SACK_OR_ACK (0),
508 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
509 } with { variant "FIELDLENGTH(1)" };
510 type record ChannelReqDescription {
511 uint4_t peak_tput_class,
512 uint2_t priority,
513 RlcMode rlc_mode,
514 LlcPduType llc_pdu_type,
515 uint16_t RlcOctetCount
516 } with { variant "" };
517
518 /* 12.8 Frequency Parameters */
519 type record FreqIndirect {
520 uint6_t maio,
521 uint4_t ma_number,
522 BIT1 change_mark1_present,
523 uint2_t change_mark1 optional,
524 BIT1 change_mark2_present,
525 uint2_t change_mark2 optional
526 } with {
527 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
528 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
529 };
530 type record FreqDirect1 {
531 uint6_t maio,
532 GprsMobileAllication mobile_allocation
533 }
534 type record FreqDirect2 {
535 uint6_t maio,
536 uint6_t hsn,
537 uint4_t ma_freq_len,
538 octetstring m1_freq_list
539 } with {
540 /* FIXME: this can not be expressed in TTCN-3 ?!? */
541 //variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
542 variant (ma_freq_len) "LENGTHTO(m1_freq_list)"
543 };
544 type record FrequencyParameters {
545 uint3_t tsc,
546 BIT2 presence,
547 uint10_t arfcn optional,
548 FreqIndirect indirect optional,
549 FreqDirect1 direct1 optional,
550 FreqDirect2 direct2 optional
551 } with {
552 variant (arfcn) "PRESENCE(presence = '00'B)"
553 variant (indirect) "PRESENCE(presence = '01'B)"
554 variant (direct1) "PRESENCE(presence = '10'B)"
555 variant (direct2) "PRESENCE(presence = '11'B)"
556 };
557
558 /* 12.10 Global TFI */
559 type record GlobalTfi {
560 boolean is_dl_tfi,
561 uint5_t tfi
562 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
563
564 /* 12.10a GPRS Mobile Allocation */
565 type record RflNumberList {
566 uint4_t rfl_number,
567 BIT1 presence,
568 RflNumberList rfl_number_list optional
569 } with {
570 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
571 };
572 type record GprsMobileAllication {
573 uint6_t hsn,
574 BIT1 rfl_number_list_present,
575 RflNumberList rfl_number_list optional,
576 BIT1 ma_present,
577 uint6_t ma_length optional,
578 bitstring ma_bitmap optional
579 /* TODO: ARFCN index list */
580 } with {
581 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
582 variant (ma_length) "PRESENCE(ma_present = '0'B)"
583 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
584 /* FIXME: this can not be expressed in TTCN-3 ?!? */
585 //variant (ma_length) "LENGTHTO(ma_bitmap)+1"
586 variant (ma_length) "LENGTHTO(ma_bitmap)"
587 }
588
589 /* 12.11 Packet Request Reference */
590 type record PacketRequestReference {
591 uint11_t ra_info,
592 uint16_t frame_nr
593 } with { variant "" };
594
595 /* 12.12 Packet Timing Advance */
596 type record PacketTimingAdvance {
597 BIT1 val_present,
598 uint6_t val optional,
599 BIT1 idx_present,
600 uint4_t idx optional,
601 uint3_t timeslot_nr optional
602 } with {
603 variant (val) "PRESENCE(val_present = '1'B)"
604 variant (idx) "PRESENCE(idx_present = '1'B)"
605 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
606 };
607
608 /* 12.13 Power Control Parameters */
609 type record ZeroOneGamma {
610 BIT1 gamma_present,
611 uint5_t gamma
612 } with {
613 variant (gamma) "PRESENCE (gamma_present = '1'B)"
614 };
615 type record length(8) of ZeroOneGamma ZeroOneGammas;
616 type record PowerControlParameters {
617 uint4_t alpha,
618 ZeroOneGammas gamma
619 } with { variant "" };
620
621 /* 12.14 Persistence Level */
622 type record length(4) of uint4_t PersistenceLevels;
623
624 /* 12.20 Page Mode */
625 type enumerated PageMode {
626 PAGE_MODE_NORMAL ('00'B),
627 PAGE_MODE_EXTENDED ('01'B),
628 PAGE_MODE_REORG ('10'B),
629 PAGE_MODE_SAME ('11'B)
630 } with { variant "FIELDLENGTH(2)" };
631
632 /* 12.21 Starting Frame Number */
633 type record StartingFnDesc {
634 BIT1 presence,
635 uint16_t absolute_starting_time optional,
636 uint13_t relative_k optional
637 } with {
638 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
639 variant (relative_k) "PRESENCE(presence = '1'B)"
640 };
641
Vadim Yanitskiy3911d112020-04-01 22:31:30 +0700642 /* 3GPP TS 44.060, table 11.2.5a.2 "EGPRS PACKET CHANNEL REQUEST" */
643 type union EGPRSPktChRequest {
644 EGPRSPktChRequest_MC5P2RB3 one_phase,
645 EGPRSPktChRequest_NOB3P2RB3 short, // deprecated
646 EGPRSPktChRequest_MCG3P2RB3 one_phase_red,
647 EGPRSPktChRequest_P2RB3 two_phase,
648 EGPRSPktChRequest_RB5 signalling,
649 EGPRSPktChRequest_RB5 one_phase_unack,
650 EGPRSPktChRequest_RB5 dedicated,
651 EGPRSPktChRequest_RB5 emergency,
652 EGPRSPktChRequest_P2RB3 two_phase_ipa,
653 EGPRSPktChRequest_RB5 signalling_ipa
654 } with {
655 variant "TAG (
656 one_phase, tag = '0'B;
657 short, tag = '100'B;
658 one_phase_red, tag = '101'B;
659 two_phase, tag = '110000'B;
660 signalling, tag = '110011'B;
661 one_phase_unack, tag = '110101'B;
662 dedicated, tag = '110110'B;
663 emergency, tag = '110111'B;
664 two_phase_ipa, tag = '111000'B;
665 signalling_ipa, tag = '111001'B;
666 )"
667 };
668
669 private type record EGPRSPktChRequest_MC5P2RB3 {
670 BIT1 tag,
671 BIT5 multislot_class,
672 BIT2 priority,
673 BIT3 random_bits
674 };
675
676 private type record EGPRSPktChRequest_NOB3P2RB3 {
677 BIT3 tag,
678 BIT3 nr_of_blocks,
679 BIT2 priority,
680 BIT3 random_bits
681 };
682
683 private type record EGPRSPktChRequest_MCG3P2RB3 {
684 BIT3 tag,
685 BIT3 multislot_class_group,
686 BIT2 priority,
687 BIT3 random_bits
688 };
689
690 private type record EGPRSPktChRequest_P2RB3 {
691 BIT6 tag,
692 BIT2 priority,
693 BIT3 random_bits
694 };
695
696 private type record EGPRSPktChRequest_RB5 {
697 BIT6 tag,
698 BIT5 random_bits
699 };
700
701 /* TITAN violates length restrictions on returned type, so we cannot do '... return BIT11'.
702 * Keep this function private as it returns octet-aligned bitstring (+5 padding bits). */
703 private external function enc_EGPRSPktChRequestInternal(in EGPRSPktChRequest req) return bitstring
704 with { extension "prototype(convert) encode(RAW)" };
705
706 function enc_EGPRSPktChRequest2bits(in EGPRSPktChRequest req) return BIT11
707 {
708 var bitstring ra11_pad := enc_EGPRSPktChRequestInternal(req);
709 return substr(ra11_pad, 0, 11); /* TITAN adds 5 padding bits */
710 }
711
712 function enc_EGPRSPktChRequest2uint(in EGPRSPktChRequest req) return uint16_t
713 {
714 var BIT11 ra11 := enc_EGPRSPktChRequest2bits(req);
715 return bit2int(ra11);
716 }
717
Harald Welte7024baa2018-03-02 23:37:51 +0100718
Harald Welte484160b2017-07-28 13:30:24 +0200719} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };