removed rrc asn1 header from bcd_helpers, from rlc_interface, and rlc tests

master
Francisco Paisana 6 years ago committed by Andre Puschmann
parent bb0dbf0f1c
commit b936629221

@ -30,30 +30,37 @@ namespace rrc {
struct plmn_id_s; struct plmn_id_s;
struct s_tmsi_s; struct s_tmsi_s;
struct rlc_cfg_c;
} // namespace rrc } // namespace rrc
} // namespace asn1 } // namespace asn1
namespace srslte { namespace srslte {
bool plmn_is_valid(const asn1::rrc::plmn_id_s& asn1_type);
struct plmn_id_t { struct plmn_id_t {
uint8_t mcc[3]; uint8_t mcc[3];
uint8_t mnc[3]; uint8_t mnc[3];
uint8_t nof_mnc_digits; uint8_t nof_mnc_digits;
plmn_id_t() : mcc(), mnc(), nof_mnc_digits(0) {} plmn_id_t() : mcc(), mnc(), nof_mnc_digits(2) {}
int from_asn1(const asn1::rrc::plmn_id_s* asn1_type); explicit plmn_id_t(const asn1::rrc::plmn_id_s& asn1_type);
void to_asn1(asn1::rrc::plmn_id_s* asn1_type) const; void reset();
void from_number(uint16_t mcc_num, uint16_t mnc_num); int from_asn1(const asn1::rrc::plmn_id_s& asn1_type);
int to_asn1(asn1::rrc::plmn_id_s* asn1_type) const;
int from_number(uint16_t mcc_num, uint16_t mnc_num);
int from_string(const std::string& plmn_str); int from_string(const std::string& plmn_str);
std::string to_string() const; std::string to_string() const;
}; };
struct s_tmsi_t { struct s_tmsi_t {
uint8_t mmec; uint8_t mmec = 0;
uint32_t m_tmsi; uint32_t m_tmsi = 0;
void from_asn1(const asn1::rrc::s_tmsi_s* asn1_type); s_tmsi_t() = default;
explicit s_tmsi_t(const asn1::rrc::s_tmsi_s& asn1_type);
void from_asn1(const asn1::rrc::s_tmsi_s& asn1_type);
void to_asn1(asn1::rrc::s_tmsi_s* asn1_type) const; void to_asn1(asn1::rrc::s_tmsi_s* asn1_type) const;
}; };
@ -70,6 +77,8 @@ enum class establishment_cause_t {
}; };
std::string to_string(const establishment_cause_t& cause); std::string to_string(const establishment_cause_t& cause);
class srslte_rlc_config_t;
void convert_from_asn1(srslte_rlc_config_t* out, const asn1::rrc::rlc_cfg_c& asn1_type);
} }
#endif // SRSLTE_RRC_ASN1_UTILS_H #endif // SRSLTE_RRC_ASN1_UTILS_H

