library: move IA/IAR Rest Octets to GSM_RestOctets.ttcn
Change-Id: Icd96fc461e37d1346950a4fa158e0421bd7330c5
diff --git a/library/GSM_RestOctets.ttcn b/library/GSM_RestOctets.ttcn
index 94dce04..2be96a4 100644
--- a/library/GSM_RestOctets.ttcn
+++ b/library/GSM_RestOctets.ttcn
@@ -16,6 +16,270 @@
import from General_Types all;
import from Osmocom_Types all;
import from RLCMAC_CSN1_Types all;
+import from GSM_Types all;
+
+/* 10.5.2.16 IA (Immediate Assignment) Rest Octets */
+type record IaRestOctets {
+ BIT2 presence,
+ IaRestOctLL ll optional,
+ IaRestOctLH lh optional,
+ IaRestOctHL hl optional,
+ IaRestOctHH hh optional
+} with {
+ variant (presence) "CSN.1 L/H"
+ variant (ll) "PRESENCE(presence = '00'B)"
+ variant (lh) "PRESENCE(presence = '01'B)"
+ variant (hl) "PRESENCE(presence = '10'B)"
+ variant (hh) "PRESENCE(presence = '11'B)"
+
+ /* The TITAN's RAW encoder generates an octet-aligned octetstring,
+ * so we should make sure that unused bits contain proper padding. */
+ variant "PADDING(yes), PADDING_PATTERN('00101011'B)"
+};
+
+type record IaRestOctLL {
+ BIT1 compressed_irat_ho_info_ind
+} with {
+ variant (compressed_irat_ho_info_ind) "CSN.1 L/H"
+};
+
+type record IaRestOctLH {
+ BIT2 presence,
+ EgprsUlAss egprs_ul optional,
+ octetstring multiblock_dl_ass optional /* TODO */
+} with {
+ variant (egprs_ul) "PRESENCE(presence = '00'B)"
+ variant (multiblock_dl_ass) "PRESENCE(presence = '01'B)"
+};
+
+/* EGPRS Packet Uplink Assignment */
+type record EgprsUlAss {
+ BIT5 ext_ra,
+ BIT1 ats_present,
+ AccessTechnologiesRequestRepetition ats optional,
+ BIT1 presence,
+ EgprsUlAssignDyn dynamic optional,
+ EgprsUlAssignMultiblock multiblock optional
+} with {
+ variant (ats) "PRESENCE(ats_present = '1'B)"
+ variant (dynamic) "PRESENCE(presence = '1'B)"
+ variant (multiblock) "PRESENCE(presence = '0'B)"
+ /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562488 */
+ variant (ext_ra) "BYTEORDER(last)" // FIXME: should be first
+};
+
+type record EgprsUlAssignDyn {
+ uint5_t tfi_assignment,
+ BIT1 polling,
+ BIT1 spare ('0'B),
+ uint3_t usf,
+ BIT1 usf_granularity,
+ BIT1 p0_present,
+ uint4_t p0 optional,
+ BIT1 pr_mode optional,
+ EgprsChCodingCommand egprs_ch_coding_cmd,
+ BIT1 tlli_block_chan_coding,
+ BIT1 bep_period2_present,
+ BIT4 bep_period2 optional,
+ BIT1 resegment,
+ EgprsWindowSize egprs_window_size,
+ BIT1 alpha_present,
+ uint4_t alpha optional,
+ uint5_t gamma,
+ BIT1 ta_index_present,
+ uint4_t ta_index optional,
+ BIT1 tbf_starting_time_present,
+ TbfStartingTime tbf_starting_time optional
+ /* TODO: Additions for Rel-7 */
+} with {
+ variant (p0) "PRESENCE(p0_present = '1'B)"
+ variant (pr_mode) "PRESENCE(p0_present = '1'B)"
+ variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)"
+ variant (alpha) "PRESENCE(alpha_present = '1'B)"
+ variant (ta_index) "PRESENCE(ta_index_present = '1'B)"
+ variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
+};
+
+type record EgprsUlAssignMultiblock {
+ BIT1 alpha_present,
+ uint4_t alpha optional,
+ uint5_t gamma,
+ TbfStartingTime tbf_starting_time,
+ BIT2 nr_radio_blocks_allocated,
+ BIT1 p0_present,
+ uint4_t p0 optional,
+ BIT1 spare ('0'B) optional,
+ BIT1 pr_mode optional
+ /* TDO: Additions for Rel-6 */
+} with {
+ variant (alpha) "PRESENCE(alpha_present = '1'B)"
+ variant (p0) "PRESENCE(p0_present = '1'B)"
+ variant (spare) "PRESENCE(p0_present = '1'B)"
+ variant (pr_mode) "PRESENCE(p0_present = '1'B)"
+};
+
+type record IaRestOctHL {
+ uint6_t freq_par_len,
+ BIT2 padding ('00'B) optional,
+ uint6_t maio optional,
+ octetstring mobile_allocation optional
+} with {
+ variant (freq_par_len) "LENGTHTO(mobile_allocation,maio,padding)"
+/*
+ variant (padding) "PRESENCE(freq_par_len != 0)"
+ variant (maio) "PRESENCE(freq_par_len != 0)"
+ variant (mobile_allocation) "PRESENCE(freq_par_len != 0)"
+*/
+};
+
+type record IaRestOctHH {
+ /* Packet Assignment discriminator:
+ * Packet Uplink / Downlink Assignment (0)
+ * Second Part Packet Assignment (1) */
+ BIT1 pa_disc,
+ PacketAssignUnion pa
+} with {
+ variant (pa) "CROSSTAG(spa, pa_disc = '1'B; uldl, pa_disc = '0'B)"
+};
+
+type union PacketAssignUnion {
+ SecondPartAssign spa,
+ PacketUlDlAssign uldl
+};
+
+type record SecondPartAssign {
+ BIT1 r99, /* L / H */
+ BIT1 presence optional,
+ BIT5 ext_ra optional
+} with {
+ variant (r99) "CSN.1 L/H"
+ variant (presence) "PRESENCE(r99 = '1'B)" /* H */
+ variant (ext_ra) "PRESENCE(presence = '1'B)"
+ /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562488 */
+ variant (ext_ra) "BYTEORDER(last)" // FIXME: should be first
+};
+
+type record PacketUlDlAssign {
+ BIT1 ass_disc,
+ PacketUlDlAssignUnion ass
+} with {
+ variant (ass) "CROSSTAG(dl, ass_disc = '1'B; ul, ass_disc = '0'B)"
+};
+
+type union PacketUlDlAssignUnion {
+ PacketUlAssign ul,
+ PacketDlAssign dl
+};
+
+type record PacketUlAssign {
+ BIT1 presence,
+ PacketUlAssignDyn dynamic optional,
+ PacketUlAssignSgl single optional
+ /* TODO: Estended RA, PFI */
+} with {
+ variant (dynamic) "PRESENCE(presence = '1'B)"
+ variant (single) "PRESENCE(presence = '0'B)"
+};
+
+type record PacketUlAssignDyn {
+ uint5_t tfi_assignment,
+ BIT1 polling,
+ BIT1 spare ('0'B),
+ uint3_t usf,
+ BIT1 usf_granularity,
+ BIT1 p0_present,
+ uint4_t p0 optional,
+ BIT1 pr_mode optional,
+ ChCodingCommand ch_coding_cmd,
+ BIT1 tlli_block_chan_coding,
+ BIT1 alpha_present,
+ uint4_t alpha optional,
+ uint5_t gamma,
+ BIT1 ta_index_present,
+ uint4_t ta_index optional,
+ BIT1 tbf_starting_time_present,
+ TbfStartingTime tbf_starting_time optional
+} with {
+ variant (p0) "PRESENCE(p0_present = '1'B)"
+ variant (pr_mode) "PRESENCE(p0_present = '1'B)"
+ variant (alpha) "PRESENCE(alpha_present = '1'B)"
+ variant (ta_index) "PRESENCE(ta_index_present = '1'B)"
+ variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
+};
+
+type record PacketUlAssignSgl {
+ BIT1 alpha_present,
+ uint4_t alpha optional,
+ uint5_t gamma,
+ BIT2 padding ('01'B),
+ TbfStartingTime tbf_starting_time
+ /* TODO: P0 / PR_MODE */
+} with {
+ variant (alpha) "PRESENCE(alpha_present = '1'B)"
+};
+
+type record PacketDlAssign {
+ GprsTlli tlli,
+ BIT1 group1_present,
+ PacketDlAssG1 group1 optional,
+ BIT1 ta_index_present,
+ uint4_t ta_index optional,
+ BIT1 tbf_starting_time_present,
+ TbfStartingTime tbf_starting_time optional,
+ BIT1 p0_present,
+ uint4_t p0 optional,
+ BIT1 pr_mode optional
+ /* TODO: EGPRS window size, etc. */
+} with {
+ variant (group1) "PRESENCE(group1_present = '1'B)"
+ variant (ta_index) "PRESENCE(ta_index_present = '1'B)"
+ variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)"
+ variant (p0) "PRESENCE(p0_present = '1'B)"
+ variant (pr_mode) "PRESENCE(p0_present = '1'B)"
+};
+
+type record PacketDlAssG1 {
+ uint5_t tfi_assignment,
+ BIT1 rlc_mode,
+ BIT1 alpha_present,
+ uint4_t alpha optional,
+ uint5_t gamma,
+ BIT1 polling,
+ BIT1 ta_valid
+} with { variant "" };
+
+type record TbfStartingTime {
+ uint5_t t1,
+ uint6_t t3,
+ uint5_t t2
+};
+
+/* 10.5.2.17 IAR (Immediate Assignment Reject) Rest Octets */
+type record IARRestOctets {
+ ExtRAList ext_ra_list,
+ BIT1 rel13_ind, // L/H
+ uint3_t rcc optional
+ /* Addition in Rel-15: PEO IMM Cell Group Details struct */
+} with {
+ variant (rel13_ind) "CSN.1 L/H"
+ variant (rcc) "PRESENCE(rel13_ind = '1'B)"
+
+ /* The TITAN's RAW encoder generates an octet-aligned octetstring,
+ * so we should make sure that unused bits contain proper padding. */
+ variant "PADDING(yes), PADDING_PATTERN('00101011'B)"
+};
+
+/* Optional extended RA: 0 | 1 < Extended RA 1 : bit (5) > */
+type record length(4) of ExtRAOpt ExtRAList;
+type record ExtRAOpt {
+ BIT1 presence, // L/H
+ BIT5 ext_ra optional
+} with {
+ variant (presence) "CSN.1 L/H"
+ variant (ext_ra) "PRESENCE(presence = '1'B)"
+ /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562488 */
+ variant (ext_ra) "BYTEORDER(last)"
+};
/* 10.5.2.33b SI 2quater Rest Octets */
type record SI2quaterRestOctets {