Commit 450bc25b authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update NGAP IEs

parent bdf8e1c4
......@@ -39,20 +39,20 @@ namespace ngap {
//------------------------------------------------------------------------------
AmfName::AmfName() {
amfname = NULL;
amfname = nullptr;
}
//------------------------------------------------------------------------------
AmfName::~AmfName() {
free(amfname);
amfname = NULL;
amfname = nullptr;
}
//------------------------------------------------------------------------------
void AmfName::setValue(const std::string m_amfName) {
if (amfname) {
free(amfname);
amfname = NULL;
amfname = nullptr;
}
amfname = (char*) calloc(1, m_amfName.size() + 1);
memcpy(amfname, m_amfName.c_str(), m_amfName.size());
......@@ -61,13 +61,14 @@ void AmfName::setValue(const 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) {
if (OCTET_STRING_fromBuf(amfNameIe, amfname, strlen(amfname)) < 0)
return false;
if (amfname)
if (OCTET_STRING_fromBuf(amfNameIe, amfname, strlen(amfname)) < 0)
return false;
return true;
}
......
......@@ -70,7 +70,6 @@ bool AMFSetID::encode2bitstring(Ngap_AMFSetID_t& amfsetid) {
//------------------------------------------------------------------------------
bool AMFSetID::decodefrombitstring(Ngap_AMFSetID_t& amfsetid) {
if (!amfsetid.buf) return false;
printf("test for amfsetid\n");
for (int i = 0; i < amfsetid.size; i++) {
printf("%x ", amfsetid.buf[i]);
}
......
......@@ -40,7 +40,7 @@ namespace ngap {
//------------------------------------------------------------------------------
AllowedNSSAI::AllowedNSSAI() {
snssai = NULL;
snssai = nullptr;
numofSnssai = 0;
}
......@@ -66,7 +66,6 @@ bool AllowedNSSAI::getAllowedNSSAI(S_NSSAI*& m_snssai, int& m_numofsnssai) {
//------------------------------------------------------------------------------
bool AllowedNSSAI::encode2AllowedNSSAI(Ngap_AllowedNSSAI_t* allowedNssaiList) {
cout << "AllowedNSSAI::numOfSnssai " << numofSnssai << endl;
for (int i = 0; i < numofSnssai; i++) {
Ngap_AllowedNSSAI_Item_t* allowednssaiitem =
(Ngap_AllowedNSSAI_Item_t*) calloc(1, sizeof(Ngap_AllowedNSSAI_Item_t));
......
......@@ -35,7 +35,7 @@ namespace ngap {
//------------------------------------------------------------------------------
AssociatedQosFlowItem::AssociatedQosFlowItem() {
qosFlowIdentifier = NULL;
qosFlowIdentifier = nullptr;
qosFlowMappingIndication = -1;
}
......@@ -74,6 +74,8 @@ bool AssociatedQosFlowItem::encode2AssociatedQosFlowItem(
(long*) calloc(1, sizeof(long));
*associatedQosFlowItem->qosFlowMappingIndication = qosFlowMappingIndication;
}
if (!qosFlowIdentifier) return false;
if (!qosFlowIdentifier->encode2QosFlowIdentifier(
&associatedQosFlowItem->qosFlowIdentifier))
return false;
......
......@@ -35,7 +35,7 @@ namespace ngap {
//------------------------------------------------------------------------------
AssociatedQosFlowList::AssociatedQosFlowList() {
associatedQosFlowItem = NULL;
associatedQosFlowItem = nullptr;
numofassociatedQosFlowItem = 0;
}
......@@ -65,6 +65,7 @@ bool AssociatedQosFlowList::encode2AssociatedQosFlowList(
Ngap_AssociatedQosFlowItem_t* ie = (Ngap_AssociatedQosFlowItem_t*) calloc(
1, sizeof(Ngap_AssociatedQosFlowItem_t));
if (!ie) return false;
if (!associatedQosFlowItem) return false;
if (!associatedQosFlowItem[i].encode2AssociatedQosFlowItem(ie))
return false;
if (ASN_SEQUENCE_ADD(&associatedQosFlowList.list, ie) != 0) return false;
......
......@@ -43,8 +43,8 @@ namespace ngap {
//------------------------------------------------------------------------------
BroadcastPLMNItem::BroadcastPLMNItem() {
plmn = NULL;
snssai = NULL;
plmn = nullptr;
snssai = nullptr;
numOfSnssai = 0;
}
......@@ -70,8 +70,9 @@ void BroadcastPLMNItem::getPlmnSliceSupportList(
//------------------------------------------------------------------------------
bool BroadcastPLMNItem::encode2BroadcastPLMNItem(
Ngap_BroadcastPLMNItem_t* plmnItem) {
if (!plmn) return false;
if (!snssai) return false;
if (!plmn->encode2octetstring(plmnItem->pLMNIdentity)) return false;
cout << "BroadcastPLMNItem::numOfSnssai " << numOfSnssai << endl;
for (int i = 0; i < numOfSnssai; i++) {
Ngap_SliceSupportItem_t* slice =
(Ngap_SliceSupportItem_t*) calloc(1, sizeof(Ngap_SliceSupportItem_t));
......@@ -89,7 +90,7 @@ bool BroadcastPLMNItem::decodefromBroadcastPLMNItem(
if (plmn == nullptr) plmn = new PlmnId();
if (!plmn->decodefromoctetstring(pdu->pLMNIdentity)) return false;
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++) {
if (!snssai[i].decodefromS_NSSAI(
&pdu->tAISliceSupportList.list.array[i]->s_NSSAI))
......
......@@ -43,16 +43,12 @@ bool COUNTValueForPDCP_SN18::encodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t* countvalue) {
countvalue->pDCP_SN18 = 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;
}
bool COUNTValueForPDCP_SN18::decodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t& countValue) {
pdcp = countValue.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;
}
} // namespace ngap
......@@ -78,12 +78,15 @@ void CoreNetworkAssistanceInfo::setCoreNetworkAssistanceInfo(
//------------------------------------------------------------------------------
bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo(
Ngap_CoreNetworkAssistanceInformation_t* coreNetworkAssistanceInformation) {
if (!ueIdentityIndexValue) return false;
if (!ueIdentityIndexValue->encode2UEIdentityIndexValue(
&coreNetworkAssistanceInformation->uEIdentityIndexValue))
return false;
if (!periodicRegUpdateTimer) return false;
if (!periodicRegUpdateTimer->encode2PeriodicRegistrationUpdateTimer(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false;
if (!tai) return false;
for (int i = 0; i < numoftai; i++) {
Ngap_TAIListForInactiveItem_t* taiListForInactiveItem =
(Ngap_TAIListForInactiveItem_t*) calloc(
......@@ -129,7 +132,7 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false;
numoftai = coreNetworkAssistanceInformation->tAIListForInactive.list.count;
tai = new TAI[numoftai]();
if (tai == nullptr) tai = new TAI[numoftai]();
for (int i = 0; i < numoftai; i++) {
if (!tai[i].decodefromTAI(
&coreNetworkAssistanceInformation->tAIListForInactive.list.array[i]
......@@ -137,13 +140,13 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
return false;
}
if (coreNetworkAssistanceInformation->uESpecificDRX) {
pagingDRX = new DefaultPagingDRX();
if (pagingDRX == nullptr) pagingDRX = new DefaultPagingDRX();
if (!pagingDRX->decodefromDefaultPagingDRX(
*(coreNetworkAssistanceInformation->uESpecificDRX)))
return false;
}
if (coreNetworkAssistanceInformation->mICOModeIndication) {
micoModeInd = new MICOModeIndication();
if (micoModeInd == nullptr) micoModeInd = new MICOModeIndication();
if (!micoModeInd->decodefromMICOModeIndication(
coreNetworkAssistanceInformation->mICOModeIndication))
return false;
......
......@@ -101,6 +101,7 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) {
ie->value.choice.CriticalityDiagnostics.procedureCriticality =
procedureCriticalityIE;
}
if (numberOfIEsCriticalityDiagnostics) {
Ngap_CriticalityDiagnostics_IE_List_t* ieList =
(Ngap_CriticalityDiagnostics_IE_List_t*) calloc(
......@@ -109,8 +110,10 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) {
Ngap_CriticalityDiagnostics_IE_Item_t* ieItem =
(Ngap_CriticalityDiagnostics_IE_Item_t*) calloc(
1, sizeof(Ngap_CriticalityDiagnostics_IE_Item_t));
iEsCriticalityDiagnostics[i].encode2pdu(ieItem);
ASN_SEQUENCE_ADD(&ieList->list, ieItem);
if (iEsCriticalityDiagnostics) {
iEsCriticalityDiagnostics[i].encode2pdu(ieItem);
ASN_SEQUENCE_ADD(&ieList->list, ieItem);
}
}
ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics = ieList;
}
......
......@@ -35,8 +35,8 @@ namespace ngap {
//------------------------------------------------------------------------------
DLQoSFlowPerTNLInformation::DLQoSFlowPerTNLInformation() {
uPTransportLayerInformation = NULL;
associatedQosFlowList = NULL;
uPTransportLayerInformation = nullptr;
associatedQosFlowList = nullptr;
}
//------------------------------------------------------------------------------
......@@ -63,9 +63,11 @@ bool DLQoSFlowPerTNLInformation::getDLQoSFlowPerTNLInformation(
//------------------------------------------------------------------------------
bool DLQoSFlowPerTNLInformation::encode2DLQoSFlowPerTNLInformation(
Ngap_QosFlowPerTNLInformation_t* qosFlowPerTNLInformation) {
if (!uPTransportLayerInformation) return false;
if (!uPTransportLayerInformation->encode2UpTransportLayerInformation(
qosFlowPerTNLInformation->uPTransportLayerInformation))
return false;
if (!associatedQosFlowList) return false;
if (!associatedQosFlowList->encode2AssociatedQosFlowList(
qosFlowPerTNLInformation->associatedQosFlowList))
return false;
......
......@@ -39,20 +39,6 @@ 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(
Ngap_DataForwardingNotPossible_t& dataForwardingNotPossible) {
......
......@@ -20,64 +20,69 @@
*/
#include "dRBsSubjectToStatusTransferItem.hpp"
#include "logger.hpp"
#include <iostream>
#include <vector>
using namespace std;
namespace ngap {
dRBSubjectItem::dRBSubjectItem() {
drb_id = NULL;
drb_ul = NULL;
drb_dl = NULL;
drb_id = nullptr;
drb_ul = nullptr;
drb_dl = nullptr;
}
dRBSubjectItem::~dRBSubjectItem() {}
void dRBSubjectItem::setdRBSubjectItem(
Ngap_DRB_ID_t* dRB_ID, dRBStatusUL* dRB_UL, dRBStatusDL* dRB_DL) {
drb_id = dRB_ID;
drb_ul = dRB_UL;
drb_dl = dRB_DL;
}
void dRBSubjectItem::getdRBSubjectItem(
Ngap_DRB_ID_t*& dRB_ID, dRBStatusUL*& dRB_UL, dRBStatusDL*& dRB_DL) {
dRB_ID = drb_id;
dRB_UL = drb_ul;
dRB_DL = drb_dl;
}
bool dRBSubjectItem::decodefromdRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (dRB_item->dRB_ID) {
drb_id = &dRB_item->dRB_ID;
cout << "the decode drb_id is" << *drb_id << endl;
}
drb_ul = new dRBStatusUL();
if (!drb_ul->decodedRBStatusUL(&dRB_item->dRBStatusUL)) {
cout << "decode from dRBSubjectItem dRBStatusUL error" << endl;
return false;
}
drb_dl = new dRBStatusDL();
if (!drb_dl->decodedRBStatusDL(&dRB_item->dRBStatusDL)) {
cout << "decode from dRBSubjectItem dRBStatusDL error" << endl;
return false;
}
cout << "decode from dRBSubjectItem successfully" << endl;
return true;
}
bool dRBSubjectItem::encodedRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (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)) {
cout << "encode from dRBSubjectItem dRBStatusUL error" << endl;
return false;
}
if (!drb_dl) return false;
if (!drb_dl->encodedRBStatusDL(&dRB_item->dRBStatusDL)) {
cout << "encode from dRBSubjectItem dRBStatusDL error" << endl;
return false;
}
cout << "encode from dRBSubjectItem successfully" << endl;
Logger::ngap().debug("Encode from dRBSubjectItem successfully");
return true;
}
} // namespace ngap
......@@ -26,7 +26,7 @@
using namespace std;
namespace ngap {
dRBSubjectList::dRBSubjectList() {
drbsubjectitem = NULL;
drbsubjectitem = nullptr;
numofitem = 0;
}
dRBSubjectList::~dRBSubjectList() {}
......@@ -45,6 +45,8 @@ bool dRBSubjectList::encodefromdRBSubjectlist(
(Ngap_DRBsSubjectToStatusTransferItem_t*) calloc(
1, sizeof(Ngap_DRBsSubjectToStatusTransferItem_t));
if (!ie) return false;
if (!drbsubjectitem) return false;
if (!drbsubjectitem[i].encodedRBSubjectItem(ie)) {
cout << "encodefromdRBSubjectlist error" << endl;
return false;
......
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