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