diff --git a/srsue/hdr/upper/rrc.h b/srsue/hdr/upper/rrc.h index c758622fb..9cbdd5201 100644 --- a/srsue/hdr/upper/rrc.h +++ b/srsue/hdr/upper/rrc.h @@ -42,14 +42,20 @@ using srslte::byte_buffer_t; namespace srsue { +static std::string rb_id_str[] = {"SRB0", "SRB1", "SRB2", + "DRB1","DRB2","DRB3", + "DRB4","DRB5","DRB6", + "DRB7","DRB8"}; + + class rrc - :public rrc_interface_nas - ,public rrc_interface_phy - ,public rrc_interface_mac - ,public rrc_interface_gw - ,public rrc_interface_pdcp - ,public rrc_interface_rlc - ,public srslte::timer_callback + :public rrc_interface_nas + ,public rrc_interface_phy + ,public rrc_interface_mac + ,public rrc_interface_gw + ,public rrc_interface_pdcp + ,public rrc_interface_rlc + ,public srslte::timer_callback { public: rrc(); @@ -156,10 +162,17 @@ private: RB_ID_DRB5, RB_ID_DRB6, RB_ID_DRB7, - RB_ID_DRB8 + RB_ID_DRB8, + RB_ID_MAX } rb_id_t; - std::map bearers; - std::string get_rb_name(uint32_t lcid) { return bearers.at(lcid); } + + std::string get_rb_name(uint32_t lcid) { + if (lcid < RB_ID_MAX) { + return rb_id_str[lcid]; + } else { + return std::string("INVALID_RB"); + } + } // RLC interface void max_retx_attempted(); diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 291024c05..8b417f40d 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -45,7 +45,6 @@ rrc::rrc() :state(RRC_STATE_IDLE) ,drb_up(false) { - set_bearers(); } static void liblte_rrc_handler(void *ctx, char *str) { @@ -127,7 +126,7 @@ void rrc::set_ue_category(int category) void rrc::write_sdu(uint32_t lcid, byte_buffer_t *sdu) { - rrc_log->info_hex(sdu->msg, sdu->N_bytes, "RX %s SDU", bearers.at(lcid).c_str()); + rrc_log->info_hex(sdu->msg, sdu->N_bytes, "RX %s SDU", rb_id_str[lcid].c_str()); switch(state) { @@ -238,7 +237,7 @@ bool rrc::have_drb() void rrc::write_pdu(uint32_t lcid, byte_buffer_t *pdu) { - rrc_log->info_hex(pdu->msg, pdu->N_bytes, "TX %s PDU", bearers.at(lcid).c_str()); + rrc_log->info_hex(pdu->msg, pdu->N_bytes, "TX %s PDU", rb_id_str[lcid].c_str()); rrc_log->info("TX PDU Stack latency: %ld us\n", pdu->get_latency_us()); switch(lcid) @@ -804,7 +803,7 @@ void rrc::parse_dl_dcch(uint32_t lcid, byte_buffer_t *pdu) liblte_rrc_unpack_dl_dcch_msg((LIBLTE_BIT_MSG_STRUCT*)&bit_buf, &dl_dcch_msg); rrc_log->info("%s - Received %s\n", - bearers.at(lcid).c_str(), + rb_id_str[lcid].c_str(), liblte_rrc_dl_dcch_msg_type_text[dl_dcch_msg.msg_type]); // Reset and reuse pdu buffer if possible @@ -1387,7 +1386,7 @@ void rrc::add_srb(LIBLTE_RRC_SRB_TO_ADD_MOD_STRUCT *srb_cnfg) } srbs[srb_cnfg->srb_id] = *srb_cnfg; - rrc_log->info("Added radio bearer %s\n", bearers.at(srb_cnfg->srb_id).c_str()); + rrc_log->info("Added radio bearer %s\n", rb_id_str[srb_cnfg->srb_id].c_str()); } void rrc::add_drb(LIBLTE_RRC_DRB_TO_ADD_MOD_STRUCT *drb_cnfg) @@ -1448,7 +1447,7 @@ void rrc::add_drb(LIBLTE_RRC_DRB_TO_ADD_MOD_STRUCT *drb_cnfg) drbs[lcid] = *drb_cnfg; drb_up = true; - rrc_log->info("Added radio bearer %s\n", bearers.at(lcid).c_str()); + rrc_log->info("Added radio bearer %s\n", rb_id_str[lcid].c_str()); } void rrc::release_drb(uint8_t lcid) @@ -1504,19 +1503,4 @@ void rrc::set_rrc_default() { mac_timers->get(safe_reset_timer)->set(this, 10); } -void rrc::set_bearers() -{ - boost::assign::insert(bearers) (RB_ID_SRB0, "SRB0") - (RB_ID_SRB1, "SRB1") - (RB_ID_SRB2, "SRB2") - (RB_ID_DRB1, "DRB1") - (RB_ID_DRB2, "DRB2") - (RB_ID_DRB3, "DRB3") - (RB_ID_DRB4, "DRB4") - (RB_ID_DRB5, "DRB5") - (RB_ID_DRB6, "DRB6") - (RB_ID_DRB7, "DRB7") - (RB_ID_DRB8, "DRB8"); -} - } // namespace srsue