Commit e975eb79 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'improve_ngap_lib' into 'develop'

Improve ngap lib

See merge request oai/cn5g/oai-cn5g-amf!47
parents deb5969e 6db97984
This diff is collapsed.
...@@ -39,20 +39,20 @@ namespace ngap { ...@@ -39,20 +39,20 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AmfName::AmfName() { AmfName::AmfName() {
amfname = NULL; amfname = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AmfName::~AmfName() { AmfName::~AmfName() {
free(amfname); free(amfname);
amfname = NULL; amfname = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AmfName::setValue(const std::string m_amfName) { void AmfName::setValue(const std::string m_amfName) {
if (amfname) { if (amfname) {
free(amfname); free(amfname);
amfname = NULL; amfname = nullptr;
} }
amfname = (char*) calloc(1, m_amfName.size() + 1); amfname = (char*) calloc(1, m_amfName.size() + 1);
memcpy(amfname, m_amfName.c_str(), m_amfName.size()); memcpy(amfname, m_amfName.c_str(), m_amfName.size());
...@@ -61,13 +61,14 @@ void AmfName::setValue(const std::string m_amfName) { ...@@ -61,13 +61,14 @@ void AmfName::setValue(const std::string m_amfName) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AmfName::getValue(std::string& m_amfName) { void AmfName::getValue(std::string& m_amfName) {
m_amfName = amfname; if (amfname) m_amfName = amfname;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AmfName::encode2AmfName(Ngap_AMFName_t* amfNameIe) { bool AmfName::encode2AmfName(Ngap_AMFName_t* amfNameIe) {
if (OCTET_STRING_fromBuf(amfNameIe, amfname, strlen(amfname)) < 0) if (amfname)
return false; if (OCTET_STRING_fromBuf(amfNameIe, amfname, strlen(amfname)) < 0)
return false;
return true; return true;
} }
......
...@@ -70,7 +70,6 @@ bool AMFSetID::encode2bitstring(Ngap_AMFSetID_t& amfsetid) { ...@@ -70,7 +70,6 @@ bool AMFSetID::encode2bitstring(Ngap_AMFSetID_t& amfsetid) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AMFSetID::decodefrombitstring(Ngap_AMFSetID_t& amfsetid) { bool AMFSetID::decodefrombitstring(Ngap_AMFSetID_t& amfsetid) {
if (!amfsetid.buf) return false; if (!amfsetid.buf) return false;
printf("test for amfsetid\n");
for (int i = 0; i < amfsetid.size; i++) { for (int i = 0; i < amfsetid.size; i++) {
printf("%x ", amfsetid.buf[i]); printf("%x ", amfsetid.buf[i]);
} }
......
...@@ -40,7 +40,7 @@ namespace ngap { ...@@ -40,7 +40,7 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AllowedNSSAI::AllowedNSSAI() { AllowedNSSAI::AllowedNSSAI() {
snssai = NULL; snssai = nullptr;
numofSnssai = 0; numofSnssai = 0;
} }
...@@ -66,7 +66,6 @@ bool AllowedNSSAI::getAllowedNSSAI(S_NSSAI*& m_snssai, int& m_numofsnssai) { ...@@ -66,7 +66,6 @@ bool AllowedNSSAI::getAllowedNSSAI(S_NSSAI*& m_snssai, int& m_numofsnssai) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AllowedNSSAI::encode2AllowedNSSAI(Ngap_AllowedNSSAI_t* allowedNssaiList) { bool AllowedNSSAI::encode2AllowedNSSAI(Ngap_AllowedNSSAI_t* allowedNssaiList) {
cout << "AllowedNSSAI::numOfSnssai " << numofSnssai << endl;
for (int i = 0; i < numofSnssai; i++) { for (int i = 0; i < numofSnssai; i++) {
Ngap_AllowedNSSAI_Item_t* allowednssaiitem = Ngap_AllowedNSSAI_Item_t* allowednssaiitem =
(Ngap_AllowedNSSAI_Item_t*) calloc(1, sizeof(Ngap_AllowedNSSAI_Item_t)); (Ngap_AllowedNSSAI_Item_t*) calloc(1, sizeof(Ngap_AllowedNSSAI_Item_t));
......
...@@ -35,7 +35,7 @@ namespace ngap { ...@@ -35,7 +35,7 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AssociatedQosFlowItem::AssociatedQosFlowItem() { AssociatedQosFlowItem::AssociatedQosFlowItem() {
qosFlowIdentifier = NULL; qosFlowIdentifier = nullptr;
qosFlowMappingIndication = -1; qosFlowMappingIndication = -1;
} }
...@@ -74,6 +74,8 @@ bool AssociatedQosFlowItem::encode2AssociatedQosFlowItem( ...@@ -74,6 +74,8 @@ bool AssociatedQosFlowItem::encode2AssociatedQosFlowItem(
(long*) calloc(1, sizeof(long)); (long*) calloc(1, sizeof(long));
*associatedQosFlowItem->qosFlowMappingIndication = qosFlowMappingIndication; *associatedQosFlowItem->qosFlowMappingIndication = qosFlowMappingIndication;
} }
if (!qosFlowIdentifier) return false;
if (!qosFlowIdentifier->encode2QosFlowIdentifier( if (!qosFlowIdentifier->encode2QosFlowIdentifier(
&associatedQosFlowItem->qosFlowIdentifier)) &associatedQosFlowItem->qosFlowIdentifier))
return false; return false;
......
...@@ -35,7 +35,7 @@ namespace ngap { ...@@ -35,7 +35,7 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AssociatedQosFlowList::AssociatedQosFlowList() { AssociatedQosFlowList::AssociatedQosFlowList() {
associatedQosFlowItem = NULL; associatedQosFlowItem = nullptr;
numofassociatedQosFlowItem = 0; numofassociatedQosFlowItem = 0;
} }
...@@ -65,6 +65,7 @@ bool AssociatedQosFlowList::encode2AssociatedQosFlowList( ...@@ -65,6 +65,7 @@ bool AssociatedQosFlowList::encode2AssociatedQosFlowList(
Ngap_AssociatedQosFlowItem_t* ie = (Ngap_AssociatedQosFlowItem_t*) calloc( Ngap_AssociatedQosFlowItem_t* ie = (Ngap_AssociatedQosFlowItem_t*) calloc(
1, sizeof(Ngap_AssociatedQosFlowItem_t)); 1, sizeof(Ngap_AssociatedQosFlowItem_t));
if (!ie) return false; if (!ie) return false;
if (!associatedQosFlowItem) return false;
if (!associatedQosFlowItem[i].encode2AssociatedQosFlowItem(ie)) if (!associatedQosFlowItem[i].encode2AssociatedQosFlowItem(ie))
return false; return false;
if (ASN_SEQUENCE_ADD(&associatedQosFlowList.list, ie) != 0) return false; if (ASN_SEQUENCE_ADD(&associatedQosFlowList.list, ie) != 0) return false;
......
...@@ -43,8 +43,8 @@ namespace ngap { ...@@ -43,8 +43,8 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
BroadcastPLMNItem::BroadcastPLMNItem() { BroadcastPLMNItem::BroadcastPLMNItem() {
plmn = NULL; plmn = nullptr;
snssai = NULL; snssai = nullptr;
numOfSnssai = 0; numOfSnssai = 0;
} }
...@@ -70,8 +70,9 @@ void BroadcastPLMNItem::getPlmnSliceSupportList( ...@@ -70,8 +70,9 @@ void BroadcastPLMNItem::getPlmnSliceSupportList(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool BroadcastPLMNItem::encode2BroadcastPLMNItem( bool BroadcastPLMNItem::encode2BroadcastPLMNItem(
Ngap_BroadcastPLMNItem_t* plmnItem) { Ngap_BroadcastPLMNItem_t* plmnItem) {
if (!plmn) return false;
if (!snssai) return false;
if (!plmn->encode2octetstring(plmnItem->pLMNIdentity)) return false; if (!plmn->encode2octetstring(plmnItem->pLMNIdentity)) return false;
cout << "BroadcastPLMNItem::numOfSnssai " << numOfSnssai << endl;
for (int i = 0; i < numOfSnssai; i++) { for (int i = 0; i < numOfSnssai; i++) {
Ngap_SliceSupportItem_t* slice = Ngap_SliceSupportItem_t* slice =
(Ngap_SliceSupportItem_t*) calloc(1, sizeof(Ngap_SliceSupportItem_t)); (Ngap_SliceSupportItem_t*) calloc(1, sizeof(Ngap_SliceSupportItem_t));
...@@ -89,7 +90,7 @@ bool BroadcastPLMNItem::decodefromBroadcastPLMNItem( ...@@ -89,7 +90,7 @@ bool BroadcastPLMNItem::decodefromBroadcastPLMNItem(
if (plmn == nullptr) plmn = new PlmnId(); if (plmn == nullptr) plmn = new PlmnId();
if (!plmn->decodefromoctetstring(pdu->pLMNIdentity)) return false; if (!plmn->decodefromoctetstring(pdu->pLMNIdentity)) return false;
numOfSnssai = pdu->tAISliceSupportList.list.count; numOfSnssai = pdu->tAISliceSupportList.list.count;
snssai = new S_NSSAI[numOfSnssai](); if (snssai == nullptr) snssai = new S_NSSAI[numOfSnssai]();
for (int i = 0; i < numOfSnssai; i++) { for (int i = 0; i < numOfSnssai; i++) {
if (!snssai[i].decodefromS_NSSAI( if (!snssai[i].decodefromS_NSSAI(
&pdu->tAISliceSupportList.list.array[i]->s_NSSAI)) &pdu->tAISliceSupportList.list.array[i]->s_NSSAI))
......
...@@ -43,16 +43,12 @@ bool COUNTValueForPDCP_SN18::encodedCOUNTValueForPDCP_SN18( ...@@ -43,16 +43,12 @@ bool COUNTValueForPDCP_SN18::encodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t* countvalue) { Ngap_COUNTValueForPDCP_SN18_t* countvalue) {
countvalue->pDCP_SN18 = pdcp; countvalue->pDCP_SN18 = pdcp;
countvalue->hFN_PDCP_SN18 = hfn_pdcp; countvalue->hFN_PDCP_SN18 = hfn_pdcp;
cout << "the encode pdcp_sn18 is" << countvalue->pDCP_SN18 << endl;
cout << "the encode hfn_pdcp_sn18 is" << countvalue->hFN_PDCP_SN18 << endl;
return true; return true;
} }
bool COUNTValueForPDCP_SN18::decodedCOUNTValueForPDCP_SN18( bool COUNTValueForPDCP_SN18::decodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t& countValue) { Ngap_COUNTValueForPDCP_SN18_t& countValue) {
pdcp = countValue.pDCP_SN18; pdcp = countValue.pDCP_SN18;
hfn_pdcp = countValue.hFN_PDCP_SN18; hfn_pdcp = countValue.hFN_PDCP_SN18;
cout << "the decode pdcp_sn18 is" << countValue.pDCP_SN18 << endl;
cout << "the decode hfn_pdcp_sn18 is" << countValue.hFN_PDCP_SN18 << endl;
return true; return true;
} }
} // namespace ngap } // namespace ngap
...@@ -78,12 +78,15 @@ void CoreNetworkAssistanceInfo::setCoreNetworkAssistanceInfo( ...@@ -78,12 +78,15 @@ void CoreNetworkAssistanceInfo::setCoreNetworkAssistanceInfo(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo( bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo(
Ngap_CoreNetworkAssistanceInformation_t* coreNetworkAssistanceInformation) { Ngap_CoreNetworkAssistanceInformation_t* coreNetworkAssistanceInformation) {
if (!ueIdentityIndexValue) return false;
if (!ueIdentityIndexValue->encode2UEIdentityIndexValue( if (!ueIdentityIndexValue->encode2UEIdentityIndexValue(
&coreNetworkAssistanceInformation->uEIdentityIndexValue)) &coreNetworkAssistanceInformation->uEIdentityIndexValue))
return false; return false;
if (!periodicRegUpdateTimer) return false;
if (!periodicRegUpdateTimer->encode2PeriodicRegistrationUpdateTimer( if (!periodicRegUpdateTimer->encode2PeriodicRegistrationUpdateTimer(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer)) &coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false; return false;
if (!tai) return false;
for (int i = 0; i < numoftai; i++) { for (int i = 0; i < numoftai; i++) {
Ngap_TAIListForInactiveItem_t* taiListForInactiveItem = Ngap_TAIListForInactiveItem_t* taiListForInactiveItem =
(Ngap_TAIListForInactiveItem_t*) calloc( (Ngap_TAIListForInactiveItem_t*) calloc(
...@@ -129,7 +132,7 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo( ...@@ -129,7 +132,7 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer)) &coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false; return false;
numoftai = coreNetworkAssistanceInformation->tAIListForInactive.list.count; numoftai = coreNetworkAssistanceInformation->tAIListForInactive.list.count;
tai = new TAI[numoftai](); if (tai == nullptr) tai = new TAI[numoftai]();
for (int i = 0; i < numoftai; i++) { for (int i = 0; i < numoftai; i++) {
if (!tai[i].decodefromTAI( if (!tai[i].decodefromTAI(
&coreNetworkAssistanceInformation->tAIListForInactive.list.array[i] &coreNetworkAssistanceInformation->tAIListForInactive.list.array[i]
...@@ -137,13 +140,13 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo( ...@@ -137,13 +140,13 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
return false; return false;
} }
if (coreNetworkAssistanceInformation->uESpecificDRX) { if (coreNetworkAssistanceInformation->uESpecificDRX) {
pagingDRX = new DefaultPagingDRX(); if (pagingDRX == nullptr) pagingDRX = new DefaultPagingDRX();
if (!pagingDRX->decodefromDefaultPagingDRX( if (!pagingDRX->decodefromDefaultPagingDRX(
*(coreNetworkAssistanceInformation->uESpecificDRX))) *(coreNetworkAssistanceInformation->uESpecificDRX)))
return false; return false;
} }
if (coreNetworkAssistanceInformation->mICOModeIndication) { if (coreNetworkAssistanceInformation->mICOModeIndication) {
micoModeInd = new MICOModeIndication(); if (micoModeInd == nullptr) micoModeInd = new MICOModeIndication();
if (!micoModeInd->decodefromMICOModeIndication( if (!micoModeInd->decodefromMICOModeIndication(
coreNetworkAssistanceInformation->mICOModeIndication)) coreNetworkAssistanceInformation->mICOModeIndication))
return false; return false;
......
...@@ -101,6 +101,7 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) { ...@@ -101,6 +101,7 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) {
ie->value.choice.CriticalityDiagnostics.procedureCriticality = ie->value.choice.CriticalityDiagnostics.procedureCriticality =
procedureCriticalityIE; procedureCriticalityIE;
} }
if (numberOfIEsCriticalityDiagnostics) { if (numberOfIEsCriticalityDiagnostics) {
Ngap_CriticalityDiagnostics_IE_List_t* ieList = Ngap_CriticalityDiagnostics_IE_List_t* ieList =
(Ngap_CriticalityDiagnostics_IE_List_t*) calloc( (Ngap_CriticalityDiagnostics_IE_List_t*) calloc(
...@@ -109,8 +110,10 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) { ...@@ -109,8 +110,10 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) {
Ngap_CriticalityDiagnostics_IE_Item_t* ieItem = Ngap_CriticalityDiagnostics_IE_Item_t* ieItem =
(Ngap_CriticalityDiagnostics_IE_Item_t*) calloc( (Ngap_CriticalityDiagnostics_IE_Item_t*) calloc(
1, sizeof(Ngap_CriticalityDiagnostics_IE_Item_t)); 1, sizeof(Ngap_CriticalityDiagnostics_IE_Item_t));
iEsCriticalityDiagnostics[i].encode2pdu(ieItem); if (iEsCriticalityDiagnostics) {
ASN_SEQUENCE_ADD(&ieList->list, ieItem); iEsCriticalityDiagnostics[i].encode2pdu(ieItem);
ASN_SEQUENCE_ADD(&ieList->list, ieItem);
}
} }
ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics = ieList; ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics = ieList;
} }
......
...@@ -35,8 +35,8 @@ namespace ngap { ...@@ -35,8 +35,8 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
DLQoSFlowPerTNLInformation::DLQoSFlowPerTNLInformation() { DLQoSFlowPerTNLInformation::DLQoSFlowPerTNLInformation() {
uPTransportLayerInformation = NULL; uPTransportLayerInformation = nullptr;
associatedQosFlowList = NULL; associatedQosFlowList = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -63,9 +63,11 @@ bool DLQoSFlowPerTNLInformation::getDLQoSFlowPerTNLInformation( ...@@ -63,9 +63,11 @@ bool DLQoSFlowPerTNLInformation::getDLQoSFlowPerTNLInformation(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool DLQoSFlowPerTNLInformation::encode2DLQoSFlowPerTNLInformation( bool DLQoSFlowPerTNLInformation::encode2DLQoSFlowPerTNLInformation(
Ngap_QosFlowPerTNLInformation_t* qosFlowPerTNLInformation) { Ngap_QosFlowPerTNLInformation_t* qosFlowPerTNLInformation) {
if (!uPTransportLayerInformation) return false;
if (!uPTransportLayerInformation->encode2UpTransportLayerInformation( if (!uPTransportLayerInformation->encode2UpTransportLayerInformation(
qosFlowPerTNLInformation->uPTransportLayerInformation)) qosFlowPerTNLInformation->uPTransportLayerInformation))
return false; return false;
if (!associatedQosFlowList) return false;
if (!associatedQosFlowList->encode2AssociatedQosFlowList( if (!associatedQosFlowList->encode2AssociatedQosFlowList(
qosFlowPerTNLInformation->associatedQosFlowList)) qosFlowPerTNLInformation->associatedQosFlowList))
return false; return false;
......
...@@ -39,20 +39,6 @@ DataForwardingNotPossible::DataForwardingNotPossible() {} ...@@ -39,20 +39,6 @@ DataForwardingNotPossible::DataForwardingNotPossible() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
DataForwardingNotPossible::~DataForwardingNotPossible() {} DataForwardingNotPossible::~DataForwardingNotPossible() {}
//------------------------------------------------------------------------------
#if 0
void DataForwardingNotPossible::setDataForwardingNotPossible(const uint32_t m_gtp_teid)
{
gtp_teid = m_gtp_teid;
}
bool DataForwardingNotPossible::getDataForwardingNotPossible(uint32_t &m_gtp_teid)
{
m_gtp_teid = gtp_teid;
return true;
}
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool DataForwardingNotPossible::encode2DataForwardingNotPossible( bool DataForwardingNotPossible::encode2DataForwardingNotPossible(
Ngap_DataForwardingNotPossible_t& dataForwardingNotPossible) { Ngap_DataForwardingNotPossible_t& dataForwardingNotPossible) {
......
...@@ -20,64 +20,69 @@ ...@@ -20,64 +20,69 @@
*/ */
#include "dRBsSubjectToStatusTransferItem.hpp" #include "dRBsSubjectToStatusTransferItem.hpp"
#include "logger.hpp"
#include <iostream> #include <iostream>
#include <vector> #include <vector>
using namespace std; using namespace std;
namespace ngap { namespace ngap {
dRBSubjectItem::dRBSubjectItem() { dRBSubjectItem::dRBSubjectItem() {
drb_id = NULL; drb_id = nullptr;
drb_ul = NULL; drb_ul = nullptr;
drb_dl = NULL; drb_dl = nullptr;
} }
dRBSubjectItem::~dRBSubjectItem() {} dRBSubjectItem::~dRBSubjectItem() {}
void dRBSubjectItem::setdRBSubjectItem( void dRBSubjectItem::setdRBSubjectItem(
Ngap_DRB_ID_t* dRB_ID, dRBStatusUL* dRB_UL, dRBStatusDL* dRB_DL) { Ngap_DRB_ID_t* dRB_ID, dRBStatusUL* dRB_UL, dRBStatusDL* dRB_DL) {
drb_id = dRB_ID; drb_id = dRB_ID;
drb_ul = dRB_UL; drb_ul = dRB_UL;
drb_dl = dRB_DL; drb_dl = dRB_DL;
} }
void dRBSubjectItem::getdRBSubjectItem( void dRBSubjectItem::getdRBSubjectItem(
Ngap_DRB_ID_t*& dRB_ID, dRBStatusUL*& dRB_UL, dRBStatusDL*& dRB_DL) { Ngap_DRB_ID_t*& dRB_ID, dRBStatusUL*& dRB_UL, dRBStatusDL*& dRB_DL) {
dRB_ID = drb_id; dRB_ID = drb_id;
dRB_UL = drb_ul; dRB_UL = drb_ul;
dRB_DL = drb_dl; dRB_DL = drb_dl;
} }
bool dRBSubjectItem::decodefromdRBSubjectItem( bool dRBSubjectItem::decodefromdRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) { Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (dRB_item->dRB_ID) { if (dRB_item->dRB_ID) {
drb_id = &dRB_item->dRB_ID; drb_id = &dRB_item->dRB_ID;
cout << "the decode drb_id is" << *drb_id << endl;
} }
drb_ul = new dRBStatusUL(); drb_ul = new dRBStatusUL();
if (!drb_ul->decodedRBStatusUL(&dRB_item->dRBStatusUL)) { if (!drb_ul->decodedRBStatusUL(&dRB_item->dRBStatusUL)) {
cout << "decode from dRBSubjectItem dRBStatusUL error" << endl;
return false; return false;
} }
drb_dl = new dRBStatusDL(); drb_dl = new dRBStatusDL();
if (!drb_dl->decodedRBStatusDL(&dRB_item->dRBStatusDL)) { if (!drb_dl->decodedRBStatusDL(&dRB_item->dRBStatusDL)) {
cout << "decode from dRBSubjectItem dRBStatusDL error" << endl;
return false; return false;
} }
cout << "decode from dRBSubjectItem successfully" << endl;
return true; return true;
} }
bool dRBSubjectItem::encodedRBSubjectItem( bool dRBSubjectItem::encodedRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) { Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (drb_id) { if (drb_id) {
dRB_item->dRB_ID = *drb_id; dRB_item->dRB_ID = *drb_id;
cout << "the encode drb_id is" << *drb_id << endl;
} }
if (!drb_ul) return false;
if (!drb_ul->encodedRBStatusUL(&dRB_item->dRBStatusUL)) { if (!drb_ul->encodedRBStatusUL(&dRB_item->dRBStatusUL)) {
cout << "encode from dRBSubjectItem dRBStatusUL error" << endl;
return false; return false;
} }
if (!drb_dl) return false;
if (!drb_dl->encodedRBStatusDL(&dRB_item->dRBStatusDL)) { if (!drb_dl->encodedRBStatusDL(&dRB_item->dRBStatusDL)) {
cout << "encode from dRBSubjectItem dRBStatusDL error" << endl;
return false; return false;
} }
cout << "encode from dRBSubjectItem successfully" << endl;
Logger::ngap().debug("Encode from dRBSubjectItem successfully");
return true; return true;
} }
} // namespace ngap } // namespace ngap
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
using namespace std; using namespace std;
namespace ngap { namespace ngap {
dRBSubjectList::dRBSubjectList() { dRBSubjectList::dRBSubjectList() {
drbsubjectitem = NULL; drbsubjectitem = nullptr;
numofitem = 0; numofitem = 0;
} }
dRBSubjectList::~dRBSubjectList() {} dRBSubjectList::~dRBSubjectList() {}
...@@ -45,6 +45,8 @@ bool dRBSubjectList::encodefromdRBSubjectlist( ...@@ -45,6 +45,8 @@ bool dRBSubjectList::encodefromdRBSubjectlist(
(Ngap_DRBsSubjectToStatusTransferItem_t*) calloc( (Ngap_DRBsSubjectToStatusTransferItem_t*) calloc(
1, sizeof(Ngap_DRBsSubjectToStatusTransferItem_t)); 1, sizeof(Ngap_DRBsSubjectToStatusTransferItem_t));
if (!ie) return false; if (!ie) return false;
if (!drbsubjectitem) return false;
if (!drbsubjectitem[i].encodedRBSubjectItem(ie)) { if (!drbsubjectitem[i].encodedRBSubjectItem(ie)) {
cout << "encodefromdRBSubjectlist error" << endl; cout << "encodefromdRBSubjectlist error" << endl;
return false; return false;
......
...@@ -45,14 +45,14 @@ namespace ngap { ...@@ -45,14 +45,14 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
DownLinkNasTransportMsg::DownLinkNasTransportMsg() { DownLinkNasTransportMsg::DownLinkNasTransportMsg() {
downLinkNasTransportPdu = NULL; downLinkNasTransportPdu = nullptr;
downLinkNasTransportIEs = NULL; downLinkNasTransportIEs = nullptr;
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
oldAmfName = NULL; oldAmfName = nullptr;
ranPagingPriority = NULL; ranPagingPriority = nullptr;
nasPdu = NULL; nasPdu = nullptr;
indexToRFSP = NULL; indexToRFSP = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -241,7 +241,7 @@ int DownLinkNasTransportMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -241,7 +241,7 @@ int DownLinkNasTransportMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, downLinkNasTransportPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, downLinkNasTransportPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, downLinkNasTransportPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, downLinkNasTransportPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include "DownlinkRANStatusTransfer.hpp" #include "DownlinkRANStatusTransfer.hpp"
#include "logger.hpp"
#include <iostream> #include <iostream>
#include <vector> #include <vector>
...@@ -31,6 +32,7 @@ extern "C" { ...@@ -31,6 +32,7 @@ extern "C" {
using namespace std; using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------
DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() { DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
amfUeNgapId = nullptr; amfUeNgapId = nullptr;
ranUeNgapId = nullptr; ranUeNgapId = nullptr;
...@@ -39,8 +41,10 @@ DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() { ...@@ -39,8 +41,10 @@ DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
DownlinkranstatustransferPDU = nullptr; DownlinkranstatustransferPDU = nullptr;
} }
//------------------------------------------------------------------------------
DownlinkRANStatusTransfer::~DownlinkRANStatusTransfer() {} DownlinkRANStatusTransfer::~DownlinkRANStatusTransfer() {}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) { void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID(); if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id); amfUeNgapId->setAMF_UE_NGAP_ID(id);
...@@ -55,16 +59,18 @@ void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) { ...@@ -55,16 +59,18 @@ void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) { void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID(); if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(id); ranUeNgapId->setRanUeNgapId(id);
...@@ -79,16 +85,17 @@ void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) { ...@@ -79,16 +85,17 @@ void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer( void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
long drb_id, long ul_pcdp, long ul_hfn_pdcp, long dl_pcdp, long drb_id, long ul_pcdp, long ul_hfn_pdcp, long dl_pcdp,
long dl_hfn_pdcp) { long dl_hfn_pdcp) {
...@@ -128,7 +135,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer( ...@@ -128,7 +135,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
->encoderanstatustransfer_transparentcontainer( ->encoderanstatustransfer_transparentcontainer(
&ie->value.choice.RANStatusTransfer_TransparentContainer); &ie->value.choice.RANStatusTransfer_TransparentContainer);
if (!ret) { if (!ret) {
cout << "encode ranstatustransfer_transparentcontainer error" << endl; Logger::ngap().error(
"Encode RANStatusTransfer_TransparentContainer IE error");
// free_wrapper((void**) &dRB_id); // free_wrapper((void**) &dRB_id);
free_wrapper((void**) &UL_value); free_wrapper((void**) &UL_value);
free_wrapper((void**) &DL_value); free_wrapper((void**) &DL_value);
...@@ -142,7 +150,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer( ...@@ -142,7 +150,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
} }
if (ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie) != if (ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie) !=
0) { 0) {
cout << "encode ranstatustransfer_transparentcontainer error 2" << endl; Logger::ngap().error(
"Encode ranstatustransfer_transparentcontainer IE error");
} }
/* free_wrapper((void**) &dRB_id); /* free_wrapper((void**) &dRB_id);
free_wrapper((void**) &UL_value); free_wrapper((void**) &UL_value);
...@@ -157,6 +166,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer( ...@@ -157,6 +166,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
*/ */
} }
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setmessagetype() { void DownlinkRANStatusTransfer::setmessagetype() {
if (!DownlinkranstatustransferPDU) { if (!DownlinkranstatustransferPDU) {
DownlinkranstatustransferPDU = DownlinkranstatustransferPDU =
...@@ -180,18 +190,18 @@ void DownlinkRANStatusTransfer::setmessagetype() { ...@@ -180,18 +190,18 @@ void DownlinkRANStatusTransfer::setmessagetype() {
&(DownlinkranstatustransferPDU->choice.initiatingMessage->value.choice &(DownlinkranstatustransferPDU->choice.initiatingMessage->value.choice
.DownlinkRANStatusTransfer); .DownlinkRANStatusTransfer);
} else { } else {
cout << "[warning] This information doesn't refer to " Logger::ngap().warn(
"downlinkranstatustransfer Message!!!" "This information doesn't refer to DownlinkRANStatusTransfer Message");
<< endl;
} }
} }
//------------------------------------------------------------------------------
int DownlinkRANStatusTransfer::encodetobuffer(uint8_t* buf, int buf_size) { int DownlinkRANStatusTransfer::encodetobuffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, DownlinkranstatustransferPDU); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, DownlinkranstatustransferPDU);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, DownlinkranstatustransferPDU, buf, &asn_DEF_Ngap_NGAP_PDU, NULL, DownlinkranstatustransferPDU, buf,
buf_size); buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
} // namespace ngap } // namespace ngap
...@@ -40,6 +40,7 @@ using namespace std; ...@@ -40,6 +40,7 @@ using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------
HandoverCommandMsg::HandoverCommandMsg() { HandoverCommandMsg::HandoverCommandMsg() {
amfUeNgapId = nullptr; amfUeNgapId = nullptr;
ranUeNgapId = nullptr; ranUeNgapId = nullptr;
...@@ -52,8 +53,11 @@ HandoverCommandMsg::HandoverCommandMsg() { ...@@ -52,8 +53,11 @@ HandoverCommandMsg::HandoverCommandMsg() {
handoverCommandPdu = nullptr; handoverCommandPdu = nullptr;
handoverCommandIEs = nullptr; handoverCommandIEs = nullptr;
} }
//------------------------------------------------------------------------------
HandoverCommandMsg::~HandoverCommandMsg() {} HandoverCommandMsg::~HandoverCommandMsg() {}
//------------------------------------------------------------------------------
unsigned long HandoverCommandMsg::getAmfUeNgapId() { unsigned long HandoverCommandMsg::getAmfUeNgapId() {
if (amfUeNgapId) if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
...@@ -61,6 +65,7 @@ unsigned long HandoverCommandMsg::getAmfUeNgapId() { ...@@ -61,6 +65,7 @@ unsigned long HandoverCommandMsg::getAmfUeNgapId() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
uint32_t HandoverCommandMsg::getRanUeNgapId() { uint32_t HandoverCommandMsg::getRanUeNgapId() {
if (ranUeNgapId) if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
...@@ -68,6 +73,7 @@ uint32_t HandoverCommandMsg::getRanUeNgapId() { ...@@ -68,6 +73,7 @@ uint32_t HandoverCommandMsg::getRanUeNgapId() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false; if (!ngap_msg_pdu) return false;
handoverCommandPdu = ngap_msg_pdu; handoverCommandPdu = ngap_msg_pdu;
...@@ -192,14 +198,16 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -192,14 +198,16 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true; return true;
} }
//------------------------------------------------------------------------------
int HandoverCommandMsg::encode2buffer(uint8_t* buf, int buf_size) { int HandoverCommandMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverCommandPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverCommandPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverCommandPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, handoverCommandPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
//------------------------------------------------------------------------------
void HandoverCommandMsg::setMessageType() { void HandoverCommandMsg::setMessageType() {
if (!handoverCommandPdu) if (!handoverCommandPdu)
handoverCommandPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t)); handoverCommandPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
...@@ -226,6 +234,7 @@ void HandoverCommandMsg::setMessageType() { ...@@ -226,6 +234,7 @@ void HandoverCommandMsg::setMessageType() {
} }
} }
//------------------------------------------------------------------------------
void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) { void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID(); if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id); amfUeNgapId->setAMF_UE_NGAP_ID(id);
...@@ -248,6 +257,7 @@ void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) { ...@@ -248,6 +257,7 @@ void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID(); if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id); ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id);
...@@ -271,6 +281,7 @@ void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -271,6 +281,7 @@ void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverCommandMsg::setHandoverType(long type) { void HandoverCommandMsg::setHandoverType(long type) {
if (!ngap_handovertype) ngap_handovertype = new Ngap_HandoverType_t(); if (!ngap_handovertype) ngap_handovertype = new Ngap_HandoverType_t();
Ngap_HandoverCommandIEs_t* ie = Ngap_HandoverCommandIEs_t* ie =
...@@ -285,6 +296,7 @@ void HandoverCommandMsg::setHandoverType(long type) { ...@@ -285,6 +296,7 @@ void HandoverCommandMsg::setHandoverType(long type) {
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverCommandMsg::setPduSessionResourceHandoverList( void HandoverCommandMsg::setPduSessionResourceHandoverList(
std::vector<PDUSessionResourceHandoverItem_t> list) { std::vector<PDUSessionResourceHandoverItem_t> list) {
if (!PDUSessionResourceHandoverList) if (!PDUSessionResourceHandoverList)
...@@ -320,6 +332,7 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList( ...@@ -320,6 +332,7 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverCommandMsg::setTargetToSource_TransparentContainer( void HandoverCommandMsg::setTargetToSource_TransparentContainer(
OCTET_STRING_t targetTosource) { OCTET_STRING_t targetTosource) {
if (!TargetToSource_TransparentContainer) if (!TargetToSource_TransparentContainer)
......
...@@ -60,8 +60,8 @@ class HandoverCommandMsg { ...@@ -60,8 +60,8 @@ class HandoverCommandMsg {
int encode2buffer(uint8_t* buf, int buf_size); int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu); bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1; unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId(); // return -1; uint32_t getRanUeNgapId();
/*void getHandoverType(Ngap_HandoverType_t &handovertype); /*void getHandoverType(Ngap_HandoverType_t &handovertype);
void getCause(Cause cause); void getCause(Cause cause);
void getTargetID(Ngap_TargetID_t targetID); void getTargetID(Ngap_TargetID_t targetID);
...@@ -73,7 +73,6 @@ class HandoverCommandMsg { ...@@ -73,7 +73,6 @@ class HandoverCommandMsg {
private: private:
Ngap_NGAP_PDU_t* handoverCommandPdu; Ngap_NGAP_PDU_t* handoverCommandPdu;
Ngap_HandoverCommand_t* handoverCommandIEs; Ngap_HandoverCommand_t* handoverCommandIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId; AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId; RAN_UE_NGAP_ID* ranUeNgapId;
Ngap_HandoverType_t* ngap_handovertype; Ngap_HandoverType_t* ngap_handovertype;
......
...@@ -42,6 +42,8 @@ extern "C" { ...@@ -42,6 +42,8 @@ extern "C" {
using namespace std; using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------
HandoverNotifyMsg::HandoverNotifyMsg() { HandoverNotifyMsg::HandoverNotifyMsg() {
amfUeNgapId = nullptr; amfUeNgapId = nullptr;
ranUeNgapId = nullptr; ranUeNgapId = nullptr;
...@@ -50,7 +52,10 @@ HandoverNotifyMsg::HandoverNotifyMsg() { ...@@ -50,7 +52,10 @@ HandoverNotifyMsg::HandoverNotifyMsg() {
handoverNotifyIEs = nullptr; handoverNotifyIEs = nullptr;
} }
//------------------------------------------------------------------------------
HandoverNotifyMsg::~HandoverNotifyMsg(){}; HandoverNotifyMsg::~HandoverNotifyMsg(){};
//------------------------------------------------------------------------------
unsigned long HandoverNotifyMsg::getAmfUeNgapId() { unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
if (amfUeNgapId) if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
...@@ -58,14 +63,16 @@ unsigned long HandoverNotifyMsg::getAmfUeNgapId() { ...@@ -58,14 +63,16 @@ unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) { int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverNotifyPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverNotifyPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverNotifyPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, handoverNotifyPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
//------------------------------------------------------------------------------
bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false; if (!ngap_msg_pdu) return false;
handoverNotifyPdu = ngap_msg_pdu; handoverNotifyPdu = ngap_msg_pdu;
...@@ -150,6 +157,8 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -150,6 +157,8 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
} }
return true; return true;
} }
//------------------------------------------------------------------------------
void HandoverNotifyMsg::setUserLocationInfoNR( void HandoverNotifyMsg::setUserLocationInfoNR(
struct NrCgi_s cig, struct Tai_s tai) { struct NrCgi_s cig, struct Tai_s tai) {
if (!userLocationInformation) if (!userLocationInformation)
...@@ -194,6 +203,7 @@ void HandoverNotifyMsg::setUserLocationInfoNR( ...@@ -194,6 +203,7 @@ void HandoverNotifyMsg::setUserLocationInfoNR(
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
uint32_t HandoverNotifyMsg::getRanUeNgapId() { uint32_t HandoverNotifyMsg::getRanUeNgapId() {
if (ranUeNgapId) if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
...@@ -201,6 +211,7 @@ uint32_t HandoverNotifyMsg::getRanUeNgapId() { ...@@ -201,6 +211,7 @@ uint32_t HandoverNotifyMsg::getRanUeNgapId() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
bool HandoverNotifyMsg::getUserLocationInfoNR( bool HandoverNotifyMsg::getUserLocationInfoNR(
struct NrCgi_s& cig, struct Tai_s& tai) { struct NrCgi_s& cig, struct Tai_s& tai) {
if (!userLocationInformation) return false; if (!userLocationInformation) return false;
......
...@@ -39,6 +39,7 @@ using namespace std; ...@@ -39,6 +39,7 @@ using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------
HandoverPreparationFailure::HandoverPreparationFailure() { HandoverPreparationFailure::HandoverPreparationFailure() {
amfUeNgapId = nullptr; amfUeNgapId = nullptr;
ranUeNgapId = nullptr; ranUeNgapId = nullptr;
...@@ -47,8 +48,10 @@ HandoverPreparationFailure::HandoverPreparationFailure() { ...@@ -47,8 +48,10 @@ HandoverPreparationFailure::HandoverPreparationFailure() {
CriticalityDiagnostics = nullptr; CriticalityDiagnostics = nullptr;
} }
//------------------------------------------------------------------------------
HandoverPreparationFailure::~HandoverPreparationFailure() {} HandoverPreparationFailure::~HandoverPreparationFailure() {}
//------------------------------------------------------------------------------
unsigned long HandoverPreparationFailure::getAmfUeNgapId() const { unsigned long HandoverPreparationFailure::getAmfUeNgapId() const {
if (amfUeNgapId) if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
...@@ -56,6 +59,7 @@ unsigned long HandoverPreparationFailure::getAmfUeNgapId() const { ...@@ -56,6 +59,7 @@ unsigned long HandoverPreparationFailure::getAmfUeNgapId() const {
return 0; return 0;
} }
//------------------------------------------------------------------------------
uint32_t HandoverPreparationFailure::getRanUeNgapId() const { uint32_t HandoverPreparationFailure::getRanUeNgapId() const {
if (ranUeNgapId) if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
...@@ -63,6 +67,7 @@ uint32_t HandoverPreparationFailure::getRanUeNgapId() const { ...@@ -63,6 +67,7 @@ uint32_t HandoverPreparationFailure::getRanUeNgapId() const {
return 0; return 0;
} }
//------------------------------------------------------------------------------
bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false; if (!ngap_msg_pdu) return false;
hoPreparationFailurePdu = ngap_msg_pdu; hoPreparationFailurePdu = ngap_msg_pdu;
...@@ -162,14 +167,16 @@ bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -162,14 +167,16 @@ bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true; return true;
} }
//------------------------------------------------------------------------------
int HandoverPreparationFailure::encode2buffer(uint8_t* buf, int buf_size) { int HandoverPreparationFailure::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, hoPreparationFailurePdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, hoPreparationFailurePdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, hoPreparationFailurePdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, hoPreparationFailurePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setMessageType() { void HandoverPreparationFailure::setMessageType() {
if (!hoPreparationFailurePdu) if (!hoPreparationFailurePdu)
hoPreparationFailurePdu = hoPreparationFailurePdu =
...@@ -198,6 +205,7 @@ void HandoverPreparationFailure::setMessageType() { ...@@ -198,6 +205,7 @@ void HandoverPreparationFailure::setMessageType() {
} }
} }
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) { void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID(); if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id); amfUeNgapId->setAMF_UE_NGAP_ID(id);
...@@ -222,6 +230,7 @@ void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) { ...@@ -222,6 +230,7 @@ void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) { void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID(); if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id); ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id);
...@@ -247,6 +256,7 @@ void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -247,6 +256,7 @@ void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setCause( void HandoverPreparationFailure::setCause(
Ngap_Cause_PR m_causePresent, long value) // Ngap_Cause_PR m_causePresent, long value) //
{ {
...@@ -266,6 +276,7 @@ void HandoverPreparationFailure::setCause( ...@@ -266,6 +276,7 @@ void HandoverPreparationFailure::setCause(
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
Ngap_Cause_PR HandoverPreparationFailure::getChoiceOfCause() const { Ngap_Cause_PR HandoverPreparationFailure::getChoiceOfCause() const {
if (cause) if (cause)
return cause->getChoiceOfCause(); return cause->getChoiceOfCause();
......
...@@ -39,6 +39,7 @@ using namespace std; ...@@ -39,6 +39,7 @@ using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------
HandoverRequest::HandoverRequest() { HandoverRequest::HandoverRequest() {
amfUeNgapId = nullptr; amfUeNgapId = nullptr;
handovertype = nullptr; handovertype = nullptr;
...@@ -54,8 +55,11 @@ HandoverRequest::HandoverRequest() { ...@@ -54,8 +55,11 @@ HandoverRequest::HandoverRequest() {
handoverRequestPdu = nullptr; handoverRequestPdu = nullptr;
handoverRequestIEs = nullptr; handoverRequestIEs = nullptr;
} }
//------------------------------------------------------------------------------
HandoverRequest::~HandoverRequest() {} HandoverRequest::~HandoverRequest() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequest::getAmfUeNgapId() { unsigned long HandoverRequest::getAmfUeNgapId() {
if (amfUeNgapId) if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
...@@ -63,6 +67,7 @@ unsigned long HandoverRequest::getAmfUeNgapId() { ...@@ -63,6 +67,7 @@ unsigned long HandoverRequest::getAmfUeNgapId() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
/*bool HandoverRequest::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) /*bool HandoverRequest::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu)
{ {
handoverCommandPdu = ngap_msg_pdu; handoverCommandPdu = ngap_msg_pdu;
...@@ -219,14 +224,16 @@ error" << endl; return false; ...@@ -219,14 +224,16 @@ error" << endl; return false;
return true; return true;
}*/ }*/
//------------------------------------------------------------------------------
int HandoverRequest::encode2buffer(uint8_t* buf, int buf_size) { int HandoverRequest::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequestPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequestPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
//------------------------------------------------------------------------------
void HandoverRequest::setMessageType() { void HandoverRequest::setMessageType() {
if (!handoverRequestPdu) if (!handoverRequestPdu)
handoverRequestPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t)); handoverRequestPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
...@@ -253,6 +260,7 @@ void HandoverRequest::setMessageType() { ...@@ -253,6 +260,7 @@ void HandoverRequest::setMessageType() {
} }
} }
//------------------------------------------------------------------------------
void HandoverRequest::setAmfUeNgapId(unsigned long id) { void HandoverRequest::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID(); if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id); amfUeNgapId->setAMF_UE_NGAP_ID(id);
...@@ -276,6 +284,7 @@ void HandoverRequest::setAmfUeNgapId(unsigned long id) { ...@@ -276,6 +284,7 @@ void HandoverRequest::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setHandoverType(long type) // 0--intra5gs void HandoverRequest::setHandoverType(long type) // 0--intra5gs
{ {
if (!handovertype) handovertype = new Ngap_HandoverType_t(); if (!handovertype) handovertype = new Ngap_HandoverType_t();
...@@ -290,6 +299,7 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs ...@@ -290,6 +299,7 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) // void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
{ {
if (!cause) cause = new Cause; if (!cause) cause = new Cause;
...@@ -307,6 +317,7 @@ void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) // ...@@ -307,6 +317,7 @@ void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setUEAggregateMaximumBitRate( void HandoverRequest::setUEAggregateMaximumBitRate(
long bit_rate_downlink, long bit_rate_uplink) { long bit_rate_downlink, long bit_rate_uplink) {
if (!ueAggregateMaximumBitRate) if (!ueAggregateMaximumBitRate)
...@@ -329,6 +340,8 @@ void HandoverRequest::setUEAggregateMaximumBitRate( ...@@ -329,6 +340,8 @@ void HandoverRequest::setUEAggregateMaximumBitRate(
Logger::ngap().error("Encode UEAggregateMaximumBitRate IE error"); Logger::ngap().error("Encode UEAggregateMaximumBitRate IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setUESecurityCapabilities( void HandoverRequest::setUESecurityCapabilities(
uint16_t m_NR_EncryptionAlgs, uint16_t m_NR_IntegrityProtectionAlgs, uint16_t m_NR_EncryptionAlgs, uint16_t m_NR_IntegrityProtectionAlgs,
uint16_t m_E_UTRA_EncryptionAlgs, uint16_t m_E_UTRA_EncryptionAlgs,
...@@ -352,6 +365,7 @@ void HandoverRequest::setUESecurityCapabilities( ...@@ -352,6 +365,7 @@ void HandoverRequest::setUESecurityCapabilities(
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setGUAMI( void HandoverRequest::setGUAMI(
PlmnId* m_plmnId, AMFRegionID* m_aMFRegionID, AMFSetID* m_aMFSetID, PlmnId* m_plmnId, AMFRegionID* m_aMFRegionID, AMFSetID* m_aMFSetID,
AMFPointer* m_aMFPointer) { AMFPointer* m_aMFPointer) {
...@@ -370,6 +384,8 @@ void HandoverRequest::setGUAMI( ...@@ -370,6 +384,8 @@ void HandoverRequest::setGUAMI(
if (ret != 0) Logger::ngap().error("Encode GUAMI IE error"); if (ret != 0) Logger::ngap().error("Encode GUAMI IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) { void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
if (!allowedNSSAI) allowedNSSAI = new Ngap_AllowedNSSAI_t(); if (!allowedNSSAI) allowedNSSAI = new Ngap_AllowedNSSAI_t();
...@@ -395,6 +411,8 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) { ...@@ -395,6 +411,8 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
if (ret != 0) Logger::ngap().error("Encode AllowedNSSAI IE error"); if (ret != 0) Logger::ngap().error("Encode AllowedNSSAI IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) { void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
if (!SecurityContext) SecurityContext = new Ngap_SecurityContext_t(); if (!SecurityContext) SecurityContext = new Ngap_SecurityContext_t();
...@@ -414,6 +432,7 @@ void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) { ...@@ -414,6 +432,7 @@ void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setPduSessionResourceSetupList( void HandoverRequest::setPduSessionResourceSetupList(
std::vector<PDUSessionResourceSetupRequestItem_t> list) { std::vector<PDUSessionResourceSetupRequestItem_t> list) {
if (!PDUSessionResourceSetupList) if (!PDUSessionResourceSetupList)
...@@ -457,6 +476,7 @@ void HandoverRequest::setPduSessionResourceSetupList( ...@@ -457,6 +476,7 @@ void HandoverRequest::setPduSessionResourceSetupList(
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setSourceToTarget_TransparentContainer( void HandoverRequest::setSourceToTarget_TransparentContainer(
OCTET_STRING_t sourceTotarget) { OCTET_STRING_t sourceTotarget) {
if (!SourceToTarget_TransparentContainer) if (!SourceToTarget_TransparentContainer)
...@@ -475,6 +495,8 @@ void HandoverRequest::setSourceToTarget_TransparentContainer( ...@@ -475,6 +495,8 @@ void HandoverRequest::setSourceToTarget_TransparentContainer(
Logger::ngap().error("Encode SourceToTarget_TransparentContainer IE error"); Logger::ngap().error("Encode SourceToTarget_TransparentContainer IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
//------------------------------------------------------------------------------
void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) { void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) {
if (!mobilityrestrictionlist) { if (!mobilityrestrictionlist) {
mobilityrestrictionlist = new MobilityRestrictionList(); mobilityrestrictionlist = new MobilityRestrictionList();
......
...@@ -76,7 +76,7 @@ class HandoverRequest { ...@@ -76,7 +76,7 @@ class HandoverRequest {
void setMobilityRestrictionList(PlmnId* m_plmnId); void setMobilityRestrictionList(PlmnId* m_plmnId);
int encode2buffer(uint8_t* buf, int buf_size); int encode2buffer(uint8_t* buf, int buf_size);
// bool decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu); // bool decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1; unsigned long getAmfUeNgapId();
private: private:
Ngap_NGAP_PDU_t* handoverRequestPdu; Ngap_NGAP_PDU_t* handoverRequestPdu;
......
...@@ -41,6 +41,7 @@ using namespace std; ...@@ -41,6 +41,7 @@ using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------
HandoverRequestAck::HandoverRequestAck() { HandoverRequestAck::HandoverRequestAck() {
amfUeNgapId = nullptr; amfUeNgapId = nullptr;
ranUeNgapId = nullptr; ranUeNgapId = nullptr;
...@@ -53,13 +54,18 @@ HandoverRequestAck::HandoverRequestAck() { ...@@ -53,13 +54,18 @@ HandoverRequestAck::HandoverRequestAck() {
handovertype = nullptr; handovertype = nullptr;
} }
//------------------------------------------------------------------------------
HandoverRequestAck::~HandoverRequestAck() {} HandoverRequestAck::~HandoverRequestAck() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequestAck::getAmfUeNgapId() { unsigned long HandoverRequestAck::getAmfUeNgapId() {
if (amfUeNgapId) if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
else else
return 0; return 0;
} }
//------------------------------------------------------------------------------
void HandoverRequestAck::setMessageType() { void HandoverRequestAck::setMessageType() {
if (!handoverRequestAckPdu) if (!handoverRequestAckPdu)
handoverRequestAckPdu = handoverRequestAckPdu =
...@@ -87,18 +93,22 @@ void HandoverRequestAck::setMessageType() { ...@@ -87,18 +93,22 @@ void HandoverRequestAck::setMessageType() {
} }
} }
//------------------------------------------------------------------------------
uint32_t HandoverRequestAck::getRanUeNgapId() { uint32_t HandoverRequestAck::getRanUeNgapId() {
if (ranUeNgapId) if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
else else
return 0; return 0;
} }
//------------------------------------------------------------------------------
OCTET_STRING_t HandoverRequestAck::getTargetToSource_TransparentContainer() { OCTET_STRING_t HandoverRequestAck::getTargetToSource_TransparentContainer() {
if (TargetToSource_TransparentContainer) if (TargetToSource_TransparentContainer)
return *TargetToSource_TransparentContainer; return *TargetToSource_TransparentContainer;
return OCTET_STRING_t(); return OCTET_STRING_t();
} }
//------------------------------------------------------------------------------
bool HandoverRequestAck::getPDUSessionResourceAdmittedList( bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
std::vector<PDUSessionResourceAdmittedItem_t>& list) { std::vector<PDUSessionResourceAdmittedItem_t>& list) {
if (!pduSessionResourceAdmittedList) return false; if (!pduSessionResourceAdmittedList) return false;
...@@ -121,6 +131,7 @@ bool HandoverRequestAck::getPDUSessionResourceAdmittedList( ...@@ -121,6 +131,7 @@ bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
return true; return true;
} }
//------------------------------------------------------------------------------
bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false; if (!ngap_msg_pdu) return false;
handoverRequestAckPdu = ngap_msg_pdu; handoverRequestAckPdu = ngap_msg_pdu;
...@@ -226,14 +237,16 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -226,14 +237,16 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true; return true;
} }
//------------------------------------------------------------------------------
int HandoverRequestAck::encode2buffer(uint8_t* buf, int buf_size) { int HandoverRequestAck::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestAckPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestAckPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequestAckPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequestAckPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
//------------------------------------------------------------------------------
/* void HandoverRequestAck::setMessageType() /* void HandoverRequestAck::setMessageType()
{ {
if (!handoverRequestAckPdu) handoverRequestAckPdu = if (!handoverRequestAckPdu) handoverRequestAckPdu =
......
...@@ -54,8 +54,8 @@ class HandoverRequestAck { ...@@ -54,8 +54,8 @@ class HandoverRequestAck {
int encode2buffer(uint8_t* buf, int buf_size); int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu); bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1; unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId(); // return -1; uint32_t getRanUeNgapId();
void setMessageType(); // Initialize the PDU and populate the MessageType; void setMessageType(); // Initialize the PDU and populate the MessageType;
OCTET_STRING_t getTargetToSource_TransparentContainer(); OCTET_STRING_t getTargetToSource_TransparentContainer();
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include "HandoverRequiredMsg.hpp" #include "HandoverRequiredMsg.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "TAI.hpp"
extern "C" { extern "C" {
#include "Ngap_NGAP-PDU.h" #include "Ngap_NGAP-PDU.h"
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -32,12 +34,11 @@ extern "C" { ...@@ -32,12 +34,11 @@ extern "C" {
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include "TAI.hpp"
using namespace std; using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------
HandoverRequiredMsg::HandoverRequiredMsg() { HandoverRequiredMsg::HandoverRequiredMsg() {
amfUeNgapId = nullptr; amfUeNgapId = nullptr;
ranUeNgapId = nullptr; ranUeNgapId = nullptr;
...@@ -50,8 +51,11 @@ HandoverRequiredMsg::HandoverRequiredMsg() { ...@@ -50,8 +51,11 @@ HandoverRequiredMsg::HandoverRequiredMsg() {
handoverRequiredPdu = nullptr; handoverRequiredPdu = nullptr;
handoverRequiredIEs = nullptr; handoverRequiredIEs = nullptr;
} }
//------------------------------------------------------------------------------
HandoverRequiredMsg::~HandoverRequiredMsg() {} HandoverRequiredMsg::~HandoverRequiredMsg() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequiredMsg::getAmfUeNgapId() { unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
if (amfUeNgapId) if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
...@@ -59,6 +63,7 @@ unsigned long HandoverRequiredMsg::getAmfUeNgapId() { ...@@ -59,6 +63,7 @@ unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
uint32_t HandoverRequiredMsg::getRanUeNgapId() { uint32_t HandoverRequiredMsg::getRanUeNgapId() {
if (ranUeNgapId) if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
...@@ -66,6 +71,7 @@ uint32_t HandoverRequiredMsg::getRanUeNgapId() { ...@@ -66,6 +71,7 @@ uint32_t HandoverRequiredMsg::getRanUeNgapId() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() { Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
if (handovertype) if (handovertype)
return *handovertype; return *handovertype;
...@@ -73,6 +79,7 @@ Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() { ...@@ -73,6 +79,7 @@ Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
return Ngap_HandoverType_t(); return Ngap_HandoverType_t();
} }
//------------------------------------------------------------------------------
Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() { Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
if (cause) if (cause)
return cause->getChoiceOfCause(); return cause->getChoiceOfCause();
...@@ -80,6 +87,7 @@ Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() { ...@@ -80,6 +87,7 @@ Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
return Ngap_Cause_PR(); return Ngap_Cause_PR();
} }
//------------------------------------------------------------------------------
long HandoverRequiredMsg::getCauseValue() { long HandoverRequiredMsg::getCauseValue() {
if (cause) if (cause)
return cause->getValue(); return cause->getValue();
...@@ -87,16 +95,19 @@ long HandoverRequiredMsg::getCauseValue() { ...@@ -87,16 +95,19 @@ long HandoverRequiredMsg::getCauseValue() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) { void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) {
if (ptr) if (ptr)
ptr->decodefromGlobalgNBId( ptr->decodefromGlobalgNBId(
targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID); targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID);
} }
//------------------------------------------------------------------------------
void HandoverRequiredMsg::getTAI(TAI*& ptr) { void HandoverRequiredMsg::getTAI(TAI*& ptr) {
if (ptr) ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI)); if (ptr) ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI));
} }
//------------------------------------------------------------------------------
OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() { OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
if (SourceToTarget_TransparentContainer) if (SourceToTarget_TransparentContainer)
return *SourceToTarget_TransparentContainer; return *SourceToTarget_TransparentContainer;
...@@ -104,6 +115,7 @@ OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() { ...@@ -104,6 +115,7 @@ OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
return OCTET_STRING_t(); return OCTET_STRING_t();
} }
//------------------------------------------------------------------------------
bool HandoverRequiredMsg::getPDUSessionResourceList( bool HandoverRequiredMsg::getPDUSessionResourceList(
std::vector<PDUSessionResourceItem_t>& list) { std::vector<PDUSessionResourceItem_t>& list) {
if (!PDUSessionResourceList) return false; if (!PDUSessionResourceList) return false;
...@@ -127,6 +139,7 @@ bool HandoverRequiredMsg::getPDUSessionResourceList( ...@@ -127,6 +139,7 @@ bool HandoverRequiredMsg::getPDUSessionResourceList(
return true; return true;
} }
//------------------------------------------------------------------------------
long HandoverRequiredMsg::getDirectForwardingPathAvailability() { long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
if (directforwardingPathAvailability) if (directforwardingPathAvailability)
return *directforwardingPathAvailability; return *directforwardingPathAvailability;
...@@ -134,6 +147,7 @@ long HandoverRequiredMsg::getDirectForwardingPathAvailability() { ...@@ -134,6 +147,7 @@ long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredPdu = ngap_msg_pdu; handoverRequiredPdu = ngap_msg_pdu;
...@@ -295,12 +309,12 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -295,12 +309,12 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true; return true;
} }
//------------------------------------------------------------------------------
int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) { int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequiredPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequiredPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequiredPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequiredPdu, buf, buf_size);
// cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
Logger::ngap().error("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "InitialContextSetupFailure.hpp" #include "InitialContextSetupFailure.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -81,9 +82,9 @@ void InitialContextSetupFailureMsg::setMessageType() { ...@@ -81,9 +82,9 @@ void InitialContextSetupFailureMsg::setMessageType() {
&(initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value &(initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.InitialContextSetupFailure); .choice.InitialContextSetupFailure);
} else { } else {
cout << "[warning] This information doesn't refer to " Logger::ngap().warn(
"InitialContextSetupFailure Message!!!" "This information doesn't refer to InitialContextSetupFailure "
<< endl; "Message!");
} }
} }
...@@ -102,13 +103,13 @@ void InitialContextSetupFailureMsg::setAmfUeNgapId(unsigned long id) { ...@@ -102,13 +103,13 @@ void InitialContextSetupFailureMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -127,13 +128,14 @@ void InitialContextSetupFailureMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -127,13 +128,14 @@ void InitialContextSetupFailureMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -175,15 +177,15 @@ void InitialContextSetupFailureMsg::setPduSessionResourceFailedToSetupList( ...@@ -175,15 +177,15 @@ void InitialContextSetupFailureMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListCxtFail( ->encode2PDUSessionResourceFailedToSetupListCxtFail(
&ie->value.choice.PDUSessionResourceFailedToSetupListCxtFail); &ie->value.choice.PDUSessionResourceFailedToSetupListCxtFail);
if (!ret) { if (!ret) {
cout << "encode PDUSessionResourceFailedToSetupListCxtFail IE error" Logger::ngap().error(
<< endl; "Encode PDUSessionResourceFailedToSetupListCxtFail IE error");
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode PDUSessionResourceFailedToSetupListCxtFail IE error" Logger::ngap().error(
<< endl; "Encode PDUSessionResourceFailedToSetupListCxtFail IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -192,7 +194,7 @@ int InitialContextSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -192,7 +194,7 @@ int InitialContextSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupFailurePdu, buf, &asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupFailurePdu, buf,
buf_size); buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -216,11 +218,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu( ...@@ -216,11 +218,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
&initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value &initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.InitialContextSetupFailure; .choice.InitialContextSetupFailure;
} else { } else {
cout << "Check InitialContextSetupFailure message error!!!" << endl; Logger::ngap().error("Check InitialContextSetupFailure message error!");
return false; return false;
} }
} else { } else {
cout << "MessageType error!!!" << endl; Logger::ngap().error("MessageType error!");
return false; return false;
} }
for (int i = 0; i < initialContextSetupFailureIEs->protocolIEs.list.count; for (int i = 0; i < initialContextSetupFailureIEs->protocolIEs.list.count;
...@@ -236,11 +238,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu( ...@@ -236,11 +238,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
initialContextSetupFailureIEs->protocolIEs.list.array[i] initialContextSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -254,11 +256,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu( ...@@ -254,11 +256,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialContextSetupFailureIEs->protocolIEs.list.array[i] initialContextSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -276,21 +278,22 @@ bool InitialContextSetupFailureMsg::decodefrompdu( ...@@ -276,21 +278,22 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
.array[i] .array[i]
->value.choice ->value.choice
.PDUSessionResourceFailedToSetupListCxtFail)) { .PDUSessionResourceFailedToSetupListCxtFail)) {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtFail " Logger::ngap().error(
"IE error" "Decoded NGAP PDUSessionResourceFailedToSetupListCxtFail IE "
<< endl; "error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtFail IE " Logger::ngap().error(
"error!" "Decoded NGAP PDUSessionResourceFailedToSetupListCxtFail IE "
<< endl; "error");
return false; return false;
} }
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded NGAP Message PDU error");
return false; return false;
} }
} }
...@@ -307,7 +310,7 @@ unsigned long InitialContextSetupFailureMsg::getAmfUeNgapId() { ...@@ -307,7 +310,7 @@ unsigned long InitialContextSetupFailureMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t InitialContextSetupFailureMsg::getRanUeNgapId() { uint32_t InitialContextSetupFailureMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1; if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "InitialContextSetupResponse.hpp" #include "InitialContextSetupResponse.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -43,12 +44,12 @@ namespace ngap { ...@@ -43,12 +44,12 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
InitialContextSetupResponseMsg::InitialContextSetupResponseMsg() { InitialContextSetupResponseMsg::InitialContextSetupResponseMsg() {
initialContextSetupResponsePdu = NULL; initialContextSetupResponsePdu = nullptr;
initialContextSetupResponseIEs = NULL; initialContextSetupResponseIEs = nullptr;
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
pduSessionResourceSetupResponseList = NULL; pduSessionResourceSetupResponseList = nullptr;
pduSessionResourceFailedToSetupResponseList = NULL; pduSessionResourceFailedToSetupResponseList = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -81,9 +82,9 @@ void InitialContextSetupResponseMsg::setMessageType() { ...@@ -81,9 +82,9 @@ void InitialContextSetupResponseMsg::setMessageType() {
&(initialContextSetupResponsePdu->choice.successfulOutcome->value.choice &(initialContextSetupResponsePdu->choice.successfulOutcome->value.choice
.InitialContextSetupResponse); .InitialContextSetupResponse);
} else { } else {
std::cout << "[Warning] This information doesn't refer to " Logger::ngap().warn(
"InitialContextSetupResponse message!" "This information doesn't refer to InitialContextSetupResponse "
<< std::endl; "message!");
} }
} }
...@@ -102,13 +103,13 @@ void InitialContextSetupResponseMsg::setAmfUeNgapId(unsigned long id) { ...@@ -102,13 +103,13 @@ void InitialContextSetupResponseMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl; if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -127,13 +128,14 @@ void InitialContextSetupResponseMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -127,13 +128,14 @@ void InitialContextSetupResponseMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl; if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -170,16 +172,14 @@ void InitialContextSetupResponseMsg::setPduSessionResourceSetupResponseList( ...@@ -170,16 +172,14 @@ void InitialContextSetupResponseMsg::setPduSessionResourceSetupResponseList(
->encode2PDUSessionResourceSetupListCxtRes( ->encode2PDUSessionResourceSetupListCxtRes(
&ie->value.choice.PDUSessionResourceSetupListCxtRes); &ie->value.choice.PDUSessionResourceSetupListCxtRes);
if (!ret) { if (!ret) {
std::cout << "Encode PDUSessionResourceSetupListCxtRes IE error" Logger::ngap().error("Encode PDUSessionResourceSetupListCxtRes IE error");
<< std::endl;
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
std::cout << "Encode PDUSessionResourceSetupListCxtRes IE error" Logger::ngap().error("Encode PDUSessionResourceSetupListCxtRes IE error");
<< std::endl;
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -221,16 +221,16 @@ void InitialContextSetupResponseMsg::setPduSessionResourceFailedToSetupList( ...@@ -221,16 +221,16 @@ void InitialContextSetupResponseMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListCxtRes( ->encode2PDUSessionResourceFailedToSetupListCxtRes(
&ie->value.choice.PDUSessionResourceFailedToSetupListCxtRes); &ie->value.choice.PDUSessionResourceFailedToSetupListCxtRes);
if (!ret) { if (!ret) {
std::cout << "Encode PDUSessionResourceFailedToSetupListCxtRes IE error" Logger::ngap().error(
<< std::endl; "Encode PDUSessionResourceFailedToSetupListCxtRes IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
std::cout << "Encode PDUSessionResourceFailedToSetupListCxtRes IE error" Logger::ngap().error(
<< std::endl; "Encode PDUSessionResourceFailedToSetupListCxtRes IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -240,7 +240,7 @@ int InitialContextSetupResponseMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -240,7 +240,7 @@ int InitialContextSetupResponseMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupResponsePdu, buf, &asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupResponsePdu, buf,
buf_size); buf_size);
std::cout << "er.encoded(" << er.encoded << ")" << std::endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -264,12 +264,13 @@ bool InitialContextSetupResponseMsg::decodefrompdu( ...@@ -264,12 +264,13 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
&initialContextSetupResponsePdu->choice.successfulOutcome->value &initialContextSetupResponsePdu->choice.successfulOutcome->value
.choice.InitialContextSetupResponse; .choice.InitialContextSetupResponse;
} else { } else {
std::cout << "Check InitialContextSetupResponse message error!" Logger::ngap().error("Check InitialContextSetupResponse message error");
<< std::endl;
return false; return false;
} }
} else { } else {
std::cout << "MessageType error!" << std::endl; Logger::ngap().error("MessageType error");
return false; return false;
} }
for (int i = 0; i < initialContextSetupResponseIEs->protocolIEs.list.count; for (int i = 0; i < initialContextSetupResponseIEs->protocolIEs.list.count;
...@@ -286,11 +287,12 @@ bool InitialContextSetupResponseMsg::decodefrompdu( ...@@ -286,11 +287,12 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
initialContextSetupResponseIEs->protocolIEs.list.array[i] initialContextSetupResponseIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
std::cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
std::cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -305,11 +307,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu( ...@@ -305,11 +307,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialContextSetupResponseIEs->protocolIEs.list.array[i] initialContextSetupResponseIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
std::cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
std::cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -326,14 +328,15 @@ bool InitialContextSetupResponseMsg::decodefrompdu( ...@@ -326,14 +328,15 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
&initialContextSetupResponseIEs->protocolIEs.list &initialContextSetupResponseIEs->protocolIEs.list
.array[i] .array[i]
->value.choice.PDUSessionResourceSetupListCxtRes)) { ->value.choice.PDUSessionResourceSetupListCxtRes)) {
std::cout Logger::ngap().error(
<< "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error" "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error");
<< std::endl;
return false; return false;
} }
} else { } else {
std::cout << "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error" Logger::ngap().error(
<< std::endl; "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error");
return false; return false;
} }
} break; } break;
...@@ -351,21 +354,24 @@ bool InitialContextSetupResponseMsg::decodefrompdu( ...@@ -351,21 +354,24 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
.array[i] .array[i]
->value.choice ->value.choice
.PDUSessionResourceFailedToSetupListCxtRes)) { .PDUSessionResourceFailedToSetupListCxtRes)) {
std::cout << "Decoded NGAP " Logger::ngap().error(
"PDUSessionResourceFailedToSetupListCxtRes IE error" "Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes IE "
<< std::endl; "error");
return false; return false;
} }
} else { } else {
std::cout << "Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes " Logger::ngap().error(
"IE error!" "Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes IE "
<< std::endl; "error");
return false; return false;
} }
} break; } break;
default: { default: {
std::cout << "Decoded NGAP message PDU error" << std::endl; Logger::ngap().error("Decoded NGAP message PDU error");
return false; return false;
} }
} }
...@@ -382,7 +388,7 @@ unsigned long InitialContextSetupResponseMsg::getAmfUeNgapId() { ...@@ -382,7 +388,7 @@ unsigned long InitialContextSetupResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t InitialContextSetupResponseMsg::getRanUeNgapId() { uint32_t InitialContextSetupResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1; if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "InitialUEMessage.hpp" #include "InitialUEMessage.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -44,14 +45,14 @@ namespace ngap { ...@@ -44,14 +45,14 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
InitialUEMessageMsg::InitialUEMessageMsg() { InitialUEMessageMsg::InitialUEMessageMsg() {
initialUEMessagePdu = NULL; initialUEMessagePdu = nullptr;
initialUEMessageIEs = NULL; initialUEMessageIEs = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
nasPdu = NULL; nasPdu = nullptr;
userLocationInformation = NULL; userLocationInformation = nullptr;
rRCEstablishmentCause = NULL; rRCEstablishmentCause = nullptr;
uEContextRequest = NULL; uEContextRequest = nullptr;
fivegSTmsi = NULL; fivegSTmsi = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -81,9 +82,8 @@ void InitialUEMessageMsg::setMessageType() { ...@@ -81,9 +82,8 @@ void InitialUEMessageMsg::setMessageType() {
initialUEMessageIEs = &(initialUEMessagePdu->choice.initiatingMessage->value initialUEMessageIEs = &(initialUEMessagePdu->choice.initiatingMessage->value
.choice.InitialUEMessage); .choice.InitialUEMessage);
} else { } else {
cout << "[warning] This information doesn't refer to InitialUEMessage " Logger::ngap().warn(
"Message!!!" "This information doesn't refer to InitialUEMessage message!");
<< endl;
} }
} }
...@@ -100,13 +100,14 @@ void InitialUEMessageMsg::setRanUENgapID(uint32_t ran_ue_ngap_id) { ...@@ -100,13 +100,14 @@ void InitialUEMessageMsg::setRanUENgapID(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -124,13 +125,13 @@ void InitialUEMessageMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) { ...@@ -124,13 +125,13 @@ void InitialUEMessageMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU); int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) { if (!ret) {
cout << "encode NAS_PDU IE error" << endl; Logger::ngap().error("Encode NAS PDU IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode NAS_PDU IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NAS PDU IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -169,13 +170,14 @@ void InitialUEMessageMsg::setUserLocationInfoNR( ...@@ -169,13 +170,14 @@ void InitialUEMessageMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation( int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation); &ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
cout << "encode UserLocationInformation IE error" << endl; Logger::ngap().error("Encode UserLocationInformation IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UserLocationInformation IE error" << endl; if (ret != 0) Logger::ngap().error("Encode UserLocationInformation IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -196,13 +198,13 @@ void InitialUEMessageMsg::setRRCEstablishmentCause( ...@@ -196,13 +198,13 @@ void InitialUEMessageMsg::setRRCEstablishmentCause(
int ret = rRCEstablishmentCause->encode2RRCEstablishmentCause( int ret = rRCEstablishmentCause->encode2RRCEstablishmentCause(
ie->value.choice.RRCEstablishmentCause); ie->value.choice.RRCEstablishmentCause);
if (!ret) { if (!ret) {
cout << "encode RRCEstablishmentCause IE error" << endl; Logger::ngap().error("Encode RRCEstablishmentCause IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RRCEstablishmentCause IE error" << endl; if (ret != 0) Logger::ngap().error("Encode RRCEstablishmentCause IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -224,13 +226,13 @@ void InitialUEMessageMsg::setUeContextRequest( ...@@ -224,13 +226,13 @@ void InitialUEMessageMsg::setUeContextRequest(
int ret = uEContextRequest->encode2UEContextRequest( int ret = uEContextRequest->encode2UEContextRequest(
ie->value.choice.UEContextRequest); ie->value.choice.UEContextRequest);
if (!ret) { if (!ret) {
cout << "encode UEContextRequest IE error" << endl; Logger::ngap().error("Encode UEContextRequest IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UEContextRequest IE error" << endl; if (ret != 0) Logger::ngap().error("Encode UEContextRequest IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -239,7 +241,7 @@ int InitialUEMessageMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -239,7 +241,7 @@ int InitialUEMessageMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, initialUEMessagePdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, initialUEMessagePdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialUEMessagePdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, initialUEMessagePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -259,11 +261,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -259,11 +261,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
initialUEMessageIEs = &initialUEMessagePdu->choice.initiatingMessage initialUEMessageIEs = &initialUEMessagePdu->choice.initiatingMessage
->value.choice.InitialUEMessage; ->value.choice.InitialUEMessage;
} else { } else {
cout << "Check InitialUEMessage message error!!!" << endl; Logger::ngap().error("Check InitialUEMessage message error");
return false; return false;
} }
} else { } else {
cout << "MessageType error!!!" << endl; Logger::ngap().error("Check MessageType error");
return false; return false;
} }
for (int i = 0; i < initialUEMessageIEs->protocolIEs.list.count; i++) { for (int i = 0; i < initialUEMessageIEs->protocolIEs.list.count; i++) {
...@@ -277,13 +279,14 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -277,13 +279,14 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialUEMessageIEs->protocolIEs.list.array[i] initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
cout << "[InitialUeMessage] Received RanUeNgapId " Logger::ngap().debug(
<< ranUeNgapId->getRanUeNgapId() << endl; "Received RanUeNgapId %d ", ranUeNgapId->getRanUeNgapId());
} else { } else {
cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -296,11 +299,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -296,11 +299,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!nasPdu->decodefromoctetstring( if (!nasPdu->decodefromoctetstring(
initialUEMessageIEs->protocolIEs.list.array[i] initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.NAS_PDU)) { ->value.choice.NAS_PDU)) {
cout << "Decoded NGAP NAS_PDU IE error" << endl; Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP NAS_PDU IE error" << endl; Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false; return false;
} }
} break; } break;
...@@ -314,11 +317,12 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -314,11 +317,12 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!userLocationInformation->decodefromUserLocationInformation( if (!userLocationInformation->decodefromUserLocationInformation(
&initialUEMessageIEs->protocolIEs.list.array[i] &initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) { ->value.choice.UserLocationInformation)) {
cout << "Decoded NGAP UserLocationInformation IE error" << endl; Logger::ngap().error(
"Decoded NGAP UserLocationInformation IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP UserLocationInformation IE error" << endl; Logger::ngap().error("Decoded NGAP UserLocationInformation IE error");
return false; return false;
} }
} break; } break;
...@@ -331,11 +335,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -331,11 +335,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!rRCEstablishmentCause->decodefromRRCEstablishmentCause( if (!rRCEstablishmentCause->decodefromRRCEstablishmentCause(
initialUEMessageIEs->protocolIEs.list.array[i] initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.RRCEstablishmentCause)) { ->value.choice.RRCEstablishmentCause)) {
cout << "Decoded NGAP RRCEstablishmentCause IE error" << endl; Logger::ngap().error("Decoded NGAP RRCEstablishmentCause IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP RRCEstablishmentCause IE error" << endl; Logger::ngap().error("Decoded NGAP RRCEstablishmentCause IE error");
return false; return false;
} }
} break; } break;
...@@ -348,11 +352,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -348,11 +352,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!uEContextRequest->decodefromUEContextRequest( if (!uEContextRequest->decodefromUEContextRequest(
initialUEMessageIEs->protocolIEs.list.array[i] initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.UEContextRequest)) { ->value.choice.UEContextRequest)) {
cout << "Decoded NGAP UEContextRequest IE error" << endl; Logger::ngap().error("Decoded NGAP UEContextRequest IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP UEContextRequest IE error" << endl; Logger::ngap().error("Decoded NGAP UEContextRequest IE error");
return false; return false;
} }
} break; } break;
...@@ -366,15 +370,16 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -366,15 +370,16 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!fivegSTmsi->decodefrompdu( if (!fivegSTmsi->decodefrompdu(
initialUEMessageIEs->protocolIEs.list.array[i] initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.FiveG_S_TMSI)) { ->value.choice.FiveG_S_TMSI)) {
cout << "decode ngap FiveG_S_TMSI IE error" << endl; Logger::ngap().error("Decoded NGAP FiveG_S_TMSI IE error");
return false; return false;
} }
} }
} break; } break;
default: { default: {
cout << "not decoded IE:" Logger::ngap().warn(
<< initialUEMessageIEs->protocolIEs.list.array[i]->id << endl; "Not decoded IE %d",
initialUEMessageIEs->protocolIEs.list.array[i]->id);
return true; return true;
} }
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "NGReset.hpp" #include "NGReset.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "Ngap_NGAP-PDU.h" #include "Ngap_NGAP-PDU.h"
...@@ -73,9 +74,7 @@ void NGResetMsg::setMessageType() { ...@@ -73,9 +74,7 @@ void NGResetMsg::setMessageType() {
NgResetMessageTypeIE.encode2pdu(ngResetPdu); NgResetMessageTypeIE.encode2pdu(ngResetPdu);
ngResetIEs = &(ngResetPdu->choice.initiatingMessage->value.choice.NGReset); ngResetIEs = &(ngResetPdu->choice.initiatingMessage->value.choice.NGReset);
} else { } else {
cout << "[Warning] This information doesn't refer to NGReset " Logger::ngap().warn("This information doesn't refer to NGReset message!");
"Message!!!"
<< endl;
} }
} }
...@@ -116,7 +115,7 @@ int NGResetMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -116,7 +115,7 @@ int NGResetMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngResetPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngResetPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngResetPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, ngResetPdu, buf, buf_size);
printf("er.encoded(%ld)\n", er.encoded); Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -144,11 +143,11 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -144,11 +143,11 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!cause->decodefromCause( if (!cause->decodefromCause(
&ngResetIEs->protocolIEs.list.array[i] &ngResetIEs->protocolIEs.list.array[i]
->value.choice.Cause)) { ->value.choice.Cause)) {
cout << "Decoded NGAP Cause IE error" << endl; Logger::ngap().error("Decoded NGAP Cause IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP Cause IE error" << endl; Logger::ngap().error("Decoded NGAP Cause IE error");
return false; return false;
} }
} break; } break;
...@@ -160,28 +159,28 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -160,28 +159,28 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
resetType = new ResetType(); resetType = new ResetType();
if (!resetType->decode(&ngResetIEs->protocolIEs.list.array[i] if (!resetType->decode(&ngResetIEs->protocolIEs.list.array[i]
->value.choice.ResetType)) { ->value.choice.ResetType)) {
cout << "Decoded NGAP ResetType IE error" << endl; Logger::ngap().error("Decoded NGAP ResetType IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP ResetType IE error" << endl; Logger::ngap().error("Decoded NGAP ResetType IE error");
return false; return false;
} }
} break; } break;
default: { default: {
cout << "Decoded NGAP message PDU error" << endl; Logger::ngap().error("Decoded NGAP message PDU IE error");
return false; return false;
} }
} }
} }
} else { } else {
cout << "Check NGReset message error!!!"; Logger::ngap().error("Check NGReset message error!");
return false; return false;
} }
} else { } else {
cout << "Check NGReset message error!!!"; Logger::ngap().error("Check NGReset message error!");
return false; return false;
} }
return true; return true;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "NGSetupFailure.hpp" #include "NGSetupFailure.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -43,10 +44,10 @@ namespace ngap { ...@@ -43,10 +44,10 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
NGSetupFailureMsg::NGSetupFailureMsg() { NGSetupFailureMsg::NGSetupFailureMsg() {
ngSetupFailurePdu = NULL; ngSetupFailurePdu = nullptr;
ngSetupFailureIEs = NULL; ngSetupFailureIEs = nullptr;
cause = NULL; cause = nullptr;
timeToWait = NULL; timeToWait = nullptr;
// criticalityDiagnostics = NULL; // criticalityDiagnostics = NULL;
} }
...@@ -74,9 +75,8 @@ void NGSetupFailureMsg::setMessageType() { ...@@ -74,9 +75,8 @@ void NGSetupFailureMsg::setMessageType() {
ngSetupFailureIEs = &(ngSetupFailurePdu->choice.unsuccessfulOutcome->value ngSetupFailureIEs = &(ngSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.NGSetupFailure); .choice.NGSetupFailure);
} else { } else {
cout << "[warning] This information doesn't refer to NGSetupFailure " Logger::ngap().warn(
"Message!!!" "This information doesn't refer to NGSetupFailure message!");
<< endl;
} }
} }
...@@ -91,7 +91,7 @@ void NGSetupFailureMsg::addCauseIE() { ...@@ -91,7 +91,7 @@ void NGSetupFailureMsg::addCauseIE() {
cause->encode2Cause(&ie->value.choice.Cause); cause->encode2Cause(&ie->value.choice.Cause);
int ret = ASN_SEQUENCE_ADD(&ngSetupFailureIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&ngSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode Cause IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP Cause IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -105,7 +105,7 @@ void NGSetupFailureMsg::addTimeToWaitIE() { ...@@ -105,7 +105,7 @@ void NGSetupFailureMsg::addTimeToWaitIE() {
timeToWait->encode2TimeToWait(&ie->value.choice.TimeToWait); timeToWait->encode2TimeToWait(&ie->value.choice.TimeToWait);
int ret = ASN_SEQUENCE_ADD(&ngSetupFailureIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&ngSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode TimeToWait IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP TimeToWait IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -219,7 +219,7 @@ int NGSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -219,7 +219,7 @@ int NGSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupFailurePdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupFailurePdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngSetupFailurePdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, ngSetupFailurePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -238,11 +238,11 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -238,11 +238,11 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ngSetupFailureIEs = &ngSetupFailurePdu->choice.initiatingMessage->value ngSetupFailureIEs = &ngSetupFailurePdu->choice.initiatingMessage->value
.choice.NGSetupFailure; .choice.NGSetupFailure;
} else { } else {
cout << "Check NGSetupFailure message error!!!" << endl; Logger::ngap().error("Check NGSetupFailure message error!");
return false; return false;
} }
} else { } else {
cout << "MessageType error!!!" << endl; Logger::ngap().error("MessageType error!");
return false; return false;
} }
for (int i = 0; i < ngSetupFailureIEs->protocolIEs.list.count; i++) { for (int i = 0; i < ngSetupFailureIEs->protocolIEs.list.count; i++) {
...@@ -256,11 +256,11 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -256,11 +256,11 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!cause->decodefromCause( if (!cause->decodefromCause(
&ngSetupFailureIEs->protocolIEs.list.array[i] &ngSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.Cause)) { ->value.choice.Cause)) {
cout << "decoded ngap Cause IE error" << endl; Logger::ngap().error("Decoded NGAP Cause IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap Cause IE error" << endl; Logger::ngap().error("Decoded NGAP Cause IE error");
return false; return false;
} }
} break; } break;
...@@ -273,19 +273,19 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -273,19 +273,19 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!timeToWait->decodefromTimeToWait( if (!timeToWait->decodefromTimeToWait(
&ngSetupFailureIEs->protocolIEs.list.array[i] &ngSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.TimeToWait)) { ->value.choice.TimeToWait)) {
cout << "decoded ngap TimeToWait IE error" << endl; Logger::ngap().error("Decoded NGAP TimeToWait IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap TimeToWait IE error" << endl; Logger::ngap().error("Decoded NGAP TimeToWait IE error");
return false; return false;
} }
} break; } break;
case Ngap_ProtocolIE_ID_id_CriticalityDiagnostics: { case Ngap_ProtocolIE_ID_id_CriticalityDiagnostics: {
cout << "decoded ngap: This is CriticalityDiagnostics IE" << endl; Logger::ngap().debug("Decoded NGAP CriticalityDiagnostics IE ");
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded NGAP message PDU error");
return false; return false;
} }
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "NGSetupRequest.hpp" #include "NGSetupRequest.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "Ngap_NGAP-PDU.h" #include "Ngap_NGAP-PDU.h"
...@@ -47,13 +48,13 @@ namespace ngap { ...@@ -47,13 +48,13 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
NGSetupRequestMsg::NGSetupRequestMsg() { NGSetupRequestMsg::NGSetupRequestMsg() {
ngSetupRequestPdu = NULL; ngSetupRequestPdu = nullptr;
ngSetupRequestIEs = NULL; ngSetupRequestIEs = nullptr;
globalRanNodeId = NULL; globalRanNodeId = nullptr;
ranNodeName = NULL; ranNodeName = nullptr;
supportedTAList = NULL; supportedTAList = nullptr;
defaultPagingDrx = NULL; defaultPagingDrx = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -79,9 +80,8 @@ void NGSetupRequestMsg::setMessageType() { ...@@ -79,9 +80,8 @@ void NGSetupRequestMsg::setMessageType() {
ngSetupRequestIEs = &(ngSetupRequestPdu->choice.initiatingMessage->value ngSetupRequestIEs = &(ngSetupRequestPdu->choice.initiatingMessage->value
.choice.NGSetupRequest); .choice.NGSetupRequest);
} else { } else {
cout << "[warning] This information doesn't refer to NGSetupRequest " Logger::ngap().warn(
"Message!!!" "This information doesn't refer to NGSetupRequest message!");
<< endl;
} }
} }
...@@ -108,12 +108,12 @@ void NGSetupRequestMsg::setGlobalRanNodeID( ...@@ -108,12 +108,12 @@ void NGSetupRequestMsg::setGlobalRanNodeID(
int ret = globalRanNodeIdIE.encode2GlobalRANNodeID( int ret = globalRanNodeIdIE.encode2GlobalRANNodeID(
&ie->value.choice.GlobalRANNodeID); &ie->value.choice.GlobalRANNodeID);
if (!ret) { if (!ret) {
cout << "encode GlobalRANNodeID IE error" << endl; Logger::ngap().error("Encode NGAP GlobalRANNodeID IE error");
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode GlobalRANNodeID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP GlobalRANNodeID IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -129,19 +129,19 @@ void NGSetupRequestMsg::setRanNodeName(const std::string ranNodeName) { ...@@ -129,19 +129,19 @@ void NGSetupRequestMsg::setRanNodeName(const std::string ranNodeName) {
int ret = ranNodeNameIE.encode2RanNodeName(&ie->value.choice.RANNodeName); int ret = ranNodeNameIE.encode2RanNodeName(&ie->value.choice.RANNodeName);
if (!ret) { if (!ret) {
cout << "encode RanNodeName IE error" << endl; Logger::ngap().error("Encode NGAP RANNodeName IE error");
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RANNodeName IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP RANNodeName IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void NGSetupRequestMsg::setSupportedTAList( void NGSetupRequestMsg::setSupportedTAList(
const std::vector<struct SupportedItem_s> list) { const std::vector<struct SupportedItem_s> list) {
if (list.size() == 0) { if (list.size() == 0) {
cout << "[Warning] Setup failed, vector is empty!!!" << endl; Logger::ngap().warn("Setup failed, vector is empty");
return; return;
} }
...@@ -181,12 +181,12 @@ void NGSetupRequestMsg::setSupportedTAList( ...@@ -181,12 +181,12 @@ void NGSetupRequestMsg::setSupportedTAList(
int ret = supportedTAListIE.encode2SupportedTAList( int ret = supportedTAListIE.encode2SupportedTAList(
&ie->value.choice.SupportedTAList); &ie->value.choice.SupportedTAList);
if (!ret) { if (!ret) {
cout << "encode SupportedTAList IE error" << endl; Logger::ngap().error("Encode SupportedTAList IE error");
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode SupportedTAList IE error" << endl; if (ret != 0) Logger::ngap().error("Encode SupportedTAList IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -203,13 +203,13 @@ void NGSetupRequestMsg::setDefaultPagingDRX(e_Ngap_PagingDRX value) { ...@@ -203,13 +203,13 @@ void NGSetupRequestMsg::setDefaultPagingDRX(e_Ngap_PagingDRX value) {
int ret = int ret =
defaultPagingDRXIE.encode2DefaultPagingDRX(ie->value.choice.PagingDRX); defaultPagingDRXIE.encode2DefaultPagingDRX(ie->value.choice.PagingDRX);
if (!ret) { if (!ret) {
cout << "encode DefaultPagingDRX IE error" << endl; Logger::ngap().error("Encode DefaultPagingDRX IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode DefaultPagingDRX IE error" << endl; if (ret != 0) Logger::ngap().error("Encode DefaultPagingDRX IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -218,7 +218,7 @@ int NGSetupRequestMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -218,7 +218,7 @@ int NGSetupRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupRequestPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupRequestPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngSetupRequestPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, ngSetupRequestPdu, buf, buf_size);
printf("er.encoded(%ld)\n", er.encoded); Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -247,11 +247,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -247,11 +247,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!globalRanNodeId->decodefromGlobalRANNodeID( if (!globalRanNodeId->decodefromGlobalRANNodeID(
&ngSetupRequestIEs->protocolIEs.list.array[i] &ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.GlobalRANNodeID)) { ->value.choice.GlobalRANNodeID)) {
cout << "Decoded NGAP GlobalRanNodeId IE error!" << endl; Logger::ngap().error("Decoded NGAP GlobalRanNodeId IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP GlobalRanNodeId IE error" << endl; Logger::ngap().error("Decoded NGAP GlobalRanNodeId IE error");
return false; return false;
} }
} break; } break;
...@@ -264,11 +264,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -264,11 +264,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranNodeName->decodefromRanNodeName( if (!ranNodeName->decodefromRanNodeName(
&ngSetupRequestIEs->protocolIEs.list.array[i] &ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.RANNodeName)) { ->value.choice.RANNodeName)) {
cout << "Decoded NGAP RanNodeName IE error" << endl; Logger::ngap().error("Decoded NGAP RanNodeName IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP RanNodeName IE error" << endl; Logger::ngap().error("Decoded NGAP RanNodeName IE error");
return false; return false;
} }
} break; } break;
...@@ -281,11 +281,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -281,11 +281,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!supportedTAList->decodefromSupportedTAList( if (!supportedTAList->decodefromSupportedTAList(
&ngSetupRequestIEs->protocolIEs.list.array[i] &ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.SupportedTAList)) { ->value.choice.SupportedTAList)) {
cout << "Decoded NGAP SupportedTAList IE error" << endl; Logger::ngap().error("Decoded NGAP SupportedTAList IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP SupportedTAList IE error" << endl; Logger::ngap().error("Decoded NGAP SupportedTAList IE error");
return false; return false;
} }
} break; } break;
...@@ -298,26 +298,26 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -298,26 +298,26 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!defaultPagingDrx->decodefromDefaultPagingDRX( if (!defaultPagingDrx->decodefromDefaultPagingDRX(
ngSetupRequestIEs->protocolIEs.list.array[i] ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.PagingDRX)) { ->value.choice.PagingDRX)) {
cout << "Decoded NGAP DefaultPagingDRX IE error" << endl; Logger::ngap().error("Decoded NGAP DefaultPagingDRX IE error");
return false; return false;
} }
} else { } else {
cout << "Decoded NGAP DefaultPagingDRX IE error" << endl; Logger::ngap().error("Decoded NGAP DefaultPagingDRX IE error");
return false; return false;
} }
} break; } break;
default: { default: {
cout << "Decoded NGAP message PDU error" << endl; Logger::ngap().error("Decoded NGAP message PDU error");
return false; return false;
} }
} }
} }
} else { } else {
cout << "Check NGSetupRequest message error!!!"; Logger::ngap().error("Check NGSetupRequest message error");
return false; return false;
} }
} else { } else {
cout << "Check NGSetupRequest message error!!!"; Logger::ngap().error("Check NGSetupRequest message error");
return false; return false;
} }
return true; return true;
......
...@@ -70,7 +70,6 @@ class NGSetupRequestMsg { ...@@ -70,7 +70,6 @@ class NGSetupRequestMsg {
Ngap_NGAP_PDU_t* ngSetupRequestPdu; Ngap_NGAP_PDU_t* ngSetupRequestPdu;
Ngap_NGSetupRequest_t* ngSetupRequestIEs; Ngap_NGSetupRequest_t* ngSetupRequestIEs;
/***************** for decoding ****************/
GlobalRanNodeId* globalRanNodeId; GlobalRanNodeId* globalRanNodeId;
RanNodeName* ranNodeName; RanNodeName* ranNodeName;
SupportedTAList* supportedTAList; SupportedTAList* supportedTAList;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "NGSetupResponse.hpp" #include "NGSetupResponse.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -43,13 +44,13 @@ namespace ngap { ...@@ -43,13 +44,13 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
NGSetupResponseMsg::NGSetupResponseMsg() { NGSetupResponseMsg::NGSetupResponseMsg() {
ngSetupResponsePdu = NULL; ngSetupResponsePdu = nullptr;
ngSetupResponsIEs = NULL; ngSetupResponsIEs = nullptr;
amfName = NULL; amfName = nullptr;
servedGUAMIList = NULL; servedGUAMIList = nullptr;
relativeAmfCapacity = NULL; relativeAmfCapacity = nullptr;
plmnSupportList = NULL; plmnSupportList = nullptr;
// criticalityDiagnostics = NULL; // criticalityDiagnostics = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -75,9 +76,8 @@ void NGSetupResponseMsg::setMessageType() { ...@@ -75,9 +76,8 @@ void NGSetupResponseMsg::setMessageType() {
ngSetupResponsIEs = &(ngSetupResponsePdu->choice.successfulOutcome->value ngSetupResponsIEs = &(ngSetupResponsePdu->choice.successfulOutcome->value
.choice.NGSetupResponse); .choice.NGSetupResponse);
} else { } else {
cout << "[warning] This information doesn't refer to NGSetupRespons " Logger::ngap().warn(
"Message!!!" "This information doesn't refer to NGSetupRespons message!");
<< endl;
} }
} }
...@@ -94,12 +94,12 @@ void NGSetupResponseMsg::setAMFName(const std::string name) { ...@@ -94,12 +94,12 @@ void NGSetupResponseMsg::setAMFName(const std::string name) {
int ret = amfName->encode2AmfName(&ie->value.choice.AMFName); int ret = amfName->encode2AmfName(&ie->value.choice.AMFName);
if (!ret) { if (!ret) {
cout << "encode AmfName IE error" << endl; Logger::ngap().error("Encode NGAP AMFName IE error");
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AmfName IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP AMFName IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -139,7 +139,7 @@ void NGSetupResponseMsg::setGUAMIList(std::vector<struct GuamiItem_s> list) { ...@@ -139,7 +139,7 @@ void NGSetupResponseMsg::setGUAMIList(std::vector<struct GuamiItem_s> list) {
servedGUAMIList->encode2ServedGUAMIList(&ie->value.choice.ServedGUAMIList); servedGUAMIList->encode2ServedGUAMIList(&ie->value.choice.ServedGUAMIList);
int ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode ServedGUAMIList IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP ServedGUAMIList IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -157,7 +157,8 @@ void NGSetupResponseMsg::setRelativeAmfCapacity(long capacity) { ...@@ -157,7 +157,8 @@ void NGSetupResponseMsg::setRelativeAmfCapacity(long capacity) {
&ie->value.choice.RelativeAMFCapacity); &ie->value.choice.RelativeAMFCapacity);
int ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RelativeAMFCapacity IE error" << endl; if (ret != 0)
Logger::ngap().error("Encode NGAP RelativeAMFCapacity IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -192,7 +193,7 @@ void NGSetupResponseMsg::setPlmnSupportList( ...@@ -192,7 +193,7 @@ void NGSetupResponseMsg::setPlmnSupportList(
plmnSupportList->encode2PLMNSupportList(&ie->value.choice.PLMNSupportList); plmnSupportList->encode2PLMNSupportList(&ie->value.choice.PLMNSupportList);
int ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode PLMNSupportList IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP PLMNSupportList IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -200,7 +201,7 @@ int NGSetupResponseMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -200,7 +201,7 @@ int NGSetupResponseMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupResponsePdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupResponsePdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngSetupResponsePdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, ngSetupResponsePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -220,13 +221,13 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -220,13 +221,13 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ngSetupResponsIEs = &ngSetupResponsePdu->choice.successfulOutcome->value ngSetupResponsIEs = &ngSetupResponsePdu->choice.successfulOutcome->value
.choice.NGSetupResponse; .choice.NGSetupResponse;
} else { } else {
cout << "Check NGSetupResponse message error!!!" << endl; Logger::ngap().error("Check NGSetupResponse message error");
return false; return false;
} }
} else { } else {
cout << "MessageType error!!!" << endl; Logger::ngap().error(
cout << "ngSetupResponsePdu->present == " << ngSetupResponsePdu->present "MessageType error, ngSetupResponsePdu->present %d",
<< endl; ngSetupResponsePdu->present);
return false; return false;
} }
for (int i = 0; i < ngSetupResponsIEs->protocolIEs.list.count; i++) { for (int i = 0; i < ngSetupResponsIEs->protocolIEs.list.count; i++) {
...@@ -240,11 +241,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -240,11 +241,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfName->decodefromAmfName( if (!amfName->decodefromAmfName(
&ngSetupResponsIEs->protocolIEs.list.array[i] &ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.AMFName)) { ->value.choice.AMFName)) {
cout << "decoded ngap AmfName IE error" << endl; Logger::ngap().error("Decoded NGAP AMFName error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap AmfName IE error" << endl; Logger::ngap().error("Decoded NGAP AMFName error");
return false; return false;
} }
} break; } break;
...@@ -257,11 +258,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -257,11 +258,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!servedGUAMIList->decodefromServedGUAMIList( if (!servedGUAMIList->decodefromServedGUAMIList(
&ngSetupResponsIEs->protocolIEs.list.array[i] &ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.ServedGUAMIList)) { ->value.choice.ServedGUAMIList)) {
cout << "decoded ngap ServedGUAMIList IE error!" << endl; Logger::ngap().error("Decoded NGAP ServedGUAMIList error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap ServedGUAMIList IE error" << endl; Logger::ngap().error("Decoded NGAP ServedGUAMIList error");
return false; return false;
} }
} break; } break;
...@@ -274,11 +275,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -274,11 +275,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!relativeAmfCapacity->decodefromRelativeAMFCapacity( if (!relativeAmfCapacity->decodefromRelativeAMFCapacity(
&ngSetupResponsIEs->protocolIEs.list.array[i] &ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.RelativeAMFCapacity)) { ->value.choice.RelativeAMFCapacity)) {
cout << "decoded ngap RelativeAMFCapacity IE error" << endl; Logger::ngap().error("Decoded NGAP RelativeAMFCapacity error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap RelativeAMFCapacity IE error" << endl; Logger::ngap().error("Decoded NGAP RelativeAMFCapacity error");
return false; return false;
} }
} break; } break;
...@@ -291,19 +292,20 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -291,19 +292,20 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!plmnSupportList->decodefromPLMNSupportList( if (!plmnSupportList->decodefromPLMNSupportList(
&ngSetupResponsIEs->protocolIEs.list.array[i] &ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.PLMNSupportList)) { ->value.choice.PLMNSupportList)) {
cout << "decoded ngap PLMNSupportList IE error" << endl; Logger::ngap().error("Decoded NGAP PLMNSupportList error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap PLMNSupportList IE error!" << endl; Logger::ngap().error("Decoded NGAP PLMNSupportList error");
return false; return false;
} }
} break; } break;
case Ngap_ProtocolIE_ID_id_CriticalityDiagnostics: { case Ngap_ProtocolIE_ID_id_CriticalityDiagnostics: {
cout << "decoded ngap: This is CriticalityDiagnostics IE" << endl; cout << "decoded ngap: This is CriticalityDiagnostics IE" << endl;
Logger::ngap().debug("Decoded NGAP CriticalityDiagnostics");
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded NGAP Message PDU error");
return false; return false;
} }
} }
......
...@@ -69,8 +69,6 @@ class NGSetupResponseMsg { ...@@ -69,8 +69,6 @@ class NGSetupResponseMsg {
Ngap_NGAP_PDU_t* ngSetupResponsePdu; Ngap_NGAP_PDU_t* ngSetupResponsePdu;
Ngap_NGSetupResponse_t* ngSetupResponsIEs; Ngap_NGSetupResponse_t* ngSetupResponsIEs;
/***************** for decoding ****************/
AmfName* amfName; AmfName* amfName;
ServedGUAMIList* servedGUAMIList; ServedGUAMIList* servedGUAMIList;
RelativeAMFCapacity* relativeAmfCapacity; RelativeAMFCapacity* relativeAmfCapacity;
......
...@@ -46,13 +46,13 @@ namespace ngap { ...@@ -46,13 +46,13 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PduSessionResourceReleaseCommandMsg::PduSessionResourceReleaseCommandMsg() { PduSessionResourceReleaseCommandMsg::PduSessionResourceReleaseCommandMsg() {
pduSessionResourceReleaseCommandPdu = NULL; pduSessionResourceReleaseCommandPdu = nullptr;
pduSessionResourceReleaseCommandIEs = NULL; pduSessionResourceReleaseCommandIEs = nullptr;
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
ranPagingPriority = NULL; ranPagingPriority = nullptr;
nasPdu = NULL; nasPdu = nullptr;
pduSessionResourceToReleaseList = NULL; pduSessionResourceToReleaseList = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -431,7 +431,7 @@ unsigned long PduSessionResourceReleaseCommandMsg::getAmfUeNgapId() { ...@@ -431,7 +431,7 @@ unsigned long PduSessionResourceReleaseCommandMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t PduSessionResourceReleaseCommandMsg::getRanUeNgapId() { uint32_t PduSessionResourceReleaseCommandMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1; if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
} }
......
...@@ -45,12 +45,12 @@ namespace ngap { ...@@ -45,12 +45,12 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PduSessionResourceReleaseResponseMsg::PduSessionResourceReleaseResponseMsg() { PduSessionResourceReleaseResponseMsg::PduSessionResourceReleaseResponseMsg() {
pduSessionResourceReleaseResponsePdu = NULL; pduSessionResourceReleaseResponsePdu = nullptr;
pduSessionResourceReleaseResponseIEs = NULL; pduSessionResourceReleaseResponseIEs = nullptr;
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
pduSessionResourceReleasedList = NULL; pduSessionResourceReleasedList = nullptr;
userLocationInformation = NULL; userLocationInformation = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -380,7 +380,7 @@ unsigned long PduSessionResourceReleaseResponseMsg::getAmfUeNgapId() { ...@@ -380,7 +380,7 @@ unsigned long PduSessionResourceReleaseResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t PduSessionResourceReleaseResponseMsg::getRanUeNgapId() { uint32_t PduSessionResourceReleaseResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1; if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
} }
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "PduSessionResourceSetupResponse.hpp" #include "PduSessionResourceSetupResponse.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
#include "constr_TYPE.h" #include "constr_TYPE.h"
...@@ -44,12 +46,12 @@ namespace ngap { ...@@ -44,12 +46,12 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PduSessionResourceSetupResponseMsg::PduSessionResourceSetupResponseMsg() { PduSessionResourceSetupResponseMsg::PduSessionResourceSetupResponseMsg() {
pduSessionResourceSetupResponsePdu = NULL; pduSessionResourceSetupResponsePdu = nullptr;
pduSessionResourceSetupResponseIEs = NULL; pduSessionResourceSetupResponseIEs = nullptr;
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
pduSessionResourceSetupResponseList = NULL; pduSessionResourceSetupResponseList = nullptr;
pduSessionResourceFailedToSetupResponseList = NULL; pduSessionResourceFailedToSetupResponseList = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -83,9 +85,9 @@ void PduSessionResourceSetupResponseMsg::setMessageType() { ...@@ -83,9 +85,9 @@ void PduSessionResourceSetupResponseMsg::setMessageType() {
&(pduSessionResourceSetupResponsePdu->choice.successfulOutcome->value &(pduSessionResourceSetupResponsePdu->choice.successfulOutcome->value
.choice.PDUSessionResourceSetupResponse); .choice.PDUSessionResourceSetupResponse);
} else { } else {
cout << "[warning] This information doesn't refer to " Logger::ngap().warn(
"PDUSessionResourceSetupResponse Message!!!" "This information doesn't refer to PDUSessionResourceSetupResponse "
<< endl; "message!");
} }
} }
...@@ -104,14 +106,14 @@ void PduSessionResourceSetupResponseMsg::setAmfUeNgapId(unsigned long id) { ...@@ -104,14 +106,14 @@ void PduSessionResourceSetupResponseMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD( ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie); &pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -131,14 +133,14 @@ void PduSessionResourceSetupResponseMsg::setRanUeNgapId( ...@@ -131,14 +133,14 @@ void PduSessionResourceSetupResponseMsg::setRanUeNgapId(
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD( ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie); &pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -175,14 +177,17 @@ void PduSessionResourceSetupResponseMsg::setPduSessionResourceSetupResponseList( ...@@ -175,14 +177,17 @@ void PduSessionResourceSetupResponseMsg::setPduSessionResourceSetupResponseList(
->encode2PDUSessionResourceSetupListSURes( ->encode2PDUSessionResourceSetupListSURes(
&ie->value.choice.PDUSessionResourceSetupListSURes); &ie->value.choice.PDUSessionResourceSetupListSURes);
if (!ret) { if (!ret) {
cout << "encode PDUSessionResourceSetupListSURes IE error" << endl; Logger::ngap().error(
"Encode NGAP PDUSessionResourceSetupListSURes IE error");
return; return;
} }
ret = ASN_SEQUENCE_ADD( ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie); &pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode PDUSessionResourceSetupListSURes IE error" << endl; Logger::ngap().error(
"Encode NGAP PDUSessionResourceSetupListSURes IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -222,14 +227,16 @@ void PduSessionResourceSetupResponseMsg::setPduSessionResourceFailedToSetupList( ...@@ -222,14 +227,16 @@ void PduSessionResourceSetupResponseMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListSURes( ->encode2PDUSessionResourceFailedToSetupListSURes(
&ie->value.choice.PDUSessionResourceFailedToSetupListSURes); &ie->value.choice.PDUSessionResourceFailedToSetupListSURes);
if (!ret) { if (!ret) {
cout << "encode PDUSessionResourceFailedToSetupListSURes IE error" << endl; Logger::ngap().error(
"Encode NGAP PDUSessionResourceFailedToSetupListSURes IE error");
return; return;
} }
ret = ASN_SEQUENCE_ADD( ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie); &pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode PDUSessionResourceFailedToSetupListSURes IE error" << endl; Logger::ngap().error(
"Encode NGAP PDUSessionResourceFailedToSetupListSURes IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -240,7 +247,7 @@ int PduSessionResourceSetupResponseMsg::encode2buffer( ...@@ -240,7 +247,7 @@ int PduSessionResourceSetupResponseMsg::encode2buffer(
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, pduSessionResourceSetupResponsePdu, buf, &asn_DEF_Ngap_NGAP_PDU, NULL, pduSessionResourceSetupResponsePdu, buf,
buf_size); buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -267,11 +274,12 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu( ...@@ -267,11 +274,12 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
&pduSessionResourceSetupResponsePdu->choice.successfulOutcome->value &pduSessionResourceSetupResponsePdu->choice.successfulOutcome->value
.choice.PDUSessionResourceSetupResponse; .choice.PDUSessionResourceSetupResponse;
} else { } else {
cout << "Check PDUSessionResourceSetupResponse message error!!!" << endl; Logger::ngap().error(
"Check PDUSessionResourceSetupResponse message error!");
return false; return false;
} }
} else { } else {
cout << "MessageType error!!!" << endl; Logger::ngap().error("MessageType error!");
return false; return false;
} }
for (int i = 0; for (int i = 0;
...@@ -288,11 +296,11 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu( ...@@ -288,11 +296,11 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
pduSessionResourceSetupResponseIEs->protocolIEs.list.array[i] pduSessionResourceSetupResponseIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error!");
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error!");
return false; return false;
} }
} break; } break;
...@@ -307,11 +315,11 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu( ...@@ -307,11 +315,11 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
pduSessionResourceSetupResponseIEs->protocolIEs.list.array[i] pduSessionResourceSetupResponseIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error!");
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error!");
return false; return false;
} }
} break; } break;
...@@ -328,13 +336,13 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu( ...@@ -328,13 +336,13 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
&pduSessionResourceSetupResponseIEs->protocolIEs.list &pduSessionResourceSetupResponseIEs->protocolIEs.list
.array[i] .array[i]
->value.choice.PDUSessionResourceSetupListSURes)) { ->value.choice.PDUSessionResourceSetupListSURes)) {
cout << "decoded ngap PDUSessionResourceSetupListSURes IE error" Logger::ngap().error(
<< endl; "Decoded NGAP PDUSessionResourceSetupListSURes IE error!");
return false; return false;
} }
} else { } else {
cout << "decoded ngap PDUSessionResourceSetupListSURes IE error" Logger::ngap().error(
<< endl; "Decoded NGAP PDUSessionResourceSetupListSURes IE error!");
return false; return false;
} }
} break; } break;
...@@ -352,21 +360,21 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu( ...@@ -352,21 +360,21 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
.array[i] .array[i]
->value.choice ->value.choice
.PDUSessionResourceFailedToSetupListSURes)) { .PDUSessionResourceFailedToSetupListSURes)) {
cout << "decoded ngap PDUSessionResourceFailedToSetupListSURes IE " Logger::ngap().error(
"error" "Decoded NGAP PDUSessionResourceFailedToSetupListSURes IE "
<< endl; "error!");
return false; return false;
} }
} else { } else {
cout << "decoded ngap PDUSessionResourceFailedToSetupListSURes IE " Logger::ngap().error(
"error!" "Decoded NGAP PDUSessionResourceFailedToSetupListSURes IE "
<< endl; "error!");
return false; return false;
} }
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded NGAP message PDU error!");
return false; return false;
} }
} }
...@@ -383,7 +391,7 @@ unsigned long PduSessionResourceSetupResponseMsg::getAmfUeNgapId() { ...@@ -383,7 +391,7 @@ unsigned long PduSessionResourceSetupResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t PduSessionResourceSetupResponseMsg::getRanUeNgapId() { uint32_t PduSessionResourceSetupResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1; if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
} }
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "UEContextReleaseCommand.hpp" #include "UEContextReleaseCommand.hpp"
#include "logger.hpp"
#include <iostream> #include <iostream>
extern "C" { extern "C" {
#include "Ngap_UE-NGAP-ID-pair.h" #include "Ngap_UE-NGAP-ID-pair.h"
...@@ -85,12 +87,13 @@ void UEContextReleaseCommandMsg::setAmfUeNgapId(unsigned long id) { ...@@ -85,12 +87,13 @@ void UEContextReleaseCommandMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID( int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(
ie->value.choice.UE_NGAP_IDs.choice.aMF_UE_NGAP_ID); ie->value.choice.UE_NGAP_IDs.choice.aMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode UE_NGAP_IDs IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -113,19 +116,19 @@ void UEContextReleaseCommandMsg::setUeNgapIdPair( ...@@ -113,19 +116,19 @@ void UEContextReleaseCommandMsg::setUeNgapIdPair(
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID( int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(
ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->aMF_UE_NGAP_ID); ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->aMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ranUeNgapId->encode2RAN_UE_NGAP_ID( ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(
ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->rAN_UE_NGAP_ID); ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->rAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode UE_NGAP_IDs IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -155,7 +158,7 @@ void UEContextReleaseCommandMsg::addCauseIE() { ...@@ -155,7 +158,7 @@ void UEContextReleaseCommandMsg::addCauseIE() {
ie->value.present = Ngap_UEContextReleaseCommand_IEs__value_PR_Cause; ie->value.present = Ngap_UEContextReleaseCommand_IEs__value_PR_Cause;
causeValue->encode2Cause(&ie->value.choice.Cause); causeValue->encode2Cause(&ie->value.choice.Cause);
int ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode Cause IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP Cause IE error");
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -163,7 +166,7 @@ int UEContextReleaseCommandMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -163,7 +166,7 @@ int UEContextReleaseCommandMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu);
asn_enc_rval_t er = asn_enc_rval_t er =
aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, pdu, buf, buf_size); aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, pdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded; return er.encoded;
} }
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "UEContextReleaseComplete.hpp" #include "UEContextReleaseComplete.hpp"
#include "logger.hpp"
#include <iostream> #include <iostream>
#include <memory> #include <memory>
...@@ -82,12 +84,12 @@ void UEContextReleaseCompleteMsg::setAmfUeNgapId(unsigned long id) { ...@@ -82,12 +84,12 @@ void UEContextReleaseCompleteMsg::setAmfUeNgapId(unsigned long id) {
Ngap_UEContextReleaseComplete_IEs__value_PR_AMF_UE_NGAP_ID; Ngap_UEContextReleaseComplete_IEs__value_PR_AMF_UE_NGAP_ID;
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -110,12 +112,12 @@ void UEContextReleaseCompleteMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -110,12 +112,12 @@ void UEContextReleaseCompleteMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
Ngap_UEContextReleaseComplete_IEs__value_PR_RAN_UE_NGAP_ID; Ngap_UEContextReleaseComplete_IEs__value_PR_RAN_UE_NGAP_ID;
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -161,12 +163,13 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR( ...@@ -161,12 +163,13 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation( int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation); &ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
cout << "encode UserLocationInformation IE error" << endl; Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode UserLocationInformation IE error" << endl; if (ret != 0)
Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -209,7 +212,7 @@ int UEContextReleaseCompleteMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -209,7 +212,7 @@ int UEContextReleaseCompleteMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu);
asn_enc_rval_t er = asn_enc_rval_t er =
aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, pdu, buf, buf_size); aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, pdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -226,12 +229,13 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -226,12 +229,13 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ies = ies =
&pdu->choice.successfulOutcome->value.choice.UEContextReleaseComplete; &pdu->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
} else { } else {
cout << "Check UEContextReleaseComplete message error" << endl; Logger::ngap().error("Check UEContextReleaseComplete message error");
return false; return false;
} }
} else { } else {
cout << "typeOfMessage of UEContextReleaseComplete is not SuccessfulOutcome" Logger::ngap().error(
<< endl; "TypeOfMessage of UEContextReleaseComplete is not SuccessfulOutcome");
return false; return false;
} }
// TODO // TODO
...@@ -247,11 +251,11 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -247,11 +251,11 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
ies->protocolIEs.list.array[i] ies->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decode AMF_UE_NGAP_ID error" << endl; Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "IE AMF_UE_NGAP_ID is not correct" << endl; Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -264,11 +268,11 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -264,11 +268,11 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
ies->protocolIEs.list.array[i] ies->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decode RAN_UE_NGAP_ID error" << endl; Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "IE RAN_UE_NGAP_ID is not correct" << endl; Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "UEContextReleaseRequest.hpp" #include "UEContextReleaseRequest.hpp"
#include "logger.hpp"
#include <iostream> #include <iostream>
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -79,12 +81,12 @@ void UEContextReleaseRequestMsg::setAmfUeNgapId(unsigned long id) { ...@@ -79,12 +81,12 @@ void UEContextReleaseRequestMsg::setAmfUeNgapId(unsigned long id) {
ie->value.present = Ngap_UEContextReleaseRequest_IEs__value_PR_AMF_UE_NGAP_ID; ie->value.present = Ngap_UEContextReleaseRequest_IEs__value_PR_AMF_UE_NGAP_ID;
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -100,12 +102,12 @@ void UEContextReleaseRequestMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -100,12 +102,12 @@ void UEContextReleaseRequestMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
ie->value.present = Ngap_UEContextReleaseRequest_IEs__value_PR_RAN_UE_NGAP_ID; ie->value.present = Ngap_UEContextReleaseRequest_IEs__value_PR_RAN_UE_NGAP_ID;
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -137,7 +139,7 @@ int UEContextReleaseRequestMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -137,7 +139,7 @@ int UEContextReleaseRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu);
asn_enc_rval_t er = asn_enc_rval_t er =
aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, pdu, buf, buf_size); aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, pdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -154,12 +156,13 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -154,12 +156,13 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ies = ies =
&pdu->choice.initiatingMessage->value.choice.UEContextReleaseRequest; &pdu->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
} else { } else {
cout << "Check UEContextReleaseRequest message error" << endl; Logger::ngap().error("Check UEContextReleaseRequest message error");
return false; return false;
} }
} else { } else {
cout << "typeOfMessage of UEContextReleaseRequest is not initiatingMessage" Logger::ngap().error(
<< endl; "TypeOfMessage of UEContextReleaseRequest is not initiatingMessage");
return false; return false;
} }
for (int i = 0; i < ies->protocolIEs.list.count; i++) { for (int i = 0; i < ies->protocolIEs.list.count; i++) {
...@@ -173,11 +176,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -173,11 +176,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
ies->protocolIEs.list.array[i] ies->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decode AMF_UE_NGAP_ID error" << endl; Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "IE AMF_UE_NGAP_ID is not correct" << endl; Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -190,11 +193,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -190,11 +193,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
ies->protocolIEs.list.array[i] ies->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decode RAN_UE_NGAP_ID error" << endl; Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "IE RAN_UE_NGAP_ID is not correct" << endl; Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -206,11 +209,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -206,11 +209,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
causeValue = new Cause(); causeValue = new Cause();
if (!causeValue->decodefromCause( if (!causeValue->decodefromCause(
&ies->protocolIEs.list.array[i]->value.choice.Cause)) { &ies->protocolIEs.list.array[i]->value.choice.Cause)) {
cout << "decode Cause error" << endl; Logger::ngap().error("Decode NGAP Cause IE error");
return false; return false;
} }
} else { } else {
cout << "IE Cause is not correct" << endl; Logger::ngap().error("Decode NGAP Cause IE error");
return false; return false;
} }
} break; } break;
...@@ -223,7 +226,7 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -223,7 +226,7 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
bool UEContextReleaseRequestMsg::getCauseRadioNetwork( bool UEContextReleaseRequestMsg::getCauseRadioNetwork(
e_Ngap_CauseRadioNetwork& causeRadioNetwork) { e_Ngap_CauseRadioNetwork& causeRadioNetwork) {
if (causeValue->getValue() < 0) { if (causeValue->getValue() < 0) {
cout << "Get Cause value from UEContextReleaseRequest Error!!!" << endl; Logger::ngap().error("Get Cause value from UEContextReleaseRequest Error");
return false; return false;
} }
causeRadioNetwork = (e_Ngap_CauseRadioNetwork) causeValue->getValue(); causeRadioNetwork = (e_Ngap_CauseRadioNetwork) causeValue->getValue();
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "UERadioCapabilityInfoIndication.hpp" #include "UERadioCapabilityInfoIndication.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -44,12 +45,12 @@ namespace ngap { ...@@ -44,12 +45,12 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
UeRadioCapabilityInfoIndicationMsg::UeRadioCapabilityInfoIndicationMsg() { UeRadioCapabilityInfoIndicationMsg::UeRadioCapabilityInfoIndicationMsg() {
ueRadioCapabilityInfoIndicationPdu = NULL; ueRadioCapabilityInfoIndicationPdu = nullptr;
ueRadioCapabilityInfoIndicationIEs = NULL; ueRadioCapabilityInfoIndicationIEs = nullptr;
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
ueRadioCapability = NULL; ueRadioCapability = nullptr;
ueRadioCapabilityForPaging = NULL; ueRadioCapabilityForPaging = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -83,9 +84,9 @@ void UeRadioCapabilityInfoIndicationMsg::setMessageType() { ...@@ -83,9 +84,9 @@ void UeRadioCapabilityInfoIndicationMsg::setMessageType() {
&(ueRadioCapabilityInfoIndicationPdu->choice.initiatingMessage->value &(ueRadioCapabilityInfoIndicationPdu->choice.initiatingMessage->value
.choice.UERadioCapabilityInfoIndication); .choice.UERadioCapabilityInfoIndication);
} else { } else {
cout << "[warning] This information doesn't refer to " Logger::ngap().warn(
"UERadioCapabilityInfoIndication Message!!!" "This information doesn't refer to UERadioCapabilityInfoIndication "
<< endl; "message!");
} }
} }
...@@ -104,14 +105,14 @@ void UeRadioCapabilityInfoIndicationMsg::setAmfUeNgapId(unsigned long id) { ...@@ -104,14 +105,14 @@ void UeRadioCapabilityInfoIndicationMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD( ret = ASN_SEQUENCE_ADD(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie); &ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -131,14 +132,14 @@ void UeRadioCapabilityInfoIndicationMsg::setRanUeNgapId( ...@@ -131,14 +132,14 @@ void UeRadioCapabilityInfoIndicationMsg::setRanUeNgapId(
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD( ret = ASN_SEQUENCE_ADD(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie); &ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -160,14 +161,14 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapability( ...@@ -160,14 +161,14 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapability(
int ret = ueRadioCapability->encode2UERadioCapability( int ret = ueRadioCapability->encode2UERadioCapability(
ie->value.choice.UERadioCapability); ie->value.choice.UERadioCapability);
if (!ret) { if (!ret) {
cout << "encode UERadioCapability IE error" << endl; Logger::ngap().error("Encode NGAP UERadioCapability IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD( ret = ASN_SEQUENCE_ADD(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie); &ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UERadioCapability IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NGAP UERadioCapability IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -176,8 +177,9 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapabilityForPaging( ...@@ -176,8 +177,9 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapabilityForPaging(
uint8_t* nr, size_t sizeofnr, uint8_t* eutra, size_t sizeofeutra) { uint8_t* nr, size_t sizeofnr, uint8_t* eutra, size_t sizeofeutra) {
if (!ueRadioCapabilityForPaging) if (!ueRadioCapabilityForPaging)
ueRadioCapabilityForPaging = new UERadioCapabilityForPaging(); ueRadioCapabilityForPaging = new UERadioCapabilityForPaging();
UERadioCapabilityForPagingOfNR* m_ueRadioCapabilityForPagingOfNR = NULL; UERadioCapabilityForPagingOfNR* m_ueRadioCapabilityForPagingOfNR = nullptr;
UERadioCapabilityForPagingOfEUTRA* m_ueRadioCapabilityForPagingOfEUTRA = NULL; UERadioCapabilityForPagingOfEUTRA* m_ueRadioCapabilityForPagingOfEUTRA =
nullptr;
if (nr && sizeofnr > 0) { if (nr && sizeofnr > 0) {
m_ueRadioCapabilityForPagingOfNR = new UERadioCapabilityForPagingOfNR(); m_ueRadioCapabilityForPagingOfNR = new UERadioCapabilityForPagingOfNR();
m_ueRadioCapabilityForPagingOfNR->setUERadioCapabilityForPagingOfNR( m_ueRadioCapabilityForPagingOfNR->setUERadioCapabilityForPagingOfNR(
...@@ -203,14 +205,15 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapabilityForPaging( ...@@ -203,14 +205,15 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapabilityForPaging(
int ret = ueRadioCapabilityForPaging->encode2UERadioCapabilityForPaging( int ret = ueRadioCapabilityForPaging->encode2UERadioCapabilityForPaging(
&ie->value.choice.UERadioCapabilityForPaging); &ie->value.choice.UERadioCapabilityForPaging);
if (!ret) { if (!ret) {
cout << "encode UERadioCapabilityForPaging IE error" << endl; Logger::ngap().error("Encode NGAP UERadioCapabilityForPaging IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD( ret = ASN_SEQUENCE_ADD(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie); &ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UERadioCapabilityForPaging IE error" << endl; if (ret != 0)
Logger::ngap().error("Encode NGAP UERadioCapabilityForPaging IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -222,7 +225,7 @@ int UeRadioCapabilityInfoIndicationMsg::encode2buffer( ...@@ -222,7 +225,7 @@ int UeRadioCapabilityInfoIndicationMsg::encode2buffer(
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ueRadioCapabilityInfoIndicationPdu, buf, &asn_DEF_Ngap_NGAP_PDU, NULL, ueRadioCapabilityInfoIndicationPdu, buf,
buf_size); buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -247,11 +250,12 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu( ...@@ -247,11 +250,12 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
&ueRadioCapabilityInfoIndicationPdu->choice.initiatingMessage->value &ueRadioCapabilityInfoIndicationPdu->choice.initiatingMessage->value
.choice.UERadioCapabilityInfoIndication; .choice.UERadioCapabilityInfoIndication;
} else { } else {
cout << "Check UERadioCapabilityInfoIndication message error!!!" << endl; Logger::ngap().error(
"Check UERadioCapabilityInfoIndication message error!");
return false; return false;
} }
} else { } else {
cout << "MessageType error!!!" << endl; Logger::ngap().error("MessageType error!");
return false; return false;
} }
for (int i = 0; for (int i = 0;
...@@ -267,11 +271,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu( ...@@ -267,11 +271,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i] ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -285,11 +289,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu( ...@@ -285,11 +289,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i] ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -303,11 +307,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu( ...@@ -303,11 +307,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
if (!ueRadioCapability->decodefromUERadioCapability( if (!ueRadioCapability->decodefromUERadioCapability(
ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i] ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i]
->value.choice.UERadioCapability)) { ->value.choice.UERadioCapability)) {
cout << "decoded ngap UERadioCapability IE error" << endl; Logger::ngap().error("Decoded NGAP UERadioCapability IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap UERadioCapability IE error" << endl; Logger::ngap().error("Decoded NGAP UERadioCapability IE error");
return false; return false;
} }
} break; } break;
...@@ -322,16 +326,18 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu( ...@@ -322,16 +326,18 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list &ueRadioCapabilityInfoIndicationIEs->protocolIEs.list
.array[i] .array[i]
->value.choice.UERadioCapabilityForPaging)) { ->value.choice.UERadioCapabilityForPaging)) {
cout << "decoded ngap UERadioCapabilityForPaging IE error" << endl; Logger::ngap().error(
"Decoded NGAP UERadioCapabilityForPaging IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap UERadioCapabilityForPaging IE error" << endl; Logger::ngap().error(
"Decoded NGAP UERadioCapabilityForPaging IE error");
return false; return false;
} }
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded NGAP message PDU error");
return false; return false;
} }
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "UplinkNASTransport.hpp" #include "UplinkNASTransport.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -43,12 +44,12 @@ namespace ngap { ...@@ -43,12 +44,12 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
UplinkNASTransportMsg::UplinkNASTransportMsg() { UplinkNASTransportMsg::UplinkNASTransportMsg() {
uplinkNASTransportPdu = NULL; uplinkNASTransportPdu = nullptr;
uplinkNASTransportIEs = NULL; uplinkNASTransportIEs = nullptr;
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
nasPdu = NULL; nasPdu = nullptr;
userLocationInformation = NULL; userLocationInformation = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -78,9 +79,8 @@ void UplinkNASTransportMsg::setMessageType() { ...@@ -78,9 +79,8 @@ void UplinkNASTransportMsg::setMessageType() {
uplinkNASTransportIEs = &(uplinkNASTransportPdu->choice.initiatingMessage uplinkNASTransportIEs = &(uplinkNASTransportPdu->choice.initiatingMessage
->value.choice.UplinkNASTransport); ->value.choice.UplinkNASTransport);
} else { } else {
std::cout << "[Warning] This information doesn't refer to " Logger::ngap().warn(
"UplinkNASTransport Message!" "This information doesn't refer to UplinkNASTransport message!");
<< std::endl;
} }
} }
...@@ -97,13 +97,13 @@ void UplinkNASTransportMsg::setAmfUeNgapId(unsigned long id) { ...@@ -97,13 +97,13 @@ void UplinkNASTransportMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl; if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -120,13 +120,13 @@ void UplinkNASTransportMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -120,13 +120,13 @@ void UplinkNASTransportMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl; if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -144,13 +144,13 @@ void UplinkNASTransportMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) { ...@@ -144,13 +144,13 @@ void UplinkNASTransportMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU); int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) { if (!ret) {
std::cout << "Encode NAS_PDU IE error" << std::endl; Logger::ngap().error("Encode NGAP NAS_PDU IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode NAS_PDU IE error" << std::endl; if (ret != 0) Logger::ngap().error("Encode NGAP NAS_PDU IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -189,14 +189,14 @@ void UplinkNASTransportMsg::setUserLocationInfoNR( ...@@ -189,14 +189,14 @@ void UplinkNASTransportMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation( int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation); &ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
std::cout << "Encode UserLocationInformation IE error" << std::endl; Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
std::cout << "Encode UserLocationInformation IE error" << std::endl; Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -205,7 +205,7 @@ int UplinkNASTransportMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -205,7 +205,7 @@ int UplinkNASTransportMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, uplinkNASTransportPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, uplinkNASTransportPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, uplinkNASTransportPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, uplinkNASTransportPdu, buf, buf_size);
std::cout << "er.encoded(" << er.encoded << ")" << std::endl; Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -225,11 +225,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -225,11 +225,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
uplinkNASTransportIEs = &uplinkNASTransportPdu->choice.initiatingMessage uplinkNASTransportIEs = &uplinkNASTransportPdu->choice.initiatingMessage
->value.choice.UplinkNASTransport; ->value.choice.UplinkNASTransport;
} else { } else {
std::cout << "Check UplinkNASTransport message error!!!" << std::endl; Logger::ngap().error("Check UplinkNASTransport message error!");
return false; return false;
} }
} else { } else {
std::cout << "MessageType error!!!" << std::endl; Logger::ngap().error("MessageType error!");
return false; return false;
} }
for (int i = 0; i < uplinkNASTransportIEs->protocolIEs.list.count; i++) { for (int i = 0; i < uplinkNASTransportIEs->protocolIEs.list.count; i++) {
...@@ -243,11 +243,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -243,11 +243,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
uplinkNASTransportIEs->protocolIEs.list.array[i] uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
std::cout << "decoded ngap AMF_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
std::cout << "decoded ngap AMF_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -260,11 +260,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -260,11 +260,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
uplinkNASTransportIEs->protocolIEs.list.array[i] uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
std::cout << "decoded ngap RAN_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
std::cout << "decoded ngap RAN_UE_NGAP_ID IE error" << std::endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -277,11 +277,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -277,11 +277,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!nasPdu->decodefromoctetstring( if (!nasPdu->decodefromoctetstring(
uplinkNASTransportIEs->protocolIEs.list.array[i] uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.NAS_PDU)) { ->value.choice.NAS_PDU)) {
std::cout << "decoded ngap NAS_PDU IE error" << std::endl; Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false; return false;
} }
} else { } else {
std::cout << "decoded ngap NAS_PDU IE error" << std::endl; Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false; return false;
} }
} break; } break;
...@@ -294,19 +294,18 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -294,19 +294,18 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!userLocationInformation->decodefromUserLocationInformation( if (!userLocationInformation->decodefromUserLocationInformation(
&uplinkNASTransportIEs->protocolIEs.list.array[i] &uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) { ->value.choice.UserLocationInformation)) {
std::cout << "decoded ngap UserLocationInformation IE error" Logger::ngap().error(
<< std::endl; "Decoded NGAP UserLocationInformation IE error");
return false; return false;
} }
} else { } else {
std::cout << "decoded ngap UserLocationInformation IE error" Logger::ngap().error("Decoded NGAP UserLocationInformation IE error");
<< std::endl;
return false; return false;
} }
} break; } break;
default: { default: {
std::cout << "decoded ngap message pdu error" << std::endl; Logger::ngap().error("Decoded NGAP message PDU error");
return false; return false;
} }
} }
......
...@@ -27,12 +27,15 @@ ...@@ -27,12 +27,15 @@
*/ */
#include "UplinkRANStatusTransfer.hpp" #include "UplinkRANStatusTransfer.hpp"
#include "logger.hpp"
#include <iostream> #include <iostream>
#include <vector> #include <vector>
using namespace std; using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------
UplinkRANStatusTransfer::UplinkRANStatusTransfer() { UplinkRANStatusTransfer::UplinkRANStatusTransfer() {
amfUeNgapId = nullptr; amfUeNgapId = nullptr;
ranUeNgapId = nullptr; ranUeNgapId = nullptr;
...@@ -41,8 +44,10 @@ UplinkRANStatusTransfer::UplinkRANStatusTransfer() { ...@@ -41,8 +44,10 @@ UplinkRANStatusTransfer::UplinkRANStatusTransfer() {
UplinkRANStatusTransferIEs = nullptr; UplinkRANStatusTransferIEs = nullptr;
} }
//------------------------------------------------------------------------------
UplinkRANStatusTransfer::~UplinkRANStatusTransfer() {} UplinkRANStatusTransfer::~UplinkRANStatusTransfer() {}
//------------------------------------------------------------------------------
unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() { unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() {
if (amfUeNgapId) if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
...@@ -50,6 +55,7 @@ unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() { ...@@ -50,6 +55,7 @@ unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
uint32_t UplinkRANStatusTransfer::getRanUeNgapId() { uint32_t UplinkRANStatusTransfer::getRanUeNgapId() {
if (ranUeNgapId) if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
...@@ -57,6 +63,7 @@ uint32_t UplinkRANStatusTransfer::getRanUeNgapId() { ...@@ -57,6 +63,7 @@ uint32_t UplinkRANStatusTransfer::getRanUeNgapId() {
return 0; return 0;
} }
//------------------------------------------------------------------------------
void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer( void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer(
RANStatusTransferTransparentContainer*& RANStatusTransferTransparentContainer*&
ranstatustransfer_transparentcontainer) { ranstatustransfer_transparentcontainer) {
...@@ -64,6 +71,7 @@ void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer( ...@@ -64,6 +71,7 @@ void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer(
ranStatusTransfer_TransparentContainer; ranStatusTransfer_TransparentContainer;
} }
//------------------------------------------------------------------------------
bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
UplinkRANStatusTransferPDU = ngap_msg_pdu; UplinkRANStatusTransferPDU = ngap_msg_pdu;
if (UplinkRANStatusTransferPDU->present == if (UplinkRANStatusTransferPDU->present ==
...@@ -79,11 +87,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -79,11 +87,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
&UplinkRANStatusTransferPDU->choice.initiatingMessage->value.choice &UplinkRANStatusTransferPDU->choice.initiatingMessage->value.choice
.UplinkRANStatusTransfer; .UplinkRANStatusTransfer;
} else { } else {
cout << "Check uplinkranstatustransfer message error!!!" << endl; Logger::ngap().error("Check UplinkRANStatusTransfer message error");
return false; return false;
} }
} else { } else {
cout << "uplinkranstatustransfer message type error" << endl; Logger::ngap().error("UplinkRANStatusTransfer message type error");
return false; return false;
} }
for (int i = 0; i < UplinkRANStatusTransferIEs->protocolIEs.list.count; i++) { for (int i = 0; i < UplinkRANStatusTransferIEs->protocolIEs.list.count; i++) {
...@@ -98,11 +106,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -98,11 +106,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
UplinkRANStatusTransferIEs->protocolIEs.list.array[i] UplinkRANStatusTransferIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -116,11 +124,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -116,11 +124,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
UplinkRANStatusTransferIEs->protocolIEs.list.array[i] UplinkRANStatusTransferIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -137,20 +145,19 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -137,20 +145,19 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
&UplinkRANStatusTransferIEs->protocolIEs.list.array[i] &UplinkRANStatusTransferIEs->protocolIEs.list.array[i]
->value.choice ->value.choice
.RANStatusTransfer_TransparentContainer)) { .RANStatusTransfer_TransparentContainer)) {
cout << "decoded ngap ranStatusTransfer_TransparentContainer error" Logger::ngap().error(
<< endl; "Decoded NGAP RANStatusTransfer_TransparentContainer IE error");
return false; return false;
} }
cout << "can get the buffer of RANStatusTransfer_TransparentContainer" Logger::ngap().error(
<< endl; "Decoded NGAP RANStatusTransfer_TransparentContainer IE error");
} else { } else {
cout << "cann't get the buffer of " Logger::ngap().error(
"RANStatusTransfer_TransparentContainer" "Decoded NGAP RANStatusTransfer_TransparentContainer IE error");
<< endl;
} }
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded NGAP message PDU error");
return false; return false;
} }
} }
......
...@@ -43,8 +43,8 @@ class UplinkRANStatusTransfer { ...@@ -43,8 +43,8 @@ class UplinkRANStatusTransfer {
public: public:
UplinkRANStatusTransfer(); UplinkRANStatusTransfer();
virtual ~UplinkRANStatusTransfer(); virtual ~UplinkRANStatusTransfer();
unsigned long getAmfUeNgapId(); // return -1; unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId(); // return -1; uint32_t getRanUeNgapId();
void getRANStatusTransfer_TransparentContainer( void getRANStatusTransfer_TransparentContainer(
RANStatusTransferTransparentContainer*& RANStatusTransferTransparentContainer*&
ranstatustransfer_transparentcontainer); ranstatustransfer_transparentcontainer);
......
...@@ -75,7 +75,6 @@ class ngap_app : public sctp_application { ...@@ -75,7 +75,6 @@ class ngap_app : public sctp_application {
void handle_sctp_shutdown(sctp_assoc_id_t assoc_id); void handle_sctp_shutdown(sctp_assoc_id_t assoc_id);
// gnb context management
bool is_assoc_id_2_gnb_context(const sctp_assoc_id_t& assoc_id) const; bool is_assoc_id_2_gnb_context(const sctp_assoc_id_t& assoc_id) const;
void set_assoc_id_2_gnb_context( void set_assoc_id_2_gnb_context(
const sctp_assoc_id_t& assoc_id, std::shared_ptr<gnb_context> gc); const sctp_assoc_id_t& assoc_id, std::shared_ptr<gnb_context> gc);
......
This diff is collapsed.
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