move rrc::ue to separate file

master
Francisco Paisana 5 years ago committed by Francisco Paisana
parent 9d5c2d70df
commit 61680d64d7

@ -99,154 +99,29 @@ public:
typedef enum { Rx = 0, Tx } direction_t;
template <class T>
void log_rrc_message(const std::string& source,
direction_t dir,
const direction_t dir,
const srslte::byte_buffer_t* pdu,
const T& msg,
const std::string& msg_type);
private:
class ue
const std::string& msg_type)
{
public:
class rrc_mobility;
ue(rrc* outer_rrc, uint16_t rnti, const sched_interface::ue_cfg_t& ue_cfg);
~ue();
bool is_connected();
bool is_idle();
typedef enum {
MSG3_RX_TIMEOUT = 0, ///< Msg3 has its own timeout to quickly remove fake UEs from random PRACHs
UE_RESPONSE_RX_TIMEOUT, ///< General purpose timeout for responses to eNB requests
UE_INACTIVITY_TIMEOUT, ///< UE inactivity timeout
nulltype
} activity_timeout_type_t;
std::string to_string(const activity_timeout_type_t& type);
void set_activity_timeout(const activity_timeout_type_t type);
void set_activity();
void activity_timer_expired();
uint32_t rl_failure();
rrc_state_t get_state();
void send_connection_setup(bool is_setup = true);
void send_connection_reest();
void send_connection_reject();
void send_connection_release();
void send_connection_reest_rej();
void send_connection_reconf(srslte::unique_byte_buffer_t sdu);
void send_connection_reconf_new_bearer();
void send_connection_reconf_upd(srslte::unique_byte_buffer_t pdu);
void send_security_mode_command();
void send_ue_cap_enquiry();
void parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu);
void handle_rrc_con_req(asn1::rrc::rrc_conn_request_s* msg);
void handle_rrc_con_reest_req(asn1::rrc::rrc_conn_reest_request_r8_ies_s* msg);
void handle_rrc_con_setup_complete(asn1::rrc::rrc_conn_setup_complete_s* msg, srslte::unique_byte_buffer_t pdu);
void handle_rrc_reconf_complete(asn1::rrc::rrc_conn_recfg_complete_s* msg, srslte::unique_byte_buffer_t pdu);
void handle_security_mode_complete(asn1::rrc::security_mode_complete_s* msg);
void handle_security_mode_failure(asn1::rrc::security_mode_fail_s* msg);
bool handle_ue_cap_info(asn1::rrc::ue_cap_info_s* msg);
void handle_ue_init_ctxt_setup_req(const asn1::s1ap::init_context_setup_request_s& msg);
bool handle_ue_ctxt_mod_req(const asn1::s1ap::ue_context_mod_request_s& msg);
void set_bitrates(const asn1::s1ap::ue_aggregate_maximum_bitrate_s& rates);
bool setup_erabs(const asn1::s1ap::erab_to_be_setup_list_ctxt_su_req_l& e);
bool setup_erabs(const asn1::s1ap::erab_to_be_setup_list_bearer_su_req_l& e);
bool release_erabs();
// handover
void handle_ho_preparation_complete(bool is_success, srslte::unique_byte_buffer_t container);
void notify_s1ap_ue_ctxt_setup_complete();
void notify_s1ap_ue_erab_setup_response(const asn1::s1ap::erab_to_be_setup_list_bearer_su_req_l& e);
// Getters for PUCCH resources
int get_cqi(uint16_t* pmi_idx, uint16_t* n_pucch, uint32_t ue_cc_idx);
int get_ri(uint32_t m_ri, uint16_t* ri_idx);
bool is_allocated() const;
void send_dl_ccch(asn1::rrc::dl_ccch_msg_s* dl_ccch_msg);
bool send_dl_dcch(const asn1::rrc::dl_dcch_msg_s* dl_dcch_msg,
srslte::unique_byte_buffer_t pdu = srslte::unique_byte_buffer_t());
uint16_t rnti = 0;
rrc* parent = nullptr;
bool connect_notified = false;
std::unique_ptr<rrc_mobility> mobility_handler;
if (rrc_log->get_level() == srslte::LOG_LEVEL_INFO) {
rrc_log->info("%s - %s %s (%d B)\n", source.c_str(), dir == Tx ? "Tx" : "Rx", msg_type.c_str(), pdu->N_bytes);
} else if (rrc_log->get_level() >= srslte::LOG_LEVEL_DEBUG) {
asn1::json_writer json_writer;
msg.to_json(json_writer);
rrc_log->debug_hex(pdu->msg,
pdu->N_bytes,
"%s - %s %s (%d B)\n",
source.c_str(),
dir == Tx ? "Tx" : "Rx",
msg_type.c_str(),
pdu->N_bytes);
rrc_log->debug_long("Content:\n%s\n", json_writer.to_string().c_str());
}
}
bool is_csfb = false;
private:
// args
srslte::byte_buffer_pool* pool = nullptr;
srslte::timer_handler::unique_timer activity_timer;
// cached for ease of context transfer
asn1::rrc::rrc_conn_recfg_s last_rrc_conn_recfg;
asn1::rrc::establishment_cause_e establishment_cause;
// S-TMSI for this UE
bool has_tmsi = false;
uint32_t m_tmsi = 0;
uint8_t mmec = 0;
// state
sched_interface::ue_cfg_t current_sched_ue_cfg = {};
uint32_t rlf_cnt = 0;
uint8_t transaction_id = 0;
rrc_state_t state = RRC_STATE_IDLE;
asn1::s1ap::ue_aggregate_maximum_bitrate_s bitrates;
bool eutra_capabilities_unpacked = false;
asn1::rrc::ue_eutra_cap_s eutra_capabilities;
srslte::rrc_ue_capabilities_t ue_capabilities;
const static uint32_t UE_PCELL_CC_IDX = 0;
cell_ctxt_dedicated_list cell_ded_list;
bearer_cfg_handler bearer_list;
security_cfg_handler ue_security_cfg;
///< Helper to access a cell cfg based on ue_cc_idx
cell_info_common* get_ue_cc_cfg(uint32_t ue_cc_idx);
///< Helper to fill SCell struct for RRR Connection Reconfig
int fill_scell_to_addmod_list(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_reconf);
///< UE's Physical layer dedicated configuration
phy_interface_rrc_lte::phy_rrc_dedicated_list_t phy_rrc_dedicated_list = {};
/**
* Setups the PCell physical layer common configuration of the UE from the SIB2 message. This methods is designed to
* be called from the constructor.
*
* @param config ASN1 Common SIB struct carrying the common physical layer parameters
*/
void apply_setup_phy_common(const asn1::rrc::rr_cfg_common_sib_s& config);
/**
* Setups the PCell physical layer dedicated configuration of the UE. This method shall be called from the
* connection setup only.
*
* @param phys_cfg_ded ASN1 Physical layer configuration dedicated
*/
void apply_setup_phy_config_dedicated(const asn1::rrc::phys_cfg_ded_s& phys_cfg_ded);
/**
* Reconfigures the PCell and SCell physical layer dedicated configuration of the UE. This method shall be called
* from the connection reconfiguration. `apply_setup_phy_config` shall not be called before/after. It automatically
* parses the PCell and SCell reconfiguration.
*
* @param reconfig_r8 ASN1 reconfiguration message
*/
void apply_reconf_phy_config(const asn1::rrc::rrc_conn_recfg_r8_ies_s& reconfig_r8);
}; // class ue
private:
class ue;
// args
srslte::timer_handler* timers = nullptr;

