Skip to content

Commit

Permalink
fixing typos and adding commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kbaccar committed Feb 13, 2023
1 parent 317e988 commit 269ddad
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
2 changes: 2 additions & 0 deletions lib/include/srsran/interfaces/ue_nas_interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class pdu_session_cfg_t
apn_types apn_type = ipv4;
std::string apn_user;
std::string apn_pass;
bool emergency_registration_5g;
};
class nas_interface_rrc
{
Expand Down Expand Up @@ -83,6 +84,7 @@ class nas_5g_interface_procedures
add_pdu_session(uint16_t pdu_session_id, uint16_t pdu_session_type, srsran::nas_5g::pdu_address_t pdu_address) = 0;

virtual uint32_t allocate_next_proc_trans_id() = 0;

};

} // namespace srsue
Expand Down
5 changes: 3 additions & 2 deletions srsue/hdr/stack/upper/nas_5g_procedures.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class nas_5g::pdu_session_establishment_procedure
{
public:
explicit pdu_session_establishment_procedure(nas_5g_interface_procedures* parent_nas_, srslog::basic_logger& logger_);
srsran::proc_outcome_t init(const uint16_t pdu_session_id, const pdu_session_cfg_t& pdu_session);
srsran::proc_outcome_t init(const uint16_t pdu_session_id, const pdu_session_cfg_t& pdu_session, const bool emergency_pdu_session);
srsran::proc_outcome_t react(const srsran::nas_5g::pdu_session_establishment_accept_t& pdu_session_est_accept);
srsran::proc_outcome_t react(const srsran::nas_5g::pdu_session_establishment_reject_t& pdu_session_est_reject);
srsran::proc_outcome_t step();
Expand All @@ -69,8 +69,9 @@ class nas_5g::pdu_session_establishment_procedure
nas_5g_interface_procedures* parent_nas;
uint32_t transaction_identity = 0;
uint16_t pdu_session_id = 0;
bool emergency_pdu_session = false;
};

} // namespace srsue

#endif // SRSUE_NAS_5G_PROCEDURES_H_
#endif // SRSUE_NAS_5G_PROCEDURES_H_
3 changes: 1 addition & 2 deletions srsue/hdr/stack/upper/nas_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ class nas_5g_args_t
std::string ia5g;
std::string ea5g;
std::vector<pdu_session_cfg_t> pdu_session_cfgs;
bool emergency_registration;

bool emergency_registration_5g;
};

} // namespace srsue
Expand Down
2 changes: 1 addition & 1 deletion srsue/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
("nas.force_imsi_attach", bpo::value<bool>(&args->stack.nas.force_imsi_attach)->default_value(false), "Whether to always perform an IMSI attach")
("nas.eia", bpo::value<string>(&args->stack.nas.eia)->default_value("1,2,3"), "List of integrity algorithms included in UE capabilities")
("nas.eea", bpo::value<string>(&args->stack.nas.eea)->default_value("0,1,2,3"), "List of ciphering algorithms included in UE capabilities")
("nas.enable_emergency_reg", bpo::value<bool>(&args->stack.nas_5g.emergency_registration)->default_value(false), "Specifies if it is an anonymous emergency registration.")
("nas.enable_emergency_reg_5g", bpo::value<bool>(&args->stack.nas_5g.emergency_registration_5g)->default_value(false), "Specifies if it is an anonymous emergency registration.")

("pcap.enable", bpo::value<string>(&args->stack.pkt_trace.enable)->default_value("none"), "Enable (MAC, MAC_NR, NAS) packet captures for wireshark")
("pcap.mac_filename", bpo::value<string>(&args->stack.pkt_trace.mac_pcap.filename)->default_value("/tmp/ue_mac.pcap"), "MAC layer capture filename")
Expand Down
12 changes: 6 additions & 6 deletions srsue/src/stack/upper/nas_5g.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ int nas_5g::write_pdu(srsran::unique_byte_buffer_t pdu)
/*******************************************************************************
* Senders
******************************************************************************/

