Commit 4fa4f831 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Code refactoring for UserLocationInformation

parent 4581a722
...@@ -21,130 +21,114 @@ ...@@ -21,130 +21,114 @@
#include "UserLocationInformation.hpp" #include "UserLocationInformation.hpp"
#include "logger.hpp"
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
UserLocationInformation::UserLocationInformation() { UserLocationInformation::UserLocationInformation() {
userLocationInformationEUTRA = nullptr; present_ = Ngap_UserLocationInformation_PR_NOTHING;
userLocationInformationNR = nullptr; user_location_information_eutra_ = std::nullopt;
// userLocationInformationN3IWF = nullptr; user_location_information_nr_ = std::nullopt;
// userLocationInformationN3IWF = std::nullopt;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
UserLocationInformation::~UserLocationInformation() {} UserLocationInformation::~UserLocationInformation() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UserLocationInformation::setInformation( Ngap_UserLocationInformation_PR
UserLocationInformationEUTRA* informationEUTRA) { UserLocationInformation::getChoiceOfUserLocationInformation() {
informationPresent = return present_;
Ngap_UserLocationInformation_PR_userLocationInformationEUTRA; }
userLocationInformationEUTRA = informationEUTRA;
//------------------------------------------------------------------------------
bool UserLocationInformation::getInformation(
UserLocationInformationEUTRA& information_eutra) {
if (!user_location_information_eutra_.has_value()) return false;
information_eutra = user_location_information_eutra_.value();
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UserLocationInformation::setInformation( void UserLocationInformation::setInformation(
UserLocationInformationNR* informationNR) { const UserLocationInformationEUTRA& information_eutra) {
informationPresent = present_ = Ngap_UserLocationInformation_PR_userLocationInformationEUTRA;
Ngap_UserLocationInformation_PR_userLocationInformationNR; user_location_information_eutra_ =
userLocationInformationNR = informationNR; std::optional<UserLocationInformationEUTRA>(information_eutra);
}
//------------------------------------------------------------------------------
bool UserLocationInformation::getInformation(
UserLocationInformationNR& information_nr) {
if (!user_location_information_nr_.has_value()) return false;
information_nr = user_location_information_nr_.value();
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if 0 void UserLocationInformation::setInformation(
void UserLocationInformation::setInformation(UserLocationInformationN3IWF* informationN3IWF) const UserLocationInformationNR& information_nr) {
{ present_ = Ngap_UserLocationInformation_PR_userLocationInformationNR;
informationPresent = Ngap_UserLocationInformation_PR_userLocationInformationN3IWF; user_location_information_nr_ =
userLocationInformationN3IWF = informationN3IWF; std::optional<UserLocationInformationNR>(information_nr);
} }
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UserLocationInformation::encodefromUserLocationInformation( bool UserLocationInformation::encode(
Ngap_UserLocationInformation_t* userLocationInformation) { Ngap_UserLocationInformation_t* user_location_information) {
userLocationInformation->present = informationPresent; user_location_information->present = present_;
switch (informationPresent) { switch (present_) {
case Ngap_UserLocationInformation_PR_userLocationInformationEUTRA: { case Ngap_UserLocationInformation_PR_userLocationInformationEUTRA: {
Ngap_UserLocationInformationEUTRA* ieEUTRA = Ngap_UserLocationInformationEUTRA* ie_eutra =
(Ngap_UserLocationInformationEUTRA*) calloc( (Ngap_UserLocationInformationEUTRA*) calloc(
1, sizeof(Ngap_UserLocationInformationEUTRA)); 1, sizeof(Ngap_UserLocationInformationEUTRA));
userLocationInformationEUTRA->encode2UserLocationInformationEUTRA( user_location_information_eutra_.value().encode(ie_eutra);
ieEUTRA); user_location_information->choice.userLocationInformationEUTRA = ie_eutra;
userLocationInformation->choice.userLocationInformationEUTRA = ieEUTRA;
break; break;
} }
case Ngap_UserLocationInformation_PR_userLocationInformationNR: { case Ngap_UserLocationInformation_PR_userLocationInformationNR: {
Ngap_UserLocationInformationNR* ieNR = Ngap_UserLocationInformationNR* ie_nr =
(Ngap_UserLocationInformationNR*) calloc( (Ngap_UserLocationInformationNR*) calloc(
1, sizeof(Ngap_UserLocationInformationNR)); 1, sizeof(Ngap_UserLocationInformationNR));
userLocationInformationNR->encode2UserLocationInformationNR(ieNR); user_location_information_nr_.value().encode(ie_nr);
userLocationInformation->choice.userLocationInformationNR = ieNR; user_location_information->choice.userLocationInformationNR = ie_nr;
break; break;
} }
#if 0
case Ngap_UserLocationInformation_PR_userLocationInformationN3IWF:{
Ngap_UserLocationInformationN3IWF *ieN3IWF = (Ngap_UserLocationInformationN3IWF *)calloc(1,sizeof(Ngap_UserLocationInformationN3IWF));
userLocationInformationN3IWF->encode2UserLocationInformationN3IWF(ieN3IWF);
userLocationInformation->choice.userLocationInformationN3IWF = ieN3IWF;
break;}
#endif
default: default:
// cout << "[Warning] UserLocationInformation encode error!" << endl; Logger::ngap().warn("UserLocationInformation encode error!");
return false; return false;
} }
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UserLocationInformation::decodefromUserLocationInformation( bool UserLocationInformation::decode(
Ngap_UserLocationInformation_t* userLocationInformation) { Ngap_UserLocationInformation_t* user_location_information) {
informationPresent = userLocationInformation->present; present_ = user_location_information->present;
switch (informationPresent) { switch (present_) {
case Ngap_UserLocationInformation_PR_userLocationInformationEUTRA: { case Ngap_UserLocationInformation_PR_userLocationInformationEUTRA: {
userLocationInformationEUTRA = new UserLocationInformationEUTRA(); UserLocationInformationEUTRA user_location_information_eutra = {};
userLocationInformationEUTRA->decodefromUserLocationInformationEUTRA( user_location_information_eutra.decode(
userLocationInformation->choice.userLocationInformationEUTRA); user_location_information->choice.userLocationInformationEUTRA);
user_location_information_eutra_ =
std::optional<UserLocationInformationEUTRA>(
user_location_information_eutra);
break; break;
} }
case Ngap_UserLocationInformation_PR_userLocationInformationNR: { case Ngap_UserLocationInformation_PR_userLocationInformationNR: {
userLocationInformationNR = new UserLocationInformationNR(); UserLocationInformationNR user_location_information_nr = {};
userLocationInformationNR->decodefromUserLocationInformationNR( user_location_information_nr.decode(
userLocationInformation->choice.userLocationInformationNR); user_location_information->choice.userLocationInformationNR);
user_location_information_nr_ = std::optional<UserLocationInformationNR>(
user_location_information_nr);
break; break;
} }
#if 0
case Ngap_UserLocationInformation_PR_userLocationInformationN3IWF:{
userLocationInformationN3IWF = new UserLocationInformationN3IWF();
userLocationInformationN3IWF->decodefromUserLocationInformationN3IWF(userLocationInformation->choice.userLocationInformationN3IWF);
break;}
#endif
default: default:
// cout << "[Warning] UserLocationInformation decode error!" << endl; Logger::ngap().warn("UserLocationInformation decode error!");
return false; return false;
} }
return true; return true;
} }
//------------------------------------------------------------------------------
Ngap_UserLocationInformation_PR
UserLocationInformation::getChoiceOfUserLocationInformation() {
return informationPresent;
}
//------------------------------------------------------------------------------
void UserLocationInformation::getInformation(
UserLocationInformationEUTRA*& informationEUTRA) {
informationEUTRA = userLocationInformationEUTRA;
}
//------------------------------------------------------------------------------
void UserLocationInformation::getInformation(
UserLocationInformationNR*& informationNR) {
informationNR = userLocationInformationNR;
}
#if 0
void UserLocationInformation::getInformation(UserLocationInformationN3IWF* &informationN3IWF)
{
informationN3IWF = userLocationInformationN3IWF;
}
#endif
} // namespace ngap } // namespace ngap
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include "UserLocationInformationN3IWF.hpp" #include "UserLocationInformationN3IWF.hpp"
#include "UserLocationInformationNR.hpp" #include "UserLocationInformationNR.hpp"
#include <optional>
extern "C" { extern "C" {
#include "Ngap_UserLocationInformation.h" #include "Ngap_UserLocationInformation.h"
} }
...@@ -36,25 +38,23 @@ class UserLocationInformation { ...@@ -36,25 +38,23 @@ class UserLocationInformation {
UserLocationInformation(); UserLocationInformation();
virtual ~UserLocationInformation(); virtual ~UserLocationInformation();
void setInformation(UserLocationInformationEUTRA*); void setInformation(const UserLocationInformationEUTRA&);
void getInformation(UserLocationInformationEUTRA*&); bool getInformation(UserLocationInformationEUTRA&);
void setInformation(UserLocationInformationNR*); void setInformation(const UserLocationInformationNR&);
void getInformation(UserLocationInformationNR*&); bool getInformation(UserLocationInformationNR&);
// void setInformation(UserLocationInformationN3IWF*); // void setInformation(const UserLocationInformationN3IWF&);
// void getInformation(UserLocationInformationN3IWF*&); // void getInformation(UserLocationInformationN3IWF&);
bool encodefromUserLocationInformation( bool encode(Ngap_UserLocationInformation_t* user_location_information);
Ngap_UserLocationInformation_t* userLocationInformation); bool decode(Ngap_UserLocationInformation_t* user_location_information);
bool decodefromUserLocationInformation(
Ngap_UserLocationInformation_t* userLocationInformation);
Ngap_UserLocationInformation_PR getChoiceOfUserLocationInformation(); Ngap_UserLocationInformation_PR getChoiceOfUserLocationInformation();
private: private:
Ngap_UserLocationInformation_PR informationPresent; Ngap_UserLocationInformation_PR present_;
UserLocationInformationEUTRA* userLocationInformationEUTRA; std::optional<UserLocationInformationEUTRA> user_location_information_eutra_;
UserLocationInformationNR* userLocationInformationNR; std::optional<UserLocationInformationNR> user_location_information_nr_;
// TODO: UserLocationInformationN3IWF *userLocationInformationN3IWF; // TODO: UserLocationInformationN3IWF *userLocationInformationN3IWF;
}; };
......
...@@ -31,70 +31,44 @@ UserLocationInformationEUTRA::UserLocationInformationEUTRA() {} ...@@ -31,70 +31,44 @@ UserLocationInformationEUTRA::UserLocationInformationEUTRA() {}
UserLocationInformationEUTRA::~UserLocationInformationEUTRA() {} UserLocationInformationEUTRA::~UserLocationInformationEUTRA() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UserLocationInformationEUTRA::setInformationEUTRA( void UserLocationInformationEUTRA::set(
const EUTRA_CGI& m_eUTRA_CGI, const TAI& m_tAI) { const EUTRA_CGI& m_eUTRA_CGI, const TAI& m_tAI) {
eUTRA_CGI = m_eUTRA_CGI; eUTRA_CGI = m_eUTRA_CGI;
tAI = m_tAI; tAI = m_tAI;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UserLocationInformationEUTRA::encode2UserLocationInformationEUTRA( void UserLocationInformationEUTRA::get(EUTRA_CGI& m_eUTRA_CGI, TAI& m_tAI) {
Ngap_UserLocationInformationEUTRA_t* userLocationInformationEUTRA) { m_eUTRA_CGI = eUTRA_CGI;
if (!eUTRA_CGI.encode(userLocationInformationEUTRA->eUTRA_CGI)) { m_tAI = tAI;
}
//------------------------------------------------------------------------------
bool UserLocationInformationEUTRA::encode(
Ngap_UserLocationInformationEUTRA_t* user_location_info_eutra) {
if (!eUTRA_CGI.encode(user_location_info_eutra->eUTRA_CGI)) {
Logger::ngap().warn("Encode eUTRA_CGI IE error"); Logger::ngap().warn("Encode eUTRA_CGI IE error");
return false; return false;
} }
if (!tAI.encode(&userLocationInformationEUTRA->tAI)) { if (!tAI.encode(&user_location_info_eutra->tAI)) {
Logger::ngap().warn("Encode TAI IE error"); Logger::ngap().warn("Encode TAI IE error");
return false; return false;
} }
#if 0
if(istimeStampSet)
{
Ngap_TimeStamp_t *ieTimeStamp = (Ngap_TimeStamp_t *)calloc(1,sizeof(Ngap_TimeStamp_t));
if(!timeStamp->encodefromTimeStamp(ieTimeStamp))
{
cout<<"[Warning] timeStamp->encodefromTimeStamp() error!"<<endl;
free(ieTimeStamp);
return false;
}
userLocationInformationEUTRA->timeStamp = ieTimeStamp;
}
#endif
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UserLocationInformationEUTRA::decodefromUserLocationInformationEUTRA( bool UserLocationInformationEUTRA::decode(
Ngap_UserLocationInformationEUTRA_t* userLocationInformationEUTRA) { Ngap_UserLocationInformationEUTRA_t* user_location_info_eutra) {
if (!eUTRA_CGI.decode(userLocationInformationEUTRA->eUTRA_CGI)) { if (!eUTRA_CGI.decode(user_location_info_eutra->eUTRA_CGI)) {
Logger::ngap().warn("Decode eUTRA_CGI IE error"); Logger::ngap().warn("Decode eUTRA_CGI IE error");
return false; return false;
} }
if (!tAI.decode(&userLocationInformationEUTRA->tAI)) { if (!tAI.decode(&user_location_info_eutra->tAI)) {
Logger::ngap().warn("Decode TAI IE error"); Logger::ngap().warn("Decode TAI IE error");
return false; return false;
} }
#if 0
if(userLocationInformationEUTRA->timeStamp)
{
istimeStampSet = true;
timeStamp = new TimeStamp();
if(!timeStamp->decodefromTimeStamp(userLocationInformationEUTRA->timeStamp))
{
cout<<"[Warning] timeStamp->decodefromTimeStamp() error!"<<endl;
return false;
}
}
#endif
return true; return true;
} }
//------------------------------------------------------------------------------
void UserLocationInformationEUTRA::getInformationEUTRA(
EUTRA_CGI& m_eUTRA_CGI, TAI& m_tAI) {
m_eUTRA_CGI = eUTRA_CGI;
m_tAI = tAI;
}
} // namespace ngap } // namespace ngap
...@@ -36,15 +36,13 @@ class UserLocationInformationEUTRA { ...@@ -36,15 +36,13 @@ class UserLocationInformationEUTRA {
UserLocationInformationEUTRA(); UserLocationInformationEUTRA();
virtual ~UserLocationInformationEUTRA(); virtual ~UserLocationInformationEUTRA();
void setInformationEUTRA(const EUTRA_CGI& m_eUTRA_CGI, const TAI& m_tAI); void set(const EUTRA_CGI& m_eUTRA_CGI, const TAI& m_tAI);
void getInformationEUTRA(EUTRA_CGI& m_eUTRA_CGI, TAI& m_tAI); void get(EUTRA_CGI& m_eUTRA_CGI, TAI& m_tAI);
// bool getTimeStampPresence(); // bool getTimeStampPresence();
bool encode2UserLocationInformationEUTRA( bool encode(Ngap_UserLocationInformationEUTRA_t* userLocationInformation);
Ngap_UserLocationInformationEUTRA_t* userLocationInformation); bool decode(Ngap_UserLocationInformationEUTRA_t* userLocationInformation);
bool decodefromUserLocationInformationEUTRA(
Ngap_UserLocationInformationEUTRA_t* userLocationInformation);
private: private:
EUTRA_CGI eUTRA_CGI; // Mandatory EUTRA_CGI eUTRA_CGI; // Mandatory
......
...@@ -30,62 +30,38 @@ UserLocationInformationNR::UserLocationInformationNR() {} ...@@ -30,62 +30,38 @@ UserLocationInformationNR::UserLocationInformationNR() {}
UserLocationInformationNR::~UserLocationInformationNR() {} UserLocationInformationNR::~UserLocationInformationNR() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UserLocationInformationNR::setInformationNR( void UserLocationInformationNR::set(const NR_CGI& m_nR_CGI, const TAI& m_tAI) {
const NR_CGI& m_nR_CGI, const TAI& m_tAI) {
nR_CGI = m_nR_CGI; nR_CGI = m_nR_CGI;
tAI = m_tAI; tAI = m_tAI;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UserLocationInformationNR::encode2UserLocationInformationNR( bool UserLocationInformationNR::encode(
Ngap_UserLocationInformationNR_t* userLocationInformationNR) { Ngap_UserLocationInformationNR_t* user_location_info_nr) {
if (!nR_CGI.encode2NR_CGI(&userLocationInformationNR->nR_CGI)) { if (!nR_CGI.encode2NR_CGI(&user_location_info_nr->nR_CGI)) {
return false; return false;
} }
if (!tAI.encode(&userLocationInformationNR->tAI)) { if (!tAI.encode(&user_location_info_nr->tAI)) {
return false; return false;
} }
#if 0
if(istimeStampSet)
{
Ngap_TimeStamp_t *ieTimeStamp = (Ngap_TimeStamp_t *)calloc(1,sizeof(Ngap_TimeStamp_t));
if(!timeStamp->encodefromTimeStamp(ieTimeStamp))
{
free(ieTimeStamp);
return false;
}
userLocationInformationEUTRA->timeStamp = ieTimeStamp;
}
#endif
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UserLocationInformationNR::decodefromUserLocationInformationNR( bool UserLocationInformationNR::decode(
Ngap_UserLocationInformationNR_t* userLocationInformationNR) { Ngap_UserLocationInformationNR_t* user_location_info_nr) {
if (!nR_CGI.decodefromNR_CGI(&userLocationInformationNR->nR_CGI)) { if (!nR_CGI.decodefromNR_CGI(&user_location_info_nr->nR_CGI)) {
return false; return false;
} }
if (!tAI.decode(&userLocationInformationNR->tAI)) { if (!tAI.decode(&user_location_info_nr->tAI)) {
return false; return false;
} }
#if 0
if(userLocationInformationEUTRA->timeStamp)
{
istimeStampSet = true;
timeStamp = new TimeStamp();
if(!timeStamp->decodefromTimeStamp(userLocationInformationEUTRA->timeStamp))
{
return false;
}
}
#endif
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UserLocationInformationNR::getInformationNR(NR_CGI& m_nR_CGI, TAI& m_tAI) { void UserLocationInformationNR::get(NR_CGI& m_nR_CGI, TAI& m_tAI) {
m_nR_CGI = nR_CGI; m_nR_CGI = nR_CGI;
m_tAI = tAI; m_tAI = tAI;
} }
......
...@@ -35,11 +35,11 @@ class UserLocationInformationNR { ...@@ -35,11 +35,11 @@ class UserLocationInformationNR {
UserLocationInformationNR(); UserLocationInformationNR();
virtual ~UserLocationInformationNR(); virtual ~UserLocationInformationNR();
void setInformationNR(const NR_CGI&, const TAI&); void set(const NR_CGI&, const TAI&);
void getInformationNR(NR_CGI&, TAI&); void get(NR_CGI&, TAI&);
bool encode2UserLocationInformationNR(Ngap_UserLocationInformationNR_t*); bool encode(Ngap_UserLocationInformationNR_t*);
bool decodefromUserLocationInformationNR(Ngap_UserLocationInformationNR_t*); bool decode(Ngap_UserLocationInformationNR_t*);
private: private:
NR_CGI nR_CGI; // Mandatory NR_CGI nR_CGI; // Mandatory
......
...@@ -88,13 +88,13 @@ void HandoverNotifyMsg::setRanUeNgapId(const uint32_t& ran_ue_ngap_id) { ...@@ -88,13 +88,13 @@ void HandoverNotifyMsg::setRanUeNgapId(const uint32_t& ran_ue_ngap_id) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void HandoverNotifyMsg::setUserLocationInfoNR( void HandoverNotifyMsg::setUserLocationInfoNR(
const NrCgi_t& cig, const Tai_t& tai) { const NrCgi_t& cig, const Tai_t& tai) {
UserLocationInformationNR* informationNR = new UserLocationInformationNR(); UserLocationInformationNR information_nr = {};
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
nR_CGI.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID); nR_CGI.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID);
TAI tai_nr = {}; TAI tai_nr = {};
tai_nr.setTAI(tai); tai_nr.setTAI(tai);
informationNR->setInformationNR(nR_CGI, tai_nr); information_nr.set(nR_CGI, tai_nr);
userLocationInformation.setInformation(informationNR); userLocationInformation.setInformation(information_nr);
Ngap_HandoverNotifyIEs_t* ie = Ngap_HandoverNotifyIEs_t* ie =
(Ngap_HandoverNotifyIEs_t*) calloc(1, sizeof(Ngap_HandoverNotifyIEs_t)); (Ngap_HandoverNotifyIEs_t*) calloc(1, sizeof(Ngap_HandoverNotifyIEs_t));
...@@ -102,8 +102,8 @@ void HandoverNotifyMsg::setUserLocationInfoNR( ...@@ -102,8 +102,8 @@ void HandoverNotifyMsg::setUserLocationInfoNR(
ie->criticality = Ngap_Criticality_ignore; ie->criticality = Ngap_Criticality_ignore;
ie->value.present = Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation; ie->value.present = Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation;
int ret = userLocationInformation.encodefromUserLocationInformation( int ret =
&ie->value.choice.UserLocationInformation); userLocationInformation.encode(&ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
Logger::ngap().error("Encode UserLocationInformation IE error"); Logger::ngap().error("Encode UserLocationInformation IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
...@@ -116,9 +116,8 @@ void HandoverNotifyMsg::setUserLocationInfoNR( ...@@ -116,9 +116,8 @@ void HandoverNotifyMsg::setUserLocationInfoNR(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool HandoverNotifyMsg::getUserLocationInfoNR(NrCgi_t& cig, Tai_t& tai) { bool HandoverNotifyMsg::getUserLocationInfoNR(NrCgi_t& cig, Tai_t& tai) {
UserLocationInformationNR* informationNR = nullptr; UserLocationInformationNR information_nr = {};
userLocationInformation.getInformation(informationNR); if (!userLocationInformation.getInformation(information_nr)) return false;
if (!informationNR) return false;
if (userLocationInformation.getChoiceOfUserLocationInformation() != if (userLocationInformation.getChoiceOfUserLocationInformation() !=
Ngap_UserLocationInformation_PR_userLocationInformationNR) Ngap_UserLocationInformation_PR_userLocationInformationNR)
...@@ -126,7 +125,7 @@ bool HandoverNotifyMsg::getUserLocationInfoNR(NrCgi_t& cig, Tai_t& tai) { ...@@ -126,7 +125,7 @@ bool HandoverNotifyMsg::getUserLocationInfoNR(NrCgi_t& cig, Tai_t& tai) {
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
TAI nR_TAI = {}; TAI nR_TAI = {};
informationNR->getInformationNR(nR_CGI, nR_TAI); information_nr.get(nR_CGI, nR_TAI);
nR_CGI.getNR_CGI(cig); nR_CGI.getNR_CGI(cig);
nR_TAI.getTAI(tai); nR_TAI.getTAI(tai);
...@@ -198,7 +197,7 @@ bool HandoverNotifyMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) { ...@@ -198,7 +197,7 @@ bool HandoverNotifyMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
*/ */
if (handoverNotifyIEs->protocolIEs.list.array[i]->value.present == if (handoverNotifyIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation) { Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation) {
if (!userLocationInformation.decodefromUserLocationInformation( if (!userLocationInformation.decode(
&handoverNotifyIEs->protocolIEs.list.array[i] &handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) { ->value.choice.UserLocationInformation)) {
Logger::ngap().error( Logger::ngap().error(
......
...@@ -95,14 +95,14 @@ void InitialUEMessageMsg::setNasPdu(uint8_t* nas, size_t size) { ...@@ -95,14 +95,14 @@ void InitialUEMessageMsg::setNasPdu(uint8_t* nas, size_t size) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void InitialUEMessageMsg::setUserLocationInfoNR( void InitialUEMessageMsg::setUserLocationInfoNR(
const struct NrCgi_s& cig, const struct Tai_s& tai) { const struct NrCgi_s& cig, const struct Tai_s& tai) {
UserLocationInformationNR* informationNR = new UserLocationInformationNR(); UserLocationInformationNR information_nr;
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
nR_CGI.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID); nR_CGI.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID);
TAI tai_nr = {}; TAI tai_nr = {};
tai_nr.setTAI(tai); tai_nr.setTAI(tai);
informationNR->setInformationNR(nR_CGI, tai_nr); information_nr.set(nR_CGI, tai_nr);
userLocationInformation.setInformation(informationNR); userLocationInformation.setInformation(information_nr);
Ngap_InitialUEMessage_IEs_t* ie = (Ngap_InitialUEMessage_IEs_t*) calloc( Ngap_InitialUEMessage_IEs_t* ie = (Ngap_InitialUEMessage_IEs_t*) calloc(
1, sizeof(Ngap_InitialUEMessage_IEs_t)); 1, sizeof(Ngap_InitialUEMessage_IEs_t));
...@@ -111,8 +111,8 @@ void InitialUEMessageMsg::setUserLocationInfoNR( ...@@ -111,8 +111,8 @@ void InitialUEMessageMsg::setUserLocationInfoNR(
ie->value.present = ie->value.present =
Ngap_InitialUEMessage_IEs__value_PR_UserLocationInformation; Ngap_InitialUEMessage_IEs__value_PR_UserLocationInformation;
int ret = userLocationInformation.encodefromUserLocationInformation( int ret =
&ie->value.choice.UserLocationInformation); userLocationInformation.encode(&ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
Logger::ngap().error("Encode UserLocationInformation IE error"); Logger::ngap().error("Encode UserLocationInformation IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
...@@ -234,7 +234,7 @@ bool InitialUEMessageMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) { ...@@ -234,7 +234,7 @@ bool InitialUEMessageMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
Ngap_Criticality_reject && Ngap_Criticality_reject &&
initialUEMessageIEs->protocolIEs.list.array[i]->value.present == initialUEMessageIEs->protocolIEs.list.array[i]->value.present ==
Ngap_InitialUEMessage_IEs__value_PR_UserLocationInformation) { Ngap_InitialUEMessage_IEs__value_PR_UserLocationInformation) {
if (!userLocationInformation.decodefromUserLocationInformation( if (!userLocationInformation.decode(
&initialUEMessageIEs->protocolIEs.list.array[i] &initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) { ->value.choice.UserLocationInformation)) {
Logger::ngap().error( Logger::ngap().error(
...@@ -322,14 +322,14 @@ bool InitialUEMessageMsg::getNasPdu(uint8_t*& nas, size_t& size) { ...@@ -322,14 +322,14 @@ bool InitialUEMessageMsg::getNasPdu(uint8_t*& nas, size_t& size) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool InitialUEMessageMsg::getUserLocationInfoNR( bool InitialUEMessageMsg::getUserLocationInfoNR(
struct NrCgi_s& cig, struct Tai_s& tai) { struct NrCgi_s& cig, struct Tai_s& tai) {
UserLocationInformationNR* informationNR; UserLocationInformationNR information_nr = {};
userLocationInformation.getInformation(informationNR); userLocationInformation.getInformation(information_nr);
if (userLocationInformation.getChoiceOfUserLocationInformation() != if (userLocationInformation.getChoiceOfUserLocationInformation() !=
Ngap_UserLocationInformation_PR_userLocationInformationNR) Ngap_UserLocationInformation_PR_userLocationInformationNR)
return false; return false;
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
TAI nR_TAI = {}; TAI nR_TAI = {};
informationNR->getInformationNR(nR_CGI, nR_TAI); information_nr.get(nR_CGI, nR_TAI);
nR_CGI.getNR_CGI(cig); nR_CGI.getNR_CGI(cig);
nR_TAI.getTAI(tai); nR_TAI.getTAI(tai);
......
...@@ -172,13 +172,13 @@ void PduSessionResourceReleaseResponseMsg::setUserLocationInfoNR( ...@@ -172,13 +172,13 @@ void PduSessionResourceReleaseResponseMsg::setUserLocationInfoNR(
if (!userLocationInformation) if (!userLocationInformation)
userLocationInformation = new UserLocationInformation(); userLocationInformation = new UserLocationInformation();
UserLocationInformationNR* informationNR = new UserLocationInformationNR(); UserLocationInformationNR information_nr = {};
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
TAI tai_nr = {}; TAI tai_nr = {};
nR_CGI.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID); nR_CGI.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID);
tai_nr.setTAI(tai); tai_nr.setTAI(tai);
informationNR->setInformationNR(nR_CGI, tai_nr); information_nr.set(nR_CGI, tai_nr);
userLocationInformation->setInformation(informationNR); userLocationInformation->setInformation(information_nr);
Ngap_PDUSessionResourceReleaseResponseIEs_t* ie = Ngap_PDUSessionResourceReleaseResponseIEs_t* ie =
(Ngap_PDUSessionResourceReleaseResponseIEs_t*) calloc( (Ngap_PDUSessionResourceReleaseResponseIEs_t*) calloc(
...@@ -188,7 +188,7 @@ void PduSessionResourceReleaseResponseMsg::setUserLocationInfoNR( ...@@ -188,7 +188,7 @@ void PduSessionResourceReleaseResponseMsg::setUserLocationInfoNR(
ie->value.present = ie->value.present =
Ngap_PDUSessionResourceReleaseResponseIEs__value_PR_UserLocationInformation; Ngap_PDUSessionResourceReleaseResponseIEs__value_PR_UserLocationInformation;
int ret = userLocationInformation->encodefromUserLocationInformation( int ret = userLocationInformation->encode(
&ie->value.choice.UserLocationInformation); &ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
Logger::nas_mm().warn("Encode UserLocationInformation IE error"); Logger::nas_mm().warn("Encode UserLocationInformation IE error");
...@@ -206,14 +206,15 @@ void PduSessionResourceReleaseResponseMsg::setUserLocationInfoNR( ...@@ -206,14 +206,15 @@ void PduSessionResourceReleaseResponseMsg::setUserLocationInfoNR(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PduSessionResourceReleaseResponseMsg::getUserLocationInfoNR( bool PduSessionResourceReleaseResponseMsg::getUserLocationInfoNR(
NrCgi_t& cig, Tai_t& tai) { NrCgi_t& cig, Tai_t& tai) {
UserLocationInformationNR* informationNR; UserLocationInformationNR information_nr = {};
userLocationInformation->getInformation(informationNR); if (!userLocationInformation->getInformation(information_nr)) return false;
if (userLocationInformation->getChoiceOfUserLocationInformation() != if (userLocationInformation->getChoiceOfUserLocationInformation() !=
Ngap_UserLocationInformation_PR_userLocationInformationNR) Ngap_UserLocationInformation_PR_userLocationInformationNR)
return false; return false;
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
TAI nR_TAI = {}; TAI nR_TAI = {};
informationNR->getInformationNR(nR_CGI, nR_TAI); information_nr.get(nR_CGI, nR_TAI);
PlmnId cgi_plmnId = {}; PlmnId cgi_plmnId = {};
NRCellIdentity nRCellIdentity = {}; NRCellIdentity nRCellIdentity = {};
nR_CGI.getNR_CGI(cig); nR_CGI.getNR_CGI(cig);
......
...@@ -93,14 +93,14 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR( ...@@ -93,14 +93,14 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR(
if (!userLocationInformation) if (!userLocationInformation)
userLocationInformation = new UserLocationInformation(); userLocationInformation = new UserLocationInformation();
UserLocationInformationNR* informationNR = new UserLocationInformationNR(); UserLocationInformationNR information_nr = {};
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
nR_CGI.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID); nR_CGI.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID);
TAI tai_nr = {}; TAI tai_nr = {};
tai_nr.setTAI(tai); tai_nr.setTAI(tai);
informationNR->setInformationNR(nR_CGI, tai_nr); information_nr.set(nR_CGI, tai_nr);
userLocationInformation->setInformation(informationNR); userLocationInformation->setInformation(information_nr);
Ngap_UEContextReleaseComplete_IEs* ie = Ngap_UEContextReleaseComplete_IEs* ie =
(Ngap_UEContextReleaseComplete_IEs*) calloc( (Ngap_UEContextReleaseComplete_IEs*) calloc(
...@@ -110,7 +110,7 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR( ...@@ -110,7 +110,7 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR(
ie->value.present = ie->value.present =
Ngap_UEContextReleaseComplete_IEs__value_PR_UserLocationInformation; Ngap_UEContextReleaseComplete_IEs__value_PR_UserLocationInformation;
int ret = userLocationInformation->encodefromUserLocationInformation( int ret = userLocationInformation->encode(
&ie->value.choice.UserLocationInformation); &ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
Logger::ngap().error("Encode NGAP UserLocationInformation IE error"); Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
...@@ -126,12 +126,12 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR( ...@@ -126,12 +126,12 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR(
void UEContextReleaseCompleteMsg::getUserLocationInfoNR( void UEContextReleaseCompleteMsg::getUserLocationInfoNR(
NrCgi_t& cig, Tai_t& tai) { NrCgi_t& cig, Tai_t& tai) {
if (userLocationInformation) { if (userLocationInformation) {
UserLocationInformationNR* informationNR = new UserLocationInformationNR(); UserLocationInformationNR information_nr = {};
userLocationInformation->getInformation(informationNR); if (!userLocationInformation->getInformation(information_nr)) return;
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
TAI tai_nr = {}; TAI tai_nr = {};
informationNR->getInformationNR(nR_CGI, tai_nr); information_nr.get(nR_CGI, tai_nr);
PlmnId plmnId_cgi = {}; PlmnId plmnId_cgi = {};
NRCellIdentity nRCellIdentity = {}; NRCellIdentity nRCellIdentity = {};
......
...@@ -118,14 +118,14 @@ bool UplinkNASTransportMsg::getNasPdu(uint8_t*& nas, size_t& sizeofnas) { ...@@ -118,14 +118,14 @@ bool UplinkNASTransportMsg::getNasPdu(uint8_t*& nas, size_t& sizeofnas) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UplinkNASTransportMsg::setUserLocationInfoNR( void UplinkNASTransportMsg::setUserLocationInfoNR(
const NrCgi_t& cig, const Tai_t& tai) { const NrCgi_t& cig, const Tai_t& tai) {
UserLocationInformationNR* informationNR = new UserLocationInformationNR(); UserLocationInformationNR information_nr;
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
TAI tai_nr = {}; TAI tai_nr = {};
nR_CGI.setNR_CGI(cig); nR_CGI.setNR_CGI(cig);
tai_nr.setTAI(tai); tai_nr.setTAI(tai);
informationNR->setInformationNR(nR_CGI, tai_nr); information_nr.set(nR_CGI, tai_nr);
userLocationInformation.setInformation(informationNR); userLocationInformation.setInformation(information_nr);
Ngap_UplinkNASTransport_IEs_t* ie = (Ngap_UplinkNASTransport_IEs_t*) calloc( Ngap_UplinkNASTransport_IEs_t* ie = (Ngap_UplinkNASTransport_IEs_t*) calloc(
1, sizeof(Ngap_UplinkNASTransport_IEs_t)); 1, sizeof(Ngap_UplinkNASTransport_IEs_t));
...@@ -134,8 +134,8 @@ void UplinkNASTransportMsg::setUserLocationInfoNR( ...@@ -134,8 +134,8 @@ void UplinkNASTransportMsg::setUserLocationInfoNR(
ie->value.present = ie->value.present =
Ngap_UplinkNASTransport_IEs__value_PR_UserLocationInformation; Ngap_UplinkNASTransport_IEs__value_PR_UserLocationInformation;
int ret = userLocationInformation.encodefromUserLocationInformation( int ret =
&ie->value.choice.UserLocationInformation); userLocationInformation.encode(&ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
Logger::ngap().error("Encode NGAP UserLocationInformation IE error"); Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
...@@ -149,14 +149,16 @@ void UplinkNASTransportMsg::setUserLocationInfoNR( ...@@ -149,14 +149,16 @@ void UplinkNASTransportMsg::setUserLocationInfoNR(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UplinkNASTransportMsg::getUserLocationInfoNR(NrCgi_t& cig, Tai_t& tai) { bool UplinkNASTransportMsg::getUserLocationInfoNR(NrCgi_t& cig, Tai_t& tai) {
UserLocationInformationNR* informationNR; UserLocationInformationNR information_nr = {};
userLocationInformation.getInformation(informationNR); if (!userLocationInformation.getInformation(information_nr)) return false;
if (userLocationInformation.getChoiceOfUserLocationInformation() != if (userLocationInformation.getChoiceOfUserLocationInformation() !=
Ngap_UserLocationInformation_PR_userLocationInformationNR) Ngap_UserLocationInformation_PR_userLocationInformationNR)
return false; return false;
NR_CGI nR_CGI = {}; NR_CGI nR_CGI = {};
TAI nR_TAI = {}; TAI nR_TAI = {};
informationNR->getInformationNR(nR_CGI, nR_TAI); information_nr.get(nR_CGI, nR_TAI);
nR_CGI.getNR_CGI(cig); nR_CGI.getNR_CGI(cig);
nR_TAI.getTAI(tai); nR_TAI.getTAI(tai);
...@@ -239,7 +241,7 @@ bool UplinkNASTransportMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) { ...@@ -239,7 +241,7 @@ bool UplinkNASTransportMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
Ngap_Criticality_ignore && Ngap_Criticality_ignore &&
uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present == uplinkNASTransportIEs->protocolIEs.list.array[i]->value.present ==
Ngap_UplinkNASTransport_IEs__value_PR_UserLocationInformation) { Ngap_UplinkNASTransport_IEs__value_PR_UserLocationInformation) {
if (!userLocationInformation.decodefromUserLocationInformation( if (!userLocationInformation.decode(
&uplinkNASTransportIEs->protocolIEs.list.array[i] &uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) { ->value.choice.UserLocationInformation)) {
Logger::ngap().error( Logger::ngap().error(
......
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