@ -23,6 +23,7 @@
#define SRSENB_RRC_MOBILITY_H
#include "rrc.h"
#include "rrc_ue.h"
#include "srslte/common/logmap.h"
#include <map>

@ -0,0 +1,174 @@
/*
* Copyright 2013-2020 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#ifndef SRSLTE_RRC_UE_H
#define SRSLTE_RRC_UE_H
#include "rrc.h"
namespace srsenb {
class rrc::ue
{
public:
class rrc_mobility;
ue(rrc* outer_rrc, uint16_t rnti, const sched_interface::ue_cfg_t& ue_cfg);
~ue();
bool is_connected();
bool is_idle();
typedef enum {
MSG3_RX_TIMEOUT = 0, ///< Msg3 has its own timeout to quickly remove fake UEs from random PRACHs
UE_RESPONSE_RX_TIMEOUT, ///< General purpose timeout for responses to eNB requests
UE_INACTIVITY_TIMEOUT, ///< UE inactivity timeout
nulltype
} activity_timeout_type_t;
std::string to_string(const activity_timeout_type_t& type);
void set_activity_timeout(const activity_timeout_type_t type);
void set_activity();
void activity_timer_expired();
uint32_t rl_failure();
rrc_state_t get_state();
void send_connection_setup(bool is_setup = true);
void send_connection_reest();
void send_connection_reject();
void send_connection_release();
void send_connection_reest_rej();
void send_connection_reconf(srslte::unique_byte_buffer_t sdu);
void send_connection_reconf_new_bearer();
void send_connection_reconf_upd(srslte::unique_byte_buffer_t pdu);
void send_security_mode_command();
void send_ue_cap_enquiry();
void parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu);
void handle_rrc_con_req(asn1::rrc::rrc_conn_request_s* msg);
void handle_rrc_con_reest_req(asn1::rrc::rrc_conn_reest_request_r8_ies_s* msg);
void handle_rrc_con_setup_complete(asn1::rrc::rrc_conn_setup_complete_s* msg, srslte::unique_byte_buffer_t pdu);
void handle_rrc_reconf_complete(asn1::rrc::rrc_conn_recfg_complete_s* msg, srslte::unique_byte_buffer_t pdu);
void handle_security_mode_complete(asn1::rrc::security_mode_complete_s* msg);
void handle_security_mode_failure(asn1::rrc::security_mode_fail_s* msg);
bool handle_ue_cap_info(asn1::rrc::ue_cap_info_s* msg);
void handle_ue_init_ctxt_setup_req(const asn1::s1ap::init_context_setup_request_s& msg);
bool handle_ue_ctxt_mod_req(const asn1::s1ap::ue_context_mod_request_s& msg);
void set_bitrates(const asn1::s1ap::ue_aggregate_maximum_bitrate_s& rates);
bool setup_erabs(const asn1::s1ap::erab_to_be_setup_list_ctxt_su_req_l& e);
bool setup_erabs(const asn1::s1ap::erab_to_be_setup_list_bearer_su_req_l& e);
bool release_erabs();
// handover
void handle_ho_preparation_complete(bool is_success, srslte::unique_byte_buffer_t container);
void notify_s1ap_ue_ctxt_setup_complete();
void notify_s1ap_ue_erab_setup_response(const asn1::s1ap::erab_to_be_setup_list_bearer_su_req_l& e);
// Getters for PUCCH resources
int get_cqi(uint16_t* pmi_idx, uint16_t* n_pucch, uint32_t ue_cc_idx);
int get_ri(uint32_t m_ri, uint16_t* ri_idx);
bool is_allocated() const;
void send_dl_ccch(asn1::rrc::dl_ccch_msg_s* dl_ccch_msg);
bool send_dl_dcch(const asn1::rrc::dl_dcch_msg_s* dl_dcch_msg,
srslte::unique_byte_buffer_t pdu = srslte::unique_byte_buffer_t());
uint16_t rnti = 0;
rrc* parent = nullptr;
bool connect_notified = false;
std::unique_ptr<rrc_mobility> mobility_handler;
bool is_csfb = false;
private:
// args
srslte::byte_buffer_pool* pool = nullptr;
srslte::timer_handler::unique_timer activity_timer;
// cached for ease of context transfer
asn1::rrc::rrc_conn_recfg_s last_rrc_conn_recfg;
asn1::rrc::establishment_cause_e establishment_cause;
// S-TMSI for this UE
bool has_tmsi = false;
uint32_t m_tmsi = 0;
uint8_t mmec = 0;
// state
sched_interface::ue_cfg_t current_sched_ue_cfg = {};
uint32_t rlf_cnt = 0;
uint8_t transaction_id = 0;
rrc_state_t state = RRC_STATE_IDLE;
asn1::s1ap::ue_aggregate_maximum_bitrate_s bitrates;
bool eutra_capabilities_unpacked = false;
asn1::rrc::ue_eutra_cap_s eutra_capabilities;
srslte::rrc_ue_capabilities_t ue_capabilities;
const static uint32_t UE_PCELL_CC_IDX = 0;
cell_ctxt_dedicated_list cell_ded_list;
bearer_cfg_handler bearer_list;
security_cfg_handler ue_security_cfg;
///< Helper to access a cell cfg based on ue_cc_idx
cell_info_common* get_ue_cc_cfg(uint32_t ue_cc_idx);
///< Helper to fill SCell struct for RRR Connection Reconfig
int fill_scell_to_addmod_list(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_reconf);
///< UE's Physical layer dedicated configuration
phy_interface_rrc_lte::phy_rrc_dedicated_list_t phy_rrc_dedicated_list = {};
/**
* Setups the PCell physical layer common configuration of the UE from the SIB2 message. This methods is designed to
* be called from the constructor.
*
* @param config ASN1 Common SIB struct carrying the common physical layer parameters
*/
void apply_setup_phy_common(const asn1::rrc::rr_cfg_common_sib_s& config);
/**
* Setups the PCell physical layer dedicated configuration of the UE. This method shall be called from the
* connection setup only.
*
* @param phys_cfg_ded ASN1 Physical layer configuration dedicated
*/
void apply_setup_phy_config_dedicated(const asn1::rrc::phys_cfg_ded_s& phys_cfg_ded);
/**
* Reconfigures the PCell and SCell physical layer dedicated configuration of the UE. This method shall be called
* from the connection reconfiguration. `apply_setup_phy_config` shall not be called before/after. It automatically
* parses the PCell and SCell reconfiguration.
*
* @param reconfig_r8 ASN1 reconfiguration message
*/
void apply_reconf_phy_config(const asn1::rrc::rrc_conn_recfg_r8_ies_s& reconfig_r8);
}; // class ue
} // namespace srsenb
#endif // SRSLTE_RRC_UE_H

@ -18,5 +18,5 @@
# and at http://www.gnu.org/licenses/.
#
set(SOURCES rrc.cc rrc_mobility.cc rrc_cell_cfg.cc rrc_bearer_cfg.cc)
set(SOURCES rrc.cc rrc_ue.cc rrc_mobility.cc rrc_cell_cfg.cc rrc_bearer_cfg.cc)
add_library(srsenb_rrc STATIC ${SOURCES})

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save