@ -26,8 +26,6 @@
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#include "srslte/asn1/rrc_asn1.h"
namespace srslte { namespace srslte {
/****************************************************************************** /******************************************************************************
@ -89,7 +87,7 @@ inline bool mcc_to_bytes(uint16_t mcc, uint8_t* bytes)
return true; return true;
} }
inline std::string mcc_bytes_to_string(asn1::rrc::mcc_l mcc_bytes) inline std::string mcc_bytes_to_string(uint8_t* mcc_bytes)
{ {
std::string mcc_str; std::string mcc_str;
uint16_t mcc; uint16_t mcc;
@ -200,45 +198,21 @@ bool mnc_to_bytes(uint16_t mnc, Vec& vec)
return ret; return ret;
} }
inline std::string mnc_bytes_to_string(asn1::rrc::mnc_l mnc_bytes) inline std::string mnc_bytes_to_string(uint8_t* mnc_bytes, uint32_t nof_bytes)
{ {
std::string mnc_str; std::string mnc_str;
uint16_t mnc; uint16_t mnc;
bytes_to_mnc(&mnc_bytes[0], &mnc, mnc_bytes.size()); bytes_to_mnc(&mnc_bytes[0], &mnc, nof_bytes);
if (!mnc_to_string(mnc, &mnc_str)) { if (!mnc_to_string(mnc, &mnc_str)) {
mnc_str = "000"; mnc_str = "000";
} }
return mnc_str; return mnc_str;
} }
inline std::string plmn_id_to_string(asn1::rrc::plmn_id_s plmn_id) template <class Vec>
{ std::string mnc_bytes_to_string(Vec mnc_bytes)
std::string mcc_str, mnc_str;
uint16_t mnc, mcc;
bytes_to_mnc(&plmn_id.mnc[0], &mnc, plmn_id.mnc.size());
bytes_to_mcc(&plmn_id.mcc[0], &mcc);
mnc_to_string(mnc, &mnc_str);
mcc_to_string(mcc, &mcc_str);
return mcc_str + mnc_str;
}
inline bool string_to_plmn_id(asn1::rrc::plmn_id_s& plmn, std::string mccmnc_str)
{ {
if (mccmnc_str.size() < 5 or mccmnc_str.size() > 6) { return mnc_bytes_to_string(&mnc_bytes[0], mnc_bytes.size());
return false;
}
uint16_t mnc, mcc;
if (not string_to_mcc(std::string(mccmnc_str.begin(), mccmnc_str.begin() + 3), &mcc)) {
return false;
}
if (not string_to_mnc(std::string(mccmnc_str.begin() + 3, mccmnc_str.end()), &mnc)) {
return false;
}
plmn.mcc_present = true;
if (not mcc_to_bytes(mcc, &plmn.mcc[0])) {
return false;
}
return mnc_to_bytes(mnc, plmn.mnc);
} }
/****************************************************************************** /******************************************************************************

@ -22,9 +22,6 @@
#ifndef SRSLTE_RLC_INTERFACE_H #ifndef SRSLTE_RLC_INTERFACE_H
#define SRSLTE_RLC_INTERFACE_H #define SRSLTE_RLC_INTERFACE_H
// for custom constructors
#include "srslte/asn1/rrc_asn1.h"
#define RLC_TX_QUEUE_LEN (128) #define RLC_TX_QUEUE_LEN (128)
namespace srslte { namespace srslte {
@ -91,48 +88,6 @@ public:
// Default ctor // Default ctor
srslte_rlc_config_t() : rlc_mode(RLC_MODE_TM), am(), um(), tx_queue_length(RLC_TX_QUEUE_LEN){}; srslte_rlc_config_t() : rlc_mode(RLC_MODE_TM), am(), um(), tx_queue_length(RLC_TX_QUEUE_LEN){};
// Constructor based on rrc_asn1's RLC config
srslte_rlc_config_t(asn1::rrc::rlc_cfg_c* cnfg) : rlc_mode(RLC_MODE_AM), am(), um()
{
// update RLC mode to internal mode struct
rlc_mode = (cnfg->type() == asn1::rrc::rlc_cfg_c::types::am) ? RLC_MODE_AM : RLC_MODE_UM;
switch(rlc_mode)
{
case RLC_MODE_AM:
am.t_poll_retx = cnfg->am().ul_am_rlc.t_poll_retx.to_number();
am.poll_pdu = cnfg->am().ul_am_rlc.poll_pdu.to_number();
am.poll_byte = cnfg->am().ul_am_rlc.poll_byte.to_number() * 1000; // KB
am.max_retx_thresh = cnfg->am().ul_am_rlc.max_retx_thres.to_number();
am.t_reordering = cnfg->am().dl_am_rlc.t_reordering.to_number();
am.t_status_prohibit = cnfg->am().dl_am_rlc.t_status_prohibit.to_number();
break;
case RLC_MODE_UM:
um.t_reordering = cnfg->um_bi_dir().dl_um_rlc.t_reordering.to_number();
um.rx_sn_field_length = (rlc_umd_sn_size_t)cnfg->um_bi_dir().dl_um_rlc.sn_field_len.value;
um.rx_window_size = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 16 : 512;
um.rx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 32 : 1024;
um.tx_sn_field_length = (rlc_umd_sn_size_t)cnfg->um_bi_dir().ul_um_rlc.sn_field_len.value;
um.tx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.tx_sn_field_length) ? 32 : 1024;
break;
// case asn1::rrc::rlc_cfg_c::types::um_uni_dir_ul:
// um.tx_sn_field_length = (rlc_umd_sn_size_t)cnfg->um_uni_dir_ul().ul_um_rlc.sn_field_len.value;
// um.tx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.tx_sn_field_length) ? 32 : 1024;
// break;
// case asn1::rrc::rlc_cfg_c::types::um_uni_dir_dl:
// um.t_reordering = cnfg->um_uni_dir_dl().dl_um_rlc.t_reordering.to_number();
// um.rx_sn_field_length = (rlc_umd_sn_size_t)cnfg->um_uni_dir_dl().dl_um_rlc.sn_field_len.value;
// um.rx_window_size = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 16 : 512;
// um.rx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 32 : 1024;
// break;
default:
// Handle default case
break;
}
tx_queue_length = RLC_TX_QUEUE_LEN;
}
// Factory for MCH // Factory for MCH
static srslte_rlc_config_t mch_config() static srslte_rlc_config_t mch_config()
{ {

@ -23,49 +23,77 @@
#include "srslte/asn1/rrc_asn1.h" #include "srslte/asn1/rrc_asn1.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/config.h" #include "srslte/config.h"
#include "srslte/upper/rlc_interface.h"
#include <algorithm> #include <algorithm>
namespace srslte { namespace srslte {
int plmn_id_t::from_asn1(const asn1::rrc::plmn_id_s* asn1_type) bool plmn_is_valid(const asn1::rrc::plmn_id_s& asn1_type)
{ {
if (not asn1_type->mcc_present) { return asn1_type.mcc_present and (asn1_type.mnc.size() == 3 or asn1_type.mnc.size() == 2);
}
plmn_id_t::plmn_id_t(const asn1::rrc::plmn_id_s& asn1_type)
{
from_asn1(asn1_type);
}
void plmn_id_t::reset()
{
nof_mnc_digits = 2;
std::fill(&mnc[0], &mnc[3], 3);
std::fill(&mcc[0], &mcc[3], 3);
}
int plmn_id_t::from_asn1(const asn1::rrc::plmn_id_s& asn1_type)
{
if (not plmn_is_valid(asn1_type)) {
reset();
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
std::copy(&asn1_type->mcc[0], &asn1_type->mcc[3], &mcc[0]); std::copy(&asn1_type.mcc[0], &asn1_type.mcc[3], &mcc[0]);
nof_mnc_digits = asn1_type->mnc.size(); nof_mnc_digits = asn1_type.mnc.size();
std::copy(&asn1_type->mnc[0], &asn1_type->mnc[nof_mnc_digits], &mnc[0]); std::copy(&asn1_type.mnc[0], &asn1_type.mnc[nof_mnc_digits], &mnc[0]);
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
void plmn_id_t::to_asn1(asn1::rrc::plmn_id_s* asn1_type) const int plmn_id_t::to_asn1(asn1::rrc::plmn_id_s* asn1_type) const
{ {
asn1_type->mcc_present = true; asn1_type->mcc_present = true;
std::copy(&mcc[0], &mcc[3], &asn1_type->mcc[0]); std::copy(&mcc[0], &mcc[3], &asn1_type->mcc[0]);
asn1_type->mnc.resize(nof_mnc_digits); asn1_type->mnc.resize(nof_mnc_digits);
std::copy(&mnc[0], &mnc[nof_mnc_digits], &asn1_type->mnc[0]); std::copy(&mnc[0], &mnc[nof_mnc_digits], &asn1_type->mnc[0]);
return SRSLTE_SUCCESS;
} }
void plmn_id_t::from_number(uint16_t mcc_num, uint16_t mnc_num) int plmn_id_t::from_number(uint16_t mcc_num, uint16_t mnc_num)
{ {
srslte::mcc_to_bytes(mcc_num, &mcc[0]); srslte::mcc_to_bytes(mcc_num, &mcc[0]);
srslte::mnc_to_bytes(mnc_num, &mnc[0], &nof_mnc_digits); if (not srslte::mnc_to_bytes(mnc_num, &mnc[0], &nof_mnc_digits)) {
reset();
return SRSLTE_ERROR;
}
return SRSLTE_SUCCESS;
} }
int plmn_id_t::from_string(const std::string& plmn_str) int plmn_id_t::from_string(const std::string& plmn_str)
{ {
if (plmn_str.size() < 5 or plmn_str.size() > 6) { if (plmn_str.size() < 5 or plmn_str.size() > 6) {
reset();
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
uint16_t mnc_num, mcc_num; uint16_t mnc_num, mcc_num;
if (not string_to_mcc(std::string(plmn_str.begin(), plmn_str.begin() + 3), &mcc_num)) { if (not string_to_mcc(std::string(plmn_str.begin(), plmn_str.begin() + 3), &mcc_num)) {
reset();
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
if (not string_to_mnc(std::string(plmn_str.begin() + 3, plmn_str.end()), &mnc_num)) { if (not string_to_mnc(std::string(plmn_str.begin() + 3, plmn_str.end()), &mnc_num)) {
reset();
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
if (not mcc_to_bytes(mcc_num, &mcc[0])) { if (not mcc_to_bytes(mcc_num, &mcc[0])) {
reset();
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
return mnc_to_bytes(mnc_num, &mnc[0], &nof_mnc_digits) ? SRSLTE_SUCCESS : SRSLTE_ERROR; return mnc_to_bytes(mnc_num, &mnc[0], &nof_mnc_digits) ? SRSLTE_SUCCESS : SRSLTE_ERROR;
@ -82,10 +110,15 @@ std::string plmn_id_t::to_string() const
return mcc_str + mnc_str; return mcc_str + mnc_str;
} }
void s_tmsi_t::from_asn1(const asn1::rrc::s_tmsi_s* asn1_type) s_tmsi_t::s_tmsi_t(const asn1::rrc::s_tmsi_s& asn1_type)
{
from_asn1(asn1_type);
}
void s_tmsi_t::from_asn1(const asn1::rrc::s_tmsi_s& asn1_type)
{ {
mmec = asn1_type->mmec.to_number(); mmec = asn1_type.mmec.to_number();
m_tmsi = asn1_type->m_tmsi.to_number(); m_tmsi = asn1_type.m_tmsi.to_number();
} }
void s_tmsi_t::to_asn1(asn1::rrc::s_tmsi_s* asn1_type) const void s_tmsi_t::to_asn1(asn1::rrc::s_tmsi_s* asn1_type) const
@ -102,4 +135,47 @@ std::string to_string(const establishment_cause_t& cause)
return asn1_cause.to_string(); return asn1_cause.to_string();
} }
void convert_from_asn1(srslte_rlc_config_t* out, const asn1::rrc::rlc_cfg_c& asn1_type)
{
out->am = srslte_rlc_am_config_t();
out->um = srslte_rlc_um_config_t();
// update RLC mode to internal mode struct
out->rlc_mode = (asn1_type.type() == asn1::rrc::rlc_cfg_c::types::am) ? RLC_MODE_AM : RLC_MODE_UM;
switch (out->rlc_mode) {
case RLC_MODE_AM:
out->am.t_poll_retx = asn1_type.am().ul_am_rlc.t_poll_retx.to_number();
out->am.poll_pdu = asn1_type.am().ul_am_rlc.poll_pdu.to_number();
out->am.poll_byte = asn1_type.am().ul_am_rlc.poll_byte.to_number() * 1000; // KB
out->am.max_retx_thresh = asn1_type.am().ul_am_rlc.max_retx_thres.to_number();
out->am.t_reordering = asn1_type.am().dl_am_rlc.t_reordering.to_number();
out->am.t_status_prohibit = asn1_type.am().dl_am_rlc.t_status_prohibit.to_number();
break;
case RLC_MODE_UM:
out->um.t_reordering = asn1_type.um_bi_dir().dl_um_rlc.t_reordering.to_number();
out->um.rx_sn_field_length = (rlc_umd_sn_size_t)asn1_type.um_bi_dir().dl_um_rlc.sn_field_len.value;
out->um.rx_window_size = (RLC_UMD_SN_SIZE_5_BITS == out->um.rx_sn_field_length) ? 16 : 512;
out->um.rx_mod = (RLC_UMD_SN_SIZE_5_BITS == out->um.rx_sn_field_length) ? 32 : 1024;
out->um.tx_sn_field_length = (rlc_umd_sn_size_t)asn1_type.um_bi_dir().ul_um_rlc.sn_field_len.value;
out->um.tx_mod = (RLC_UMD_SN_SIZE_5_BITS == out->um.tx_sn_field_length) ? 32 : 1024;
break;
// case asn1::rrc::rlc_cfg_c::types::um_uni_dir_ul:
// um.tx_sn_field_length = (rlc_umd_sn_size_t)cnfg->um_uni_dir_ul().ul_um_rlc.sn_field_len.value;
// um.tx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.tx_sn_field_length) ? 32 : 1024;
// break;
// case asn1::rrc::rlc_cfg_c::types::um_uni_dir_dl:
// um.t_reordering = cnfg->um_uni_dir_dl().dl_um_rlc.t_reordering.to_number();
// um.rx_sn_field_length = (rlc_umd_sn_size_t)cnfg->um_uni_dir_dl().dl_um_rlc.sn_field_len.value;
// um.rx_window_size = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 16 : 512;
// um.rx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 32 : 1024;
// break;
default:
// Handle default case
break;
}
out->tx_queue_length = RLC_TX_QUEUE_LEN;
}
} // namespace } // namespace

@ -24,8 +24,6 @@
#include "srslte/upper/rlc_um.h" #include "srslte/upper/rlc_um.h"
#include "srslte/upper/rlc_am.h" #include "srslte/upper/rlc_am.h"
using namespace asn1::rrc;
namespace srslte { namespace srslte {
rlc::rlc(log* log_) : rlc_log(log_) rlc::rlc(log* log_) : rlc_log(log_)
@ -390,16 +388,15 @@ void rlc::add_bearer(uint32_t lcid)
add_bearer(lcid, srslte_rlc_config_t()); add_bearer(lcid, srslte_rlc_config_t());
} else { } else {
// SRB1 and SRB2 are AM // SRB1 and SRB2 are AM
rlc_cfg_c cnfg; srslte_rlc_config_t rlc_cfg;
cnfg.set(rlc_cfg_c::types::am); rlc_cfg.rlc_mode = RLC_MODE_AM;
rlc_cfg_c::am_s_* amcfg = &cnfg.am(); rlc_cfg.am.t_poll_retx = 45;
amcfg->ul_am_rlc.t_poll_retx = t_poll_retx_e::ms45; rlc_cfg.am.poll_pdu = -1;
amcfg->ul_am_rlc.poll_pdu = poll_pdu_e::p_infinity; rlc_cfg.am.poll_byte = -1;
amcfg->ul_am_rlc.poll_byte = poll_byte_e::kbinfinity; rlc_cfg.am.max_retx_thresh = 4;
amcfg->ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4; rlc_cfg.am.t_reordering = 35;
amcfg->dl_am_rlc.t_reordering = t_reordering_e::ms35; rlc_cfg.am.t_status_prohibit = 0;
amcfg->dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms0; add_bearer(lcid, rlc_cfg);
add_bearer(lcid, srslte_rlc_config_t(&cnfg));
} }
} }

@ -20,6 +20,7 @@
*/ */
#include "srslte/asn1/rrc_asn1.h" #include "srslte/asn1/rrc_asn1.h"
#include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/log_filter.h" #include "srslte/common/log_filter.h"
#include <iostream> #include <iostream>
@ -84,9 +85,9 @@ int basic_test()
.mbms_session_info_list_r9[0] .mbms_session_info_list_r9[0]
.tmgi_r9.plmn_id_r9.explicit_value_r9() .tmgi_r9.plmn_id_r9.explicit_value_r9()
.mcc_present); .mcc_present);
std::string mccmnc_str = srslte::plmn_id_to_string( srslte::plmn_id_t plmn(
area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9()); area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9());
TESTASSERT(mccmnc_str == "987654"); TESTASSERT(plmn.to_string() == "987654");
TESTASSERT(area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.service_id_r9.to_string() == TESTASSERT(area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.service_id_r9.to_string() ==
"000001"); "000001");
TESTASSERT(area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].session_id_r9.to_string() == "01"); TESTASSERT(area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].session_id_r9.to_string() == "01");
@ -107,9 +108,8 @@ int basic_test()
.mbms_session_info_list_r9[0] .mbms_session_info_list_r9[0]
.tmgi_r9.plmn_id_r9.explicit_value_r9() .tmgi_r9.plmn_id_r9.explicit_value_r9()
.mcc_present); .mcc_present);
mccmnc_str = srslte::plmn_id_to_string( plmn.from_asn1(area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9());
area_cfg_r9->pmch_info_list_r9[0].mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9()); TESTASSERT(plmn.to_string() == "987654");
TESTASSERT(mccmnc_str == "987654");
TESTASSERT(area_cfg_r9->pmch_info_list_r9[1].mbms_session_info_list_r9[0].tmgi_r9.service_id_r9.to_string() == TESTASSERT(area_cfg_r9->pmch_info_list_r9[1].mbms_session_info_list_r9[0].tmgi_r9.service_id_r9.to_string() ==
"000002"); "000002");
TESTASSERT(area_cfg_r9->pmch_info_list_r9[1].mbms_session_info_list_r9[0].session_id_r9.to_string() == "02"); TESTASSERT(area_cfg_r9->pmch_info_list_r9[1].mbms_session_info_list_r9[0].session_id_r9.to_string() == "02");

