gnb,ngap: Added some comments to ngap.cc to make it easier to navigate

the file. Re-ordered NGAP UE procedures have the same order as in the
standard.
master
Pedro Alvarez 3 years ago
parent 50ac1c6c0a
commit bb9eaf4390

@ -28,8 +28,33 @@
namespace srsenb {
// TS 38.413 - Section 8.3 - UE Context Management Procedures
/*
* TS 38.413 - Section 8.2 - PDU Session Management Procedures
*/
// TS 38.413 - Section 8.2.1 PDU Session Resource Setup
class ngap_ue_pdu_session_res_setup_proc
{
public:
explicit ngap_ue_pdu_session_res_setup_proc(ngap_interface_ngap_proc* parent_,
rrc_interface_ngap_nr* rrc_,
ngap_ue_ctxt_t* ue_ctxt,
ngap_ue_bearer_manager* bearer_manager,
srslog::basic_logger& logger_);
srsran::proc_outcome_t init(const asn1::ngap::pdu_session_res_setup_request_s& msg);
srsran::proc_outcome_t step();
static const char* name() { return "UE PDU Session Resource Setup"; }
private:
ngap_ue_ctxt_t* ue_ctxt;
ngap_interface_ngap_proc* parent;
ngap_ue_bearer_manager* bearer_manager;
rrc_interface_ngap_nr* rrc = nullptr;
srslog::basic_logger& logger;
};
/*
* TS 38.413 - Section 8.3 - UE Context Management Procedures
*/
// TS 38.413 - Section 8.3.1 - Initial Context Setup
class ngap_ue_initial_context_setup_proc
{
@ -71,39 +96,6 @@ private:
srslog::basic_logger& logger;
};
// TS 38.413 - Section 8.3.4 - UE Context Modification
class ngap_ue_ue_context_modification_proc
{
public:
explicit ngap_ue_ue_context_modification_proc(ngap_interface_ngap_proc* parent_, srslog::basic_logger& logger_);
srsran::proc_outcome_t init();
srsran::proc_outcome_t step();
static const char* name() { return "UE Context Modification"; }
private:
ngap_interface_ngap_proc* parent;
};
class ngap_ue_pdu_session_res_setup_proc
{
public:
explicit ngap_ue_pdu_session_res_setup_proc(ngap_interface_ngap_proc* parent_,
rrc_interface_ngap_nr* rrc_,
ngap_ue_ctxt_t* ue_ctxt,
ngap_ue_bearer_manager* bearer_manager,
srslog::basic_logger& logger_);
srsran::proc_outcome_t init(const asn1::ngap::pdu_session_res_setup_request_s& msg);
srsran::proc_outcome_t step();
static const char* name() { return "UE PDU Session Resource Setup"; }
private:
ngap_ue_ctxt_t* ue_ctxt;
ngap_interface_ngap_proc* parent;
ngap_ue_bearer_manager* bearer_manager;
rrc_interface_ngap_nr* rrc = nullptr;
srslog::basic_logger& logger;
};
} // namespace srsenb
#endif

