diff --git a/lib/include/srslte/upper/pdcp_entity_nr.h b/lib/include/srslte/upper/pdcp_entity_nr.h index 00cbc054d..244ff96a7 100644 --- a/lib/include/srslte/upper/pdcp_entity_nr.h +++ b/lib/include/srslte/upper/pdcp_entity_nr.h @@ -45,7 +45,7 @@ public: srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_, srslte::timer_handler* timers_, - srslte::log* log_); + srslte::log_ref log_); ~pdcp_entity_nr(); void init(uint32_t lcid_, pdcp_config_t cfg_); void reset(); diff --git a/lib/include/srslte/upper/rlc_um_nr.h b/lib/include/srslte/upper/rlc_um_nr.h index 45f9f40c8..576514c58 100644 --- a/lib/include/srslte/upper/rlc_um_nr.h +++ b/lib/include/srslte/upper/rlc_um_nr.h @@ -43,7 +43,7 @@ typedef struct { class rlc_um_nr : public rlc_um_base { public: - rlc_um_nr(srslte::log* log_, + rlc_um_nr(srslte::log_ref log_, uint32_t lcid_, srsue::pdcp_interface_rlc* pdcp_, srsue::rrc_interface_rlc* rrc_, diff --git a/lib/src/upper/pdcp_entity_nr.cc b/lib/src/upper/pdcp_entity_nr.cc index fa504f567..acff0ee0b 100644 --- a/lib/src/upper/pdcp_entity_nr.cc +++ b/lib/src/upper/pdcp_entity_nr.cc @@ -28,7 +28,7 @@ pdcp_entity_nr::pdcp_entity_nr(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_, srslte::timer_handler* timers_, - srslte::log* log_) : + srslte::log_ref log_) : pdcp_entity_base(timers_, log_), rlc(rlc_), rrc(rrc_), @@ -41,9 +41,9 @@ pdcp_entity_nr::~pdcp_entity_nr() {} void pdcp_entity_nr::init(uint32_t lcid_, pdcp_config_t cfg_) { - lcid = lcid_; - cfg = cfg_; - active = true; + lcid = lcid_; + cfg = cfg_; + active = true; integrity_direction = DIRECTION_NONE; encryption_direction = DIRECTION_NONE; @@ -72,9 +72,7 @@ void pdcp_entity_nr::reestablish() void pdcp_entity_nr::reset() { active = false; - if (log != nullptr) { - log->debug("Reset %s\n", rrc->get_rb_name(lcid).c_str()); - } + log->debug("Reset %s\n", rrc->get_rb_name(lcid).c_str()); } // SDAP/RRC interface diff --git a/lib/src/upper/rlc_um_nr.cc b/lib/src/upper/rlc_um_nr.cc index 5a054d205..5bc4924cf 100644 --- a/lib/src/upper/rlc_um_nr.cc +++ b/lib/src/upper/rlc_um_nr.cc @@ -28,7 +28,7 @@ using namespace asn1::rrc; namespace srslte { -rlc_um_nr::rlc_um_nr(srslte::log* log_, +rlc_um_nr::rlc_um_nr(srslte::log_ref log_, uint32_t lcid_, srsue::pdcp_interface_rlc* pdcp_, srsue::rrc_interface_rlc* rrc_, diff --git a/lib/test/upper/pdcp_nr_test.h b/lib/test/upper/pdcp_nr_test.h index 9f2e3c510..02a85b55f 100644 --- a/lib/test/upper/pdcp_nr_test.h +++ b/lib/test/upper/pdcp_nr_test.h @@ -95,7 +95,7 @@ pdcp_initial_state near_wraparound_init_state = {.tx_next = 4294967295, class pdcp_nr_test_helper { public: - pdcp_nr_test_helper(srslte::pdcp_config_t cfg, srslte::as_security_config_t sec_cfg, srslte::log* log) : + pdcp_nr_test_helper(srslte::pdcp_config_t cfg, srslte::as_security_config_t sec_cfg, srslte::log_ref log) : rlc(log), rrc(log), gw(log), @@ -129,7 +129,7 @@ srslte::unique_byte_buffer_t gen_expected_pdu(const srslte::unique_byte_buffer_t uint8_t pdcp_sn_len, srslte::as_security_config_t sec_cfg, srslte::byte_buffer_pool* pool, - srslte::log* log) + srslte::log_ref log) { srslte::pdcp_config_t cfg = {1, srslte::PDCP_RB_IS_DRB, @@ -162,7 +162,7 @@ std::vector gen_expected_pdus_vector(const srslte::unique_byt uint8_t pdcp_sn_len, srslte::as_security_config_t sec_cfg, srslte::byte_buffer_pool* pool, - srslte::log* log) + srslte::log_ref log) { std::vector pdu_vec; for (uint32_t tx_next : tx_nexts) { diff --git a/lib/test/upper/pdcp_nr_test_discard_sdu.cc b/lib/test/upper/pdcp_nr_test_discard_sdu.cc index fc4b7653f..ebb85fe21 100644 --- a/lib/test/upper/pdcp_nr_test_discard_sdu.cc +++ b/lib/test/upper/pdcp_nr_test_discard_sdu.cc @@ -28,7 +28,7 @@ int test_tx_sdu_discard(const pdcp_initial_state& init_state, srslte::pdcp_discard_timer_t discard_timeout, bool imediate_notify, srslte::byte_buffer_pool* pool, - srslte::log* log) + srslte::log_ref log) { srslte::pdcp_config_t cfg = {1, srslte::PDCP_RB_IS_DRB, @@ -82,7 +82,7 @@ int test_tx_sdu_discard(const pdcp_initial_state& init_state, * TX Test: PDCP Entity with SN LEN = 12 and 18. * PDCP entity configured with EIA2 and EEA2 */ -int test_tx_discard_all(srslte::byte_buffer_pool* pool, srslte::log* log) +int test_tx_discard_all(srslte::byte_buffer_pool* pool, srslte::log_ref log) { /* @@ -103,11 +103,11 @@ int test_tx_discard_all(srslte::byte_buffer_pool* pool, srslte::log* log) int run_all_tests(srslte::byte_buffer_pool* pool) { // Setup log - srslte::log_filter log("PDCP NR Test"); - log.set_level(srslte::LOG_LEVEL_DEBUG); - log.set_hex_limit(128); + srslte::log_ref log("PDCP NR Test"); + log->set_level(srslte::LOG_LEVEL_DEBUG); + log->set_hex_limit(128); - TESTASSERT(test_tx_discard_all(pool, &log) == 0); + TESTASSERT(test_tx_discard_all(pool, log) == 0); return 0; } diff --git a/lib/test/upper/pdcp_nr_test_rx.cc b/lib/test/upper/pdcp_nr_test_rx.cc index 55d8faf34..29be3ce13 100644 --- a/lib/test/upper/pdcp_nr_test_rx.cc +++ b/lib/test/upper/pdcp_nr_test_rx.cc @@ -30,7 +30,7 @@ int test_rx(std::vector events, uint32_t n_sdus_exp, const srslte::unique_byte_buffer_t& sdu_exp, srslte::byte_buffer_pool* pool, - srslte::log* log) + srslte::log_ref log) { @@ -70,7 +70,7 @@ int test_rx(std::vector events, * RX Test: PDCP Entity with SN LEN = 12 and 18. * PDCP entity configured with EIA2 and EEA2 */ -int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log) +int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log) { // Test SDUs srslte::unique_byte_buffer_t tst_sdu1 = allocate_unique_buffer(*pool); // SDU 1 @@ -232,11 +232,11 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log) int run_all_tests(srslte::byte_buffer_pool* pool) { // Setup log - srslte::log_filter log("PDCP NR Test RX"); - log.set_level(srslte::LOG_LEVEL_DEBUG); - log.set_hex_limit(128); + srslte::log_ref log("PDCP NR Test RX"); + log->set_level(srslte::LOG_LEVEL_DEBUG); + log->set_hex_limit(128); - TESTASSERT(test_rx_all(pool, &log) == 0); + TESTASSERT(test_rx_all(pool, log) == 0); return 0; } diff --git a/lib/test/upper/pdcp_nr_test_tx.cc b/lib/test/upper/pdcp_nr_test_tx.cc index a97337049..5db77e303 100644 --- a/lib/test/upper/pdcp_nr_test_tx.cc +++ b/lib/test/upper/pdcp_nr_test_tx.cc @@ -30,7 +30,7 @@ int test_tx(uint32_t n_packets, uint64_t n_pdus_exp, srslte::unique_byte_buffer_t pdu_exp, srslte::byte_buffer_pool* pool, - srslte::log* log) + srslte::log_ref log) { srslte::pdcp_config_t cfg = {1, srslte::PDCP_RB_IS_DRB, @@ -66,7 +66,7 @@ int test_tx(uint32_t n_packets, * TX Test: PDCP Entity with SN LEN = 12 and 18. * PDCP entity configured with EIA2 and EEA2 */ -int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log* log) +int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log_ref log) { uint64_t n_packets; /* @@ -209,11 +209,11 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log* log) int run_all_tests(srslte::byte_buffer_pool* pool) { // Setup log - srslte::log_filter log("PDCP NR Test TX"); - log.set_level(srslte::LOG_LEVEL_DEBUG); - log.set_hex_limit(128); + srslte::log_ref log("PDCP NR Test TX"); + log->set_level(srslte::LOG_LEVEL_DEBUG); + log->set_hex_limit(128); - TESTASSERT(test_tx_all(pool, &log) == 0); + TESTASSERT(test_tx_all(pool, log) == 0); return 0; } diff --git a/lib/test/upper/rlc_um_nr_test.cc b/lib/test/upper/rlc_um_nr_test.cc index 5bed76b6e..50939c071 100644 --- a/lib/test/upper/rlc_um_nr_test.cc +++ b/lib/test/upper/rlc_um_nr_test.cc @@ -84,14 +84,14 @@ public: log1("RLC_UM_1"), log2("RLC_UM_2"), timers(16), - rlc1(&log1, 3, &tester, &tester, &timers), - rlc2(&log2, 3, &tester, &tester, &timers) + rlc1(log1, 3, &tester, &tester, &timers), + rlc2(log2, 3, &tester, &tester, &timers) { // setup logging - log1.set_level(srslte::LOG_LEVEL_DEBUG); - log2.set_level(srslte::LOG_LEVEL_DEBUG); - log1.set_hex_limit(-1); - log2.set_hex_limit(-1); + log1->set_level(srslte::LOG_LEVEL_DEBUG); + log2->set_level(srslte::LOG_LEVEL_DEBUG); + log1->set_hex_limit(-1); + log2->set_hex_limit(-1); // configure RLC entities rlc_config_t cnfg = rlc_config_t::default_rlc_um_nr_config(6); @@ -105,7 +105,7 @@ public: tester.set_expected_sdu_len(1); } - srslte::log_filter log1, log2; + srslte::log_ref log1, log2; srslte::timer_handler timers; rlc_um_tester tester; rlc_um_nr rlc1, rlc2;