Commit b2ac87a8 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Code cleanup/address review comments

parent 7fc6c548
......@@ -244,10 +244,9 @@ typedef struct slice_s {
bool operator>(const struct slice_s& s) const {
if (this->sst > s.sst) return true;
if (this->sst == s.sst) {
if (this->sd > s.sd) return true;
if (this->sd <= s.sd) return false;
return (this->sd > s.sd);
}
return true;
return false;
}
nlohmann::json to_json() const {
......
......@@ -1247,7 +1247,6 @@ void amf_n1::registration_request_handle(
if (nc == nullptr) {
// try to get the GUTI -> nas_context
if (guti_2_nas_context(guti, nc)) {
// nc = guti_2_nas_context(guti);
set_amf_ue_ngap_id_2_nas_context(amf_ue_ngap_id, nc);
nc->amf_ue_ngap_id = amf_ue_ngap_id;
nc->ran_ue_ngap_id = ran_ue_ngap_id;
......
......@@ -108,17 +108,18 @@ class amf_n1 {
SecurityHeaderType_t& type, const uint8_t* buffer, const uint32_t length);
/*
* Verify if a UE NAS context associated with a GUTI exist
* Verify if a UE NAS context associated with a GUTI exists
* @param [const std::string&] guti: UE GUTI
* @return true if UE NAS context exist, otherwise false
* @return true if the UE NAS context exists, otherwise false
*/
bool is_guti_2_nas_context(const std::string& guti) const;
/*
* Get UE NAS context associated with a GUTI if exist and not null
* Get UE NAS context associated with a GUTI if the context exists and is not
* null
* @param [const std::string&] guti: UE GUTI
* @param [std::shared_ptr<nas_context>&] nc: UE NAS Context
* @return true if context exists and not null, otherwise return false
* @return true if the context exists and is not null, otherwise return false
*/
bool guti_2_nas_context(
const std::string& guti, std::shared_ptr<nas_context>& nc) const;
......@@ -140,18 +141,18 @@ class amf_n1 {
bool remove_guti_2_nas_context(const std::string& guti);
/*
* Verify if a UE NAS context associated with an AMF UE NGAP ID exist
* Verify if a UE NAS context associated with an AMF UE NGAP ID exists
* @param [const long& ] amf_ue_ngap_id: AMF UE NGAP ID
* @return true if UE NAS context exist, otherwise false
* @return true if UE NAS context exists, otherwise false
*/
bool is_amf_ue_id_2_nas_context(const long& amf_ue_ngap_id) const;
/*
* Verify if a UE NAS context associated with an AMF UE NGAP ID exist and not
* null
* Verify if a UE NAS context associated with an AMF UE NGAP ID exists and is
* not null
* @param [const long& ] amf_ue_ngap_id: AMF UE NGAP ID
* @param [std::shared_ptr<nas_context>&] nc: pointer to UE NAS context
* @return true if UE NAS context exist, otherwise false
* @return true if the UE NAS context exists (and not null), otherwise false
*/
bool amf_ue_id_2_nas_context(
const long& amf_ue_ngap_id, std::shared_ptr<nas_context>& nc) const;
......@@ -223,7 +224,8 @@ class amf_n1 {
* Get UE NAS context associated with an IMSI
* @param [const std::string&] imsi: UE IMSI
* @param [const std::shared_ptr<nas_context>&] nc: pointer to UE NAS context
* @return true if the NAS context exist and not null, otherwise return false
* @return true if the NAS context exists and is not null, otherwise return
* false
*/
bool imsi_2_nas_context(
const std::string& imsi, std::shared_ptr<nas_context>&) const;
......
......@@ -225,20 +225,21 @@ class amf_n2 : public ngap::ngap_app {
const uint32_t& ran_ue_ngap_id, std::vector<nas::SNSSAI_t>& common_nssai);
/*
* Verify whether a UE NGAP context associated with a RAN UE NGAP ID exist
* Get the UE NGAP context associated with a RAN UE NGAP ID if it exists and
* not null
* @param [const uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID
* @param [std::shared_ptr<ue_ngap_context>&] unc: shared pointer to the
* existing UE NGAP context
* @return true if exist, otherwise return false
* @return true if the context exists and is not null, otherwise return false
*/
bool ran_ue_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id,
std::shared_ptr<ue_ngap_context>& unc) const;
/*
* Verify whether a UE NGAP context associated with a RAN UE NGAP ID exist
* Verify whether a UE NGAP context associated with a RAN UE NGAP ID exists
* @param [const uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID
* @return true if exist, otherwise return false
* @return true if the context exists and is not null, otherwise return false
*/
bool is_ran_ue_id_2_ue_ngap_context(const uint32_t& ran_ue_ngap_id) const;
......@@ -268,19 +269,21 @@ class amf_n2 : public ngap::ngap_app {
void remove_ue_context_with_ran_ue_ngap_id(const uint32_t& ran_ue_ngap_id);
/*
* Verify whether a UE NGAP context associated with a AMF UE NGAP ID exist
* Verify whether a UE NGAP context associated with a AMF UE NGAP ID exists
* and is not null
* @param [const unsigned long&] amf_ue_ngap_id: AMF UE NGAP ID
* @return true if exist, otherwise return false
* @return true if the context exists and is not null, otherwise return false
*/
bool is_amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id) const;
/*
* Get UE NGAP context associated with a AMF UE NGAP ID
* Get UE NGAP context associated with a AMF UE NGAP ID if the context exists
* and is not null
* @param [const unsigned long&] amf_ue_ngap_id: AMF UE NGAP ID
* @param [std::shared_ptr<ue_ngap_context>&] unc: store the pointer to UE
* NGAP context
* @return true if context exist and not null, otherwise return false
* @return true if the context exists and is not null, otherwise return false
*/
bool amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id,
......
......@@ -42,9 +42,12 @@ extern "C" {
namespace sctp {
//------------------------------------------------------------------------------
sctp_application::~sctp_application() {}
//------------------------------------------------------------------------------
sctp_server::sctp_server(const char* address, const uint16_t port_num) {
Logger::sctp().debug("Creating socket!!");
Logger::sctp().debug("Creating socket!");
create_socket(address, port_num);
app_ = nullptr;
sctp_desc = {};
......@@ -118,7 +121,7 @@ void* sctp_server::sctp_receiver_thread(void* arg) {
FD_SET(ptr->getSocket(), &master);
fdmax = ptr->getSocket();
while (1) {
while (true) {
memcpy(&read_fds, &master, sizeof(master));
if (select(fdmax + 1, &read_fds, NULL, NULL, NULL) == -1) {
Logger::sctp().error(
......
......@@ -73,7 +73,7 @@ typedef struct sctp_descriptor_s {
class sctp_application {
public:
virtual ~sctp_application(){};
virtual ~sctp_application();
virtual void handle_receive(
bstring payload, sctp_assoc_id_t assoc_id, sctp_stream_id_t stream,
sctp_stream_id_t instreams, sctp_stream_id_t outstreams) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment