/** * * \section COPYRIGHT * * Copyright 2013-2021 Software Radio Systems Limited * * By using this file, you agree to the terms and conditions set * forth in the LICENSE file which can be found at the top level of * the distribution. * */ #include "srsenb/hdr/stack/mac/sched_interface.h" #include "srsran/asn1/s1ap_utils.h" #include "srsran/interfaces/enb_rrc_interface_types.h" #ifndef SRSRAN_ENB_RRC_INTERFACES_H #define SRSRAN_ENB_RRC_INTERFACES_H namespace srsenb { // RRC interface for S1AP class rrc_interface_s1ap { public: using failed_erab_list = std::map; virtual void write_dl_info(uint16_t rnti, srsran::unique_byte_buffer_t sdu) = 0; virtual void release_ue(uint16_t rnti) = 0; virtual bool setup_ue_ctxt(uint16_t rnti, const asn1::s1ap::init_context_setup_request_s& msg) = 0; virtual bool modify_ue_ctxt(uint16_t rnti, const asn1::s1ap::ue_context_mod_request_s& msg) = 0; virtual bool has_erab(uint16_t rnti, uint32_t erab_id) const = 0; virtual bool release_erabs(uint32_t rnti) = 0; virtual int get_erab_addr_in(uint16_t rnti, uint16_t erab_id, transp_addr_t& addr_in, uint32_t& teid_in) const = 0; virtual void set_aggregate_max_bitrate(uint16_t rnti, const asn1::s1ap::ue_aggregate_maximum_bitrate_s& bitrate) = 0; /** * TS 36.413, 8.2.1 and 8.3.1 - Setup E-RAB / Initial Context Setup * @return if error, cause argument is updated with cause */ virtual int setup_erab(uint16_t rnti, uint16_t erab_id, const asn1::s1ap::erab_level_qos_params_s& qos_params, srsran::const_span nas_pdu, const transp_addr_t& addr, uint32_t gtpu_teid_out, asn1::s1ap::cause_c& cause) = 0; /** * TS 36.413, 8.2.2 - Modify E-RAB * @return if error, cause argument is updated with cause */ virtual int modify_erab(uint16_t rnti, uint16_t erab_id, const asn1::s1ap::erab_level_qos_params_s& qos_params, srsran::const_span nas_pdu, asn1::s1ap::cause_c& cause) = 0; /** * TS 36.413, 8.2.3 - Release E-RAB id * @return error if E-RAB id or rnti were not found */ virtual int release_erab(uint16_t rnti, uint16_t erab_id) = 0; virtual void add_paging_id(uint32_t ueid, const asn1::s1ap::ue_paging_id_c& ue_paging_id) = 0; /// TS 36.413, 8.2.1, 8.2.2, 8.2.3 - Notify UE of ERAB updates (done via RRC Reconfiguration Message) virtual int notify_ue_erab_updates(uint16_t rnti, srsran::const_span nas_pdu) = 0; /** * Reports the reception of S1 HandoverCommand / HandoverPreparationFailure or abnormal conditions during * S1 Handover preparation back to RRC. * * @param rnti user * @param is_success true if ho cmd was received * @param container TargeteNB RRCConnectionReconfiguration message with MobilityControlInfo */ enum class ho_prep_result { success, failure, timeout }; virtual void ho_preparation_complete(uint16_t rnti, ho_prep_result result, const asn1::s1ap::ho_cmd_s& msg, srsran::unique_byte_buffer_t container) = 0; virtual uint16_t start_ho_ue_resource_alloc(const asn1::s1ap::ho_request_s& msg, const asn1::s1ap::sourceenb_to_targetenb_transparent_container_s& container, asn1::s1ap::cause_c& failure_cause) = 0; virtual void set_erab_status(uint16_t rnti, const asn1::s1ap::bearers_subject_to_status_transfer_list_l& erabs) = 0; }; /// RRC interface for RLC class rrc_interface_rlc { public: virtual void max_retx_attempted(uint16_t rnti) = 0; virtual void protocol_failure(uint16_t rnti) = 0; virtual void write_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu) = 0; }; /// RRC interface for MAC class rrc_interface_mac { public: /* Radio Link failure */ virtual int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0; virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0; virtual void set_activity_user(uint16_t rnti) = 0; virtual void set_radiolink_dl_state(uint16_t rnti, bool crc_res) = 0; virtual void set_radiolink_ul_state(uint16_t rnti, bool crc_res) = 0; virtual bool is_paging_opportunity(uint32_t tti_tx_dl, uint32_t* payload_len) = 0; virtual void read_pdu_pcch(uint32_t tti_tx_dl, uint8_t* payload, uint32_t payload_size) = 0; ///< Provide packed SIB to MAC (buffer is managed by RRC) virtual uint8_t* read_pdu_bcch_dlsch(const uint8_t enb_cc_idx, const uint32_t sib_index) = 0; }; /// RRC interface for PDCP class rrc_interface_pdcp { public: virtual void write_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t pdu) = 0; virtual void notify_pdcp_integrity_error(uint16_t rnti, uint32_t lcid) = 0; }; // RRC interfaces for NSA operation /// X2AP inspired interface to allow EUTRA RRC to call NR RRC class rrc_nr_interface_rrc { public: struct sgnb_addition_req_params_t { uint32_t eps_bearer_id; // add configuration check // E-RAB Parameters, Tunnel address (IP address, TEID) // QCI, security, etc }; /// Request addition of NR carrier for UE virtual int sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_params_t& params) = 0; /// Provide information whether the requested configuration was applied successfully by the UE virtual int sgnb_reconfiguration_complete(uint16_t eutra_rnti, asn1::dyn_octstring reconfig_response) = 0; }; /// X2AP inspired interface for response from NR RRC to EUTRA RRC class rrc_eutra_interface_rrc_nr { public: /** * @brief List of parameters included in the SgNB addition Ack message * @param nr_secondary_cell_group_cfg_r15 Encoded part of the RRC Reconfiguration * @param nr_radio_bearer_cfg1_r15 Encoded part of the RRC Reconfiguration * @param eps_bearer_id ID of the transfered bearer */ struct sgnb_addition_ack_params_t { uint16_t nr_rnti = SRSRAN_INVALID_RNTI; // RNTI that was assigned to the UE asn1::dyn_octstring nr_secondary_cell_group_cfg_r15; asn1::dyn_octstring nr_radio_bearer_cfg1_r15; uint32_t eps_bearer_id = 0; // (list of) successfully transfered EPS bearers }; /** * @brief Signal successful addition of UE * * @param eutra_rnti The RNTI that the EUTRA RRC used to request the SgNB addition * @param params Parameter list */ virtual void sgnb_addition_ack(uint16_t eutra_rnti, sgnb_addition_ack_params_t params) = 0; /** * @brief Signal unsuccessful SgNB addition * * @param eutra_rnti The RNTI that the EUTRA RRC used to request the SgNB addition */ virtual void sgnb_addition_reject(uint16_t eutra_rnti) = 0; /** * @brief Signal completion of SgNB addition after UE (with new NR identity) has attached * * @param eutra_rnti The RNTI that the EUTRA RRC used to request the SgNB addition * @param nr_rnti The RNTI that has been assigned to the UE on the SgNB */ virtual void sgnb_addition_complete(uint16_t eutra_rnti, uint16_t nr_rnti) = 0; }; } // namespace srsenb #endif // SRSRAN_ENB_RRC_INTERFACES_H