RLCMAC_EncDec: Provide decoded (m)cs in (E)GPRS data blocks

Let's provide this information to higher layer since CS is mostly
discovered by original bitstring size which is available during
decoding.

Call the size2mcs converter in each function to avoid having to pass it
as a parameter and have it selfcontained, meaning one can simply call
decode(bitstring) from TTCN3 code and be done with it.

Change-Id: I80ed44e575cc0a11510832e5bbfc07173e7b75b8
This commit is contained in:
Pau Espin 2020-11-03 17:30:44 +01:00
parent 745a48bce3
commit 5abfded61e
3 changed files with 27 additions and 12 deletions

View File

@ -450,6 +450,8 @@ RlcmacDlDataBlock dec__RlcmacDlDataBlock(const OCTETSTRING& stream)
TTCN_Buffer ttcn_buffer(stream);
int num_llc_blocks = 0;
ret_val.cs() = payload_len_2_coding_scheme(stream.lengthof());
/* use automatic/generated decoder for header */
ret_val.mac__hdr().decode(DlMacDataHeader_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
@ -541,7 +543,7 @@ EgprsDlMacDataHeader dec__EgprsDlMacDataHeader_type3(const OCTETSTRING& stream)
}
static
RlcmacDlEgprsDataBlock dec__RlcmacDlEgprsDataBlock(const OCTETSTRING& stream, CodingScheme::enum_type mcs)
RlcmacDlEgprsDataBlock dec__RlcmacDlEgprsDataBlock(const OCTETSTRING& stream)
{
RlcmacDlEgprsDataBlock ret_val;
TTCN_Buffer ttcn_buffer(stream);
@ -551,7 +553,8 @@ RlcmacDlEgprsDataBlock dec__RlcmacDlEgprsDataBlock(const OCTETSTRING& stream, Co
unsigned int num_calls;
const uint8_t *ti_e;
switch (mcs) {
ret_val.mcs() = payload_len_2_coding_scheme(stream.lengthof());
switch (ret_val.mcs()) {
case CodingScheme::MCS__0:
case CodingScheme::MCS__1:
case CodingScheme::MCS__2:
@ -569,7 +572,7 @@ RlcmacDlEgprsDataBlock dec__RlcmacDlEgprsDataBlock(const OCTETSTRING& stream, Co
ret_val.mac__hdr() = dec__EgprsDlMacDataHeader_type1(stream);
break;
}
setup_rlc_mac_priv(mcs, ret_val.mac__hdr().header__type(), false,
setup_rlc_mac_priv(ret_val.mcs(), ret_val.mac__hdr().header__type(), false,
&num_calls, &data_block_bits, data_block_offsets);
get_egprs_data_block(ttcn_buffer, data_block_offsets[0], data_block_bits, aligned_buffer);
@ -611,10 +614,10 @@ RlcmacDlBlock dec__RlcmacDlBlock(const OCTETSTRING& stream)
{
RlcmacDlBlock ret_val;
size_t stream_len = stream.lengthof();
CodingScheme::enum_type mcs = payload_len_2_coding_scheme(stream_len);
CodingScheme::enum_type cs_mcs = payload_len_2_coding_scheme(stream_len);
unsigned char pt;
switch (mcs) {
switch (cs_mcs) {
case CodingScheme::CS__1:
case CodingScheme::CS__2:
case CodingScheme::CS__3:
@ -635,7 +638,7 @@ RlcmacDlBlock dec__RlcmacDlBlock(const OCTETSTRING& stream)
case CodingScheme::MCS__7:
case CodingScheme::MCS__8:
case CodingScheme::MCS__9:
ret_val.data__egprs() = dec__RlcmacDlEgprsDataBlock(stream, mcs);
ret_val.data__egprs() = dec__RlcmacDlEgprsDataBlock(stream);
break;
}
return ret_val;
@ -655,6 +658,8 @@ RlcmacUlDataBlock dec__RlcmacUlDataBlock(const OCTETSTRING& stream)
stream.log();
TTCN_Logger::end_event();
ret_val.cs() = payload_len_2_coding_scheme(stream.lengthof());
/* use automatic/generated decoder for header */
ret_val.mac__hdr().decode(UlMacDataHeader_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW);
@ -792,7 +797,7 @@ EgprsUlMacDataHeader dec__EgprsUlMacDataHeader_type3(const OCTETSTRING& stream)
return ret_val;
}
RlcmacUlEgprsDataBlock dec__RlcmacUlEgprsDataBlock(const OCTETSTRING& stream, CodingScheme::enum_type mcs)
RlcmacUlEgprsDataBlock dec__RlcmacUlEgprsDataBlock(const OCTETSTRING& stream)
{
RlcmacUlEgprsDataBlock ret_val;
TTCN_Buffer ttcn_buffer(stream);
@ -802,7 +807,8 @@ RlcmacUlEgprsDataBlock dec__RlcmacUlEgprsDataBlock(const OCTETSTRING& stream, Co
unsigned int num_calls;
const uint8_t *ti_e;
switch (mcs) {
ret_val.mcs() = payload_len_2_coding_scheme(stream.lengthof());
switch (ret_val.mcs()) {
case CodingScheme::MCS__1:
case CodingScheme::MCS__2:
case CodingScheme::MCS__3:
@ -819,7 +825,7 @@ RlcmacUlEgprsDataBlock dec__RlcmacUlEgprsDataBlock(const OCTETSTRING& stream, Co
ret_val.mac__hdr() = dec__EgprsUlMacDataHeader_type1(stream);
break;
}
setup_rlc_mac_priv(mcs, ret_val.mac__hdr().header__type(), true,
setup_rlc_mac_priv(ret_val.mcs(), ret_val.mac__hdr().header__type(), true,
&num_calls, &data_block_bits, data_block_offsets);
get_egprs_data_block(ttcn_buffer, data_block_offsets[0], data_block_bits, aligned_buffer);
@ -889,10 +895,10 @@ RlcmacUlBlock dec__RlcmacUlBlock(const OCTETSTRING& stream)
{
RlcmacUlBlock ret_val;
size_t stream_len = stream.lengthof();
CodingScheme::enum_type mcs = payload_len_2_coding_scheme(stream_len);
CodingScheme::enum_type cs_mcs = payload_len_2_coding_scheme(stream_len);
unsigned char pt;
switch (mcs) {
switch (cs_mcs) {
case CodingScheme::CS__1:
case CodingScheme::CS__2:
case CodingScheme::CS__3:
@ -912,7 +918,7 @@ RlcmacUlBlock dec__RlcmacUlBlock(const OCTETSTRING& stream)
case CodingScheme::MCS__7:
case CodingScheme::MCS__8:
case CodingScheme::MCS__9:
ret_val.data__egprs() = dec__RlcmacUlEgprsDataBlock(stream, mcs);
ret_val.data__egprs() = dec__RlcmacUlEgprsDataBlock(stream);
break;
}

View File

@ -374,6 +374,7 @@ module RLCMAC_Templates {
template RlcmacUlBlock t_RLCMAC_UL_DATA(template uint5_t tfi, template uint4_t cv, template uint7_t bsn,
template LlcBlocks blocks := {}, template boolean stall := false) := {
data := {
cs := CS_1, /* TODO: make this available to template */
mac_hdr := {
payload_type := MAC_PT_RLC_DATA,
countdown := cv,
@ -394,6 +395,7 @@ module RLCMAC_Templates {
template RlcmacUlBlock t_RLCMAC_UL_DATA_TLLI(template uint5_t tfi, template uint4_t cv, template uint7_t bsn,
template LlcBlocks blocks := {}, template boolean stall := false, template GprsTlli tlli) := {
data := {
cs := CS_1, /* TODO: make this available to template */
mac_hdr := {
payload_type := MAC_PT_RLC_DATA,
countdown := cv,
@ -417,6 +419,7 @@ module RLCMAC_Templates {
template uint5_t tfi, template uint4_t cv,
template uint11_t bsn1, template EgprsLlcBlocks blocks := {}) := {
data_egprs := {
mcs := mcs,
mac_hdr := {
header_type := f_rlcmac_mcs2headertype(mcs),
tfi := tfi,
@ -657,6 +660,7 @@ module RLCMAC_Templates {
template (present) MacRrbp rrbp := ?,
template (present) uint3_t usf := ?) := {
data := {
cs := ?,
mac_hdr := {
mac_hdr := {
payload_type := MAC_PT_RLC_DATA,
@ -672,6 +676,7 @@ module RLCMAC_Templates {
template RlcmacDlBlock tr_RLCMAC_DATA_EGPRS := {
data_egprs := {
mcs := ?,
mac_hdr := ?,
fbi := ?,
e := ?,

View File

@ -182,6 +182,7 @@ module RLCMAC_Types {
DlMacHdrDataExt hdr_ext
} with { variant "" };
type record RlcmacDlDataBlock {
CodingScheme cs, /* Provided by C++ Decoder */
DlMacDataHeader mac_hdr,
/* Octet 3..M / N: manual C++ Decoder */
LlcBlocks blocks
@ -230,6 +231,7 @@ module RLCMAC_Types {
} with { variant "" };
/* Manual C++ Decoder: */
type record RlcmacDlEgprsDataBlock {
CodingScheme mcs, /* Provided by C++ Decoder */
EgprsDlMacDataHeader mac_hdr,
boolean fbi,
boolean e,
@ -286,6 +288,7 @@ module RLCMAC_Types {
};
/* Manual C++ Decoder: 10.3a.2.1 EGPRS Uplink RLC data block */
type record RlcmacUlEgprsDataBlock {
CodingScheme mcs, /* Provided by C++ Decoder */
EgprsUlMacDataHeader mac_hdr,
boolean tlli_ind,
boolean e,
@ -300,6 +303,7 @@ module RLCMAC_Types {
/* TS 44.060 10.2.2 */
type record RlcmacUlDataBlock {
CodingScheme cs, /* Provided by C++ Decoder */
/* MAC header */
UlMacDataHeader mac_hdr,
/* Octet 3 ... M (optional): manual C++ Decoder */