@ -16,82 +16,9 @@ using namespace srsran;
namespace srsenb {
ngap_ue_initial_context_setup_proc::ngap_ue_initial_context_setup_proc(ngap_interface_ngap_proc* parent_,
rrc_interface_ngap_nr* rrc_,
ngap_ue_ctxt_t* ue_ctxt_,
srslog::basic_logger& logger_) :
logger(logger_), parent(parent_), rrc(rrc_), ue_ctxt(ue_ctxt_){};
proc_outcome_t ngap_ue_initial_context_setup_proc::init(const asn1::ngap::init_context_setup_request_s& msg)
{
ue_ctxt->amf_pointer = msg->guami.value.amf_pointer.to_number();
ue_ctxt->amf_set_id = msg->guami.value.amf_set_id.to_number();
ue_ctxt->amf_region_id = msg->guami.value.amf_region_id.to_number();
if (msg->ue_aggregate_maximum_bit_rate_present == true) {
rrc->ue_set_bitrates(ue_ctxt->rnti, msg->ue_aggregate_maximum_bit_rate.value);
}
rrc->ue_set_security_cfg_capabilities(ue_ctxt->rnti, msg->ue_security_cap.value);
rrc->ue_set_security_cfg_key(ue_ctxt->rnti, msg->security_key.value);
if (msg->nas_pdu_present) {
srsran::unique_byte_buffer_t pdu = srsran::make_byte_buffer();
if (pdu == nullptr) {
logger.error("Fatal Error: Couldn't allocate buffer in %s.", __FUNCTION__);
return proc_outcome_t::error;
}
memcpy(pdu->msg, msg->nas_pdu.value.data(), msg->nas_pdu.value.size());
pdu->N_bytes = msg->nas_pdu.value.size();
rrc->start_security_mode_procedure(ue_ctxt->rnti, std::move(pdu));
} else {
rrc->start_security_mode_procedure(ue_ctxt->rnti, nullptr);
}
return proc_outcome_t::yield;
};
proc_outcome_t ngap_ue_initial_context_setup_proc::react(bool rrc_reconf_outcome)
{
if (rrc_reconf_outcome == true) {
parent->send_initial_ctxt_setup_response();
return proc_outcome_t::success;
}
return proc_outcome_t::error;
}
proc_outcome_t ngap_ue_initial_context_setup_proc::step()
{
return proc_outcome_t::yield;
}
ngap_ue_ue_context_release_proc::ngap_ue_ue_context_release_proc(ngap_interface_ngap_proc* parent_,
rrc_interface_ngap_nr* rrc_,
ngap_ue_ctxt_t* ue_ctxt_,
ngap_ue_bearer_manager* bearer_manager_,
srslog::basic_logger& logger_) :
logger(logger_)
{
parent = parent_;
rrc = rrc_;
ue_ctxt = ue_ctxt_;
bearer_manager = bearer_manager_;
};
proc_outcome_t ngap_ue_ue_context_release_proc::init(const asn1::ngap::ue_context_release_cmd_s& msg)
{
logger.info("Started %s", name());
bearer_manager->reset_pdu_sessions(ue_ctxt->rnti);
rrc->release_user(ue_ctxt->rnti);
parent->send_ue_ctxt_release_complete();
return proc_outcome_t::success;
}
proc_outcome_t ngap_ue_ue_context_release_proc::step()
{
return proc_outcome_t::success;
}
/*
* TS 38.413 - Section 8.2.1 PDU Session Resource Setup
*/
ngap_ue_pdu_session_res_setup_proc::ngap_ue_pdu_session_res_setup_proc(ngap_interface_ngap_proc* parent_,
rrc_interface_ngap_nr* rrc_,
ngap_ue_ctxt_t* ue_ctxt_,
@ -182,4 +109,86 @@ proc_outcome_t ngap_ue_pdu_session_res_setup_proc::step()
return proc_outcome_t::success;
}
/*
* TS 38.413 - Section 8.3.1 - Initial Context Setup
*/
ngap_ue_initial_context_setup_proc::ngap_ue_initial_context_setup_proc(ngap_interface_ngap_proc* parent_,
rrc_interface_ngap_nr* rrc_,
ngap_ue_ctxt_t* ue_ctxt_,
srslog::basic_logger& logger_) :
logger(logger_), parent(parent_), rrc(rrc_), ue_ctxt(ue_ctxt_){};
proc_outcome_t ngap_ue_initial_context_setup_proc::init(const asn1::ngap::init_context_setup_request_s& msg)
{
ue_ctxt->amf_pointer = msg->guami.value.amf_pointer.to_number();
ue_ctxt->amf_set_id = msg->guami.value.amf_set_id.to_number();
ue_ctxt->amf_region_id = msg->guami.value.amf_region_id.to_number();
if (msg->ue_aggregate_maximum_bit_rate_present == true) {
rrc->ue_set_bitrates(ue_ctxt->rnti, msg->ue_aggregate_maximum_bit_rate.value);
}
rrc->ue_set_security_cfg_capabilities(ue_ctxt->rnti, msg->ue_security_cap.value);
rrc->ue_set_security_cfg_key(ue_ctxt->rnti, msg->security_key.value);
if (msg->nas_pdu_present) {
srsran::unique_byte_buffer_t pdu = srsran::make_byte_buffer();
if (pdu == nullptr) {
logger.error("Fatal Error: Couldn't allocate buffer in %s.", __FUNCTION__);
return proc_outcome_t::error;
}
memcpy(pdu->msg, msg->nas_pdu.value.data(), msg->nas_pdu.value.size());
pdu->N_bytes = msg->nas_pdu.value.size();
rrc->start_security_mode_procedure(ue_ctxt->rnti, std::move(pdu));
} else {
rrc->start_security_mode_procedure(ue_ctxt->rnti, nullptr);
}
return proc_outcome_t::yield;
};
proc_outcome_t ngap_ue_initial_context_setup_proc::react(bool rrc_reconf_outcome)
{
if (rrc_reconf_outcome == true) {
parent->send_initial_ctxt_setup_response();
return proc_outcome_t::success;
}
return proc_outcome_t::error;
}
proc_outcome_t ngap_ue_initial_context_setup_proc::step()
{
return proc_outcome_t::yield;
}
/*
* TS 38.413 - Section 8.3.2 - UE Context Release Request (NG-RAN node initiated)
*/
ngap_ue_ue_context_release_proc::ngap_ue_ue_context_release_proc(ngap_interface_ngap_proc* parent_,
rrc_interface_ngap_nr* rrc_,
ngap_ue_ctxt_t* ue_ctxt_,
ngap_ue_bearer_manager* bearer_manager_,
srslog::basic_logger& logger_) :
logger(logger_)
{
parent = parent_;
rrc = rrc_;
ue_ctxt = ue_ctxt_;
bearer_manager = bearer_manager_;
};
proc_outcome_t ngap_ue_ue_context_release_proc::init(const asn1::ngap::ue_context_release_cmd_s& msg)
{
logger.info("Started %s", name());
bearer_manager->reset_pdu_sessions(ue_ctxt->rnti);
rrc->release_user(ue_ctxt->rnti);
parent->send_ue_ctxt_release_complete();
return proc_outcome_t::success;
}
proc_outcome_t ngap_ue_ue_context_release_proc::step()
{
return proc_outcome_t::success;
}
} // namespace srsenb

Loading…
Cancel
Save