@ -20,6 +20,7 @@
*/ */
#include "srslte/asn1/rrc_asn1.h" #include "srslte/asn1/rrc_asn1.h"
#include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/log_filter.h" #include "srslte/common/log_filter.h"
#include <iostream> #include <iostream>
@ -75,8 +76,8 @@ int basic_test()
TESTASSERT(meas_list[0].cgi_info_present); TESTASSERT(meas_list[0].cgi_info_present);
TESTASSERT(meas_list[0].cgi_info.plmn_id_list_present); TESTASSERT(meas_list[0].cgi_info.plmn_id_list_present);
TESTASSERT(meas_list[0].cgi_info.cell_global_id.plmn_id.mcc_present); TESTASSERT(meas_list[0].cgi_info.cell_global_id.plmn_id.mcc_present);
std::string mccmnc_str = srslte::plmn_id_to_string(meas_list[0].cgi_info.cell_global_id.plmn_id); srslte::plmn_id_t plmn(meas_list[0].cgi_info.cell_global_id.plmn_id);
TESTASSERT(mccmnc_str == "89878"); TESTASSERT(plmn.to_string() == "89878");
TESTASSERT(meas_list[0].cgi_info.cell_global_id.cell_id.to_number() == 0x1084104); TESTASSERT(meas_list[0].cgi_info.cell_global_id.cell_id.to_number() == 0x1084104);
TESTASSERT(meas_list[0].cgi_info.tac.to_number() == 0x1042); TESTASSERT(meas_list[0].cgi_info.tac.to_number() == 0x1042);
TESTASSERT(meas_list[0].cgi_info.plmn_id_list.size() == 1); TESTASSERT(meas_list[0].cgi_info.plmn_id_list.size() == 1);

