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

Code cleanup for PLMN List

parent af488084
...@@ -29,22 +29,22 @@ ...@@ -29,22 +29,22 @@
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PLMN_List::PLMN_List(uint8_t iei) : Type4NasIe(iei) { PlmnList::PlmnList(uint8_t iei) : Type4NasIe(iei) {
SetLengthIndicator(0); SetLengthIndicator(0);
SetIeName(kPlmnListIeName); SetIeName(kPlmnListIeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PLMN_List::PLMN_List() : Type4NasIe() { PlmnList::PlmnList() : Type4NasIe() {
SetLengthIndicator(0); SetLengthIndicator(0);
SetIeName(kPlmnListIeName); SetIeName(kPlmnListIeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PLMN_List::~PLMN_List() {} PlmnList::~PlmnList() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PLMN_List::set(uint8_t iei, const std::vector<nas_plmn_t>& list) { void PlmnList::Set(uint8_t iei, const std::vector<nas_plmn_t>& list) {
plmn_list = list; plmn_list = list;
int length = 0; int length = 0;
if (list.size() > 0) if (list.size() > 0)
...@@ -58,12 +58,12 @@ void PLMN_List::set(uint8_t iei, const std::vector<nas_plmn_t>& list) { ...@@ -58,12 +58,12 @@ void PLMN_List::set(uint8_t iei, const std::vector<nas_plmn_t>& list) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PLMN_List::getPLMNList(std::vector<nas_plmn_t>& list) { void PlmnList::GetPLMNList(std::vector<nas_plmn_t>& list) const {
list = plmn_list; list = plmn_list;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int PLMN_List::Encode(uint8_t* buf, int len) { int PlmnList::Encode(uint8_t* buf, int len) {
Logger::nas_mm().debug("Encoding %s", GetIeName().c_str()); Logger::nas_mm().debug("Encoding %s", GetIeName().c_str());
int ie_len = GetIeLength(); int ie_len = GetIeLength();
...@@ -89,7 +89,7 @@ int PLMN_List::Encode(uint8_t* buf, int len) { ...@@ -89,7 +89,7 @@ int PLMN_List::Encode(uint8_t* buf, int len) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int PLMN_List::Decode(uint8_t* buf, int len, bool is_iei) { int PlmnList::Decode(uint8_t* buf, int len, bool is_iei) {
Logger::nas_mm().debug("Decoding %s", GetIeName().c_str()); Logger::nas_mm().debug("Decoding %s", GetIeName().c_str());
if (len < kPlmnListMinimumLength) { if (len < kPlmnListMinimumLength) {
......
...@@ -34,17 +34,17 @@ constexpr auto kPlmnListIeName = "PLMN List"; ...@@ -34,17 +34,17 @@ constexpr auto kPlmnListIeName = "PLMN List";
namespace nas { namespace nas {
class PLMN_List : public Type4NasIe { class PlmnList : public Type4NasIe {
public: public:
PLMN_List(); PlmnList();
PLMN_List(uint8_t iei); PlmnList(uint8_t iei);
~PLMN_List(); ~PlmnList();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len, bool is_option); int Decode(uint8_t* buf, int len, bool is_option);
void set(uint8_t iei, const std::vector<nas_plmn_t>& list); void Set(uint8_t iei, const std::vector<nas_plmn_t>& list);
void getPLMNList(std::vector<nas_plmn_t>& list); void GetPLMNList(std::vector<nas_plmn_t>& list) const;
private: private:
std::vector<nas_plmn_t> plmn_list; std::vector<nas_plmn_t> plmn_list;
......
...@@ -131,9 +131,9 @@ void RegistrationAccept::Set5gSTmsi() {} ...@@ -131,9 +131,9 @@ void RegistrationAccept::Set5gSTmsi() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setEquivalent_PLMNs( void RegistrationAccept::setEquivalent_PLMNs(
const std::vector<nas_plmn_t>& list) { const std::vector<nas_plmn_t>& list) {
PLMN_List ie_equivalent_plmns_tmp = {}; PlmnList ie_equivalent_plmns_tmp = {};
ie_equivalent_plmns_tmp.set(kEquivalentPlmns, list); ie_equivalent_plmns_tmp.Set(kEquivalentPlmns, list);
ie_equivalent_plmns = std::optional<PLMN_List>(ie_equivalent_plmns_tmp); ie_equivalent_plmns = std::optional<PlmnList>(ie_equivalent_plmns_tmp);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -843,10 +843,10 @@ int RegistrationAccept::Decode(uint8_t* buf, int len) { ...@@ -843,10 +843,10 @@ int RegistrationAccept::Decode(uint8_t* buf, int len) {
} break; } break;
case 0x4A: { case 0x4A: {
Logger::nas_mm().debug("Decoding IEI (0x4A)"); Logger::nas_mm().debug("Decoding IEI (0x4A)");
PLMN_List ie_equivalent_plmns_tmp = {}; PlmnList ie_equivalent_plmns_tmp = {};
decoded_size += ie_equivalent_plmns_tmp.Decode( decoded_size += ie_equivalent_plmns_tmp.Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
ie_equivalent_plmns = std::optional<PLMN_List>(ie_equivalent_plmns_tmp); ie_equivalent_plmns = std::optional<PlmnList>(ie_equivalent_plmns_tmp);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
Logger::nas_mm().debug("Next IEI (0x%x)", octet); Logger::nas_mm().debug("Next IEI (0x%x)", octet);
} break; } break;
......
...@@ -149,7 +149,7 @@ class RegistrationAccept : public NasMmPlainHeader { ...@@ -149,7 +149,7 @@ class RegistrationAccept : public NasMmPlainHeader {
_5GS_Registration_Result ie_5gs_registration_result; // Mandatory _5GS_Registration_Result ie_5gs_registration_result; // Mandatory
std::optional<_5GSMobileIdentity> ie_5g_guti; // Optional std::optional<_5GSMobileIdentity> ie_5g_guti; // Optional
std::optional<PLMN_List> ie_equivalent_plmns; // Optional std::optional<PlmnList> ie_equivalent_plmns; // Optional
_5GSTrackingAreaIdList* ie_tai_list; // Optional _5GSTrackingAreaIdList* ie_tai_list; // Optional
NSSAI* ie_allowed_nssai; // Optional NSSAI* ie_allowed_nssai; // Optional
Rejected_NSSAI* ie_rejected_nssai; // Optional Rejected_NSSAI* ie_rejected_nssai; // Optional
......
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