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

Code cleanup for PLMN List

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