@ -129,6 +129,19 @@ private:
bool running; bool running;
}; };
srslte_rlc_config_t default_rlc_cnfg()
{
srslte_rlc_config_t rlc_cnfg;
rlc_cnfg.rlc_mode = RLC_MODE_AM;
rlc_cnfg.am.t_reordering = 5;
rlc_cnfg.am.t_status_prohibit = 5;
rlc_cnfg.am.max_retx_thresh = 4;
rlc_cnfg.am.poll_byte = 25;
rlc_cnfg.am.poll_pdu = 4;
rlc_cnfg.am.t_poll_retx = 5;
return rlc_cnfg;
}
void basic_test_tx(rlc_am* rlc, byte_buffer_t pdu_bufs[NBUFS]) void basic_test_tx(rlc_am* rlc, byte_buffer_t pdu_bufs[NBUFS])
{ {
@ -169,20 +182,11 @@ bool basic_test()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -237,20 +241,11 @@ bool concat_test()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -312,20 +307,11 @@ bool segment_test(bool in_seq_rx)
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -415,20 +401,11 @@ bool retx_test()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -517,20 +494,11 @@ bool resegment_test_1()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -632,20 +600,11 @@ bool resegment_test_2()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -743,20 +702,11 @@ bool resegment_test_3()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -849,20 +799,11 @@ bool resegment_test_4()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -957,20 +898,11 @@ bool resegment_test_5()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -1066,20 +998,11 @@ bool resegment_test_6()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -1211,20 +1134,11 @@ bool resegment_test_7()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -1393,20 +1307,11 @@ bool resegment_test_8()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_am rlc2(&log2, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
if (not rlc2.configure(&cnfg)) { if (not rlc2.configure(default_rlc_cnfg())) {
return -1; return -1;
} }
@ -1546,16 +1451,7 @@ bool reset_test()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
@ -1600,16 +1496,7 @@ bool resume_test()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }
@ -1653,16 +1540,7 @@ bool stop_test()
rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc1(&log1, 1, &tester, &tester, &timers);
rlc_cfg_c cnfg; if (not rlc1.configure(default_rlc_cnfg())) {
cnfg.set(rlc_cfg_c::types::am);
cnfg.am().dl_am_rlc.t_reordering = t_reordering_e::ms5;
cnfg.am().dl_am_rlc.t_status_prohibit = t_status_prohibit_e::ms5;
cnfg.am().ul_am_rlc.max_retx_thres = ul_am_rlc_s::max_retx_thres_e_::t4;
cnfg.am().ul_am_rlc.poll_byte = poll_byte_e::kb25;
cnfg.am().ul_am_rlc.poll_pdu = poll_pdu_e::p4;
cnfg.am().ul_am_rlc.t_poll_retx = t_poll_retx_e::ms5;
if (not rlc1.configure(&cnfg)) {
return -1; return -1;
} }

@ -109,14 +109,17 @@ int basic_test()
rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc1(&log1, 3, &tester, &tester, &timers);
rlc_um rlc2(&log2, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers);
rlc_cfg_c cnfg; srslte_rlc_config_t cnfg;
cnfg.set(rlc_cfg_c::types::um_bi_dir); cnfg.rlc_mode = RLC_MODE_UM;
cnfg.um_bi_dir().dl_um_rlc.t_reordering = t_reordering_e::ms5; cnfg.um.t_reordering = 5;
cnfg.um_bi_dir().dl_um_rlc.sn_field_len = sn_field_len_e::size10; cnfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_10_BITS;
cnfg.um_bi_dir().ul_um_rlc.sn_field_len = sn_field_len_e::size10; cnfg.um.rx_window_size = 512;
cnfg.um.rx_mod = 1024;
TESTASSERT(rlc1.configure(&cnfg) == true); cnfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_10_BITS;
TESTASSERT(rlc2.configure(&cnfg) == true); cnfg.um.tx_mod = 1024;
TESTASSERT(rlc1.configure(cnfg) == true);
TESTASSERT(rlc2.configure(cnfg) == true);
tester.set_expected_sdu_len(1); tester.set_expected_sdu_len(1);
@ -176,14 +179,17 @@ int loss_test()
rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc1(&log1, 3, &tester, &tester, &timers);
rlc_um rlc2(&log2, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers);
rlc_cfg_c cnfg; srslte_rlc_config_t cnfg;
cnfg.set(rlc_cfg_c::types::um_bi_dir); cnfg.rlc_mode = RLC_MODE_UM;
cnfg.um_bi_dir().dl_um_rlc.t_reordering = t_reordering_e::ms5; cnfg.um.t_reordering = 5;
cnfg.um_bi_dir().dl_um_rlc.sn_field_len = sn_field_len_e::size10; cnfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_10_BITS;
cnfg.um_bi_dir().ul_um_rlc.sn_field_len = sn_field_len_e::size10; cnfg.um.rx_window_size = 512;
cnfg.um.rx_mod = 1024;
cnfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_10_BITS;
cnfg.um.tx_mod = 1024;
rlc1.configure(&cnfg); rlc1.configure(cnfg);
rlc2.configure(&cnfg); rlc2.configure(cnfg);
tester.set_expected_sdu_len(1); tester.set_expected_sdu_len(1);
@ -313,14 +319,17 @@ int reassmble_test()
rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc1(&log1, 3, &tester, &tester, &timers);
rlc_um rlc2(&log2, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers);
rlc_cfg_c cnfg; srslte_rlc_config_t cnfg;
cnfg.set(rlc_cfg_c::types::um_bi_dir); cnfg.rlc_mode = RLC_MODE_UM;
cnfg.um_bi_dir().dl_um_rlc.t_reordering = t_reordering_e::ms5; cnfg.um.t_reordering = 5;
cnfg.um_bi_dir().dl_um_rlc.sn_field_len = sn_field_len_e::size5; cnfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS;
cnfg.um_bi_dir().ul_um_rlc.sn_field_len = sn_field_len_e::size5; cnfg.um.rx_window_size = 16;
cnfg.um.rx_mod = 32;
cnfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS;
cnfg.um.tx_mod = 32;
rlc1.configure(&cnfg); rlc1.configure(cnfg);
rlc2.configure(&cnfg); rlc2.configure(cnfg);
// Push SDUs into RLC1 // Push SDUs into RLC1
const int n_sdus = 25; const int n_sdus = 25;
@ -426,14 +435,17 @@ int reassmble_test2()
rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc1(&log1, 3, &tester, &tester, &timers);
rlc_um rlc2(&log2, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers);
rlc_cfg_c cnfg; srslte_rlc_config_t cnfg;
cnfg.set(rlc_cfg_c::types::um_bi_dir); cnfg.rlc_mode = RLC_MODE_UM;
cnfg.um_bi_dir().dl_um_rlc.t_reordering = t_reordering_e::ms5; cnfg.um.t_reordering = 5;
cnfg.um_bi_dir().dl_um_rlc.sn_field_len = sn_field_len_e::size5; cnfg.um.rx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS;
cnfg.um_bi_dir().ul_um_rlc.sn_field_len = sn_field_len_e::size5; cnfg.um.rx_window_size = 16;
cnfg.um.rx_mod = 32;
rlc1.configure(&cnfg); cnfg.um.tx_sn_field_length = RLC_UMD_SN_SIZE_5_BITS;
rlc2.configure(&cnfg); cnfg.um.tx_mod = 32;
rlc1.configure(cnfg);
rlc2.configure(cnfg);
// Push SDUs into RLC1 // Push SDUs into RLC1
const int n_sdus = 25; const int n_sdus = 25;

@ -635,10 +635,12 @@ int enb::parse_sibs(all_args_t* args, rrc_cfg_t* rrc_cfg, phy_cfg_t* phy_config_
return -1; return -1;
} }
cell_access->plmn_id_list.resize(1); cell_access->plmn_id_list.resize(1);
if (not srslte::string_to_plmn_id(cell_access->plmn_id_list[0].plmn_id, mcc_str + mnc_str)) { srslte::plmn_id_t plmn;
if (plmn.from_string(mcc_str + mnc_str) == SRSLTE_ERROR) {
ERROR("Could not convert %s to a plmn_id\n", (mcc_str + mnc_str).c_str()); ERROR("Could not convert %s to a plmn_id\n", (mcc_str + mnc_str).c_str());
return -1; return -1;
} }
plmn.to_asn1(&cell_access->plmn_id_list[0].plmn_id);
cell_access->plmn_id_list[0].cell_reserved_for_oper = plmn_id_info_s::cell_reserved_for_oper_e_::not_reserved; cell_access->plmn_id_list[0].cell_reserved_for_oper = plmn_id_info_s::cell_reserved_for_oper_e_::not_reserved;
sib1->cell_sel_info.q_rx_lev_min_offset = 0; sib1->cell_sel_info.q_rx_lev_min_offset = 0;

@ -22,6 +22,7 @@
#include "srsenb/hdr/stack/rrc/rrc.h" #include "srsenb/hdr/stack/rrc/rrc.h"
#include "srslte/asn1/asn1_utils.h" #include "srslte/asn1/asn1_utils.h"
#include "srslte/asn1/liblte_mme.h" #include "srslte/asn1/liblte_mme.h"
#include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/int_helpers.h" #include "srslte/common/int_helpers.h"
#include "srslte/interfaces/sched_interface.h" #include "srslte/interfaces/sched_interface.h"
@ -761,8 +762,9 @@ void rrc::configure_mbsfn_sibs(sib_type2_s* sib2, sib_type13_r9_s* sib13)
pmch_item->mbms_session_info_list_r9[0].session_id_r9_present = true; pmch_item->mbms_session_info_list_r9[0].session_id_r9_present = true;
pmch_item->mbms_session_info_list_r9[0].session_id_r9[0] = 0; pmch_item->mbms_session_info_list_r9[0].session_id_r9[0] = 0;
pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.set_explicit_value_r9(); pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.set_explicit_value_r9();
pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9().mcc_present = true; srslte::plmn_id_t plmn_obj;
srslte::string_to_plmn_id(pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9(), "00003"); plmn_obj.from_string("00003");
plmn_obj.to_asn1(&pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9());
uint8_t byte[] = {0x0, 0x0, 0x0}; uint8_t byte[] = {0x0, 0x0, 0x0};
memcpy(&pmch_item->mbms_session_info_list_r9[0].tmgi_r9.service_id_r9[0], &byte[0], 3); memcpy(&pmch_item->mbms_session_info_list_r9[0].tmgi_r9.service_id_r9[0], &byte[0], 3);
@ -770,8 +772,8 @@ void rrc::configure_mbsfn_sibs(sib_type2_s* sib2, sib_type13_r9_s* sib13)
pmch_item->mbms_session_info_list_r9[1].lc_ch_id_r9 = 2; pmch_item->mbms_session_info_list_r9[1].lc_ch_id_r9 = 2;
pmch_item->mbms_session_info_list_r9[1].session_id_r9_present = true; pmch_item->mbms_session_info_list_r9[1].session_id_r9_present = true;
pmch_item->mbms_session_info_list_r9[1].session_id_r9[0] = 1; pmch_item->mbms_session_info_list_r9[1].session_id_r9[0] = 1;
pmch_item->mbms_session_info_list_r9[1].tmgi_r9.plmn_id_r9.set_explicit_value_r9(); pmch_item->mbms_session_info_list_r9[1].tmgi_r9.plmn_id_r9.set_explicit_value_r9() =
srslte::string_to_plmn_id(pmch_item->mbms_session_info_list_r9[1].tmgi_r9.plmn_id_r9.explicit_value_r9(), "00003"); pmch_item->mbms_session_info_list_r9[0].tmgi_r9.plmn_id_r9.explicit_value_r9();
byte[2] = 1; byte[2] = 1;
memcpy(&pmch_item->mbms_session_info_list_r9[1].tmgi_r9.service_id_r9[0], &byte[0], memcpy(&pmch_item->mbms_session_info_list_r9[1].tmgi_r9.service_id_r9[0], &byte[0],
3); // FIXME: Check if service is set to 1 3); // FIXME: Check if service is set to 1
@ -1749,7 +1751,9 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
parent->pdcp->enable_encryption(rnti, 2); parent->pdcp->enable_encryption(rnti, 2);
// Configure DRB1 in RLC // Configure DRB1 in RLC
parent->rlc->add_bearer(rnti, 3, &conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].rlc_cfg); srslte::srslte_rlc_config_t rlc_cfg;
srslte::convert_from_asn1(&rlc_cfg, conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].rlc_cfg);
parent->rlc->add_bearer(rnti, 3, rlc_cfg);
// Configure DRB1 in PDCP // Configure DRB1 in PDCP
pdcp_cnfg.is_control = false; pdcp_cnfg.is_control = false;
@ -1816,7 +1820,9 @@ void rrc::ue::send_connection_reconf_new_bearer(LIBLTE_S1AP_E_RABTOBESETUPLISTBE
parent->mac->bearer_ue_cfg(rnti, lcid, &bearer_cfg); parent->mac->bearer_ue_cfg(rnti, lcid, &bearer_cfg);
// Configure DRB in RLC // Configure DRB in RLC
parent->rlc->add_bearer(rnti, lcid, &drb_item.rlc_cfg); srslte::srslte_rlc_config_t rlc_cfg;
srslte::convert_from_asn1(&rlc_cfg, drb_item.rlc_cfg);
parent->rlc->add_bearer(rnti, lcid, rlc_cfg);
// Configure DRB in PDCP // Configure DRB in PDCP
srslte::srslte_pdcp_config_t pdcp_config; srslte::srslte_pdcp_config_t pdcp_config;

@ -21,6 +21,7 @@
#include "srsenb/hdr/stack/upper/common_enb.h" #include "srsenb/hdr/stack/upper/common_enb.h"
#include "srslte/asn1/rrc_asn1.h" #include "srslte/asn1/rrc_asn1.h"
#include "srslte/asn1/rrc_asn1_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include <iostream> #include <iostream>
@ -62,8 +63,8 @@ int rrc_plmn_test()
TESTASSERT(plmn_in.mnc == plmn_out.mnc); TESTASSERT(plmn_in.mnc == plmn_out.mnc);
// Test plmn --> string // Test plmn --> string
std::string mccmnc_str = srslte::plmn_id_to_string(plmn_in); srslte::plmn_id_t srsplmn_out(plmn_out);
TESTASSERT(mccmnc_str == "12345"); TESTASSERT(srsplmn_out.to_string() == "12345");
asn1::bit_ref bref_in(&byte_buf[0], sizeof(byte_buf)); asn1::bit_ref bref_in(&byte_buf[0], sizeof(byte_buf));
asn1::bit_ref bref_in0(&byte_buf[0], sizeof(byte_buf)); asn1::bit_ref bref_in0(&byte_buf[0], sizeof(byte_buf));

@ -104,8 +104,7 @@ class cell_t
srslte::plmn_id_t get_plmn(uint32_t idx) srslte::plmn_id_t get_plmn(uint32_t idx)
{ {
if (idx < sib1.cell_access_related_info.plmn_id_list.size() && has_valid_sib1) { if (idx < sib1.cell_access_related_info.plmn_id_list.size() && has_valid_sib1) {
srslte::plmn_id_t ret; srslte::plmn_id_t ret(sib1.cell_access_related_info.plmn_id_list[idx].plmn_id);
ret.from_asn1(&sib1.cell_access_related_info.plmn_id_list[idx].plmn_id);
return ret; return ret;
} else { } else {
return {}; return {};

@ -1156,7 +1156,7 @@ std::string rrc::print_mbms()
ss << ", Session ID: " << sess->session_id_r9.to_string(); ss << ", Session ID: " << sess->session_id_r9.to_string();
} }
if (sess->tmgi_r9.plmn_id_r9.type() == tmgi_r9_s::plmn_id_r9_c_::types::explicit_value_r9) { if (sess->tmgi_r9.plmn_id_r9.type() == tmgi_r9_s::plmn_id_r9_c_::types::explicit_value_r9) {
ss << ", MCC: " << mcc_bytes_to_string(sess->tmgi_r9.plmn_id_r9.explicit_value_r9().mcc); ss << ", MCC: " << mcc_bytes_to_string(&sess->tmgi_r9.plmn_id_r9.explicit_value_r9().mcc[0]);
ss << ", MNC: " << mnc_bytes_to_string(sess->tmgi_r9.plmn_id_r9.explicit_value_r9().mnc); ss << ", MNC: " << mnc_bytes_to_string(sess->tmgi_r9.plmn_id_r9.explicit_value_r9().mnc);
} else { } else {
ss << ", PLMN index: " << sess->tmgi_r9.plmn_id_r9.plmn_idx_r9(); ss << ", PLMN index: " << sess->tmgi_r9.plmn_id_r9.plmn_idx_r9();
@ -2087,8 +2087,7 @@ void rrc::process_pcch(unique_byte_buffer_t pdu)
} }
for (uint32_t i = 0; i < paging->paging_record_list.size(); i++) { for (uint32_t i = 0; i < paging->paging_record_list.size(); i++) {
s_tmsi_t s_tmsi_paged; s_tmsi_t s_tmsi_paged(paging->paging_record_list[i].ue_id.s_tmsi());
s_tmsi_paged.from_asn1(&paging->paging_record_list[i].ue_id.s_tmsi());
rrc_log->info("Received paging (%d/%d) for UE %" PRIu64 ":%" PRIu64 "\n", rrc_log->info("Received paging (%d/%d) for UE %" PRIu64 ":%" PRIu64 "\n",
i + 1, i + 1,
paging->paging_record_list.size(), paging->paging_record_list.size(),
@ -3098,7 +3097,9 @@ void rrc::add_srb(srb_to_add_mod_s* srb_cnfg)
if (srb_cnfg->rlc_cfg.type() == srb_to_add_mod_s::rlc_cfg_c_::types::default_value) { if (srb_cnfg->rlc_cfg.type() == srb_to_add_mod_s::rlc_cfg_c_::types::default_value) {
rlc->add_bearer(srb_cnfg->srb_id); rlc->add_bearer(srb_cnfg->srb_id);
}else{ }else{
rlc->add_bearer(srb_cnfg->srb_id, srslte_rlc_config_t(&srb_cnfg->rlc_cfg.explicit_value())); srslte_rlc_config_t rlc_cfg;
srslte::convert_from_asn1(&rlc_cfg, srb_cnfg->rlc_cfg.explicit_value());
rlc->add_bearer(srb_cnfg->srb_id, rlc_cfg);
} }
} }
@ -3175,7 +3176,9 @@ void rrc::add_drb(drb_to_add_mod_s* drb_cnfg)
pdcp->enable_encryption(lcid); pdcp->enable_encryption(lcid);
// Setup RLC // Setup RLC
rlc->add_bearer(lcid, srslte_rlc_config_t(&drb_cnfg->rlc_cfg)); srslte_rlc_config_t rlc_cfg;
srslte::convert_from_asn1(&rlc_cfg, drb_cnfg->rlc_cfg);
rlc->add_bearer(lcid, rlc_cfg);
// Setup MAC // Setup MAC
uint8_t log_chan_group = 0; uint8_t log_chan_group = 0;

@ -20,7 +20,6 @@
*/ */
#include "srsue/hdr/stack/upper/nas.h" #include "srsue/hdr/stack/upper/nas.h"
#include "srslte/asn1/rrc_asn1.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include <fstream> #include <fstream>
@ -31,17 +30,14 @@
#include <unistd.h> #include <unistd.h>
#include "srslte/asn1/liblte_mme.h" #include "srslte/asn1/liblte_mme.h"
#include "srslte/asn1/rrc_asn1.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/security.h" #include "srslte/common/security.h"
#include "srsue/hdr/stack/upper/nas.h" #include "srsue/hdr/stack/upper/nas.h"
using namespace srslte; using namespace srslte;
using namespace asn1::rrc;
namespace srsue { namespace srsue {
/********************************************************************* /*********************************************************************
* NAS * NAS
********************************************************************/ ********************************************************************/

Loading…
Cancel
Save