stack: move initialization of log object into ctor

this fixes the issue when the stack is torn down if, for example,
the radio couldn't be loaded correctly. it will hence call stop() on all stack
components which are not initialzized yet, and logging therefore doesn't work.
the log object is know during contruction time and therefore can be passed
in as soon as possible.
master
Andre Puschmann 6 years ago
parent 000c9c87b4
commit 58763fb714

@ -35,10 +35,9 @@ class pdcp
,public srsue::pdcp_interface_rrc
{
public:
pdcp();
pdcp(log* log_);
virtual ~pdcp();
void
init(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_, log* pdcp_log_);
void init(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_);
void stop();
// GW interface

@ -43,11 +43,10 @@ class rlc
,public srsue::rlc_interface_rrc
{
public:
rlc();
rlc(log* rlc_log_);
virtual ~rlc();
void init(srsue::pdcp_interface_rlc* pdcp_,
srsue::rrc_interface_rlc* rrc_,
log* rlc_log_,
mac_interface_timers* mac_timers_,
uint32_t lcid_);
void stop();
@ -87,13 +86,13 @@ public:
bool has_bearer(uint32_t lcid);
private:
void reset_metrics();
byte_buffer_pool *pool;
srslte::log *rlc_log;
srsue::pdcp_interface_rlc *pdcp;
srsue::rrc_interface_rlc *rrc;
srslte::mac_interface_timers *mac_timers;
void reset_metrics();
byte_buffer_pool* pool = nullptr;
srslte::log* rlc_log = nullptr;
srsue::pdcp_interface_rlc* pdcp = nullptr;
srsue::rrc_interface_rlc* rrc = nullptr;
srslte::mac_interface_timers* mac_timers = nullptr;
typedef std::map<uint16_t, rlc_common*> rlc_map_t;
typedef std::pair<uint16_t, rlc_common*> rlc_map_pair_t;
@ -101,10 +100,10 @@ private:
rlc_map_t rlc_array, rlc_array_mrb;
pthread_rwlock_t rwlock;
uint32_t default_lcid;
uint32_t default_lcid = 0;
// Timer needed for metrics calculation
struct timeval metrics_time[3];
struct timeval metrics_time[3] = {};
bool valid_lcid(uint32_t lcid);
bool valid_lcid_mrb(uint32_t lcid);

@ -23,7 +23,7 @@
namespace srslte {
pdcp::pdcp()
pdcp::pdcp(srslte::log* log_) : pdcp_log(log_)
{
pthread_rwlock_init(&rwlock, NULL);
}
@ -46,15 +46,11 @@ pdcp::~pdcp()
pthread_rwlock_destroy(&rwlock);
}
void pdcp::init(srsue::rlc_interface_pdcp* rlc_,
srsue::rrc_interface_pdcp* rrc_,
srsue::gw_interface_pdcp* gw_,
log* pdcp_log_)
void pdcp::init(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_)
{
rlc = rlc_;
rrc = rrc_;
gw = gw_;
pdcp_log = pdcp_log_;
}
void pdcp::stop()

@ -28,13 +28,9 @@ using namespace asn1::rrc;
namespace srslte {
rlc::rlc()
rlc::rlc(log* log_) : rlc_log(log_)
{
pool = byte_buffer_pool::get_instance();
rlc_log = NULL;
pdcp = NULL;
rrc = NULL;
mac_timers = NULL;
bzero(metrics_time, sizeof(metrics_time));
pthread_rwlock_init(&rwlock, NULL);
}
@ -59,13 +55,11 @@ rlc::~rlc()
void rlc::init(srsue::pdcp_interface_rlc* pdcp_,
srsue::rrc_interface_rlc* rrc_,
log* rlc_log_,
mac_interface_timers* mac_timers_,
uint32_t lcid_)
{
pdcp = pdcp_;
rrc = rrc_;
rlc_log = rlc_log_;
mac_timers = mac_timers_;
default_lcid = lcid_;

@ -337,15 +337,15 @@ void stress_test(stress_test_args_t args)
stack_dummy stack;
rlc rlc1;
rlc rlc2;
rlc rlc1(&log1);
rlc rlc2(&log2);
rlc_tester tester1(&rlc1, "tester1", args, lcid);
rlc_tester tester2(&rlc2, "tester2", args, lcid);
mac_dummy mac(&rlc1, &rlc2, args, lcid, &stack, &pcap);
rlc1.init(&tester1, &tester1, &log1, &stack, 0);
rlc2.init(&tester2, &tester2, &log2, &stack, 0);
rlc1.init(&tester1, &tester1, &stack, 0);
rlc2.init(&tester2, &tester2, &stack, 0);
// only add AM and UM bearers
if (args.mode != "TM") {

@ -34,8 +34,9 @@ class pdcp : public pdcp_interface_rlc,
public pdcp_interface_rrc
{
public:
pdcp(srslte::log* pdcp_log_);
virtual ~pdcp() {};
void init(rlc_interface_pdcp *rlc_, rrc_interface_pdcp *rrc_, gtpu_interface_pdcp *gtpu_, srslte::log *pdcp_log_);
void init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_);
void stop();
// pdcp_interface_rlc

@ -28,7 +28,7 @@ using namespace srslte;
namespace srsenb {
enb_stack_lte::enb_stack_lte() : args(), started(false), logger(nullptr), phy(nullptr) {}
enb_stack_lte::enb_stack_lte() : args(), started(false), logger(nullptr), phy(nullptr), pdcp(&pdcp_log) {}
enb_stack_lte::~enb_stack_lte()
{
@ -120,7 +120,7 @@ int enb_stack_lte::init(const args_t& args_, const rrc_cfg_t& rrc_cfg_, srslte::
// Init all layers
mac.init(args.expert.mac, &cell_cfg, phy, &rlc, &rrc, &mac_log);
rlc.init(&pdcp, &rrc, &mac, &mac, &rlc_log);
pdcp.init(&rlc, &rrc, &gtpu, &pdcp_log);
pdcp.init(&rlc, &rrc, &gtpu);
rrc.init(&rrc_cfg, phy, &mac, &rlc, &pdcp, &s1ap, &gtpu, &rrc_log);
s1ap.init(args.enb.s1ap, &rrc, &s1ap_log);
gtpu.init(args.enb.s1ap.gtp_bind_addr,

@ -23,13 +23,14 @@
#include "srsenb/hdr/stack/upper/common_enb.h"
namespace srsenb {
void pdcp::init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_, srslte::log* pdcp_log_)
pdcp::pdcp(srslte::log* log_) : log_h(log_) {}
void pdcp::init(rlc_interface_pdcp* rlc_, rrc_interface_pdcp* rrc_, gtpu_interface_pdcp* gtpu_)
{
rlc = rlc_;
rrc = rrc_;
gtpu = gtpu_;
log_h = pdcp_log_;
pool = srslte::byte_buffer_pool::get_instance();
@ -51,8 +52,8 @@ void pdcp::add_user(uint16_t rnti)
{
pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti) == 0) {
srslte::pdcp *obj = new srslte::pdcp;
obj->init(&users[rnti].rlc_itf, &users[rnti].rrc_itf, &users[rnti].gtpu_itf, log_h);
srslte::pdcp* obj = new srslte::pdcp(log_h);
obj->init(&users[rnti].rlc_itf, &users[rnti].rrc_itf, &users[rnti].gtpu_itf);
users[rnti].rlc_itf.rnti = rnti;
users[rnti].gtpu_itf.rnti = rnti;
users[rnti].rrc_itf.rnti = rnti;

@ -53,8 +53,8 @@ void rlc::add_user(uint16_t rnti)
{
pthread_rwlock_rdlock(&rwlock);
if (users.count(rnti) == 0) {
std::unique_ptr<srslte::rlc> obj(new srslte::rlc);
obj->init(&users[rnti], &users[rnti], log_h, mac_timers, RB_ID_SRB0);
std::unique_ptr<srslte::rlc> obj(new srslte::rlc(log_h));
obj->init(&users[rnti], &users[rnti], mac_timers, RB_ID_SRB0);
users[rnti].rnti = rnti;
users[rnti].pdcp = pdcp;
users[rnti].rrc = rrc;

@ -49,9 +49,9 @@ class mac : public mac_interface_phy_lte,
public mac_interface_demux
{
public:
mac();
mac(srslte::log* log_);
~mac();
bool init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc, srslte::log* log_h);
bool init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc);
void stop();
void get_metrics(mac_metrics_t m[SRSLTE_MAX_CARRIERS]);

@ -285,7 +285,7 @@ class rrc : public rrc_interface_nas,
public thread
{
public:
rrc();
rrc(srslte::log* rrc_log_);
~rrc();
void init(phy_interface_rrc_lte* phy_,
@ -296,7 +296,6 @@ public:
usim_interface_rrc* usim_,
gw_interface_rrc* gw_,
srslte::mac_interface_timers* mac_timers_,
srslte::log* rrc_log_,
const rrc_args_t& args_);
void stop();

@ -122,7 +122,7 @@ private:
srsue::stack_args_t args;
// UE stack logging
srslte::logger* logger;
srslte::logger* logger = nullptr;
srslte::log_filter mac_log;
srslte::log_filter rlc_log;
srslte::log_filter pdcp_log;
@ -142,8 +142,8 @@ private:
std::unique_ptr<usim_base> usim;
// RAT-specific interfaces
phy_interface_stack_lte* phy;
gw_interface_stack* gw;
phy_interface_stack_lte* phy = nullptr;
gw_interface_stack* gw = nullptr;
// Thread
static const int STACK_MAIN_THREAD_PRIO = -1; // Use default high-priority below UHD

@ -42,11 +42,10 @@ class nas
public nas_interface_gw
{
public:
nas();
nas(srslte::log* log_);
void init(usim_interface_nas* usim_,
rrc_interface_nas* rrc_,
gw_interface_nas* gw_,
srslte::log* nas_log_,
nas_args_t args_);
void stop();

@ -58,9 +58,9 @@ class pcsc_usim
:public usim_base
{
public:
pcsc_usim();
pcsc_usim(srslte::log* log_);
~pcsc_usim();
int init(usim_args_t *args, srslte::log *usim_log_);
int init(usim_args_t* args);
void stop();
// NAS interface

@ -35,8 +35,8 @@ class usim
:public usim_base
{
public:
usim();
int init(usim_args_t *args, srslte::log *usim_log_);
usim(srslte::log* log_);
int init(usim_args_t* args);
void stop();
// NAS interface

@ -58,9 +58,9 @@ class usim_base
public:
usim_base();
virtual ~usim_base();
static std::unique_ptr<usim_base> get_instance(usim_args_t* args);
static std::unique_ptr<usim_base> get_instance(usim_args_t* args, srslte::log* log_);
virtual int init(usim_args_t *args, srslte::log *usim_log_) = 0;
virtual int init(usim_args_t* args) = 0;
virtual void stop() = 0;
// NAS interface

@ -37,7 +37,7 @@ using namespace asn1::rrc;
namespace srsue {
mac::mac() : timers(64), pdu_process_thread(&demux_unit), mch_msg(10), pcap(nullptr)
mac::mac(srslte::log* log_) : timers(64), pdu_process_thread(&demux_unit), mch_msg(10), pcap(nullptr), log_h(log_)
{
// Create PCell HARQ entities
auto ul = ul_harq_entity_ptr(new ul_harq_entity());
@ -65,12 +65,11 @@ mac::~mac()
srslte_softbuffer_rx_free(&mch_softbuffer);
}
bool mac::init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc, srslte::log* log_h_)
bool mac::init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc)
{
phy_h = phy;
rlc_h = rlc;
rrc_h = rrc;
log_h = log_h_;
timer_alignment = timers.get_unique_id();
uint32_t contention_resolution_timer = timers.get_unique_id();

@ -46,7 +46,8 @@ const static uint32_t required_sibs[NOF_REQUIRED_SIBS] = {0,1,2,12}; // SIB1, SI
Base functions
*******************************************************************************/
rrc::rrc() :
rrc::rrc(srslte::log* log_) :
rrc_log(log_),
state(RRC_STATE_IDLE),
last_state(RRC_STATE_CONNECTED),
drb_up(false),
@ -121,7 +122,6 @@ void rrc::init(phy_interface_rrc_lte* phy_,
usim_interface_rrc* usim_,
gw_interface_rrc* gw_,
mac_interface_timers* mac_timers_,
srslte::log* rrc_log_,
const rrc_args_t& args_)
{
pool = byte_buffer_pool::get_instance();
@ -132,7 +132,6 @@ void rrc::init(phy_interface_rrc_lte* phy_,
nas = nas_;
usim = usim_;
gw = gw_;
rrc_log = rrc_log_;
args = args_;

@ -26,7 +26,20 @@ using namespace srslte;
namespace srsue {
ue_stack_lte::ue_stack_lte() : running(false), args(), logger(nullptr), usim(nullptr), phy(nullptr), thread("STACK") {}
ue_stack_lte::ue_stack_lte() :
running(false),
args(),
logger(nullptr),
usim(nullptr),
phy(nullptr),
rlc(&rlc_log),
mac(&mac_log),
rrc(&rrc_log),
pdcp(&pdcp_log),
nas(&nas_log),
thread("STACK")
{
}
ue_stack_lte::~ue_stack_lte()
{
@ -95,17 +108,17 @@ int ue_stack_lte::init(const stack_args_t& args_, srslte::logger* logger_)
}
// Init USIM first to allow early exit in case reader couldn't be found
usim = usim_base::get_instance(&args.usim);
if (usim->init(&args.usim, &usim_log)) {
usim = usim_base::get_instance(&args.usim, &usim_log);
if (usim->init(&args.usim)) {
usim_log.console("Failed to initialize USIM.\n");
return SRSLTE_ERROR;
}
mac.init(phy, &rlc, &rrc, &mac_log);
rlc.init(&pdcp, &rrc, &rlc_log, &mac, 0 /* RB_ID_SRB0 */);
pdcp.init(&rlc, &rrc, gw, &pdcp_log);
nas.init(usim.get(), &rrc, gw, &nas_log, args.nas);
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, &mac, &rrc_log, args.rrc);
mac.init(phy, &rlc, &rrc);
rlc.init(&pdcp, &rrc, &mac, 0 /* RB_ID_SRB0 */);
pdcp.init(&rlc, &rrc, gw);
nas.init(usim.get(), &rrc, gw, args.nas);
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, &mac, args.rrc);
running = true;
start(STACK_MAIN_THREAD_PRIO);

@ -46,7 +46,13 @@ namespace srsue {
* NAS
********************************************************************/
nas::nas() : state(EMM_STATE_DEREGISTERED), have_guti(false), have_ctxt(false), auth_request(false), ip_addr(0)
nas::nas(srslte::log* log_) :
nas_log(log_),
state(EMM_STATE_DEREGISTERED),
have_guti(false),
have_ctxt(false),
auth_request(false),
ip_addr(0)
{
ctxt.rx_count = 0;
ctxt.tx_count = 0;
@ -59,14 +65,12 @@ nas::nas() : state(EMM_STATE_DEREGISTERED), have_guti(false), have_ctxt(false),
bzero(eea_caps, sizeof(eea_caps));
}
void nas::init(
usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_nas* gw_, srslte::log* nas_log_, nas_args_t cfg_)
void nas::init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_nas* gw_, nas_args_t cfg_)
{
pool = byte_buffer_pool::get_instance();
usim = usim_;
rrc = rrc_;
gw = gw_;
nas_log = nas_log_;
state = EMM_STATE_DEREGISTERED;
if (!usim->get_home_plmn_id(&home_plmn)) {

@ -32,7 +32,7 @@ using namespace asn1::rrc;
namespace srsue {
pcsc_usim::pcsc_usim()
pcsc_usim::pcsc_usim(srslte::log* log_) : log(log_)
{
bzero(ck, CK_LEN);
bzero(ik, IK_LEN);
@ -47,12 +47,11 @@ pcsc_usim::~pcsc_usim()
}
}
int pcsc_usim::init(usim_args_t *args, srslte::log *log_)
int pcsc_usim::init(usim_args_t* args)
{
int ret = SRSLTE_ERROR;
log = log_;
if (sc.init(args, log_) != SRSLTE_SUCCESS) {
if (sc.init(args, log) != SRSLTE_SUCCESS) {
return ret;
}

@ -28,12 +28,10 @@ using namespace asn1::rrc;
namespace srsue{
usim::usim() : initiated(false)
{}
usim::usim(srslte::log* log_) : usim_log(log_), initiated(false) {}
int usim::init(usim_args_t *args, srslte::log *usim_log_)
int usim::init(usim_args_t* args)
{
usim_log = usim_log_;
imsi_str = args->imsi;
imei_str = args->imei;

@ -28,16 +28,16 @@
namespace srsue {
std::unique_ptr<usim_base> usim_base::get_instance(usim_args_t* args)
std::unique_ptr<usim_base> usim_base::get_instance(usim_args_t* args, srslte::log* log_)
{
#if HAVE_PCSC
if (args->mode == "pcsc") {
return std::unique_ptr<usim_base>(new pcsc_usim());
return std::unique_ptr<usim_base>(new pcsc_usim(log_));
}
#endif
// default to soft USIM
return std::unique_ptr<usim_base>(new usim());
return std::unique_ptr<usim_base>(new usim(log_));
}
usim_base::usim_base() {

@ -162,8 +162,8 @@ int mac_unpack_test()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
// create dummy DL action and grant and push MAC PDU
mac_interface_phy_lte::tb_action_dl_t dl_action;
@ -216,8 +216,8 @@ int mac_ul_sch_pdu_test1()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
const uint16_t crnti = 0x1001;
mac.set_ho_rnti(crnti, 0);
@ -282,8 +282,8 @@ int mac_ul_logical_channel_prioritization_test1()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
const uint16_t crnti = 0x1001;
mac.set_ho_rnti(crnti, 0);
@ -393,8 +393,8 @@ int mac_ul_logical_channel_prioritization_test2()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
const uint16_t crnti = 0x1001;
mac.set_ho_rnti(crnti, 0);
@ -491,8 +491,8 @@ int mac_ul_logical_channel_prioritization_test3()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
const uint16_t crnti = 0x1001;
mac.set_ho_rnti(crnti, 0);
@ -577,8 +577,8 @@ int mac_ul_sch_pdu_with_short_bsr_test()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
const uint16_t crnti = 0x1001;
mac.set_ho_rnti(crnti, 0);
@ -663,8 +663,8 @@ int mac_ul_sch_pdu_with_padding_bsr_test()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
const uint16_t crnti = 0x1001;
mac.set_ho_rnti(crnti, 0);
@ -718,8 +718,8 @@ int mac_ul_sch_pdu_one_byte_test()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
const uint16_t crnti = 0x1001;
mac.set_ho_rnti(crnti, 0);
@ -776,8 +776,8 @@ int mac_ul_sch_pdu_two_byte_test()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
const uint16_t crnti = 0x1001;
mac.set_ho_rnti(crnti, 0);
@ -834,8 +834,8 @@ int mac_ul_sch_pdu_three_byte_test()
rrc_dummy rrc;
// the actual MAC
mac mac;
mac.init(&phy, &rlc, &rrc, &mac_log);
mac mac(&mac_log);
mac.init(&phy, &rlc, &rrc);
const uint16_t crnti = 0x1001;
mac.set_ho_rnti(crnti, 0);

@ -202,17 +202,17 @@ int security_command_test()
args.using_op = true;
// init USIM
srsue::usim usim;
srsue::usim usim(&usim_log);
bool net_valid;
uint8_t res[16];
usim.init(&args, &usim_log);
usim.init(&args);
{
srsue::nas nas;
srsue::nas nas(&nas_log);
nas_args_t cfg;
cfg.eia = "1,2";
cfg.eea = "0,1,2";
nas.init(&usim, &rrc_dummy, &gw, &nas_log, cfg);
nas.init(&usim, &rrc_dummy, &gw, cfg);
// push auth request PDU to NAS to generate security context
byte_buffer_pool* pool = byte_buffer_pool::get_instance();
@ -262,7 +262,7 @@ int mme_attach_request_test()
rrc_dummy rrc_dummy;
pdcp_dummy pdcp_dummy;
srsue::usim usim;
srsue::usim usim(&usim_log);
usim_args_t args;
args.mode = "soft";
args.algo = "xor";
@ -270,17 +270,17 @@ int mme_attach_request_test()
args.imsi = "001010123456789";
args.k = "00112233445566778899aabbccddeeff";
args.op = "63BFA50EE6523365FF14C1F45F88737D";
usim.init(&args, &usim_log);
usim.init(&args);
{
nas_args_t nas_cfg;
nas_cfg.force_imsi_attach = true;
nas_cfg.apn_name = "test123";
srsue::nas nas;
srsue::nas nas(&nas_log);
srsue::gw gw;
stack_dummy stack(&pdcp_dummy, &nas);
nas.init(&usim, &rrc_dummy, &gw, &nas_log, nas_cfg);
nas.init(&usim, &rrc_dummy, &gw, nas_cfg);
gw_args_t gw_args;
gw_args.tun_dev_name = "tun0";
@ -347,22 +347,22 @@ int esm_info_request_test()
args.op = "63BFA50EE6523365FF14C1F45F88737D";
// init USIM
srsue::usim usim;
srsue::usim usim(&usim_log);
bool net_valid;
uint8_t res[16];
usim.init(&args, &usim_log);
usim.init(&args);
srslte::byte_buffer_pool *pool;
pool = byte_buffer_pool::get_instance();
{
srsue::nas nas;
srsue::nas nas(&nas_log);
nas_args_t cfg;
cfg.apn_name = "srslte";
cfg.apn_user = "srsuser";
cfg.apn_pass = "srspass";
cfg.force_imsi_attach = true;
nas.init(&usim, &rrc_dummy, &gw, &nas_log, cfg);
nas.init(&usim, &rrc_dummy, &gw, cfg);
// push ESM info request PDU to NAS to generate response
unique_byte_buffer_t tmp = srslte::allocate_unique_buffer(*pool, true);
@ -404,15 +404,15 @@ int dedicated_eps_bearer_test()
args.op = "63BFA50EE6523365FF14C1F45F88737D";
// init USIM
srsue::usim usim;
usim.init(&args, &usim_log);
srsue::usim usim(&usim_log);
usim.init(&args);
srslte::byte_buffer_pool* pool = byte_buffer_pool::get_instance();
srsue::nas nas;
srsue::nas nas(&nas_log);
nas_args_t cfg = {};
cfg.force_imsi_attach = true; // make sure we get a fresh security context
nas.init(&usim, &rrc_dummy, &gw, &nas_log, cfg);
nas.init(&usim, &rrc_dummy, &gw, cfg);
// push dedicated EPS bearer PDU to NAS
unique_byte_buffer_t tmp = srslte::allocate_unique_buffer(*pool, true);

@ -47,8 +47,8 @@ int main(int argc, char **argv)
args.pin = "6129";
args.imei = "353490069873319";
srsue::pcsc_usim usim;
if (usim.init(&args, &usim_log)) {
srsue::pcsc_usim usim(&usim_log);
if (usim.init(&args)) {
printf("Error initializing PC/SC USIM.\n");
return SRSLTE_ERROR;
};

@ -63,7 +63,6 @@ uint16 mnc = 93;
int main(int argc, char **argv)
{
srslte::log_filter usim_log("USIM");
bool net_valid;
uint8_t res[16];
int res_len;
uint8_t k_asme[32];
@ -76,8 +75,8 @@ int main(int argc, char **argv)
args.using_op = true;
args.op = "11111111111111111111111111111111";
srsue::usim usim;
usim.init(&args, &usim_log);
srsue::usim usim(&usim_log);
usim.init(&args);
assert(usim.generate_authentication_response(rand_enb, autn_enb, mcc, mnc, res, &res_len, k_asme) == AUTH_OK);
}

Loading…
Cancel
Save