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

Code refactoring for UserLocationInformation

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