blob: 2625a1f70d04c799eb802f3770b23084fcefb568 [file] [log] [blame]
Harald Welte9419c8a2017-07-30 04:07:05 +02001/* Encoding/Decoding routines for GSM System Information messages
2 * according to 3GPP TS 44.018 Version 12.3.0 Release 12 */
3
4/* (C) 2017 by Harald Welte <laforge@gnumonks.org> */
5
6module GSM_RR_Types {
7
8 import from General_Types all;
9 import from Osmocom_Types all;
10 import from GSM_Types all;
11 import from RLCMAC_CSN1_Types all;
12
13 /* Table 10.4.1 of Section 10.4 / 3GPP TS 44.018 */
14 type enumerated RrMessageType {
15 ADDITIONAL_ASSIGNMENT ('00111011'B),
16 IMMEDIATE_ASSIGNMENT ('00111111'B),
17 IMMEDIATE_ASSIGNMENT_EXTENDED ('00111001'B),
18 IMMEDIATE_ASSIGNMENT_REJECT ('00111010'B),
19 IMMEDIATE_PACKET_ASSIGNMENT ('01101001'B),
20
21 CIPHERING_MODE_COMMAND ('00110101'B),
22 CIPHERING_MODE_COMPLETE ('00110010'B),
23
24 CONFIGURATION_CHANGE_COMMAND ('00110000'B),
25 CONFIGURATION_CHANGE_ACK ('00110001'B),
26 CONFIGURATION_CHANGE_REJECT ('00110011'B),
27
28 ASSIGNMENT_COMMAND ('00101110'B),
29 ASSIGNMENT_COMPLETE ('00101001'B),
30 ASSIGNMENT_FAILURE ('00101111'B),
31 HANDOVER_COMMAND ('00101011'B),
32 HANDOVER_COMPLETE ('00101100'B),
33 HANDOVER_FAILURE ('00101000'B),
34 PHYSICAL_INFORMATION ('00101101'B),
35
36 CHANNEL_RELEASE ('00001101'B),
37 PARTIAL_RELEASE ('00001010'B),
38 PARTIAL_RELEASE_COMPLETE ('00001111'B),
39
40 PAGING_REQUEST_TYPE_1 ('00100001'B),
41 PAGING_REQUEST_TYPE_2 ('00100010'B),
42 PAGING_REQUEST_TYPE_3 ('00100100'B),
43 PAGING_RESPONSE ('00100111'B),
44 NOTIFICATION_NCH ('00100000'B),
45 NOTIFICATION_RESPOSNE ('00100110'B),
46
47 SYSTEM_INFORMATION_TYPE_8 ('00011000'B),
48 SYSTEM_INFORMATION_TYPE_1 ('00011001'B),
49 SYSTEM_INFORMATION_TYPE_2 ('00011010'B),
50 SYSTEM_INFORMATION_TYPE_3 ('00011011'B),
51 SYSTEM_INFORMATION_TYPE_4 ('00011100'B),
52 SYSTEM_INFORMATION_TYPE_5 ('00011101'B),
53 SYSTEM_INFORMATION_TYPE_6 ('00011110'B),
54 SYSTEM_INFORMATION_TYPE_7 ('00011111'B),
55 SYSTEM_INFORMATION_TYPE_2bis ('00000010'B),
56 SYSTEM_INFORMATION_TYPE_2ter ('00000011'B),
57 SYSTEM_INFORMATION_TYPE_2quater ('00000111'B),
58 SYSTEM_INFORMATION_TYPE_5bis ('00000101'B),
59 SYSTEM_INFORMATION_TYPE_5ter ('00000110'B),
60 SYSTEM_INFORMATION_TYPE_9 ('00000100'B),
61 SYSTEM_INFORMATION_TYPE_13 ('00000000'B),
62
63 SYSTEM_INFORMATION_TYPE_16 ('00111101'B),
64 SYSTEM_INFORMATION_TYPE_17 ('00111110'B),
65
66 CHANNEL_MODE_MODIFY ('00010000'B),
67 RR_STATUS ('00010010'B),
68 CHANNEL_MODE_MODIFY_ACKNOWLEDGE ('00010111'B),
69 FREQUENCY_REDEFINITION ('00010100'B),
70 MEASUREMENT_REPORT ('00010101'B),
71 CLASSMARK_CHANGE ('00010110'B),
72 CLASSMARK_ENQUIRY ('00010011'B),
73 EXTENDED_MEASUREMENT_REPORT ('00110110'B),
74 EXTENDED_MEASUREMENT_ORDER ('00110111'B),
75 GPRS_SUSPENSION_REQUEST ('00110100'B),
76 //MBMS_ANNOUNCEMENT ('00010110'B), duplicate?
77 //SERVICE_INFORMATION ('00110110'B), duplicate?
78
79 APPLICATION_INFORMATION ('00111000'B),
80
81 SYSTEM_INFORMATION_TYPE_14 ('00000001'B),
82 SYSTEM_INFORMATION_TYPE_15 ('01000011'B),
83 SYSTEM_INFORMATION_TYPE_18 ('01000000'B),
84 SYSTEM_INFORMATION_TYPE_19 ('01000001'B),
85 SYSTEM_INFORMATION_TYPE_20 ('01000010'B),
86 SYSTEM_INFORMATION_TYPE_13alt ('01000100'B),
87 SYSTEM_INFORMATION_TYPE_2n ('01000101'B),
88 SYSTEM_INFORMATION_TYPE_21 ('01000110'B),
89 SYSTEM_INFORMATION_TYPE_22 ('01000111'B),
90 SYSTEM_INFORMATION_TYPE_23 ('01001111'B),
91
92 DTM_ASSIGNMENT_FAILURE ('01001000'B),
93 DTM_REJECT ('01001001'B),
94 DTM_REQUEST ('01001010'B),
95 PACKET_ASSIGNMENT ('01001011'B),
96 DTM_ASSIGNMENT_COMMAND ('01001100'B),
97 DTM_INFORMATION ('01001101'B),
98 PACKET_INFORMATION ('01001110'B),
99
100 UTRAN_CLASSMARK_CHANGE ('01100000'B),
101 CDMA2000_CLASSMARK_CHANGE ('01100010'B),
102 INTERSYS_TO_UTRAN_HO_CMD ('01100011'B),
103 INTERSYS_TO_CDMA2000_HO_CMD ('01100100'B),
104 GERAN_IU_MODE_CLASSMARK_CHG ('01100101'B),
105 INTERSYS_TO_EUTRAN_HO_CMD ('01100110'B)
106 } with { variant "FIELDLENGTH(8)" };
107
108 type octetstring RestOctets with { variant "PADDING(yes), PADDING_PATTERN('00101011'B)" };
109 type hexstring GsmBcdString with { variant "HEXORDER(low)" };
110 type GsmBcdString BcdMccMnc with { variant "FIELDLENGTH(6)" };
111
112 type record L2PseudoLength {
113 uint6_t l2_plen,
114 BIT2 zero_one
115 } with { variant "" };
116
117 template L2PseudoLength t_L2Pseudolength(template uint6_t len) := {
118 l2_plen := len,
119 zero_one := '01'B
120 };
121
122 type record RrHeader {
123 L2PseudoLength l2_plen,
124 uint4_t skip_indicator,
125 uint4_t rr_protocol_discriminator,
126 RrMessageType message_type
127 } with { variant "" };
128
129 template RrHeader t_RrHeader(RrMessageType msg_type, template uint6_t len) := {
130 l2_plen := t_L2Pseudolength(len),
131 skip_indicator := 0,
132 rr_protocol_discriminator := 6,
133 message_type := msg_type
134 };
135
136 type record RrL3Header {
137 uint4_t skip_indicator,
138 uint4_t rr_protocol_discriminator,
139 RrMessageType message_type
140 } with { variant "" };
141
Harald Weltecbc947f2018-02-22 00:26:55 +0100142 template RrL3Header t_RrL3Header(RrMessageType msg_type) := {
143 skip_indicator := 0,
144 rr_protocol_discriminator := 6,
145 message_type := msg_type
146 }
147
Harald Welte9419c8a2017-07-30 04:07:05 +0200148 type record MaioHsn {
149 } with { variant "" };
150
151 /* TS 24.008 10.5.1.1 */
152 type uint16_t CellIdentity;
153
154 /* TS 24.008 10.5.1.2 */
155 type uint4_t CipheringKeySeqNr (0..7);
156
157 /* 24.008 10.5.1.3 */
158 type record LocationAreaIdentification {
159 BcdMccMnc mcc_mnc,
160 uint16_t lac
161 } with { variant "" };
162
163 /* TS 24.008 10.5.1.4 */
164 type enumerated MobileIdentityType {
165 MI_TYPE_NONE (0),
166 MI_TYPE_IMSI,
167 MI_TYPE_IMEI,
168 MI_TYPE_IMEISV,
169 MI_TYPE_TMSI,
170 MI_TYPE_TMGI
171 } with { variant "FIELDLENGTH(3)" };
172
173 type record MobileIdentityBCD {
174 MobileIdentityType mi_type (MI_TYPE_IMSI, MI_TYPE_IMEI, MI_TYPE_IMEISV),
175 boolean odd,
176 hexstring digits
177 } with { variant "FIELDORDER(lsb)" };
178
179 type record MobileIdentityTMSI {
180 BIT4 pad ('1111'B),
181 boolean odd (false),
182 MobileIdentityType mi_type (MI_TYPE_TMSI),
183 GsmTmsi tmsi
184 } with { variant "FIELDORDER(lsb)" };
185
186 type record MobileIdentityNone {
187 BIT4 pad ('1111'B),
188 boolean odd (false),
189 MobileIdentityType mi_type (MI_TYPE_NONE)
190 } with { variant "FIELDORDER(lsb)" };
191
192 type union MobileIdentity {
193 MobileIdentityBCD imsi,
194 MobileIdentityBCD imei,
195 MobileIdentityBCD imeisv,
196 MobileIdentityTMSI tmsi,
197 MobileIdentityNone unused
198 } with { variant "TAG(imsi, mi_type = MI_TYPE_IMSI;
199 imei, mi_type = MI_TYPE_IMEI;
200 imeisv, mi_type = MI_TYPE_IMEISV;
201 tmsi, mi_type = MI_TYPE_TMSI;
202 unused, mi_type = MI_TYPE_NONE)"
203 variant "FIELDORDER(lsb)"
204 };
205
206 type record MobileIdentityLV {
207 uint8_t len,
208 MobileIdentity mi
209 } with { variant (len) "LENGTHTO(mi)" };
210
211 type record MobileIdentityTLV {
212 uint8_t tag,
213 uint8_t len,
214 MobileIdentity mi
215 } with { variant (len) "LENGTHTO(mi)" };
216
217 /* TS 24.008 10.5.1.5 */
218 type record MsClassmark1 {
219 BIT1 spare,
220 uint2_t rev_level,
221 boolean es_ind,
222 boolean a51,
223 uint3_t rf_pwr_cap
224 } with { variant "" };
225
226 /* TS 24.008 10.5.1.6 */
227 type record MsClassmark2 {
228 BIT1 spare,
229 uint2_t rev_level,
230 boolean es_ind,
231 boolean a51,
232 uint3_t rf_pwr_cap,
233 BIT1 spare1,
234 boolean ps_cap,
235 uint2_t ss_screen_ind,
236 boolean sm_cap,
237 boolean vbs,
238 boolean vgcs,
239 boolean fc,
240 boolean cm3,
241 BIT1 spare2,
242 boolean lcsva_cap,
243 boolean ucs2,
244 boolean solsa,
245 boolean cmsp,
246 boolean a53,
247 boolean a52
248 } with { variant "" };
249 type record MsClassmark2LV {
250 uint8_t len,
251 MsClassmark2 cm2
252 } with { variant (len) "LENGTHTO(cm2)" };
253
254
255 /* 44.018 10.5.2.5 */
256 type record ChannelDescription {
257 RslChannelNr chan_nr,
258 uint3_t tsc,
259 boolean h,
260 uint12_t arfcn optional,
261 MaioHsn maio_hsn optional
262 } with { variant (arfcn) "PRESENCE(h = false)"
263 variant (maio_hsn) "PRESENCE(h = true)" };
264
265 type record ChannelDescriptionTV {
266 OCT1 iei,
267 ChannelDescription v
268 } with { variant "" };
269
270 /* 10.5.2.21 */
271 type record MobileAllocation {
272 uint8_t len,
273 bitstring ma
274 } with { variant (len) "LENGTHTO(ma)" };
275
276 /* 10.5.2.25a */
Harald Welte1b9b7702017-07-30 04:19:14 +0200277 type record PktChDesc0Ind {
278 uint6_t maio,
279 BIT1 ma_number_ind,
280 BIT1 change_mark1_valid,
281 BIT2 change_mark1
282 } with { variant "" };
283 type record PktChDesc0 {
284 BIT1 hopping,
285 BIT1 spare ('0'B),
286 uint10_t arfcn optional,
287 PktChDesc0Ind indirect optional
288 } with {
289 variant (arfcn) "PRESENCE(hopping = '0'B)"
290 variant (indirect) "PRESENCE(hopping = '1'B)"
291 };
292 type record PktChDesc1 {
293 uint6_t maio,
294 uint6_t hsn
295 } with { variant "" };
296 type record PacketChannelDescription {
297 uint5_t channel_Type_spare,
298 uint3_t tn,
299 uint3_t tsc,
300 BIT1 presence,
301 PktChDesc0 zero optional,
302 PktChDesc1 one optional
303 } with {
304 variant (zero) "PRESENCE(presence = '0'B)"
305 variant (one) "PRESENCE(presence = '1'B)"
306 };
Harald Welte9419c8a2017-07-30 04:07:05 +0200307
308 /* 10.5.2.25b */
309 type record DedicatedModeOrTbf {
310 BIT1 spare,
311 boolean tma,
312 boolean downlink,
313 boolean tbf
314 } with { variant "" };
315
316 /* 10.5.2.26 */
317 type enumerated PageMode {
318 PAGE_MODE_NORMAL,
319 PAGE_MODE_EXTENDED,
320 PAGE_MODE_REORGANIZATION,
321 PAGE_MODE_SAME_AS_BEFORE
322 } with { variant "FIELDLENGTH(4)" };
323
324 /* 10.5.2.30 */
325 type record RequestReference {
326 bitstring ra length(8),
327 uint5_t t1p,
328 uint6_t t3,
329 uint5_t t2
330 } with { variant "" };
331
332 template RequestReference t_RequestReference(template bitstring ra, template uint5_t t1p, template uint6_t t3, template uint5_t t2) := {
333 ra := ra,
334 t1p := t1p,
335 t3 := t3,
336 t2 := t2
337 }
338
339 /* compute the expected request reference for given RA + FN */
340 function f_compute_ReqRef(uint8_t ra, GsmFrameNumber fn) return RequestReference {
341 var RequestReference req_ref := { ra := int2bit(ra, 8) };
342 req_ref.t1p := (fn / 1326) mod 32;
343 req_ref.t2 := fn mod 26;
344 req_ref.t3 := fn mod 51;
345 return req_ref
346 }
347
348 /* 10.5.2.40 */
349 type integer TimingAdvance (0..219);
350
351 /* 10.5.2.43 */
352 type uint8_t WaitIndication;
353
354 /* 10.5.2.76 */
355 type record FeatureIndicator {
356 BIT2 spare,
357 boolean cs_ir,
358 boolean ps_ir
359 } with { variant "" };
360
361 /* 24.008 10.5.5.6 */
362 type record DrxParameter {
363 uint8_t split_pg_cycle_code,
364 uint4_t drx_cycle_len_coeff,
365 boolean split_on_ccch,
366 uint3_t non_drx_timer
367 } with { variant "" };
368
369 /* 24.008 10.5.5.15 */
370 type record RoutingAreaIdentification {
371 LocationAreaIdentification lai,
372 uint8_t rac
373 } with { variant "" };
374
375 /* 44.018 10.5.2.16 */
376 type record IaRestOctHL {
377 uint6_t freq_par_len,
378 BIT2 padding ('00'B) optional,
379 uint6_t maio optional,
380 octetstring mobile_allocation optional
381 } with {
382 variant (freq_par_len) "LENGTHTO(mobile_allocation,maio,padding)"
383/*
384 variant (padding) "PRESENCE(freq_par_len != 0)"
385 variant (maio) "PRESENCE(freq_par_len != 0)"
386 variant (mobile_allocation) "PRESENCE(freq_par_len != 0)"
387*/
388 };
389 type record IaRestOctHH {
390 BIT2 presence,
391 PacketUlAssign ul optional,
392 PacketDlAssign dl optional
393 } with {
394 variant (ul) "PRESENCE(presence = '00'B)"
395 variant (dl) "PRESENCE(presence = '01'B)"
396 };
397 type record PacketUlAssignDyn {
398 uint5_t tfi_assignment,
399 BIT1 polling,
400 BIT1 spare ('0'B),
401 uint3_t usf,
402 BIT1 usf_granularity,
403 BIT1 p0_present,
404 uint4_t p0 optional,
405 BIT1 pr_mode optional,
406 ChCodingCommand ch_coding_cmd,
407 BIT1 tlli_block_chan_coding,
408 BIT1 alpha_present,
409 uint4_t alpha optional,
410 uint5_t gamma,
411 BIT1 ta_index_present,
412 uint4_t ta_index optional,
413 BIT1 tbf_starting_time_present,
414 uint16_t tbf_starting_time optional
415 } with {
416 variant (p0) "PRESENCE(p0_present = '1'B)"
417 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
418 variant (alpha) "PRESENCE(alpha_present = '1'B)"
419 variant (ta_index) "PRESENCE(ta_index_present = '1'B)"
420 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
421 };
422 type record PacketUlAssignSgl {
423 BIT1 alpha_present,
424 uint4_t alpha optional,
425 uint5_t gamma,
426 BIT2 padding ('01'B),
427 uint16_t tbf_starting_time
428 /* TODO: P0 / PR_MODE */
429 } with {
430 variant (alpha) "PRESENCE(alpha_present = '1'B)"
431 };
432 type record PacketUlAssign {
433 BIT1 presence,
434 PacketUlAssignDyn dynamic optional,
435 PacketUlAssignSgl single optional
436 /* TODO: Estended RA, PFI */
437 } with {
438 variant (dynamic) "PRESENCE(presence = '1'B)"
439 variant (single) "PRESENCE(presence = '0'B)"
440 };
441 type record PacketDlAssG1 {
442 uint5_t tfi_assignment,
443 BIT1 rlc_mode,
444 BIT1 alpha_present,
445 uint4_t alpha optional,
446 uint5_t gamma,
447 BIT1 polling,
448 BIT1 ta_valid
449 } with { variant "" };
450 type record PacketDlAssign {
451 GprsTlli tlli,
452 BIT1 group1_present,
453 PacketDlAssG1 group1 optional,
454 BIT1 ta_index_present,
455 uint4_t ta_index optional,
456 BIT1 tbf_starting_time_present,
457 uint16_t tbf_starting_time optional,
458 BIT1 p0_present,
459 uint4_t p0 optional,
460 BIT1 pr_mode optional
461 /* TODO: EGPRS window size, etc. */
462 } with {
463 variant (group1) "PRESENCE(group1_present = '1'B)"
464 variant (ta_index) "PRESENCE(ta_index_present = '1'B)"
465 variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
466 variant (p0) "PRESENCE(p0_present = '1'B)"
467 variant (pr_mode) "PRESENCE(p0_present = '1'B)"
468 };
469 type record IaRestOctLL {
470 BIT1 compressed_irat_ho_info_ind
471 } with { variant "" };
472 type octetstring EgprsUlAss; /* TODO */
473 type octetstring MblkDlAss; /* TODO */
474 type record IaRestOctLH {
475 BIT2 presence,
476 EgprsUlAss egprs_ul optional,
477 MblkDlAss multiblock_dl_ass optional
478 } with {
479 variant (egprs_ul) "PRESENCE(presence = '00'B)"
480 variant (multiblock_dl_ass) "PRESENCE(presence = '01'B)"
481 };
482 type record IaRestOctets {
483 BIT2 presence,
484 IaRestOctLL ll optional,
485 IaRestOctLH lh optional,
486 IaRestOctHL hl optional,
487 IaRestOctHH hh optional
488 } with {
489 variant (ll) "PRESENCE(presence = '00'B)"
490 variant (lh) "PRESENCE(presence = '01'B)"
491 variant (hl) "PRESENCE(presence = '10'B)"
492 variant (hh) "PRESENCE(presence = '11'B)"
493 };
494
Harald Weltecbc947f2018-02-22 00:26:55 +0100495 type record MeasurementResults {
496 BIT1 ba_used,
497 BIT1 dtx_used,
498 uint6_t rxlev_full_srv_cell,
499 BIT1 threeg_ba_used,
500 BIT1 meas_valid,
501 uint6_t rxlev_sub_srv_cell,
502 BIT1 si23_ba_used,
503 uint3_t rxqual_full_srv_cell,
504 uint3_t rxqual_sub_srv_cell,
505 uint3_t no_ncell_m,
506 NcellReports ncell_reports optional
507 } with { variant (no_ncell_m) "LENGTHTO(ncell_reports)"
508 variant (no_ncell_m) "UNIT(elements)"
509 variant "PADDING(yes)"
510 variant "FIELDLENGTH(16)"
511 };
512
513 type record NcellReport {
514 uint6_t rxlev,
515 uint5_t bcch_freq,
516 uint6_t bsic
517 } with { variant ""};
518 type record of NcellReport NcellReports;
519
Harald Welte9419c8a2017-07-30 04:07:05 +0200520
521 /* 9.1.18 */
522 type record ImmediateAssignment {
523 DedicatedModeOrTbf ded_or_tbf,
524 PageMode page_mode,
525 ChannelDescription chan_desc optional,
526 PacketChannelDescription pkt_chan_desc optional,
527 RequestReference req_ref,
528 TimingAdvance timing_advance,
529 MobileAllocation mobile_allocation,
530 /* TODO: starting time TLV */
Harald Weltecbc947f2018-02-22 00:26:55 +0100531 IaRestOctets rest_octets optional
Harald Welte9419c8a2017-07-30 04:07:05 +0200532 } with { variant (chan_desc) "PRESENCE(ded_or_tbf.tbf = false)"
533 variant (pkt_chan_desc) "PRESENCE(ded_or_tbf.tbf = true)" };
534
535 /* 9.1.20 */
536 type record ReqRefWaitInd {
537 RequestReference req_ref,
538 WaitIndication wait_ind
539 } with { variant "" };
540 type record length(4) of ReqRefWaitInd ReqRefWaitInd4;
541 type record ImmediateAssignmentReject {
542 FeatureIndicator feature_ind,
543 PageMode page_mode,
544 ReqRefWaitInd4 payload
545 } with { variant "" };
546
Harald Weltecbc947f2018-02-22 00:26:55 +0100547 /* 9.1.21 */
548 type record MeasurementReport {
549 MeasurementResults meas_res
550 } with { variant "" };
551
Harald Welte9419c8a2017-07-30 04:07:05 +0200552 /* 9.1.22 */
553 type record PagingRequestType1 {
554 ChannelNeeded12 chan_needed,
555 PageMode page_mode,
556 MobileIdentityLV mi1,
557 MobileIdentityTLV mi2 optional,
558 RestOctets rest_octets
559 } with { variant "TAG(mi2, tag = 23)" };
560
561 /* 9.1.23 */
562 type record PagingRequestType2 {
563 ChannelNeeded12 chan_needed,
564 PageMode page_mode,
565 GsmTmsi mi1,
566 GsmTmsi mi2,
567 MobileIdentityTLV mi3 optional,
568 RestOctets rest_octets
569 } with { variant "TAG(mi3, tag = 23)" };
570
571 /* 9.1.24 */
572 type record length(4) of GsmTmsi GsmTmsi4;
573 type record PagingRequestType3 {
574 ChannelNeeded12 chan_needed,
575 PageMode page_mode,
576 GsmTmsi4 mi,
577 RestOctets rest_octets
578 } with { variant "" };
579
580
581 type union RrUnion {
582/*
583 SystemInformationType1 si1,
584 SystemInformationType2 si2,
585 SystemInformationType2bis si2bis,
586 SystemInformationType2ter si2ter,
587 SystemInformationType3 si3,
588 SystemInformationType4 si4,
589 SystemInformationType5 si5,
590 SystemInformationType5bis si5bis,
591 SystemInformationType5ter si5ter,
592 SystemInformationType6 si6,
593*/
594 ImmediateAssignment imm_ass,
595 ImmediateAssignmentReject imm_ass_rej,
596 PagingRequestType1 pag_req_1,
597 PagingRequestType2 pag_req_2,
598 PagingRequestType3 pag_req_3,
599 octetstring other
600 } with { variant "" };
601
602 /* Special RR Message on BCCH / CCCH Dowlink */
603
604 type record GsmRrMessage {
605 RrHeader header,
606 RrUnion payload
607 } with { variant (payload) "CROSSTAG(
608/*
609 si1, header.message_type = SYSTEM_INFORMATION_TYPE_1;
610 si2, header.message_type = SYSTEM_INFORMATION_TYPE_2;
611 si2bis, header.message_type = SYSTEM_INFORMATION_TYPE_2bis;
612 si2ter, header.message_type = SYSTEM_INFORMATION_TYPE_2ter;
613 si3, header.message_type = SYSTEM_INFORMATION_TYPE_3;
614 si4, header.message_type = SYSTEM_INFORMATION_TYPE_4;
615 si5, header.message_type = SYSTEM_INFORMATION_TYPE_5;
616 si5bis, header.message_type = SYSTEM_INFORMATION_TYPE_5bis;
617 si5ter, header.message_type = SYSTEM_INFORMATION_TYPE_5ter;
618 si6, header.message_type = SYSTEM_INFORMATION_TYPE_6;
619*/
620 imm_ass, header.message_type = IMMEDIATE_ASSIGNMENT;
621 imm_ass_rej, header.message_type = IMMEDIATE_ASSIGNMENT_REJECT;
622 pag_req_1, header.message_type = PAGING_REQUEST_TYPE_1;
623 pag_req_2, header.message_type = PAGING_REQUEST_TYPE_2;
624 pag_req_3, header.message_type = PAGING_REQUEST_TYPE_3;
625 other, OTHERWISE;
626 )" };
627
628 external function enc_GsmRrMessage(in GsmRrMessage msg) return octetstring
629 with { extension "prototype(convert) encode(RAW)" };
630 external function dec_GsmRrMessage(in octetstring stream) return GsmRrMessage
631 with { extension "prototype(convert) decode(RAW)" };
632
633 /* Normal L3 Message on Dedicated Channel */
634
635 /* 9.1.25 Paging Response */
636 type record PagingResponse {
637 uint4_t spare_half_octet,
638 CipheringKeySeqNr cksn,
639 MsClassmark2LV cm2,
640 MobileIdentityLV mi,
641 uint8_t addl_upd_par optional
642 } with { variant "" };
643
644 type union RrL3Union {
645 PagingResponse paging_response,
Harald Weltecbc947f2018-02-22 00:26:55 +0100646 MeasurementReport meas_rep,
Harald Welte9419c8a2017-07-30 04:07:05 +0200647 octetstring other
648 };
649
650 type record GsmRrL3Message {
651 RrL3Header header,
652 RrL3Union payload
653 } with { variant (payload) "CROSSTAG(
654 paging_response, header.message_type = PAGING_RESPONSE;
Harald Weltecbc947f2018-02-22 00:26:55 +0100655 meas_rep, header.message_type = MEASUREMENT_REPORT;
Harald Welte9419c8a2017-07-30 04:07:05 +0200656 other, OTHERWISE;
657 )" }
658
Harald Weltecbc947f2018-02-22 00:26:55 +0100659 external function enc_GsmRrL3Message(in GsmRrL3Message msg) return octetstring
660 with { extension "prototype(convert) encode(RAW)" };
661 external function dec_GsmRrL3Message(in octetstring stream) return GsmRrL3Message
662 with { extension "prototype(convert) decode(RAW)" };
663
664
665 template GsmRrMessage ts_IMM_ASS(uint8_t ra, GsmFrameNumber fn, TimingAdvance ta,
666 ChannelDescription ch_desc, MobileAllocation ma) := {
667 header := t_RrHeader(IMMEDIATE_ASSIGNMENT, 0),
668 payload := {
669 imm_ass := {
670 ded_or_tbf := {
671 spare := '0'B,
672 tma := false,
673 downlink := false,
674 tbf := false
675 },
676 page_mode := PAGE_MODE_NORMAL,
677 chan_desc := ch_desc,
678 pkt_chan_desc := omit,
679 req_ref := f_compute_ReqRef(ra, fn),
680 timing_advance := ta,
681 mobile_allocation := ma,
682 rest_octets := omit
683 }
684 }
685 };
686
687 template (value) GsmRrL3Message ts_MEAS_REP(boolean valid, uint6_t rxl_f, uint6_t rxl_s,
688 uint3_t rxq_f, uint3_t rxq_s,
689 template (omit) NcellReports reps) := {
690 header := t_RrL3Header(MEASUREMENT_REPORT),
691 payload := {
692 meas_rep := {
693 meas_res := {
694 ba_used := '0'B,
695 dtx_used := '0'B,
696 rxlev_full_srv_cell := rxl_f,
697 threeg_ba_used := '0'B,
698 meas_valid := bool2bit(valid),
699 rxlev_sub_srv_cell := rxl_s,
700 si23_ba_used := '0'B,
701 rxqual_full_srv_cell := rxq_f,
702 rxqual_sub_srv_cell := rxq_s,
703 no_ncell_m := 0,
704 ncell_reports := reps
705 }
706 }
707 }
708 };
709
710
711
Harald Welte9419c8a2017-07-30 04:07:05 +0200712} with { encode "RAW" ; variant "FIELDORDER(msb)" }