From 2d2a5bee036e25b5e2d0d16805ce712322c15be7 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Thu, 6 Jan 2022 17:56:47 +0100 Subject: [PATCH] asn1: update procotol_ie_single_container interface to use -> operator instead of .value to access container content --- lib/include/srsran/asn1/asn1_utils.h | 21 ++++++++-------- lib/src/asn1/s1ap_utils.cc | 6 ++--- lib/test/asn1/s1ap_test.cc | 8 +++---- srsenb/src/stack/rrc/rrc_mobility.cc | 12 +++++----- srsenb/src/stack/s1ap/s1ap.cc | 33 +++++++++++++------------- srsenb/test/rrc/erab_setup_test.cc | 2 +- srsenb/test/rrc/rrc_mobility_test.cc | 18 +++++++------- srsenb/test/rrc/test_helpers.cc | 2 +- srsenb/test/s1ap/s1ap_test.cc | 13 +++++----- srsepc/src/mme/s1ap_ctx_mngmt_proc.cc | 7 +++--- srsepc/src/mme/s1ap_erab_mngmt_proc.cc | 9 ++++--- srsepc/src/mme/s1ap_paging.cc | 4 ++-- 12 files changed, 65 insertions(+), 70 deletions(-) diff --git a/lib/include/srsran/asn1/asn1_utils.h b/lib/include/srsran/asn1/asn1_utils.h index 6d4966870..33bffd509 100644 --- a/lib/include/srsran/asn1/asn1_utils.h +++ b/lib/include/srsran/asn1/asn1_utils.h @@ -1476,10 +1476,9 @@ typedef enumerated crit_e; template struct protocol_ie_single_container_s { using value_type = typename ies_set_paramT_::value_c; - value_type value; - uint32_t id() const { return id_; } - crit_e crit() const { return ies_set_paramT_::get_crit(id_); } + uint32_t id() const { return ies_set_paramT_::idx_to_id(value.type().value); } + crit_e crit() const { return ies_set_paramT_::get_crit(id()); } value_type* operator->() { return &value; } const value_type* operator->() const { return &value; } value_type& operator*() { return value; } @@ -1487,23 +1486,24 @@ struct protocol_ie_single_container_s { SRSASN_CODE pack(bit_ref& bref) const { - HANDLE_CODE(pack_integer(bref, id_, (uint32_t)0u, (uint32_t)65535u, false, true)); - HANDLE_CODE(ies_set_paramT_::get_crit(id_).pack(bref)); + HANDLE_CODE(pack_integer(bref, id(), (uint32_t)0u, (uint32_t)65535u, false, true)); + HANDLE_CODE(crit().pack(bref)); HANDLE_CODE(value.pack(bref)); return SRSASN_SUCCESS; } SRSASN_CODE unpack(cbit_ref& bref) { - HANDLE_CODE(unpack_integer(id_, bref, (uint32_t)0u, (uint32_t)65535u, false, true)); + uint32_t id_val; + HANDLE_CODE(unpack_integer(id_val, bref, (uint32_t)0u, (uint32_t)65535u, false, true)); HANDLE_CODE(crit().unpack(bref)); - value = ies_set_paramT_::get_value(id_); + value = ies_set_paramT_::get_value(id_val); HANDLE_CODE(value.unpack(bref)); return SRSASN_SUCCESS; } void to_json(json_writer& j) const { j.start_obj(); - j.write_int("id", id_); + j.write_int("id", id()); j.write_str("criticality", crit().to_string()); j.end_obj(); } @@ -1512,13 +1512,12 @@ struct protocol_ie_single_container_s { if (not ies_set_paramT_::is_id_valid(id_val)) { return false; } - id_ = id_val; - value = ies_set_paramT_::get_value(id_); + value = ies_set_paramT_::get_value(id_val); return value.type().value != ies_set_paramT_::value_c::types_opts::nulltype; } private: - uint32_t id_ = 0; + value_type value; }; } // namespace asn1 diff --git a/lib/src/asn1/s1ap_utils.cc b/lib/src/asn1/s1ap_utils.cc index faed183f4..55b415d6a 100644 --- a/lib/src/asn1/s1ap_utils.cc +++ b/lib/src/asn1/s1ap_utils.cc @@ -26,21 +26,21 @@ template <> uint32_t get_obj_id >( const protocol_ie_single_container_s& obj) { - return obj.value.erab_to_be_setup_item_ctxt_su_req().erab_id; + return obj->erab_to_be_setup_item_ctxt_su_req().erab_id; } template <> uint32_t get_obj_id >( const protocol_ie_single_container_s& obj) { - return obj.value.erab_to_be_setup_item_bearer_su_req().erab_id; + return obj->erab_to_be_setup_item_bearer_su_req().erab_id; } template <> uint32_t get_obj_id >( const protocol_ie_single_container_s& obj) { - return obj.value.erab_to_be_modified_item_bearer_mod_req().erab_id; + return obj->erab_to_be_modified_item_bearer_mod_req().erab_id; } } // namespace s1ap diff --git a/lib/test/asn1/s1ap_test.cc b/lib/test/asn1/s1ap_test.cc index 2da841574..8c59aa716 100644 --- a/lib/test/asn1/s1ap_test.cc +++ b/lib/test/asn1/s1ap_test.cc @@ -180,7 +180,7 @@ int test_ho_request() TESTASSERT(pdu.init_msg().crit.value == crit_opts::reject); auto& horeq = pdu.init_msg().value.ho_request().protocol_ies; - auto& erab_item = horeq.erab_to_be_setup_list_ho_req.value[0].value.erab_to_be_setup_item_ho_req(); + auto& erab_item = horeq.erab_to_be_setup_list_ho_req.value[0]->erab_to_be_setup_item_ho_req(); TESTASSERT(erab_item.erab_id == 5); TESTASSERT(erab_item.gtp_teid.to_string() == "b7361c56"); @@ -202,7 +202,7 @@ int test_enb_status_transfer() enb_status_transfer.enb_status_transfer_transparent_container.value.bearers_subject_to_status_transfer_list[0]; TESTASSERT(bearer.load_info_obj(ASN1_S1AP_ID_BEARERS_SUBJECT_TO_STATUS_TRANSFER_ITEM)); - auto& bearer_item = bearer.value.bearers_subject_to_status_transfer_item(); + auto& bearer_item = bearer->bearers_subject_to_status_transfer_item(); bearer_item.erab_id = 5; bearer_item.dl_coun_tvalue.pdcp_sn = 5; @@ -225,7 +225,7 @@ int test_enb_status_transfer() pdu2.init_msg() .value.enb_status_transfer() .protocol_ies.enb_status_transfer_transparent_container.value.bearers_subject_to_status_transfer_list[0]; - auto& bearer_item2 = bearer2.value.bearers_subject_to_status_transfer_item(); + auto& bearer_item2 = bearer2->bearers_subject_to_status_transfer_item(); TESTASSERT(bearer_item2.dl_coun_tvalue.hfn == bearer_item.dl_coun_tvalue.hfn); TESTASSERT(bearer_item2.dl_coun_tvalue.hfn == 0); @@ -275,7 +275,7 @@ int test_initial_ctxt_setup_response() // Fill in the GTP bind address for all bearers for (uint32_t i = 0; i < container.erab_setup_list_ctxt_su_res.value.size(); ++i) { container.erab_setup_list_ctxt_su_res.value[i].load_info_obj(ASN1_S1AP_ID_ERAB_SETUP_ITEM_CTXT_SU_RES); - auto& item = container.erab_setup_list_ctxt_su_res.value[i].value.erab_setup_item_ctxt_su_res(); + auto& item = container.erab_setup_list_ctxt_su_res.value[i]->erab_setup_item_ctxt_su_res(); item.erab_id = 1; // uint32_to_uint8(teid_in, item.gtp_teid.data()); item.transport_layer_address.resize(32); diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index 8f55fa20e..b8649ab9c 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -436,7 +436,7 @@ void rrc::ue::rrc_mobility::handle_ho_preparation_complete(rrc::ho_prep_result // Check if any E-RAB that was not admitted. Cancel Handover, in such case. if (msg.protocol_ies.erab_to_release_list_ho_cmd_present) { get_logger().warning("E-RAB id=%d was not admitted in target eNB. Cancelling handover...", - msg.protocol_ies.erab_to_release_list_ho_cmd.value[0].value.erab_item().erab_id); + msg.protocol_ies.erab_to_release_list_ho_cmd.value[0]->erab_item().erab_id); asn1::s1ap::cause_c cause; cause.set_radio_network().value = asn1::s1ap::cause_radio_network_opts::no_radio_res_available_in_target_cell; trigger(ho_cancel_ev{cause}); @@ -626,7 +626,7 @@ rrc::ue::rrc_mobility::s1_source_ho_st::start_enb_status_transfer(const asn1::s1 const auto& fwd_erab_list = s1ap_ho_cmd.protocol_ies.erab_subjectto_data_forwarding_list.value; const auto& erab_list = rrc_ue->bearer_list.get_erabs(); for (const auto& e : fwd_erab_list) { - const auto& fwd_erab = e.value.erab_data_forwarding_item(); + const auto& fwd_erab = e->erab_data_forwarding_item(); auto it = erab_list.find(fwd_erab.erab_id); if (it == erab_list.end()) { Warning("E-RAB id=%d subject to forwarding not found\n", fwd_erab.erab_id); @@ -867,12 +867,12 @@ void rrc::ue::rrc_mobility::handle_ho_requested(idle_st& s, const ho_req_rx_ev& std::find_if(lst.begin(), lst.end(), [&erab](const asn1::protocol_ie_single_container_s& fwd_erab) { - return fwd_erab.value.erab_info_list_item().erab_id == erab.second.id; + return fwd_erab->erab_info_list_item().erab_id == erab.second.id; }); if (it == lst.end()) { continue; } - const auto& fwd_erab = it->value.erab_info_list_item(); + const auto& fwd_erab = (*it)->erab_info_list_item(); if (fwd_erab.dl_forwarding_present and fwd_erab.dl_forwarding.value == asn1::s1ap::dl_forwarding_opts::dl_forwarding_proposed) { @@ -936,7 +936,7 @@ bool rrc::ue::rrc_mobility::apply_ho_prep_cfg(const ho_prep_info_r8_ies_s& // Establish ERABs/DRBs for (const auto& erab_item : ho_req_msg.protocol_ies.erab_to_be_setup_list_ho_req.value) { - const auto& erab = erab_item.value.erab_to_be_setup_item_ho_req(); + const auto& erab = erab_item->erab_to_be_setup_item_ho_req(); if (erab.ext) { get_logger().warning("Not handling E-RABToBeSetupList extensions"); } @@ -1038,7 +1038,7 @@ void rrc::ue::rrc_mobility::handle_status_transfer(s1_target_ho_st& s, const sta // Set DRBs SNs for (const auto& erab : erabs) { - const auto& erab_item = erab.value.bearers_subject_to_status_transfer_item(); + const auto& erab_item = erab->bearers_subject_to_status_transfer_item(); auto erab_it = rrc_ue->bearer_list.get_erabs().find(erab_item.erab_id); if (erab_it == rrc_ue->bearer_list.get_erabs().end()) { logger.warning("The E-RAB Id=%d is not recognized", erab_item.erab_id); diff --git a/srsenb/src/stack/s1ap/s1ap.cc b/srsenb/src/stack/s1ap/s1ap.cc index 83f2adbff..e18d1325d 100644 --- a/srsenb/src/stack/s1ap/s1ap.cc +++ b/srsenb/src/stack/s1ap/s1ap.cc @@ -108,7 +108,7 @@ void fill_erab_failed_setup_list(OutList& output_list, const s1ap::erab_item_lis output_list.resize(input_list.size()); for (size_t i = 0; i < input_list.size(); ++i) { output_list[i].load_info_obj(ASN1_S1AP_ID_ERAB_ITEM); - output_list[i].value.erab_item() = input_list[i]; + output_list[i]->erab_item() = input_list[i]; } } @@ -790,7 +790,7 @@ bool s1ap::handle_initialctxtsetuprequest(const init_context_setup_request_s& ms add_repeated_erab_ids(prot_ies.erab_to_be_setup_list_ctxt_su_req.value, failed_cfg_erabs); for (const auto& item : msg.protocol_ies.erab_to_be_setup_list_ctxt_su_req.value) { - const auto& erab = item.value.erab_to_be_setup_item_ctxt_su_req(); + const auto& erab = item->erab_to_be_setup_item_ctxt_su_req(); if (contains_erab_id(failed_cfg_erabs, erab.erab_id)) { // E-RAB is duplicate continue; @@ -869,7 +869,7 @@ bool s1ap::handle_erabsetuprequest(const erab_setup_request_s& msg) add_repeated_erab_ids(msg.protocol_ies.erab_to_be_setup_list_bearer_su_req.value, failed_cfg_erabs); for (const auto& item : msg.protocol_ies.erab_to_be_setup_list_bearer_su_req.value) { - const auto& erab = item.value.erab_to_be_setup_item_bearer_su_req(); + const auto& erab = item->erab_to_be_setup_item_bearer_su_req(); if (contains_erab_id(failed_cfg_erabs, erab.erab_id)) { // E-RAB is duplicate continue; @@ -929,7 +929,7 @@ bool s1ap::handle_erabmodifyrequest(const erab_modify_request_s& msg) add_repeated_erab_ids(msg.protocol_ies.erab_to_be_modified_list_bearer_mod_req.value, failed_cfg_erabs); for (const auto& item : msg.protocol_ies.erab_to_be_modified_list_bearer_mod_req.value) { - const auto& erab = item.value.erab_to_be_modified_item_bearer_mod_req(); + const auto& erab = item->erab_to_be_modified_item_bearer_mod_req(); if (contains_erab_id(failed_cfg_erabs, erab.erab_id)) { // E-RAB is duplicate continue; @@ -985,7 +985,7 @@ bool s1ap::handle_erabreleasecommand(const erab_release_cmd_s& msg) })); }; for (const auto& item : msg.protocol_ies.erab_to_be_released_list.value) { - const auto& erab = item.value.erab_item(); + const auto& erab = item->erab_item(); if (is_repeated_erab_id(erab.erab_id)) { // TS 36.413, 8.2.3.3 - ignore the duplication of E-RAB ID IEs @@ -1243,7 +1243,7 @@ bool s1ap::send_ho_req_ack(const asn1::s1ap::ho_request_s& msg, container.erab_admitted_list.value.resize(admitted_bearers.size()); for (size_t i = 0; i < admitted_bearers.size(); ++i) { container.erab_admitted_list.value[i].load_info_obj(ASN1_S1AP_ID_ERAB_ADMITTED_ITEM); - auto& c = container.erab_admitted_list.value[i].value.erab_admitted_item(); + auto& c = container.erab_admitted_list.value[i]->erab_admitted_item(); c = admitted_bearers[i]; if (!args.gtp_advertise_addr.empty()) { c.transport_layer_address = addr_to_asn1(args.gtp_advertise_addr.c_str()); @@ -1269,7 +1269,7 @@ bool s1ap::send_ho_req_ack(const asn1::s1ap::ho_request_s& msg, for (size_t i = 0; i < not_admitted_bearers.size(); ++i) { container.erab_failed_to_setup_list_ho_req_ack.value[i].load_info_obj( ASN1_S1AP_ID_ERAB_FAILEDTO_SETUP_ITEM_HO_REQ_ACK); - auto& erab = container.erab_failed_to_setup_list_ho_req_ack.value[i].value.erab_failedto_setup_item_ho_req_ack(); + auto& erab = container.erab_failed_to_setup_list_ho_req_ack.value[i]->erab_failedto_setup_item_ho_req_ack(); erab.erab_id = not_admitted_bearers[i].erab_id; erab.cause = not_admitted_bearers[i].cause; } @@ -1586,7 +1586,7 @@ void s1ap::ue::ue_ctxt_setup_complete() container.erab_setup_list_ctxt_su_res.value.resize(updated_erabs.size()); for (size_t i = 0; i < updated_erabs.size(); ++i) { container.erab_setup_list_ctxt_su_res.value[i].load_info_obj(ASN1_S1AP_ID_ERAB_SETUP_ITEM_CTXT_SU_RES); - auto& item = container.erab_setup_list_ctxt_su_res.value[i].value.erab_setup_item_ctxt_su_res(); + auto& item = container.erab_setup_list_ctxt_su_res.value[i]->erab_setup_item_ctxt_su_res(); item.erab_id = updated_erabs[i]; get_erab_addr(item.erab_id, item.transport_layer_address, item.gtp_teid); } @@ -1618,7 +1618,7 @@ bool s1ap::ue::send_erab_setup_response(const erab_id_list& erabs_setup, const e res.protocol_ies.erab_setup_list_bearer_su_res.value.resize(erabs_setup.size()); for (size_t i = 0; i < erabs_setup.size(); ++i) { res.protocol_ies.erab_setup_list_bearer_su_res.value[i].load_info_obj(ASN1_S1AP_ID_ERAB_SETUP_ITEM_BEARER_SU_RES); - auto& item = res.protocol_ies.erab_setup_list_bearer_su_res.value[i].value.erab_setup_item_bearer_su_res(); + auto& item = res.protocol_ies.erab_setup_list_bearer_su_res.value[i]->erab_setup_item_bearer_su_res(); item.erab_id = erabs_setup[i]; get_erab_addr(item.erab_id, item.transport_layer_address, item.gtp_teid); } @@ -1683,7 +1683,7 @@ bool s1ap::ue::send_erab_release_response(const erab_id_list& erabs_released, co for (size_t i = 0; i < erabs_released.size(); ++i) { container.erab_release_list_bearer_rel_comp.value[i].load_info_obj( ASN1_S1AP_ID_ERAB_RELEASE_ITEM_BEARER_REL_COMP); - container.erab_release_list_bearer_rel_comp.value[i].value.erab_release_item_bearer_rel_comp().erab_id = + container.erab_release_list_bearer_rel_comp.value[i]->erab_release_item_bearer_rel_comp().erab_id = erabs_released[i]; } } @@ -1712,8 +1712,7 @@ bool s1ap::ue::send_erab_modify_response(const erab_id_list& erabs_modified, con container.erab_modify_list_bearer_mod_res.value.resize(erabs_modified.size()); for (uint32_t i = 0; i < container.erab_modify_list_bearer_mod_res.value.size(); i++) { container.erab_modify_list_bearer_mod_res.value[i].load_info_obj(ASN1_S1AP_ID_ERAB_MODIFY_ITEM_BEARER_MOD_RES); - container.erab_modify_list_bearer_mod_res.value[i].value.erab_modify_item_bearer_mod_res().erab_id = - erabs_modified[i]; + container.erab_modify_list_bearer_mod_res.value[i]->erab_modify_item_bearer_mod_res().erab_id = erabs_modified[i]; } } @@ -1744,7 +1743,7 @@ bool s1ap::ue::send_erab_release_indication(const std::vector& erabs_s container.erab_released_list.value.resize(erabs_successfully_released.size()); for (size_t i = 0; i < container.erab_released_list.value.size(); ++i) { container.erab_released_list.value[i].load_info_obj(ASN1_S1AP_ID_ERAB_ITEM); - container.erab_released_list.value[i].value.erab_item().erab_id = erabs_successfully_released[i]; + container.erab_released_list.value[i]->erab_item().erab_id = erabs_successfully_released[i]; } return s1ap_ptr->sctp_send_s1ap_pdu(tx_pdu, ctxt.rnti, "E-RABReleaseIndication"); @@ -2149,9 +2148,9 @@ bool s1ap::ue::send_ho_required(uint32_t target_eci, transparent_cntr.erab_info_list.resize(fwd_erabs.size()); for (uint32_t i = 0; i < fwd_erabs.size(); ++i) { transparent_cntr.erab_info_list[i].load_info_obj(ASN1_S1AP_ID_ERAB_INFO_LIST_ITEM); - transparent_cntr.erab_info_list[i].value.erab_info_list_item().erab_id = fwd_erabs[i]; - transparent_cntr.erab_info_list[i].value.erab_info_list_item().dl_forwarding_present = true; - transparent_cntr.erab_info_list[i].value.erab_info_list_item().dl_forwarding.value = + transparent_cntr.erab_info_list[i]->erab_info_list_item().erab_id = fwd_erabs[i]; + transparent_cntr.erab_info_list[i]->erab_info_list_item().dl_forwarding_present = true; + transparent_cntr.erab_info_list[i]->erab_info_list_item().dl_forwarding.value = dl_forwarding_opts::dl_forwarding_proposed; } // - set target cell ID @@ -2212,7 +2211,7 @@ bool s1ap::ue::send_enb_status_transfer_proc(std::vector& be list.resize(bearer_status_list.size()); for (uint32_t i = 0; i < list.size(); ++i) { list[i].load_info_obj(ASN1_S1AP_ID_BEARERS_SUBJECT_TO_STATUS_TRANSFER_ITEM); - auto& asn1bearer = list[i].value.bearers_subject_to_status_transfer_item(); + auto& asn1bearer = list[i]->bearers_subject_to_status_transfer_item(); bearer_status_info& item = bearer_status_list[i]; asn1bearer.erab_id = item.erab_id; diff --git a/srsenb/test/rrc/erab_setup_test.cc b/srsenb/test/rrc/erab_setup_test.cc index 6f5b0103b..d084a1a0a 100644 --- a/srsenb/test/rrc/erab_setup_test.cc +++ b/srsenb/test/rrc/erab_setup_test.cc @@ -94,7 +94,7 @@ int test_erab_setup(srsran::log_sink_spy& spy, bool qci_exists) rrc.set_aggregate_max_bitrate(rnti, setupmsg.ueaggregate_maximum_bitrate.value); } for (const auto& item : setupmsg.erab_to_be_setup_list_bearer_su_req.value) { - const auto& erab = item.value.erab_to_be_setup_item_bearer_su_req(); + const auto& erab = item->erab_to_be_setup_item_bearer_su_req(); asn1::s1ap::cause_c cause; int ret = rrc.setup_erab(rnti, erab.erab_id, diff --git a/srsenb/test/rrc/rrc_mobility_test.cc b/srsenb/test/rrc/rrc_mobility_test.cc index 496abd844..b024c53a4 100644 --- a/srsenb/test/rrc/rrc_mobility_test.cc +++ b/srsenb/test/rrc/rrc_mobility_test.cc @@ -273,7 +273,7 @@ int test_s1ap_tenb_mobility(test_event test_params) /* TeNB receives S1AP Handover Request */ asn1::s1ap::ho_request_s ho_req; ho_req.protocol_ies.erab_to_be_setup_list_ho_req.value.resize(1); - auto& erab = ho_req.protocol_ies.erab_to_be_setup_list_ho_req.value[0].value.erab_to_be_setup_item_ho_req(); + auto& erab = ho_req.protocol_ies.erab_to_be_setup_list_ho_req.value[0]->erab_to_be_setup_item_ho_req(); erab.erab_id = 5; erab.erab_level_qos_params.qci = 9; if (test_params == test_event::unknown_qci) { @@ -288,9 +288,9 @@ int test_s1ap_tenb_mobility(test_event test_params) container.erab_info_list_present = true; container.erab_info_list.resize(1); container.erab_info_list[0].load_info_obj(ASN1_S1AP_ID_ERAB_INFO_LIST_ITEM); - container.erab_info_list[0].value.erab_info_list_item().erab_id = 5; - container.erab_info_list[0].value.erab_info_list_item().dl_forwarding_present = true; - container.erab_info_list[0].value.erab_info_list_item().dl_forwarding.value = + container.erab_info_list[0]->erab_info_list_item().erab_id = 5; + container.erab_info_list[0]->erab_info_list_item().dl_forwarding_present = true; + container.erab_info_list[0]->erab_info_list_item().dl_forwarding.value = asn1::s1ap::dl_forwarding_opts::dl_forwarding_proposed; uint8_t ho_prep_container[] = { 0x0a, 0x10, 0x0b, 0x81, 0x80, 0x00, 0x01, 0x80, 0x00, 0xf3, 0x02, 0x08, 0x00, 0x00, 0x15, 0x80, 0x00, 0x14, @@ -360,11 +360,11 @@ int test_s1ap_tenb_mobility(test_event test_params) // Receives MMEStatusTransfer asn1::s1ap::bearers_subject_to_status_transfer_list_l bearers; bearers.resize(1); - bearers[0].value.bearers_subject_to_status_transfer_item().erab_id = 5; - bearers[0].value.bearers_subject_to_status_transfer_item().dl_coun_tvalue.pdcp_sn = 100; - bearers[0].value.bearers_subject_to_status_transfer_item().dl_coun_tvalue.hfn = 3; - bearers[0].value.bearers_subject_to_status_transfer_item().ul_coun_tvalue.pdcp_sn = 120; - bearers[0].value.bearers_subject_to_status_transfer_item().ul_coun_tvalue.hfn = 4; + bearers[0]->bearers_subject_to_status_transfer_item().erab_id = 5; + bearers[0]->bearers_subject_to_status_transfer_item().dl_coun_tvalue.pdcp_sn = 100; + bearers[0]->bearers_subject_to_status_transfer_item().dl_coun_tvalue.hfn = 3; + bearers[0]->bearers_subject_to_status_transfer_item().ul_coun_tvalue.pdcp_sn = 120; + bearers[0]->bearers_subject_to_status_transfer_item().ul_coun_tvalue.hfn = 4; tester.rrc.set_erab_status(0x46, bearers); TESTASSERT(tester.pdcp.bearers.count(0x46)); TESTASSERT(tester.pdcp.bearers[0x46].count(3)); diff --git a/srsenb/test/rrc/test_helpers.cc b/srsenb/test/rrc/test_helpers.cc index 2987cb2bd..330d63244 100644 --- a/srsenb/test/rrc/test_helpers.cc +++ b/srsenb/test/rrc/test_helpers.cc @@ -130,7 +130,7 @@ int bring_rrc_to_reconf_state(srsenb::rrc& rrc, srsran::timer_handler& timers, u rrc.setup_ue_ctxt(rnti, s1ap_pdu.init_msg().value.init_context_setup_request()); for (auto& item : s1ap_pdu.init_msg().value.init_context_setup_request().protocol_ies.erab_to_be_setup_list_ctxt_su_req.value) { - const auto& erab = item.value.erab_to_be_setup_item_ctxt_su_req(); + const auto& erab = item->erab_to_be_setup_item_ctxt_su_req(); asn1::s1ap::cause_c cause; TESTASSERT(rrc.setup_erab(rnti, erab.erab_id, diff --git a/srsenb/test/s1ap/s1ap_test.cc b/srsenb/test/s1ap/s1ap_test.cc index 5cc888e94..0192f43d8 100644 --- a/srsenb/test/s1ap/s1ap_test.cc +++ b/srsenb/test/s1ap/s1ap_test.cc @@ -241,7 +241,7 @@ void test_s1ap_erab_setup(test_event event) auto& erab_list = protocols.erab_to_be_modified_list_bearer_mod_req.value; erab_list.resize(2); erab_list[0].load_info_obj(ASN1_S1AP_ID_ERAB_TO_BE_MODIFIED_ITEM_BEARER_MOD_REQ); - auto* erab_ptr = &erab_list[0].value.erab_to_be_modified_item_bearer_mod_req(); + auto* erab_ptr = &erab_list[0]->erab_to_be_modified_item_bearer_mod_req(); erab_ptr->erab_id = 5; erab_ptr->erab_level_qos_params.qci = 9; erab_ptr->erab_level_qos_params.alloc_retention_prio.prio_level = 15; @@ -252,7 +252,7 @@ void test_s1ap_erab_setup(test_event event) erab_ptr->nas_pdu.resize(1); erab_ptr->nas_pdu[0] = 0; erab_list[1] = erab_list[0]; - erab_ptr = &erab_list[1].value.erab_to_be_modified_item_bearer_mod_req(); + erab_ptr = &erab_list[1]->erab_to_be_modified_item_bearer_mod_req(); erab_ptr->erab_id = event == test_event::repeated_erabid_mod ? 5 : 6; if (event == test_event::wrong_erabid_mod) { rrc.next_erabs_failed_to_modify.push_back(6); @@ -286,11 +286,10 @@ void test_s1ap_erab_setup(test_event event) if (event == test_event::wrong_erabid_mod) { TESTASSERT(protocol_ies.erab_modify_list_bearer_mod_res_present); TESTASSERT(protocol_ies.erab_modify_list_bearer_mod_res.value.size() == 1); - TESTASSERT(protocol_ies.erab_modify_list_bearer_mod_res.value[0].value.erab_modify_item_bearer_mod_res().erab_id == - 5); + TESTASSERT(protocol_ies.erab_modify_list_bearer_mod_res.value[0]->erab_modify_item_bearer_mod_res().erab_id == 5); TESTASSERT(protocol_ies.erab_failed_to_modify_list_present); TESTASSERT(protocol_ies.erab_failed_to_modify_list.value.size() == 1); - auto& erab_item = protocol_ies.erab_failed_to_modify_list.value[0].value.erab_item(); + auto& erab_item = protocol_ies.erab_failed_to_modify_list.value[0]->erab_item(); TESTASSERT(erab_item.erab_id == 6); TESTASSERT(erab_item.cause.type().value == asn1::s1ap::cause_c::types_opts::radio_network); TESTASSERT(erab_item.cause.radio_network().value == asn1::s1ap::cause_radio_network_opts::unknown_erab_id); @@ -300,7 +299,7 @@ void test_s1ap_erab_setup(test_event event) TESTASSERT(not protocol_ies.erab_modify_list_bearer_mod_res_present); TESTASSERT(protocol_ies.erab_failed_to_modify_list_present); TESTASSERT(protocol_ies.erab_failed_to_modify_list.value.size() == 1); - auto& erab_item = protocol_ies.erab_failed_to_modify_list.value[0].value.erab_item(); + auto& erab_item = protocol_ies.erab_failed_to_modify_list.value[0]->erab_item(); TESTASSERT(erab_item.erab_id == 5); TESTASSERT(erab_item.cause.type().value == asn1::s1ap::cause_c::types_opts::radio_network); TESTASSERT(erab_item.cause.radio_network().value == @@ -311,7 +310,7 @@ void test_s1ap_erab_setup(test_event event) TESTASSERT(protocol_ies.erab_modify_list_bearer_mod_res_present); TESTASSERT(not protocol_ies.erab_failed_to_modify_list_present); TESTASSERT(protocol_ies.erab_modify_list_bearer_mod_res.value.size() == 2); - auto& erab_item = protocol_ies.erab_modify_list_bearer_mod_res.value[0].value.erab_modify_item_bearer_mod_res(); + auto& erab_item = protocol_ies.erab_modify_list_bearer_mod_res.value[0]->erab_modify_item_bearer_mod_res(); TESTASSERT(erab_item.erab_id == 5); } diff --git a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc index aaee7165e..98faf8925 100644 --- a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc @@ -91,7 +91,7 @@ bool s1ap_ctx_mngmt_proc::send_initial_context_setup_request(nas* nas_ctx, uint1 // Setup eRAB context asn1::s1ap::erab_to_be_setup_item_ctxt_su_req_s& erab_ctx_req = - in_ctx_req.erab_to_be_setup_list_ctxt_su_req.value[0].value.erab_to_be_setup_item_ctxt_su_req(); + in_ctx_req.erab_to_be_setup_list_ctxt_su_req.value[0]->erab_to_be_setup_item_ctxt_su_req(); erab_ctx_req.erab_id = esm_ctx->erab_id; // Setup E-RAB QoS parameters @@ -189,9 +189,8 @@ bool s1ap_ctx_mngmt_proc::handle_initial_context_setup_response( for (const asn1::protocol_ie_single_container_s& ie_container : in_ctxt_resp.protocol_ies.erab_setup_list_ctxt_su_res.value) { // Get E-RAB setup context item and E-RAB Id - const asn1::s1ap::erab_setup_item_ctxt_su_res_s& erab_setup_item_ctxt = - ie_container.value.erab_setup_item_ctxt_su_res(); - uint8_t erab_id = erab_setup_item_ctxt.erab_id; + const asn1::s1ap::erab_setup_item_ctxt_su_res_s& erab_setup_item_ctxt = ie_container->erab_setup_item_ctxt_su_res(); + uint8_t erab_id = erab_setup_item_ctxt.erab_id; // Make sure we requested the context setup esm_ctx_t* esm_ctx = &nas_ctx->m_esm_ctx[erab_id]; diff --git a/srsepc/src/mme/s1ap_erab_mngmt_proc.cc b/srsepc/src/mme/s1ap_erab_mngmt_proc.cc index 25d962b20..80ebc8632 100644 --- a/srsepc/src/mme/s1ap_erab_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_erab_mngmt_proc.cc @@ -80,10 +80,9 @@ bool s1ap_erab_mngmt_proc::send_erab_release_command(uint32_t enb_ erab_rel_cmd.erab_to_be_released_list.value.resize(erabs_to_release.size()); for (uint32_t i = 0; i < erab_rel_cmd.erab_to_be_released_list.value.size(); i++) { erab_rel_cmd.erab_to_be_released_list.value[i].load_info_obj(ASN1_S1AP_ID_ERAB_ITEM); - erab_rel_cmd.erab_to_be_released_list.value[i].value.erab_item().erab_id = erabs_to_release[i]; - erab_rel_cmd.erab_to_be_released_list.value[i].value.erab_item().cause.set(asn1::s1ap::cause_c::types::misc); - erab_rel_cmd.erab_to_be_released_list.value[i].value.erab_item().cause.misc() = - asn1::s1ap::cause_misc_opts::unspecified; + erab_rel_cmd.erab_to_be_released_list.value[i]->erab_item().erab_id = erabs_to_release[i]; + erab_rel_cmd.erab_to_be_released_list.value[i]->erab_item().cause.set(asn1::s1ap::cause_c::types::misc); + erab_rel_cmd.erab_to_be_released_list.value[i]->erab_item().cause.misc() = asn1::s1ap::cause_misc_opts::unspecified; m_logger.info("Sending release comman to %d", erabs_to_release[i]); } @@ -120,7 +119,7 @@ bool s1ap_erab_mngmt_proc::send_erab_modify_request(uint32_t erab_mod_req.erab_to_be_modified_list_bearer_mod_req.value[i].load_info_obj( ASN1_S1AP_ID_ERAB_TO_BE_MODIFIED_ITEM_BEARER_MOD_REQ); asn1::s1ap::erab_to_be_modified_item_bearer_mod_req_s& erab_to_mod = - erab_mod_req.erab_to_be_modified_list_bearer_mod_req.value[i].value.erab_to_be_modified_item_bearer_mod_req(); + erab_mod_req.erab_to_be_modified_list_bearer_mod_req.value[i]->erab_to_be_modified_item_bearer_mod_req(); erab_to_mod.erab_id = erab_it->first; erab_to_mod.erab_level_qos_params.qci = erab_it->second; erab_to_mod.erab_level_qos_params.alloc_retention_prio.prio_level = 15; // lowest diff --git a/srsepc/src/mme/s1ap_paging.cc b/srsepc/src/mme/s1ap_paging.cc index 713171b26..33857fcd2 100644 --- a/srsepc/src/mme/s1ap_paging.cc +++ b/srsepc/src/mme/s1ap_paging.cc @@ -64,10 +64,10 @@ bool s1ap_paging::send_paging(uint64_t imsi, uint16_t erab_to_setup) paging.tai_list.value[0].load_info_obj(ASN1_S1AP_ID_TAI_ITEM); uint32_t plmn = m_s1ap->get_plmn(); - paging.tai_list.value[0].value.tai_item().tai.plm_nid.from_number(plmn); + paging.tai_list.value[0]->tai_item().tai.plm_nid.from_number(plmn); uint16_t tac = m_s1ap->m_s1ap_args.tac; - paging.tai_list.value[0].value.tai_item().tai.tac.from_number(tac); + paging.tai_list.value[0]->tai_item().tai.tac.from_number(tac); // Start T3413 if (!nas_ctx->start_timer(T_3413)) {