Commit 4581a722 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Refactor TAI/TAC

parent 0344ddc8
...@@ -80,5 +80,6 @@ class conv { ...@@ -80,5 +80,6 @@ class conv {
const std::string& str, OCTET_STRING_t& o_str); const std::string& str, OCTET_STRING_t& o_str);
static bool int8_2_octet_string(const uint8_t& value, OCTET_STRING_t& o_str); static bool int8_2_octet_string(const uint8_t& value, OCTET_STRING_t& o_str);
static bool octet_string_2_int8(const OCTET_STRING_t& o_str, uint8_t& value); static bool octet_string_2_int8(const OCTET_STRING_t& o_str, uint8_t& value);
// TODO: bitstring_2_int32
}; };
#endif /* FILE_CONVERSIONS_HPP_SEEN */ #endif /* FILE_CONVERSIONS_HPP_SEEN */
...@@ -86,7 +86,7 @@ bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo( ...@@ -86,7 +86,7 @@ bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo(
(Ngap_TAIListForInactiveItem_t*) calloc( (Ngap_TAIListForInactiveItem_t*) calloc(
1, sizeof(Ngap_TAIListForInactiveItem_t)); 1, sizeof(Ngap_TAIListForInactiveItem_t));
if (!taiListForInactiveItem) return false; if (!taiListForInactiveItem) return false;
if (!it->encode2TAI(&taiListForInactiveItem->tAI)) return false; if (!it->encode(&taiListForInactiveItem->tAI)) return false;
if (ASN_SEQUENCE_ADD( if (ASN_SEQUENCE_ADD(
&coreNetworkAssistanceInformation->tAIListForInactive.list, &coreNetworkAssistanceInformation->tAIListForInactive.list,
taiListForInactiveItem) != 0) taiListForInactiveItem) != 0)
...@@ -129,7 +129,7 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo( ...@@ -129,7 +129,7 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
i < coreNetworkAssistanceInformation->tAIListForInactive.list.count; i < coreNetworkAssistanceInformation->tAIListForInactive.list.count;
i++) { i++) {
TAI tai_item = {}; TAI tai_item = {};
if (!tai_item.decodefromTAI( if (!tai_item.decode(
&coreNetworkAssistanceInformation->tAIListForInactive.list.array[i] &coreNetworkAssistanceInformation->tAIListForInactive.list.array[i]
->tAI)) ->tAI))
return false; return false;
......
...@@ -21,51 +21,39 @@ ...@@ -21,51 +21,39 @@
#include "EUTRA-CGI.hpp" #include "EUTRA-CGI.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EUTRA_CGI::EUTRA_CGI() { EUTRA_CGI::EUTRA_CGI() {}
plmnId = NULL;
eUTRACellIdentity = NULL;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EUTRA_CGI::~EUTRA_CGI() {} EUTRA_CGI::~EUTRA_CGI() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void EUTRA_CGI::setEUTRA_CGI( void EUTRA_CGI::set(
PlmnId* m_plmnId, EUTRACellIdentity* m_eUTRACellIdentity) { const PlmnId& plmn_id, const EUTRACellIdentity& eUTRA_cell_identity) {
plmnId = m_plmnId; plmn_id_ = plmn_id;
eUTRACellIdentity = m_eUTRACellIdentity; eUTRA_cell_identity_ = eUTRA_cell_identity;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool EUTRA_CGI::encode2EUTRA_CGI(Ngap_EUTRA_CGI_t* eutra_cgi) { bool EUTRA_CGI::encode(Ngap_EUTRA_CGI_t& eutra_cgi) {
if (!plmnId->encode(eutra_cgi->pLMNIdentity)) return false; if (!plmn_id_.encode(eutra_cgi.pLMNIdentity)) return false;
if (!eUTRACellIdentity->encode2bitstring(eutra_cgi->eUTRACellIdentity)) if (!eUTRA_cell_identity_.encode(eutra_cgi.eUTRACellIdentity)) return false;
return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool EUTRA_CGI::decodefromEUTRA_CGI(Ngap_EUTRA_CGI_t* eutra_cgi) { bool EUTRA_CGI::decode(Ngap_EUTRA_CGI_t& eutra_cgi) {
if (plmnId == nullptr) plmnId = new PlmnId(); if (!plmn_id_.decode(eutra_cgi.pLMNIdentity)) return false;
if (eUTRACellIdentity == nullptr) eUTRACellIdentity = new EUTRACellIdentity(); if (!eUTRA_cell_identity_.decode(eutra_cgi.eUTRACellIdentity)) return false;
if (!plmnId->decode(eutra_cgi->pLMNIdentity)) return false;
if (!eUTRACellIdentity->decodefrombitstring(eutra_cgi->eUTRACellIdentity))
return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void EUTRA_CGI::getEUTRA_CGI( void EUTRA_CGI::get(PlmnId& plmn_id, EUTRACellIdentity& eUTRA_cell_identity) {
PlmnId*& m_plmnId, EUTRACellIdentity*& m_eUTRACellIdentity) { plmn_id = plmn_id_;
m_plmnId = plmnId; eUTRA_cell_identity = eUTRA_cell_identity_;
m_eUTRACellIdentity = eUTRACellIdentity;
} }
} // namespace ngap } // namespace ngap
...@@ -36,14 +36,15 @@ class EUTRA_CGI { ...@@ -36,14 +36,15 @@ class EUTRA_CGI {
EUTRA_CGI(); EUTRA_CGI();
virtual ~EUTRA_CGI(); virtual ~EUTRA_CGI();
void setEUTRA_CGI(PlmnId*, EUTRACellIdentity*); void set(const PlmnId&, const EUTRACellIdentity&);
bool encode2EUTRA_CGI(Ngap_EUTRA_CGI_t*); void get(PlmnId&, EUTRACellIdentity&);
bool decodefromEUTRA_CGI(Ngap_EUTRA_CGI_t*);
void getEUTRA_CGI(PlmnId*&, EUTRACellIdentity*&); bool encode(Ngap_EUTRA_CGI_t&);
bool decode(Ngap_EUTRA_CGI_t&);
private: private:
PlmnId* plmnId; PlmnId plmn_id_; // Mandatory
EUTRACellIdentity* eUTRACellIdentity; EUTRACellIdentity eUTRA_cell_identity_; // Mandatory
}; };
} // namespace ngap } // namespace ngap
......
...@@ -28,47 +28,47 @@ namespace ngap { ...@@ -28,47 +28,47 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EUTRACellIdentity::EUTRACellIdentity() { EUTRACellIdentity::EUTRACellIdentity() {
eutracellidentity = 0; id_ = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EUTRACellIdentity::~EUTRACellIdentity() {} EUTRACellIdentity::~EUTRACellIdentity() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void EUTRACellIdentity::setEUTRACellIdentity(uint32_t m_eutracellidentity) { bool EUTRACellIdentity::set(const uint32_t& id) {
eutracellidentity = m_eutracellidentity; if (id > kEUTRACellIdentityMaxValue) return false;
id_ = id;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool EUTRACellIdentity::encode2bitstring( uint32_t EUTRACellIdentity::get() {
Ngap_EUTRACellIdentity_t& eUTRACellIdentity) { return id_;
eUTRACellIdentity.bits_unused = 4;
eUTRACellIdentity.size = 4;
eUTRACellIdentity.buf = (uint8_t*) calloc(1, sizeof(uint32_t));
if (!eUTRACellIdentity.buf) return false;
eUTRACellIdentity.buf[3] = eutracellidentity & 0x000000ff;
eUTRACellIdentity.buf[2] = (eutracellidentity & 0x0000ff00) >> 8;
eUTRACellIdentity.buf[1] = (eutracellidentity & 0x00ff0000) >> 16;
eUTRACellIdentity.buf[0] = (eutracellidentity & 0xff000000) >> 24;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool EUTRACellIdentity::decodefrombitstring( bool EUTRACellIdentity::encode(Ngap_EUTRACellIdentity_t& eUTRA_cell_identity) {
Ngap_EUTRACellIdentity_t& eUTRACellIdentity) { eUTRA_cell_identity.bits_unused = 4; // 28 = 4*8 - 4 bits
if (!eUTRACellIdentity.buf) return false; eUTRA_cell_identity.size = 4;
eUTRA_cell_identity.buf = (uint8_t*) calloc(1, sizeof(uint32_t));
eutracellidentity = eUTRACellIdentity.buf[0] << 24; if (!eUTRA_cell_identity.buf) return false;
eutracellidentity |= eUTRACellIdentity.buf[1] << 16; eUTRA_cell_identity.buf[3] = id_ & 0x000000ff;
eutracellidentity |= eUTRACellIdentity.buf[2] << 8; eUTRA_cell_identity.buf[2] = (id_ & 0x0000ff00) >> 8;
eutracellidentity |= eUTRACellIdentity.buf[3]; eUTRA_cell_identity.buf[1] = (id_ & 0x00ff0000) >> 16;
eUTRA_cell_identity.buf[0] = (id_ & 0xff000000) >> 24;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t EUTRACellIdentity::getEUTRACellIdentity() { bool EUTRACellIdentity::decode(Ngap_EUTRACellIdentity_t& eUTRA_cell_identity) {
return eutracellidentity; if (!eUTRA_cell_identity.buf) return false;
id_ = eUTRA_cell_identity.buf[0] << 24;
id_ |= eUTRA_cell_identity.buf[1] << 16;
id_ |= eUTRA_cell_identity.buf[2] << 8;
id_ |= eUTRA_cell_identity.buf[3];
return true;
} }
} // namespace ngap } // namespace ngap
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#ifndef _EUTRACellIdentity_H_ #ifndef _EUTRACellIdentity_H_
#define _EUTRACellIdentity_H_ #define _EUTRACellIdentity_H_
#include <cstdint>
constexpr uint32_t kEUTRACellIdentityMaxValue = 268435455; // 2^28-1
extern "C" { extern "C" {
#include "Ngap_EUTRACellIdentity.h" #include "Ngap_EUTRACellIdentity.h"
...@@ -33,13 +36,13 @@ class EUTRACellIdentity { ...@@ -33,13 +36,13 @@ class EUTRACellIdentity {
EUTRACellIdentity(); EUTRACellIdentity();
virtual ~EUTRACellIdentity(); virtual ~EUTRACellIdentity();
bool encode2bitstring(Ngap_EUTRACellIdentity_t& eUTRACellIdentity); bool encode(Ngap_EUTRACellIdentity_t& eUTRACellIdentity);
bool decodefrombitstring(Ngap_EUTRACellIdentity_t& eUTRACellIdentity); bool decode(Ngap_EUTRACellIdentity_t& eUTRACellIdentity);
uint32_t getEUTRACellIdentity(); uint32_t get();
void setEUTRACellIdentity(uint32_t m_eutracellidentity); bool set(const uint32_t& m_eutracellidentity);
private: private:
uint32_t eutracellidentity; uint32_t id_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -64,7 +64,7 @@ void SupportedTaItem::getBroadcastPlmnList( ...@@ -64,7 +64,7 @@ void SupportedTaItem::getBroadcastPlmnList(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool SupportedTaItem::encode2SupportedTaItem(Ngap_SupportedTAItem_t* ta) { bool SupportedTaItem::encode2SupportedTaItem(Ngap_SupportedTAItem_t* ta) {
if (!tac.encode2octetstring(ta->tAC)) return false; if (!tac.encode(ta->tAC)) return false;
for (std::vector<BroadcastPLMNItem>::iterator it = for (std::vector<BroadcastPLMNItem>::iterator it =
std::begin(broadcastPLMNList); std::begin(broadcastPLMNList);
...@@ -80,7 +80,7 @@ bool SupportedTaItem::encode2SupportedTaItem(Ngap_SupportedTAItem_t* ta) { ...@@ -80,7 +80,7 @@ bool SupportedTaItem::encode2SupportedTaItem(Ngap_SupportedTAItem_t* ta) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool SupportedTaItem::decodefromSupportedTaItem(Ngap_SupportedTAItem_t* pdu) { bool SupportedTaItem::decodefromSupportedTaItem(Ngap_SupportedTAItem_t* pdu) {
if (!tac.decodefromoctetstring(pdu->tAC)) return false; if (!tac.decode(pdu->tAC)) return false;
for (int i = 0; i < pdu->broadcastPLMNList.list.count; i++) { for (int i = 0; i < pdu->broadcastPLMNList.list.count; i++) {
BroadcastPLMNItem item = {}; BroadcastPLMNItem item = {};
if (!item.decodefromBroadcastPLMNItem(pdu->broadcastPLMNList.list.array[i])) if (!item.decodefromBroadcastPLMNItem(pdu->broadcastPLMNList.list.array[i]))
......
...@@ -30,56 +30,56 @@ TAI::TAI() {} ...@@ -30,56 +30,56 @@ TAI::TAI() {}
TAI::~TAI() {} TAI::~TAI() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TAI::setTAI(const PlmnId& m_plmnId, const TAC& m_tac) { void TAI::setTAI(const PlmnId& plmn_id, const TAC& tac) {
plmnId = m_plmnId; plmn_id_ = plmn_id;
tac = m_tac; tac_ = tac;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TAI::setTAI( void TAI::setTAI(
const std::string& mcc, const std::string& mnc, const uint32_t& m_tac) { const std::string& mcc, const std::string& mnc, const uint32_t& tac) {
plmnId.set(mcc, mnc); plmn_id_.set(mcc, mnc);
tac.setTac(m_tac); tac_.set(tac);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TAI::getTAI(std::string& mcc, std::string& mnc, uint32_t& m_tac) { void TAI::getTAI(std::string& mcc, std::string& mnc, uint32_t& tac) {
plmnId.getMcc(mcc); plmn_id_.getMcc(mcc);
plmnId.getMnc(mnc); plmn_id_.getMnc(mnc);
m_tac = tac.getTac(); tac = tac_.get();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TAI::setTAI(const Tai_t& tai) { void TAI::setTAI(const Tai_t& tai) {
plmnId.set(tai.mcc, tai.mnc); plmn_id_.set(tai.mcc, tai.mnc);
tac.setTac(tai.tac); tac_.set(tai.tac);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool TAI::encode2TAI(Ngap_TAI_t* tai) { bool TAI::encode(Ngap_TAI_t* tai) {
if (!plmnId.encode(tai->pLMNIdentity)) return false; if (!plmn_id_.encode(tai->pLMNIdentity)) return false;
if (!tac.encode2octetstring(tai->tAC)) return false; if (!tac_.encode(tai->tAC)) return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool TAI::decodefromTAI(Ngap_TAI_t* tai) { bool TAI::decode(Ngap_TAI_t* tai) {
if (!plmnId.decode(tai->pLMNIdentity)) return false; if (!plmn_id_.decode(tai->pLMNIdentity)) return false;
if (!tac.decodefromoctetstring(tai->tAC)) return false; if (!tac_.decode(tai->tAC)) return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TAI::getTAI(PlmnId& m_plmnId, TAC& m_tac) { void TAI::getTAI(PlmnId& plmn_id, TAC& tac) {
m_plmnId = plmnId; plmn_id = plmn_id_;
m_tac = tac; tac = tac_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TAI::getTAI(Tai_t& tai) { void TAI::getTAI(Tai_t& tai) {
plmnId.getMcc(tai.mcc); plmn_id_.getMcc(tai.mcc);
plmnId.getMnc(tai.mnc); plmn_id_.getMnc(tai.mnc);
tai.tac = tac.getTac(); tai.tac = tac_.get();
} }
} // namespace ngap } // namespace ngap
...@@ -38,6 +38,8 @@ class TAI { ...@@ -38,6 +38,8 @@ class TAI {
virtual ~TAI(); virtual ~TAI();
void setTAI(const PlmnId&, const TAC&); void setTAI(const PlmnId&, const TAC&);
void getTAI(PlmnId&, TAC&);
void setTAI( void setTAI(
const std::string& mcc, const std::string& mnc, const uint32_t& tac); const std::string& mcc, const std::string& mnc, const uint32_t& tac);
void getTAI(std::string& mcc, std::string& mnc, uint32_t& tac); void getTAI(std::string& mcc, std::string& mnc, uint32_t& tac);
...@@ -45,13 +47,12 @@ class TAI { ...@@ -45,13 +47,12 @@ class TAI {
void setTAI(const Tai_t& tai); void setTAI(const Tai_t& tai);
void getTAI(Tai_t& tai); void getTAI(Tai_t& tai);
bool encode2TAI(Ngap_TAI_t*); bool encode(Ngap_TAI_t*);
bool decodefromTAI(Ngap_TAI_t*); bool decode(Ngap_TAI_t*);
void getTAI(PlmnId&, TAC&);
private: private:
PlmnId plmnId; // Mandatory PlmnId plmn_id_; // Mandatory
TAC tac; // Mandatory TAC tac_; // Mandatory
}; };
} // namespace ngap } // namespace ngap
......
...@@ -47,7 +47,7 @@ bool TAIListForPaging::encode2TAIListForPaging(Ngap_TAIListForPaging_t* pdu) { ...@@ -47,7 +47,7 @@ bool TAIListForPaging::encode2TAIListForPaging(Ngap_TAIListForPaging_t* pdu) {
for (auto& tai : taiList) { for (auto& tai : taiList) {
Ngap_TAIListForPagingItem_t* ta = (Ngap_TAIListForPagingItem_t*) calloc( Ngap_TAIListForPagingItem_t* ta = (Ngap_TAIListForPagingItem_t*) calloc(
1, sizeof(Ngap_TAIListForPagingItem_t)); 1, sizeof(Ngap_TAIListForPagingItem_t));
if (!tai.encode2TAI(&ta->tAI)) return false; if (!tai.encode(&ta->tAI)) return false;
if (ASN_SEQUENCE_ADD(&pdu->list, ta) != 0) return false; if (ASN_SEQUENCE_ADD(&pdu->list, ta) != 0) return false;
} }
return true; return true;
...@@ -59,7 +59,7 @@ bool TAIListForPaging::decodefromTAIListForPaging( ...@@ -59,7 +59,7 @@ bool TAIListForPaging::decodefromTAIListForPaging(
if (pdu->list.count < 0) return false; if (pdu->list.count < 0) return false;
for (int i = 0; i < pdu->list.count; i++) { for (int i = 0; i < pdu->list.count; i++) {
TAI tai = {}; TAI tai = {};
if (!tai.decodefromTAI(&pdu->list.array[i]->tAI)) return false; if (!tai.decode(&pdu->list.array[i]->tAI)) return false;
taiList.push_back(tai); taiList.push_back(tai);
} }
......
...@@ -20,48 +20,48 @@ ...@@ -20,48 +20,48 @@
*/ */
#include "Tac.hpp" #include "Tac.hpp"
#include "logger.hpp"
#include <iostream>
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
TAC::TAC() { TAC::TAC() {
tac = 0; tac_ = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
TAC::~TAC() {} TAC::~TAC() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TAC::setTac(uint32_t m_tac) { void TAC::set(const uint32_t& tac) {
tac = m_tac; tac_ = tac;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool TAC::encode2octetstring(Ngap_TAC_t& m_tac) { uint32_t TAC::get() const {
m_tac.size = 3; // OCTET_STRING(SIZE(3)) return tac_;
m_tac.buf = (uint8_t*) calloc(1, sizeof(uint8_t) + sizeof(uint16_t));
m_tac.buf[2] = tac & 0x0000ff;
m_tac.buf[1] = (tac & 0x00ff00) >> 8;
m_tac.buf[0] = (tac & 0xff0000) >> 16;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool TAC::decodefromoctetstring(Ngap_TAC_t& m_tac) { bool TAC::encode(Ngap_TAC_t& tac) {
if (!m_tac.buf) return false; tac.size = 3; // OCTET_STRING(SIZE(3))
tac = 0; tac.buf = (uint8_t*) calloc(3, sizeof(uint8_t));
for (int i = 0; i < m_tac.size; i++) { tac.buf[2] = tac_ & 0x0000ff;
tac |= m_tac.buf[i] << ((m_tac.size - 1 - i) * 8); tac.buf[1] = (tac_ & 0x00ff00) >> 8;
} tac.buf[0] = (tac_ & 0xff0000) >> 16;
std::cout << "Received TAC: " << tac << std::endl;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t TAC::getTac() { bool TAC::decode(Ngap_TAC_t& tac) {
return tac; if (!tac.buf) return false;
tac_ = 0;
for (int i = 0; i < tac.size; i++) {
tac_ |= tac.buf[i] << ((tac.size - 1 - i) * 8);
}
Logger::ngap().debug("Received TAC 0x%x", tac_);
return true;
} }
} // namespace ngap } // namespace ngap
...@@ -33,14 +33,14 @@ class TAC { ...@@ -33,14 +33,14 @@ class TAC {
TAC(); TAC();
virtual ~TAC(); virtual ~TAC();
uint32_t getTac(); uint32_t get() const;
void setTac(uint32_t m_tac); void set(const uint32_t& tac);
bool encode2octetstring(Ngap_TAC_t&); bool encode(Ngap_TAC_t&);
bool decodefromoctetstring(Ngap_TAC_t& m_tac); bool decode(Ngap_TAC_t& m_tac);
private: private:
uint32_t tac : 24; uint32_t tac_ : 24;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -20,49 +20,32 @@ ...@@ -20,49 +20,32 @@
*/ */
#include "UserLocationInformationEUTRA.hpp" #include "UserLocationInformationEUTRA.hpp"
#include "logger.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
UserLocationInformationEUTRA::UserLocationInformationEUTRA() { UserLocationInformationEUTRA::UserLocationInformationEUTRA() {}
eUTRA_CGI = NULL;
tAI = NULL;
/*istimeStampSet = false;
timeStamp = NULL;*/
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
UserLocationInformationEUTRA::~UserLocationInformationEUTRA() {} UserLocationInformationEUTRA::~UserLocationInformationEUTRA() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UserLocationInformationEUTRA::setInformationEUTRA( void UserLocationInformationEUTRA::setInformationEUTRA(
EUTRA_CGI* m_eUTRA_CGI, 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;
} }
//------------------------------------------------------------------------------
/*void UserLocationInformationEUTRA::setInformationEUTRA(EUTRA_CGI*
m_eUTRA_CGI,TAI* m_tAI,TimeStamp* m_timeStamp)
{
eUTRA_CGI = m_eUTRA_CGI;
tAI = m_tAI;
istimeStampSet = true;
timeStamp = m_timeStamp;
}*/
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UserLocationInformationEUTRA::encode2UserLocationInformationEUTRA( bool UserLocationInformationEUTRA::encode2UserLocationInformationEUTRA(
Ngap_UserLocationInformationEUTRA_t* userLocationInformationEUTRA) { Ngap_UserLocationInformationEUTRA_t* userLocationInformationEUTRA) {
if (!eUTRA_CGI->encode2EUTRA_CGI(&userLocationInformationEUTRA->eUTRA_CGI)) { if (!eUTRA_CGI.encode(userLocationInformationEUTRA->eUTRA_CGI)) {
cout << "[Warning] eUTRA_CGI->encode2EUTRA_CGI() error!" << endl; Logger::ngap().warn("Encode eUTRA_CGI IE error");
return false; return false;
} }
if (!tAI->encode2TAI(&userLocationInformationEUTRA->tAI)) { if (!tAI.encode(&userLocationInformationEUTRA->tAI)) {
cout << "[Warning] tAI->encode2TAI() error!" << endl; Logger::ngap().warn("Encode TAI IE error");
return false; return false;
} }
#if 0 #if 0
...@@ -84,15 +67,13 @@ bool UserLocationInformationEUTRA::encode2UserLocationInformationEUTRA( ...@@ -84,15 +67,13 @@ bool UserLocationInformationEUTRA::encode2UserLocationInformationEUTRA(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UserLocationInformationEUTRA::decodefromUserLocationInformationEUTRA( bool UserLocationInformationEUTRA::decodefromUserLocationInformationEUTRA(
Ngap_UserLocationInformationEUTRA_t* userLocationInformationEUTRA) { Ngap_UserLocationInformationEUTRA_t* userLocationInformationEUTRA) {
if (eUTRA_CGI == nullptr) eUTRA_CGI = new EUTRA_CGI(); if (!eUTRA_CGI.decode(userLocationInformationEUTRA->eUTRA_CGI)) {
if (!eUTRA_CGI->decodefromEUTRA_CGI( Logger::ngap().warn("Decode eUTRA_CGI IE error");
&userLocationInformationEUTRA->eUTRA_CGI)) {
cout << "[Warning] eUTRA_CGI->decodefromEUTRA_CGI() error!" << endl;
return false; return false;
} }
tAI = new TAI();
if (!tAI->decodefromTAI(&userLocationInformationEUTRA->tAI)) { if (!tAI.decode(&userLocationInformationEUTRA->tAI)) {
cout << "[Warning] tAI->decodefromTAI() error!" << endl; Logger::ngap().warn("Decode TAI IE error");
return false; return false;
} }
#if 0 #if 0
...@@ -110,22 +91,9 @@ bool UserLocationInformationEUTRA::decodefromUserLocationInformationEUTRA( ...@@ -110,22 +91,9 @@ bool UserLocationInformationEUTRA::decodefromUserLocationInformationEUTRA(
return true; return true;
} }
//------------------------------------------------------------------------------
/*bool UserLocationInformationEUTRA::getTimeStampPresence()
{
return istimeStampSet;
}*/
/*void UserLocationInformationEUTRA::getInformationEUTRA(EUTRA_CGI*
&m_eUTRA_CGI,TAI* &m_tAI,TimeStamp* &m_timeStamp)
{
m_eUTRA_CGI = eUTRA_CGI;
m_tAI = tAI;
m_timeStamp = timeStamp;
}*/
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void UserLocationInformationEUTRA::getInformationEUTRA( void UserLocationInformationEUTRA::getInformationEUTRA(
EUTRA_CGI*& m_eUTRA_CGI, TAI*& m_tAI) { EUTRA_CGI& m_eUTRA_CGI, TAI& m_tAI) {
m_eUTRA_CGI = eUTRA_CGI; m_eUTRA_CGI = eUTRA_CGI;
m_tAI = tAI; m_tAI = tAI;
} }
......
...@@ -36,23 +36,21 @@ class UserLocationInformationEUTRA { ...@@ -36,23 +36,21 @@ class UserLocationInformationEUTRA {
UserLocationInformationEUTRA(); UserLocationInformationEUTRA();
virtual ~UserLocationInformationEUTRA(); virtual ~UserLocationInformationEUTRA();
void setInformationEUTRA(EUTRA_CGI* m_eUTRA_CGI, TAI* m_tAI); void setInformationEUTRA(const EUTRA_CGI& m_eUTRA_CGI, const TAI& m_tAI);
// void setInformationEUTRA(EUTRA_CGI* m_eUTRA_CGI,TAI* m_tAI,TimeStamp* void getInformationEUTRA(EUTRA_CGI& m_eUTRA_CGI, TAI& m_tAI);
// m_timeStamp);
// bool getTimeStampPresence();
bool encode2UserLocationInformationEUTRA( bool encode2UserLocationInformationEUTRA(
Ngap_UserLocationInformationEUTRA_t* userLocationInformation); Ngap_UserLocationInformationEUTRA_t* userLocationInformation);
bool decodefromUserLocationInformationEUTRA( bool decodefromUserLocationInformationEUTRA(
Ngap_UserLocationInformationEUTRA_t* userLocationInformation); Ngap_UserLocationInformationEUTRA_t* userLocationInformation);
// void getInformationEUTRA(EUTRA_CGI* &m_eUTRA_CGI,TAI* &m_tAI,TimeStamp*
// &m_timeStamp);
void getInformationEUTRA(EUTRA_CGI*& m_eUTRA_CGI, TAI*& m_tAI);
// bool getTimeStampPresence();
private: private:
EUTRA_CGI* eUTRA_CGI; EUTRA_CGI eUTRA_CGI; // Mandatory
TAI* tAI; TAI tAI; // Mandatory
// bool istimeStampSet; // TODO: TimeStamp *timeStamp; //Age of Location (Optional)
// TimeStamp *timeStamp; // TODO: NG-RAN CGI (PSCell Information) (Optional)
}; };
} // namespace ngap } // namespace ngap
......
...@@ -42,7 +42,7 @@ bool UserLocationInformationNR::encode2UserLocationInformationNR( ...@@ -42,7 +42,7 @@ bool UserLocationInformationNR::encode2UserLocationInformationNR(
if (!nR_CGI.encode2NR_CGI(&userLocationInformationNR->nR_CGI)) { if (!nR_CGI.encode2NR_CGI(&userLocationInformationNR->nR_CGI)) {
return false; return false;
} }
if (!tAI.encode2TAI(&userLocationInformationNR->tAI)) { if (!tAI.encode(&userLocationInformationNR->tAI)) {
return false; return false;
} }
#if 0 #if 0
...@@ -67,7 +67,7 @@ bool UserLocationInformationNR::decodefromUserLocationInformationNR( ...@@ -67,7 +67,7 @@ bool UserLocationInformationNR::decodefromUserLocationInformationNR(
return false; return false;
} }
if (!tAI.decodefromTAI(&userLocationInformationNR->tAI)) { if (!tAI.decode(&userLocationInformationNR->tAI)) {
return false; return false;
} }
#if 0 #if 0
......
...@@ -109,7 +109,7 @@ bool HandoverRequiredMsg::getTargetID(GlobalgNBId& gnbId, TAI& tai) { ...@@ -109,7 +109,7 @@ bool HandoverRequiredMsg::getTargetID(GlobalgNBId& gnbId, TAI& tai) {
Ngap_GlobalRANNodeID_PR_globalGNB_ID) { Ngap_GlobalRANNodeID_PR_globalGNB_ID) {
gnbId.decode( gnbId.decode(
targetID.choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID); targetID.choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID);
tai.decodefromTAI(&targetID.choice.targetRANNodeID->selectedTAI); tai.decode(&targetID.choice.targetRANNodeID->selectedTAI);
return true; return true;
} }
} }
......
...@@ -118,7 +118,7 @@ void NGSetupRequestMsg::setSupportedTAList( ...@@ -118,7 +118,7 @@ void NGSetupRequestMsg::setSupportedTAList(
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
SupportedTaItem item = {}; SupportedTaItem item = {};
TAC tac = {}; TAC tac = {};
tac.setTac(list[i].tac); tac.set(list[i].tac);
item.setTac(tac); item.setTac(tac);
std::vector<BroadcastPLMNItem> broadcastPlmnItems; std::vector<BroadcastPLMNItem> broadcastPlmnItems;
...@@ -329,7 +329,7 @@ bool NGSetupRequestMsg::getSupportedTAList( ...@@ -329,7 +329,7 @@ bool NGSetupRequestMsg::getSupportedTAList(
it->getTac(tac); it->getTac(tac);
SupportedItem_t supporteditem_data = {}; SupportedItem_t supporteditem_data = {};
supporteditem_data.tac = tac.getTac(); supporteditem_data.tac = tac.get();
std::vector<BroadcastPLMNItem> broadcastPLMNItems; std::vector<BroadcastPLMNItem> broadcastPLMNItems;
it->getBroadcastPlmnList(broadcastPLMNItems); it->getBroadcastPlmnList(broadcastPLMNItems);
......
...@@ -157,7 +157,7 @@ void PagingMsg::setTAIListForPaging(const std::vector<Tai_t>& list) { ...@@ -157,7 +157,7 @@ void PagingMsg::setTAIListForPaging(const std::vector<Tai_t>& list) {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
TAI tai = {}; TAI tai = {};
plmnid[i].set(list[i].mcc, list[i].mnc); plmnid[i].set(list[i].mcc, list[i].mnc);
tac[i].setTac(list[i].tac); tac[i].set(list[i].tac);
tai.setTAI(plmnid[i], tac[i]); tai.setTAI(plmnid[i], tac[i]);
tailist.push_back(tai); tailist.push_back(tai);
} }
......
...@@ -146,7 +146,7 @@ void UEContextReleaseCompleteMsg::getUserLocationInfoNR( ...@@ -146,7 +146,7 @@ void UEContextReleaseCompleteMsg::getUserLocationInfoNR(
plmnId.getMcc(tai.mcc); plmnId.getMcc(tai.mcc);
plmnId.getMnc(tai.mnc); plmnId.getMnc(tai.mnc);
tai.tac = tac.getTac() & 0x00ffffff; tai.tac = tac.get() & 0x00ffffff;
} }
} }
......
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