blob: b5cc5727ccaf40af59412c587f9226d23d6381c7 [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,
272 PacketDlDummy dl_dummy
273 } with { variant "" };
274
275 type record RlcmacDlCtrlMsg {
276 RlcmacDlCtrlMsgType msg_type,
277 RlcmacDlCtrlUnion u
278 } with {
279 variant (u) "CROSSTAG(dl_assignment, msg_type = PACKET_DL_ASSIGNMENT;
280 ul_assignment, msg_type = PACKET_UL_ASSIGNMENT;
281 paging, msg_type = PACKET_PAGING_REQUEST;
282 ul_ack_nack, msg_type = PACKET_UL_ACK_NACK;
283 dl_dummy, msg_type = PACKET_DL_DUMMY_CTRL
284 )"
285 };
286
287 external function enc_RlcmacDlCtrlMsg(in RlcmacDlCtrlMsg si) return octetstring
288 with { extension "prototype(convert) encode(RAW)" };
289 external function dec_RlcmacDlCtrlMsg(in octetstring stream) return RlcmacDlCtrlMsg
290 with { extension "prototype(convert) decode(RAW)" };
291
292
293 /* 11.2.6 Packet Downlikn Ack/Nack */
294 type record ILevel {
295 BIT1 presence,
296 uint4_t i_level optional
297 } with { variant (i_level) "PRESENCE(presence = '1'B)" };
298 type record length(8) of ILevel ILevels;
299 type record ChannelQualityReport {
300 uint6_t c_value,
301 uint3_t rxqual,
302 uint6_t sign_var,
303 ILevels i_levels
304 } with { variant "" };
305 type record PacketDlAckNack {
306 uint5_t dl_tfi,
307 AckNackDescription ack_nack_desc,
308 BIT1 chreq_desc_presence,
309 ChannelReqDescription chreq_desc optional,
310 ChannelQualityReport ch_qual_rep
311 } with { variant "" };
312
313 /* 11.2.2 Packet Control Acknowledgement */
314 type enumerated CtrlAck {
315 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN_NEW_TFI ('00'B),
316 MS_RCVD_RBSN1_NO_RBSN0 ('01'B),
317 MS_RCVD_RBSN0_NO_RBSN1 ('10'B),
318 MS_RCVD_TWO_RLC_SAME_RTI_DIFF_RBSN ('11'B)
319 } with { variant "FIELDLENGTH(2)" };
320 type record PacketCtrlAck {
321 GprsTlli tlli,
322 CtrlAck ctrl_ack
323 /* TODO: Rel5 additions */
324 } with { variant "" };
325
326 /* 1.2.8b Packet Uplink Dummy Control Block */
327 type record PacketUlDummy {
328 GprsTlli tlli
329 } with { variant "" };
330
331 /* 11.2.0.2 */
332 type union RlcmacUlCtrlUnion {
333 PacketCtrlAck ctrl_ack,
334 PacketDlAckNack dl_ack_nack,
335 PacketUlDummy ul_dummy
336 } with { variant "" };
337
338 type record RlcmacUlCtrlMsg {
339 RlcmacUlCtrlMsgType msg_type,
340 RlcmacUlCtrlUnion u
341 } with {
342 variant (u) "CROSSTAG(ctrl_ack, msg_type = PACKET_CONTROL_ACK;
343 dl_ack_nack, msg_type = PACKET_DL_ACK_NACK;
344 ul_dummy, msg_type = PACKET_UL_DUMMY_CTRL
345 )"
346 };
347
348 external function enc_RlcmacUlCtrlMsg(in RlcmacUlCtrlMsg si) return octetstring
349 with { extension "prototype(convert) encode(RAW)" };
350 external function dec_RlcmacUlCtrlMsg(in octetstring stream) return RlcmacUlCtrlMsg
351 with { extension "prototype(convert) decode(RAW)" };
352
353 type bitstring ReceivedBlockBitmap length(64) with { variant "BYTEORDER(last)" };
354
355 /* 12.3 Ack/Nack Description */
356 type record AckNackDescription {
357 BIT1 final_ack,
358 uint7_t starting_seq_nr,
359 ReceivedBlockBitmap receive_block_bitmap
360 } with { variant "" };
361
362 /* 12.7 Channel Request Description */
363 type enumerated RlcMode {
364 RLC_MODE_ACKNOWLEDGED (0),
365 RLC_MODE_UNACKNOWLEDGED (1)
366 } with { variant "FIELDLENGTH(1)" };
367 type enumerated LlcPduType {
368 LLC_PDU_IS_SACK_OR_ACK (0),
369 LLC_PDU_IS_NOT_SACK_OR_ACK (1)
370 } with { variant "FIELDLENGTH(1)" };
371 type record ChannelReqDescription {
372 uint4_t peak_tput_class,
373 uint2_t priority,
374 RlcMode rlc_mode,
375 LlcPduType llc_pdu_type,
376 uint16_t RlcOctetCount
377 } with { variant "" };
378
379 /* 12.8 Frequency Parameters */
380 type record FreqIndirect {
381 uint6_t maio,
382 uint4_t ma_number,
383 BIT1 change_mark1_present,
384 uint2_t change_mark1 optional,
385 BIT1 change_mark2_present,
386 uint2_t change_mark2 optional
387 } with {
388 variant (change_mark1) "PRESENCE(change_mark1_present = '1'B)"
389 variant (change_mark2) "PRESENCE(change_mark2_present = '1'B)"
390 };
391 type record FreqDirect1 {
392 uint6_t maio,
393 GprsMobileAllication mobile_allocation
394 }
395 type record FreqDirect2 {
396 uint6_t maio,
397 uint6_t hsn,
398 uint4_t ma_freq_len,
399 octetstring m1_freq_list
400 } with {
401 /* FIXME: this can not be expressed in TTCN-3 ?!? */
402 //variant (ma_freq_len) "LENGTHTO(m1_freq_list)+3"
403 variant (ma_freq_len) "LENGTHTO(m1_freq_list)"
404 };
405 type record FrequencyParameters {
406 uint3_t tsc,
407 BIT2 presence,
408 uint10_t arfcn optional,
409 FreqIndirect indirect optional,
410 FreqDirect1 direct1 optional,
411 FreqDirect2 direct2 optional
412 } with {
413 variant (arfcn) "PRESENCE(presence = '00'B)"
414 variant (indirect) "PRESENCE(presence = '01'B)"
415 variant (direct1) "PRESENCE(presence = '10'B)"
416 variant (direct2) "PRESENCE(presence = '11'B)"
417 };
418
419 /* 12.10 Global TFI */
420 type record GlobalTfi {
421 boolean is_dl_tfi,
422 uint5_t tfi
423 } with { variant (is_dl_tfi) "FIELDLENGTH(1)" };
424
425 /* 12.10a GPRS Mobile Allocation */
426 type record RflNumberList {
427 uint4_t rfl_number,
428 BIT1 presence,
429 RflNumberList rfl_number_list optional
430 } with {
431 variant (rfl_number_list) "PRESENCE(presence = '1'B)"
432 };
433 type record GprsMobileAllication {
434 uint6_t hsn,
435 BIT1 rfl_number_list_present,
436 RflNumberList rfl_number_list optional,
437 BIT1 ma_present,
438 uint6_t ma_length optional,
439 bitstring ma_bitmap optional
440 /* TODO: ARFCN index list */
441 } with {
442 variant (rfl_number_list) "PRESENCE(rfl_number_list_present = '1'B)"
443 variant (ma_length) "PRESENCE(ma_present = '0'B)"
444 variant (ma_bitmap) "PRESENCE(ma_present = '0'B)"
445 /* FIXME: this can not be expressed in TTCN-3 ?!? */
446 //variant (ma_length) "LENGTHTO(ma_bitmap)+1"
447 variant (ma_length) "LENGTHTO(ma_bitmap)"
448 }
449
450 /* 12.11 Packet Request Reference */
451 type record PacketRequestReference {
452 uint11_t ra_info,
453 uint16_t frame_nr
454 } with { variant "" };
455
456 /* 12.12 Packet Timing Advance */
457 type record PacketTimingAdvance {
458 BIT1 val_present,
459 uint6_t val optional,
460 BIT1 idx_present,
461 uint4_t idx optional,
462 uint3_t timeslot_nr optional
463 } with {
464 variant (val) "PRESENCE(val_present = '1'B)"
465 variant (idx) "PRESENCE(idx_present = '1'B)"
466 variant (timeslot_nr) "PRESENCE(idx_present = '1'B)"
467 };
468
469 /* 12.13 Power Control Parameters */
470 type record ZeroOneGamma {
471 BIT1 gamma_present,
472 uint5_t gamma
473 } with {
474 variant (gamma) "PRESENCE (gamma_present = '1'B)"
475 };
476 type record length(8) of ZeroOneGamma ZeroOneGammas;
477 type record PowerControlParameters {
478 uint4_t alpha,
479 ZeroOneGammas gamma
480 } with { variant "" };
481
482 /* 12.14 Persistence Level */
483 type record length(4) of uint4_t PersistenceLevels;
484
485 /* 12.20 Page Mode */
486 type enumerated PageMode {
487 PAGE_MODE_NORMAL ('00'B),
488 PAGE_MODE_EXTENDED ('01'B),
489 PAGE_MODE_REORG ('10'B),
490 PAGE_MODE_SAME ('11'B)
491 } with { variant "FIELDLENGTH(2)" };
492
493 /* 12.21 Starting Frame Number */
494 type record StartingFnDesc {
495 BIT1 presence,
496 uint16_t absolute_starting_time optional,
497 uint13_t relative_k optional
498 } with {
499 variant (absolute_starting_time) "PRESENCE(presence = '0'B)"
500 variant (relative_k) "PRESENCE(presence = '1'B)"
501 };
502
503} with { encode "RAW"; variant "FIELDORDER(msb)" variant "BYTEORDER(last)" };