blob: 2335c29dbda3d954575a3dd166f2efabd3c78858 [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
3 * purposes.
4 * (C) 2017 by Harald Welte <laforge@gnumonks.org> */
5module RLCMAC_CSN1_Types {
6 import from General_Types all;
7 import from Osmocom_Types all;
8 import from GSM_Types all;
9
10 /* TS 44.060 11.2.0.1 */
11 type enumerated RlcmacDlCtrlMsgType {
12 PACKET_ACCESS_REJECT ('100001'B),
13 PACKET_CELL_CHANGE_ORDER ('000001'B),
14 PACKET_DL_ASSIGNMENT ('000010'B),
15 PACKET_MEASUREMENT_ORDER ('000011'B),
16 PACKET_PAGING_REQUEST ('100010'B),
17 PACKET_PDCH_RELEASE ('100011'B),
18 PACKET_POLLING_REQUEST ('000100'B),
19 /* TODO */
20 PACKET_TBF_RELEASE ('001000'B),
21 PACKET_UL_ACK_NACK ('001001'B),
22 PACKET_UL_ASSIGNMENT ('001010'B),
23 PACKET_DL_DUMMY_CTRL ('100101'B)
24 } with { variant "FIELDLENGTH(6)" };
25
26 /* TS 44.060 11.2.0.2 */
27 type enumerated RlcmacUlCtrlMsgType {
28 PACKET_CELL_CHANGE_FEATURE ('000000'B),
29 PACKET_CONTROL_ACK ('000001'B),
30 PACKET_DL_ACK_NACK ('000010'B),
31 PACKET_UL_DUMMY_CTRL ('000011'B),
32 PACKET_MEASUREMENT_REPORT ('000100'B),
33 PACKET_ENH_MEASUREMENT_REPORT ('001010'B),
34 PACKET_RESOURCE_REQUEST ('000101'B),
35 PACKET_MOBILE_TBF_STATUS ('000110'B),
36 PACKET_PSI_STATUS ('000111'B),
37 PACKET_EGPRS_DL_ACK_NACK ('001000'B),
38 PACKET_PAUSE ('001001'B),
39 ADDITIONAL_MS_RA_CAPABILITIES ('001011'B),
40 PACKET_CELL_CANGE_NOTIFICATION ('001100'B),
41 PACKET_SI_STATUS ('001101'B),
42 PACKET_CS_REQUEST ('001110'B),
43 MBMS_SERVICE_REQUEST ('001111'B),
44 MBMS_DL_ACK_NACK ('010000'B)
45 } with { variant "FIELDLENGTH(6)" };
46
47 type record NullGlobalTfi {
48 BIT1 presence ('0'B),
49 GlobalTfi global_tfi
50 } with { variant "" };
51
52 type record TenTlli {
53 BIT2 presence ('10'B),
54 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +010055 } with { variant ""
56 variant (tlli) "BYTEORDER(first)"
57 };
Harald Welte484160b2017-07-28 13:30:24 +020058
59 type union GlobalTfiOrTlli {
60 NullGlobalTfi global_tfi,
61 TenTlli tlli
62 };
63
64 /* 11.2.7 Packet Downlink Assignment */
65 type record PacketDlAssignment {
66 PageMode page_mode,
67 BIT1 pres1,
68 PersistenceLevels persistence_levels optional,
69 GlobalTfiOrTlli tfi_or_tlli
70 /* TODO */
71 } with {
72 variant (persistence_levels) "PRESENCE(pres1 = '1'B)"
73 };
74
75 /* 11.2.29 Packet Uplink Assignment */
76 type record O_Gtfi {
77 BIT1 presence ('0'B),
78 GlobalTfi global_tfi
79 } with { variant "" };
80 type record IO_Tlli {
81 BIT2 presence ('10'B),
82 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +010083 } with { variant ""
84 variant (tlli) "BYTEORDER(first)"
85 };
Harald Welte484160b2017-07-28 13:30:24 +020086 type record IIO_Tqi {
87 BIT3 presence ('110'B),
88 PacketRequestReference pkt_req_ref
89 } with { variant "" };
90 type union PktUlAssUnion {
91 O_Gtfi global_tfi,
92 IO_Tlli tlli,
93 IIO_Tqi tqi
94 } with {
95 variant "TAG(global_tfi, presence = '0'B;
96 tlli, presence = '10'B;
97 tqi, presence = '110'B)"
98 };
99 type record DynamicAllocation {
100 BIT1 extd_dyn_alloc,
101 BIT1 p0_present,
102 uint4_t p0 optional,
103 BIT1 pr_mode optional,
104 BIT1 usf_granularity,
105 BIT1 ul_tfi_ass_present,
106 uint5_t ul_tfi_assignment optional,
107 BIT1 reserved ('0'B),
108 BIT1 tbf_starting_time_present,
109 StartingFnDesc tbf_starting_time optional,
110 TsAllocationUnion ts_allocation
111 } with {
112 variant (p0) "PRESENCE(p0_present = '1'B)"
113 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
114 variant (ul_tfi_assignment) "PRESENCE(ul_tfi_ass_present = '1'B)"
115 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
116 };
117 type record TsAllocationTs {
118 BIT1 presence,
119 uint3_t usf_tn optional
120 } with {
121 variant (usf_tn) "PRESENCE(presence = '1'B)"
122 };
123 type record length(8) of TsAllocationTs TsAllocationTsArr;
124 type record TnGamma {
125 BIT1 presence,
126 uint3_t usf_tn optional,
127 uint5_t gamma_tn optional
128 } with {
129 variant (usf_tn) "PRESENCE(presence = '1'B)"
130 variant (gamma_tn) "PRESENCE(presence = '1'B)"
131 };
132 type record length(8) of TnGamma TnGamma8;
133 type record TsAllocationPwr {
134 uint4_t alpha,
135 TnGamma tn_gamma
136 } with { variant "" };
137 type record TsAllocationUnion {
138 BIT1 presence,
139 TsAllocationTsArr ts optional,
140 TsAllocationPwr ts_with_pwr optional
141 } with {
142 variant (ts) "PRESENCE(presence = '0'B)"
143 variant (ts_with_pwr) "PRESENCE(presence = '1'B)"
144 };
145 type record SingleBlockAllocation {
146 uint3_t timeslot_nr,
147 BIT1 alpha_present,
148 uint4_t alpha optional,
149 uint5_t gamma_tn,
150 BIT1 p0_present,
151 uint4_t p0 optional,
152 BIT1 reserved ('0'B) optional,
153 BIT1 pr_mode optional,
154 StartingFnDesc tbf_starting_time
155 } with {
156 variant (alpha) "PRESENCE(alpha_present = '1'B)"
157 variant (p0) "PRESENCE(p0_present = '1'B)"
158 variant (reserved) "PRESENCE(p0_present = '1'B)"
159 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
160 };
161 type record PktUlAssGprs {
162 ChCodingCommand ch_coding_cmd,
163 BIT1 tlli_block_chan_coding,
164 PacketTimingAdvance pkt_ta,
165 BIT1 freq_par_present,
166 FrequencyParameters freq_par optional,
167 BIT2 alloc_present,
168 DynamicAllocation dyn_block_alloc optional,
169 SingleBlockAllocation sgl_block_alloc optional
170 } with {
171 variant (freq_par) "PRESENCE(freq_par_present = '1'B)"
172 variant (dyn_block_alloc) "PRESENCE(alloc_present = '01'B)"
173 variant (sgl_block_alloc) "PRESENCE(alloc_present = '10'B)"
174 };
175 type record PacketUlAssignment {
176 PageMode page_mode,
177 BIT1 persistence_levels_present,
178 PersistenceLevels persistence_levels optional,
179 PktUlAssUnion identity,
180 BIT1 is_egprs, /* msg escape */
181 PktUlAssGprs gprs optional
182 } with {
183 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
184 variant (gprs) "PRESENCE(is_egprs = '0'B)"
185 };
186
187 /* 11.2.10 Packet Paging Request */
188 type record MobileIdentityLV {
189 uint4_t len,
190 octetstring mobile_id
191 } with { variant (len) "LENGTHTO(mobile_id)" };
192 type record PageInfoPs {
193 BIT1 presence ('0'B),
194 BIT1 ptmsi_or_mobile_id,
195 GsmTmsi ptmsi optional,
196 MobileIdentityLV mobile_identity optional
197 } with {
198 variant (ptmsi) "PRESENCE(ptmsi_or_mobile_id = '0'B)"
199 variant (mobile_identity) "PRESENCE(ptmsi_or_mobile_id = '1'B)"
200 };
201 type record PageInfoCs {
202 BIT1 presence ('1'B),
203 BIT1 tmsi_or_mobile_id,
204 GsmTmsi tmsi optional,
205 MobileIdentityLV mobile_identity optional,
206 ChannelNeeded chan_needed,
207 BIT1 emlpp_prio_present,
208 uint3_t emlpp_prio optional
209 } with {
210 variant (tmsi) "PRESENCE(tmsi_or_mobile_id = '0'B)"
211 variant (mobile_identity) "PRESENCE(tmsi_or_mobile_id = '1'B)"
212 variant (emlpp_prio) "PRESENCE(emlpp_prio_present = '1'B)"
213 };
214 type union PageInfo {
215 PageInfoPs ps,
216 PageInfoCs cs
217 };
218 type record PacketPagingReq {
219 PageMode page_mode,
220 BIT1 persistence_levels_present,
221 PersistenceLevels persistence_levels optional,
222 BIT1 nln_present,
223 uint2_t nln optional
224 /* TODO: Repeated PageInfo */
225 } with {
226 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
227 variant (nln) "PRESENCE(nln_present = '1'B)"
228 };
229
230 /* 11.2.28 Uplink Ack/Nack */
231 type enumerated ChCodingCommand {
232 CH_CODING_CS1 ('00'B),
233 CH_CODING_CS2 ('01'B),
234 CH_CODING_CS3 ('10'B),
235 CH_CODING_CS4 ('11'B)
236 } with { variant "FIELDLENGTH(2)" };
237 type record UlAckNackGprs {
238 ChCodingCommand ch_coding_cmd,
239 AckNackDescription ack_nack_desc,
240 BIT1 cont_res_tlli_present,
241 GprsTlli cont_res_tlli optional,
242 BIT1 pkt_ta_present,
243 PacketTimingAdvance pkt_ta optional,
244 BIT1 pwr_ctrl_present,
245 PowerControlParameters pwr_ctrl optional
246 /* TODO: Extension Bits, Rel5 ,... */
247 } with {
248 variant (cont_res_tlli) "PRESENCE(cont_res_tlli_present = '1'B)"
249 variant (pkt_ta) "PRESENCE(pkt_ta_present = '1'B)"
250 variant (pwr_ctrl) "PRESENCE(pwr_ctrl_present = '1'B)"
Harald Welteacc93ab2018-03-02 21:39:09 +0100251 variant (cont_res_tlli) "BYTEORDER(first)"
Harald Welte484160b2017-07-28 13:30:24 +0200252 };
253 type record PacketUlAckNack {
254 PageMode page_mode,
255 BIT2 msg_excape ('00'B),
256 uint5_t uplink_tfi,
257 BIT1 is_egprs ('0'B), /* msg escape */
258 UlAckNackGprs gprs optional
259 /* TODO: EGPRS */
260 } with { variant (gprs) "PRESENCE(is_egprs = '0'B)" };
261
262 /* 11.2.8 Packet Downlink Dummy Control Block */
263 type record PacketDlDummy {
264 PageMode page_mode,
265 BIT1 persistence_levels_present,
266 PersistenceLevels persistence_levels optional
267 } with {
268 variant (persistence_levels) "PRESENCE(persistence_levels_present = '1'B)"
269 };
270
271 /* 11.2.0.1 */
272 type union RlcmacDlCtrlUnion {
273 PacketDlAssignment dl_assignment,
274 PacketUlAssignment ul_assignment,
275 PacketPagingReq paging,
276 PacketUlAckNack ul_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200277 PacketDlDummy dl_dummy,
278 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200279 } with { variant "" };
280
281 type record RlcmacDlCtrlMsg {
282 RlcmacDlCtrlMsgType msg_type,
283 RlcmacDlCtrlUnion u
284 } with {
285 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
286 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
287 paging, msg_type = PACKET_PAGING_REQUEST;
288 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200289 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL;
290 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200291 )"
292 };
293
294 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
295 with { extension "prototype(convert) encode(RAW)" };
296 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
297 with { extension "prototype(convert) decode(RAW)" };
298
299
300 /* 11.2.6 Packet Downlikn Ack/Nack */
301 type record ILevel {
302 BIT1 presence,
303 uint4_t i_level optional
304 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
305 type record length(8) of ILevel ILevels;
306 type record ChannelQualityReport {
307 uint6_t c_value,
308 uint3_t rxqual,
309 uint6_t sign_var,
310 ILevels i_levels
311 } with { variant "" };
312 type record PacketDlAckNack {
313 uint5_t dl_tfi,
314 AckNackDescription ack_nack_desc,
315 BIT1 chreq_desc_presence,
316 ChannelReqDescription chreq_desc optional,
317 ChannelQualityReport ch_qual_rep
318 } with { variant "" };
319
320 /* 11.2.2 Packet Control Acknowledgement */
321 type enumerated CtrlAck {
322 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
323 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
324 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
325 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
326 } with { variant "FIELDLENGTH(2)" };
327 type record PacketCtrlAck {
328 GprsTlli tlli,
329 CtrlAck ctrl_ack
330 /* TODO: Rel5 additions */
Harald Welteacc93ab2018-03-02 21:39:09 +0100331 } with { variant ""
332 variant (tlli) "BYTEORDER(first)"
333 };
Harald Welte484160b2017-07-28 13:30:24 +0200334
335 /* 1.2.8b Packet Uplink Dummy Control Block */
336 type record PacketUlDummy {
337 GprsTlli tlli
Harald Welteacc93ab2018-03-02 21:39:09 +0100338 } with { variant ""
339 variant (tlli) "BYTEORDER(first)"
340 };
Harald Welte484160b2017-07-28 13:30:24 +0200341
342 /* 11.2.0.2 */
343 type union RlcmacUlCtrlUnion {
344 PacketCtrlAck ctrl_ack,
345 PacketDlAckNack dl_ack_nack,
Harald Welte422f0722017-08-01 00:27:06 +0200346 PacketUlDummy ul_dummy,
347 octetstring other
Harald Welte484160b2017-07-28 13:30:24 +0200348 } with { variant "" };
349
350 type record RlcmacUlCtrlMsg {
351 RlcmacUlCtrlMsgType msg_type,
352 RlcmacUlCtrlUnion u
353 } with {
354 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
355 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
Harald Welte422f0722017-08-01 00:27:06 +0200356 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL;
357 other, OTHERWISE
Harald Welte484160b2017-07-28 13:30:24 +0200358 )"
359 };
360
361 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
362 with { extension "prototype(convert) encode(RAW)" };
363 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
364 with { extension "prototype(convert) decode(RAW)" };
365
366 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
367
368 /* 12.3 Ack/Nack Description */
369 type record AckNackDescription {
370 BIT1 final_ack,
371 uint7_t starting_seq_nr,
372 ReceivedBlockBitmap receive_block_bitmap
373 } with { variant "" };
374
375 /* 12.7 Channel Request Description */
376 type enumerated RlcMode {
377 RLC_MODE_ACKNOWLEDGED (0),
378 RLC_MODE_UNACKNOWLEDGED (1)
379 } with { variant "FIELDLENGTH(1)" };
380 type enumerated LlcPduType {
381 LLC_PDU_IS_SACK_OR_ACK (0),
382 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
383 } with { variant "FIELDLENGTH(1)" };
384 type record ChannelReqDescription {
385 uint4_t peak_tput_class,
386 uint2_t priority,
387 RlcMode rlc_mode,
388 LlcPduType llc_pdu_type,
389 uint16_t RlcOctetCount
390 } with { variant "" };
391
392 /* 12.8 Frequency Parameters */
393 type record FreqIndirect {
394 uint6_t maio,
395 uint4_t ma_number,
396 BIT1 change_mark1_present,
397 uint2_t change_mark1 optional,
398 BIT1 change_mark2_present,
399 uint2_t change_mark2 optional
400 } with {
401 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
402 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
403 };
404 type record FreqDirect1 {
405 uint6_t maio,
406 GprsMobileAllication mobile_allocation
407 }
408 type record FreqDirect2 {
409 uint6_t maio,
410 uint6_t hsn,
411 uint4_t ma_freq_len,
412 octetstring m1_freq_list
413 } with {
414 /* FIXME: this can not be expressed in TTCN-3 ?!? */
415 //variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
416 variant (ma_freq_len) "LENGTHTO(m1_freq_list)"
417 };
418 type record FrequencyParameters {
419 uint3_t tsc,
420 BIT2 presence,
421 uint10_t arfcn optional,
422 FreqIndirect indirect optional,
423 FreqDirect1 direct1 optional,
424 FreqDirect2 direct2 optional
425 } with {
426 variant (arfcn) "PRESENCE(presence = '00'B)"
427 variant (indirect) "PRESENCE(presence = '01'B)"
428 variant (direct1) "PRESENCE(presence = '10'B)"
429 variant (direct2) "PRESENCE(presence = '11'B)"
430 };
431
432 /* 12.10 Global TFI */
433 type record GlobalTfi {
434 boolean is_dl_tfi,
435 uint5_t tfi
436 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
437
438 /* 12.10a GPRS Mobile Allocation */
439 type record RflNumberList {
440 uint4_t rfl_number,
441 BIT1 presence,
442 RflNumberList rfl_number_list optional
443 } with {
444 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
445 };
446 type record GprsMobileAllication {
447 uint6_t hsn,
448 BIT1 rfl_number_list_present,
449 RflNumberList rfl_number_list optional,
450 BIT1 ma_present,
451 uint6_t ma_length optional,
452 bitstring ma_bitmap optional
453 /* TODO: ARFCN index list */
454 } with {
455 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
456 variant (ma_length) "PRESENCE(ma_present = '0'B)"
457 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
458 /* FIXME: this can not be expressed in TTCN-3 ?!? */
459 //variant (ma_length) "LENGTHTO(ma_bitmap)+1"
460 variant (ma_length) "LENGTHTO(ma_bitmap)"
461 }
462
463 /* 12.11 Packet Request Reference */
464 type record PacketRequestReference {
465 uint11_t ra_info,
466 uint16_t frame_nr
467 } with { variant "" };
468
469 /* 12.12 Packet Timing Advance */
470 type record PacketTimingAdvance {
471 BIT1 val_present,
472 uint6_t val optional,
473 BIT1 idx_present,
474 uint4_t idx optional,
475 uint3_t timeslot_nr optional
476 } with {
477 variant (val) "PRESENCE(val_present = '1'B)"
478 variant (idx) "PRESENCE(idx_present = '1'B)"
479 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
480 };
481
482 /* 12.13 Power Control Parameters */
483 type record ZeroOneGamma {
484 BIT1 gamma_present,
485 uint5_t gamma
486 } with {
487 variant (gamma) "PRESENCE (gamma_present = '1'B)"
488 };
489 type record length(8) of ZeroOneGamma ZeroOneGammas;
490 type record PowerControlParameters {
491 uint4_t alpha,
492 ZeroOneGammas gamma
493 } with { variant "" };
494
495 /* 12.14 Persistence Level */
496 type record length(4) of uint4_t PersistenceLevels;
497
498 /* 12.20 Page Mode */
499 type enumerated PageMode {
500 PAGE_MODE_NORMAL ('00'B),
501 PAGE_MODE_EXTENDED ('01'B),
502 PAGE_MODE_REORG ('10'B),
503 PAGE_MODE_SAME ('11'B)
504 } with { variant "FIELDLENGTH(2)" };
505
506 /* 12.21 Starting Frame Number */
507 type record StartingFnDesc {
508 BIT1 presence,
509 uint16_t absolute_starting_time optional,
510 uint13_t relative_k optional
511 } with {
512 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
513 variant (relative_k) "PRESENCE(presence = '1'B)"
514 };
515
516} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };