diff --git a/lib/include/srsran/interfaces/gnb_ngap_interfaces.h b/lib/include/srsran/interfaces/gnb_ngap_interfaces.h index 0dc899e67..70472a69b 100644 --- a/lib/include/srsran/interfaces/gnb_ngap_interfaces.h +++ b/lib/include/srsran/interfaces/gnb_ngap_interfaces.h @@ -37,14 +37,14 @@ public: virtual void initial_ue(uint16_t rnti, uint32_t gnb_cc_idx, asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu) = 0; + srsran::const_byte_span pdu) = 0; virtual void initial_ue(uint16_t rnti, uint32_t gnb_cc_idx, asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu, - uint32_t m_tmsi) = 0; + srsran::const_byte_span pdu, + uint32_t m_tmsi) = 0; - virtual void write_pdu(uint16_t rnti, srsran::unique_byte_buffer_t pdu) = 0; + virtual void write_pdu(uint16_t rnti, srsran::const_byte_span pdu) = 0; virtual bool user_exists(uint16_t rnti) = 0; virtual void user_mod(uint16_t old_rnti, uint16_t new_rnti) = 0; virtual bool user_release(uint16_t rnti, asn1::ngap_nr::cause_radio_network_e cause_radio) = 0; @@ -54,4 +54,4 @@ public: } // namespace srsenb -#endif // SRSRAN_GNB_NGAP_INTERFACES_H \ No newline at end of file +#endif // SRSRAN_GNB_NGAP_INTERFACES_H diff --git a/srsgnb/hdr/stack/common/test/dummy_nr_classes.h b/srsgnb/hdr/stack/common/test/dummy_nr_classes.h index 90e4f9906..c7b18f703 100644 --- a/srsgnb/hdr/stack/common/test/dummy_nr_classes.h +++ b/srsgnb/hdr/stack/common/test/dummy_nr_classes.h @@ -24,16 +24,16 @@ class ngap_dummy : public ngap_interface_rrc_nr void initial_ue(uint16_t rnti, uint32_t gnb_cc_idx, asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu) + srsran::const_byte_span pdu) {} void initial_ue(uint16_t rnti, uint32_t gnb_cc_idx, asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu, + srsran::const_byte_span pdu, uint32_t m_tmsi) {} - void write_pdu(uint16_t rnti, srsran::unique_byte_buffer_t pdu) {} + void write_pdu(uint16_t rnti, srsran::const_byte_span pdu) {} bool user_exists(uint16_t rnti) { return true; } void user_mod(uint16_t old_rnti, uint16_t new_rnti) {} bool user_release(uint16_t rnti, asn1::ngap_nr::cause_radio_network_e cause_radio) { return true; } diff --git a/srsgnb/hdr/stack/ngap/ngap.h b/srsgnb/hdr/stack/ngap/ngap.h index 63bd0e423..ac106b755 100644 --- a/srsgnb/hdr/stack/ngap/ngap.h +++ b/srsgnb/hdr/stack/ngap/ngap.h @@ -50,14 +50,14 @@ public: void initial_ue(uint16_t rnti, uint32_t gnb_cc_idx, asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu); + srsran::const_byte_span pdu); void initial_ue(uint16_t rnti, uint32_t gnb_cc_idx, asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu, + srsran::const_byte_span pdu, uint32_t s_tmsi); - void write_pdu(uint16_t rnti, srsran::unique_byte_buffer_t pdu); + void write_pdu(uint16_t rnti, srsran::const_byte_span pdu); bool user_exists(uint16_t rnti) { return true; }; void user_mod(uint16_t old_rnti, uint16_t new_rnti){}; bool user_release(uint16_t rnti, asn1::ngap_nr::cause_radio_network_e cause_radio) { return true; }; diff --git a/srsgnb/hdr/stack/ngap/ngap_ue.h b/srsgnb/hdr/stack/ngap/ngap_ue.h index 03ba97dec..e2eb7ba7f 100644 --- a/srsgnb/hdr/stack/ngap/ngap_ue.h +++ b/srsgnb/hdr/stack/ngap/ngap_ue.h @@ -31,11 +31,11 @@ public: virtual ~ue(); // TS 38.413 - Section 9.2.5.1 - Initial UE Message bool send_initial_ue_message(asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu, + srsran::const_byte_span pdu, bool has_tmsi, uint32_t s_tmsi = 0); // TS 38.413 - Section 9.2.5.3 - Uplink NAS Transport - bool send_ul_nas_transport(srsran::unique_byte_buffer_t pdu); + bool send_ul_nas_transport(srsran::const_byte_span pdu); // TS 38.413 - Section 9.2.2.2 - Initial Context Setup Response bool send_initial_ctxt_setup_response(); // TS 38.413 - Section 9.2.2.3 - Initial Context Setup Failure @@ -77,4 +77,4 @@ private: }; } // namespace srsenb -#endif \ No newline at end of file +#endif diff --git a/srsgnb/src/stack/ngap/ngap.cc b/srsgnb/src/stack/ngap/ngap.cc index c57f13f39..fa53daff2 100644 --- a/srsgnb/src/stack/ngap/ngap.cc +++ b/srsgnb/src/stack/ngap/ngap.cc @@ -214,7 +214,7 @@ int ngap::build_tai_cgi() void ngap::initial_ue(uint16_t rnti, uint32_t gnb_cc_idx, asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu) + srsran::const_byte_span pdu) { std::unique_ptr ue_ptr{new ue{this, rrc, gtpu, logger}}; ue_ptr->ctxt.rnti = rnti; @@ -224,13 +224,13 @@ void ngap::initial_ue(uint16_t rnti, logger.error("Failed to add rnti=0x%x", rnti); return; } - u->send_initial_ue_message(cause, std::move(pdu), false); + u->send_initial_ue_message(cause, pdu, false); } void ngap::initial_ue(uint16_t rnti, uint32_t gnb_cc_idx, asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu, + srsran::const_byte_span pdu, uint32_t s_tmsi) { std::unique_ptr ue_ptr{new ue{this, rrc, gtpu, logger}}; @@ -241,7 +241,7 @@ void ngap::initial_ue(uint16_t rnti, logger.error("Failed to add rnti=0x%x", rnti); return; } - u->send_initial_ue_message(cause, std::move(pdu), true, s_tmsi); + u->send_initial_ue_message(cause, pdu, true, s_tmsi); } void ngap::ue_notify_rrc_reconf_complete(uint16_t rnti, bool outcome) @@ -253,16 +253,16 @@ void ngap::ue_notify_rrc_reconf_complete(uint16_t rnti, bool outcome) u->notify_rrc_reconf_complete(outcome); } -void ngap::write_pdu(uint16_t rnti, srsran::unique_byte_buffer_t pdu) +void ngap::write_pdu(uint16_t rnti, srsran::const_byte_span pdu) { - logger.info(pdu->msg, pdu->N_bytes, "Received RRC SDU"); + logger.info(pdu.data(), pdu.size(), "Received RRC SDU"); ue* u = users.find_ue_rnti(rnti); if (u == nullptr) { logger.info("The rnti=0x%x does not exist", rnti); return; } - u->send_ul_nas_transport(std::move(pdu)); + u->send_ul_nas_transport(pdu); } /********************************************************* diff --git a/srsgnb/src/stack/ngap/ngap_ue.cc b/srsgnb/src/stack/ngap/ngap_ue.cc index 1efcf8d4a..f83b446e9 100644 --- a/srsgnb/src/stack/ngap/ngap_ue.cc +++ b/srsgnb/src/stack/ngap/ngap_ue.cc @@ -46,7 +46,7 @@ ngap::ue::~ue() {} ********************************************************************************/ bool ngap::ue::send_initial_ue_message(asn1::ngap_nr::rrcestablishment_cause_e cause, - srsran::unique_byte_buffer_t pdu, + srsran::const_byte_span pdu, bool has_tmsi, uint32_t s_tmsi) { @@ -71,8 +71,8 @@ bool ngap::ue::send_initial_ue_message(asn1::ngap_nr::rrcestablishment_cause_e c container.ran_ue_ngap_id.value = ctxt.ran_ue_ngap_id; // NAS_PDU - container.nas_pdu.value.resize(pdu->N_bytes); - memcpy(container.nas_pdu.value.data(), pdu->msg, pdu->N_bytes); + container.nas_pdu.value.resize(pdu.size()); + memcpy(container.nas_pdu.value.data(), pdu.data(), pdu.size()); // RRC Establishment Cause container.rrcestablishment_cause.value = cause; @@ -93,7 +93,7 @@ bool ngap::ue::send_initial_ue_message(asn1::ngap_nr::rrcestablishment_cause_e c return ngap_ptr->sctp_send_ngap_pdu(tx_pdu, ctxt.rnti, "InitialUEMessage"); } -bool ngap::ue::send_ul_nas_transport(srsran::unique_byte_buffer_t pdu) +bool ngap::ue::send_ul_nas_transport(srsran::const_byte_span pdu) { if (not ngap_ptr->amf_connected) { logger.warning("AMF not connected"); @@ -116,8 +116,8 @@ bool ngap::ue::send_ul_nas_transport(srsran::unique_byte_buffer_t pdu) container.ran_ue_ngap_id.value = ctxt.ran_ue_ngap_id; // NAS PDU - container.nas_pdu.value.resize(pdu->N_bytes); - memcpy(container.nas_pdu.value.data(), pdu->msg, pdu->N_bytes); + container.nas_pdu.value.resize(pdu.size()); + memcpy(container.nas_pdu.value.data(), pdu.data(), pdu.size()); // User Location Info // userLocationInformationNR @@ -276,4 +276,4 @@ bool ngap::ue::handle_pdu_session_res_setup_request(const asn1::ngap_nr::pdu_ses return true; } -} // namespace srsenb \ No newline at end of file +} // namespace srsenb