int nas_5g::send_registration_request()
{

unique_byte_buffer_t pdu = srsran::make_byte_buffer();
if (!pdu) {
logger.error("Couldn't allocate PDU in %s().", __FUNCTION__);
Expand All @@ -264,7 +264,7 @@ int nas_5g::send_registration_request()
reg_req.registration_type_5gs.follow_on_request_bit =
registration_type_5gs_t::follow_on_request_bit_type_::options::follow_on_request_pending;

if(cfg.emergency_registration){
if(cfg.emergency_registration_5g){
reg_req.registration_type_5gs.registration_type =
registration_type_5gs_t::registration_type_type_::options::emergency_registration;

Expand Down Expand Up @@ -590,14 +590,14 @@ int nas_5g::send_pdu_session_establishment_request(uint32_t tran
ul_nas_msg.pdu_session_id.pdu_session_identity_2_value = pdu_session_id;

ul_nas_msg.request_type_present = true;
ul_nas_msg.request_type.request_type_value = (cfg.emergency_registration)? request_type_t::Request_type_value_type_::initial_emergency_request:
ul_nas_msg.request_type.request_type_value = (cfg.emergency_registration_5g)? request_type_t::Request_type_value_type_::initial_emergency_request:
request_type_t::Request_type_value_type_::options::initial_request;

ul_nas_msg.s_nssai_present = (cfg.emergency_registration)? false:true;
ul_nas_msg.s_nssai_present = (cfg.emergency_registration_5g)? false:true;
ul_nas_msg.s_nssai.type = s_nssai_t::SST_type_::options::sst;
ul_nas_msg.s_nssai.sst = 1;

ul_nas_msg.dnn_present = (cfg.emergency_registration)? false:true;
ul_nas_msg.dnn_present = (cfg.emergency_registration_5g)? false:true;
ul_nas_msg.dnn.dnn_value.resize(pdu_session_cfg.apn_name.size() + 1);
ul_nas_msg.dnn.dnn_value.data()[0] = static_cast<uint8_t>(pdu_session_cfg.apn_name.size());

Expand Down Expand Up @@ -1246,7 +1246,7 @@ int nas_5g::trigger_pdu_session_est()
pdu_session_cfg_t pdu_session_cfg;
uint16_t pdu_session_id;
get_unestablished_pdu_session(pdu_session_id, pdu_session_cfg);
pdu_session_establishment_proc.launch(pdu_session_id, pdu_session_cfg);
pdu_session_establishment_proc.launch(pdu_session_id, pdu_session_cfg,cfg.emergency_registration_5g);
}
return SRSRAN_SUCCESS;
}
Expand Down
11 changes: 10 additions & 1 deletion srsue/src/stack/upper/nas_5g_procedures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,28 @@ nas_5g::pdu_session_establishment_procedure::pdu_session_establishment_procedure
{}

srsran::proc_outcome_t nas_5g::pdu_session_establishment_procedure::init(const uint16_t pdu_session_id_,
const pdu_session_cfg_t& pdu_session_cfg)
const pdu_session_cfg_t& pdu_session_cfg,
const bool emergency_pdu_session_)
{
// Get PDU transaction identity
transaction_identity = parent_nas->allocate_next_proc_trans_id();
pdu_session_id = pdu_session_id_;
parent_nas->send_pdu_session_establishment_request(transaction_identity, pdu_session_id, pdu_session_cfg);

//Check if emergency registration is enabled
emergency_pdu_session = emergency_pdu_session_;

return srsran::proc_outcome_t::yield;
}

srsran::proc_outcome_t nas_5g::pdu_session_establishment_procedure::react(
const srsran::nas_5g::pdu_session_establishment_accept_t& pdu_session_est_accept)
{
//TODO check the pdu session values
if(pdu_session_est_accept.dnn_present == false and not emergency_pdu_session){
logger.warning("Expected DNN in PDU session establishment accept");
return proc_outcome_t::error;
}

if (pdu_session_est_accept.pdu_address_present == false) {
logger.warning("Expected PDU Address in PDU session establishment accept");
Expand Down

0 comments on commit 269ddad

Please sign in to comment.