Commit 54f58b62 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update NGAP messages

parent 450bc25b
......@@ -45,14 +45,14 @@ namespace ngap {
//------------------------------------------------------------------------------
DownLinkNasTransportMsg::DownLinkNasTransportMsg() {
downLinkNasTransportPdu = NULL;
downLinkNasTransportIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
oldAmfName = NULL;
ranPagingPriority = NULL;
nasPdu = NULL;
indexToRFSP = NULL;
downLinkNasTransportPdu = nullptr;
downLinkNasTransportIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
oldAmfName = nullptr;
ranPagingPriority = nullptr;
nasPdu = nullptr;
indexToRFSP = nullptr;
}
//------------------------------------------------------------------------------
......@@ -241,7 +241,7 @@ int DownLinkNasTransportMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, downLinkNasTransportPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
......
......@@ -20,6 +20,7 @@
*/
#include "DownlinkRANStatusTransfer.hpp"
#include "logger.hpp"
#include <iostream>
#include <vector>
......@@ -31,6 +32,7 @@ extern "C" {
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -39,8 +41,10 @@ DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
DownlinkranstatustransferPDU = nullptr;
}
//------------------------------------------------------------------------------
DownlinkRANStatusTransfer::~DownlinkRANStatusTransfer() {}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(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);
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);
return;
}
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);
}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(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);
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);
return;
}
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);
}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
long drb_id, long ul_pcdp, long ul_hfn_pdcp, long dl_pcdp,
long dl_hfn_pdcp) {
......@@ -128,7 +135,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
->encoderanstatustransfer_transparentcontainer(
&ie->value.choice.RANStatusTransfer_TransparentContainer);
if (!ret) {
cout << "encode ranstatustransfer_transparentcontainer error" << endl;
Logger::ngap().error(
"Encode RANStatusTransfer_TransparentContainer IE error");
// free_wrapper((void**) &dRB_id);
free_wrapper((void**) &UL_value);
free_wrapper((void**) &DL_value);
......@@ -142,7 +150,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
}
if (ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie) !=
0) {
cout << "encode ranstatustransfer_transparentcontainer error 2" << endl;
Logger::ngap().error(
"Encode ranstatustransfer_transparentcontainer IE error");
}
/* free_wrapper((void**) &dRB_id);
free_wrapper((void**) &UL_value);
......@@ -157,6 +166,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
*/
}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setmessagetype() {
if (!DownlinkranstatustransferPDU) {
DownlinkranstatustransferPDU =
......@@ -180,18 +190,18 @@ void DownlinkRANStatusTransfer::setmessagetype() {
&(DownlinkranstatustransferPDU->choice.initiatingMessage->value.choice
.DownlinkRANStatusTransfer);
} else {
cout << "[warning] This information doesn't refer to "
"downlinkranstatustransfer Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to DownlinkRANStatusTransfer Message");
}
}
//------------------------------------------------------------------------------
int DownlinkRANStatusTransfer::encodetobuffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, DownlinkranstatustransferPDU);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, DownlinkranstatustransferPDU, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
} // namespace ngap
......@@ -40,6 +40,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverCommandMsg::HandoverCommandMsg() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -52,8 +53,11 @@ HandoverCommandMsg::HandoverCommandMsg() {
handoverCommandPdu = nullptr;
handoverCommandIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverCommandMsg::~HandoverCommandMsg() {}
//------------------------------------------------------------------------------
unsigned long HandoverCommandMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -61,6 +65,7 @@ unsigned long HandoverCommandMsg::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
uint32_t HandoverCommandMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -68,6 +73,7 @@ uint32_t HandoverCommandMsg::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverCommandPdu = ngap_msg_pdu;
......@@ -192,14 +198,16 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverCommandMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverCommandPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setMessageType() {
if (!handoverCommandPdu)
handoverCommandPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
......@@ -226,6 +234,7 @@ void HandoverCommandMsg::setMessageType() {
}
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -248,6 +257,7 @@ void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id);
......@@ -271,6 +281,7 @@ void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setHandoverType(long type) {
if (!ngap_handovertype) ngap_handovertype = new Ngap_HandoverType_t();
Ngap_HandoverCommandIEs_t* ie =
......@@ -285,6 +296,7 @@ void HandoverCommandMsg::setHandoverType(long type) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setPduSessionResourceHandoverList(
std::vector<PDUSessionResourceHandoverItem_t> list) {
if (!PDUSessionResourceHandoverList)
......@@ -320,6 +332,7 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setTargetToSource_TransparentContainer(
OCTET_STRING_t targetTosource) {
if (!TargetToSource_TransparentContainer)
......
......@@ -60,8 +60,8 @@ class HandoverCommandMsg {
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
/*void getHandoverType(Ngap_HandoverType_t &handovertype);
void getCause(Cause cause);
void getTargetID(Ngap_TargetID_t targetID);
......@@ -73,7 +73,6 @@ class HandoverCommandMsg {
private:
Ngap_NGAP_PDU_t* handoverCommandPdu;
Ngap_HandoverCommand_t* handoverCommandIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId;
Ngap_HandoverType_t* ngap_handovertype;
......
......@@ -42,6 +42,8 @@ extern "C" {
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverNotifyMsg::HandoverNotifyMsg() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -50,7 +52,10 @@ HandoverNotifyMsg::HandoverNotifyMsg() {
handoverNotifyIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverNotifyMsg::~HandoverNotifyMsg(){};
//------------------------------------------------------------------------------
unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -58,14 +63,16 @@ unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverNotifyPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
//------------------------------------------------------------------------------
bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverNotifyPdu = ngap_msg_pdu;
......@@ -150,6 +157,8 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
}
return true;
}
//------------------------------------------------------------------------------
void HandoverNotifyMsg::setUserLocationInfoNR(
struct NrCgi_s cig, struct Tai_s tai) {
if (!userLocationInformation)
......@@ -194,6 +203,7 @@ void HandoverNotifyMsg::setUserLocationInfoNR(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
uint32_t HandoverNotifyMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -201,6 +211,7 @@ uint32_t HandoverNotifyMsg::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverNotifyMsg::getUserLocationInfoNR(
struct NrCgi_s& cig, struct Tai_s& tai) {
if (!userLocationInformation) return false;
......
......@@ -39,6 +39,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverPreparationFailure::HandoverPreparationFailure() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -47,8 +48,10 @@ HandoverPreparationFailure::HandoverPreparationFailure() {
CriticalityDiagnostics = nullptr;
}
//------------------------------------------------------------------------------
HandoverPreparationFailure::~HandoverPreparationFailure() {}
//------------------------------------------------------------------------------
unsigned long HandoverPreparationFailure::getAmfUeNgapId() const {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -56,6 +59,7 @@ unsigned long HandoverPreparationFailure::getAmfUeNgapId() const {
return 0;
}
//------------------------------------------------------------------------------
uint32_t HandoverPreparationFailure::getRanUeNgapId() const {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -63,6 +67,7 @@ uint32_t HandoverPreparationFailure::getRanUeNgapId() const {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
hoPreparationFailurePdu = ngap_msg_pdu;
......@@ -162,14 +167,16 @@ bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverPreparationFailure::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, hoPreparationFailurePdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setMessageType() {
if (!hoPreparationFailurePdu)
hoPreparationFailurePdu =
......@@ -198,6 +205,7 @@ void HandoverPreparationFailure::setMessageType() {
}
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -222,6 +230,7 @@ void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id);
......@@ -247,6 +256,7 @@ void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setCause(
Ngap_Cause_PR m_causePresent, long value) //
{
......@@ -266,6 +276,7 @@ void HandoverPreparationFailure::setCause(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
Ngap_Cause_PR HandoverPreparationFailure::getChoiceOfCause() const {
if (cause)
return cause->getChoiceOfCause();
......
......@@ -39,6 +39,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverRequest::HandoverRequest() {
amfUeNgapId = nullptr;
handovertype = nullptr;
......@@ -54,8 +55,11 @@ HandoverRequest::HandoverRequest() {
handoverRequestPdu = nullptr;
handoverRequestIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverRequest::~HandoverRequest() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequest::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -63,6 +67,7 @@ unsigned long HandoverRequest::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
/*bool HandoverRequest::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu)
{
handoverCommandPdu = ngap_msg_pdu;
......@@ -219,14 +224,16 @@ error" << endl; return false;
return true;
}*/
//------------------------------------------------------------------------------
int HandoverRequest::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
//------------------------------------------------------------------------------
void HandoverRequest::setMessageType() {
if (!handoverRequestPdu)
handoverRequestPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
......@@ -253,6 +260,7 @@ void HandoverRequest::setMessageType() {
}
}
//------------------------------------------------------------------------------
void HandoverRequest::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -276,6 +284,7 @@ void HandoverRequest::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setHandoverType(long type) // 0--intra5gs
{
if (!handovertype) handovertype = new Ngap_HandoverType_t();
......@@ -290,6 +299,7 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
{
if (!cause) cause = new Cause;
......@@ -307,6 +317,7 @@ void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setUEAggregateMaximumBitRate(
long bit_rate_downlink, long bit_rate_uplink) {
if (!ueAggregateMaximumBitRate)
......@@ -329,6 +340,8 @@ void HandoverRequest::setUEAggregateMaximumBitRate(
Logger::ngap().error("Encode UEAggregateMaximumBitRate IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setUESecurityCapabilities(
uint16_t m_NR_EncryptionAlgs, uint16_t m_NR_IntegrityProtectionAlgs,
uint16_t m_E_UTRA_EncryptionAlgs,
......@@ -352,6 +365,7 @@ void HandoverRequest::setUESecurityCapabilities(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setGUAMI(
PlmnId* m_plmnId, AMFRegionID* m_aMFRegionID, AMFSetID* m_aMFSetID,
AMFPointer* m_aMFPointer) {
......@@ -370,6 +384,8 @@ void HandoverRequest::setGUAMI(
if (ret != 0) Logger::ngap().error("Encode GUAMI IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
if (!allowedNSSAI) allowedNSSAI = new Ngap_AllowedNSSAI_t();
......@@ -395,6 +411,8 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
if (ret != 0) Logger::ngap().error("Encode AllowedNSSAI IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
if (!SecurityContext) SecurityContext = new Ngap_SecurityContext_t();
......@@ -414,6 +432,7 @@ void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setPduSessionResourceSetupList(
std::vector<PDUSessionResourceSetupRequestItem_t> list) {
if (!PDUSessionResourceSetupList)
......@@ -457,6 +476,7 @@ void HandoverRequest::setPduSessionResourceSetupList(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setSourceToTarget_TransparentContainer(
OCTET_STRING_t sourceTotarget) {
if (!SourceToTarget_TransparentContainer)
......@@ -475,6 +495,8 @@ void HandoverRequest::setSourceToTarget_TransparentContainer(
Logger::ngap().error("Encode SourceToTarget_TransparentContainer IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) {
if (!mobilityrestrictionlist) {
mobilityrestrictionlist = new MobilityRestrictionList();
......
......@@ -76,7 +76,7 @@ class HandoverRequest {
void setMobilityRestrictionList(PlmnId* m_plmnId);
int encode2buffer(uint8_t* buf, int buf_size);
// bool decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
private:
Ngap_NGAP_PDU_t* handoverRequestPdu;
......
......@@ -41,6 +41,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverRequestAck::HandoverRequestAck() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -53,13 +54,18 @@ HandoverRequestAck::HandoverRequestAck() {
handovertype = nullptr;
}
//------------------------------------------------------------------------------
HandoverRequestAck::~HandoverRequestAck() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequestAck::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
}
//------------------------------------------------------------------------------
void HandoverRequestAck::setMessageType() {
if (!handoverRequestAckPdu)
handoverRequestAckPdu =
......@@ -87,18 +93,22 @@ void HandoverRequestAck::setMessageType() {
}
}
//------------------------------------------------------------------------------
uint32_t HandoverRequestAck::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
else
return 0;
}
//------------------------------------------------------------------------------
OCTET_STRING_t HandoverRequestAck::getTargetToSource_TransparentContainer() {
if (TargetToSource_TransparentContainer)
return *TargetToSource_TransparentContainer;
return OCTET_STRING_t();
}
//------------------------------------------------------------------------------
bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
std::vector<PDUSessionResourceAdmittedItem_t>& list) {
if (!pduSessionResourceAdmittedList) return false;
......@@ -121,6 +131,7 @@ bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
return true;
}
//------------------------------------------------------------------------------
bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverRequestAckPdu = ngap_msg_pdu;
......@@ -226,14 +237,16 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverRequestAck::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestAckPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
//------------------------------------------------------------------------------
/* void HandoverRequestAck::setMessageType()
{
if (!handoverRequestAckPdu) handoverRequestAckPdu =
......
......@@ -54,8 +54,8 @@ class HandoverRequestAck {
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
void setMessageType(); // Initialize the PDU and populate the MessageType;
OCTET_STRING_t getTargetToSource_TransparentContainer();
......
......@@ -21,6 +21,8 @@
#include "HandoverRequiredMsg.hpp"
#include "logger.hpp"
#include "TAI.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "asn_codecs.h"
......@@ -32,12 +34,11 @@ extern "C" {
#include <iostream>
#include <vector>
#include "TAI.hpp"
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverRequiredMsg::HandoverRequiredMsg() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -50,8 +51,11 @@ HandoverRequiredMsg::HandoverRequiredMsg() {
handoverRequiredPdu = nullptr;
handoverRequiredIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverRequiredMsg::~HandoverRequiredMsg() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -59,6 +63,7 @@ unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
uint32_t HandoverRequiredMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -66,6 +71,7 @@ uint32_t HandoverRequiredMsg::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
if (handovertype)
return *handovertype;
......@@ -73,6 +79,7 @@ Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
return Ngap_HandoverType_t();
}
//------------------------------------------------------------------------------
Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
if (cause)
return cause->getChoiceOfCause();
......@@ -80,6 +87,7 @@ Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
return Ngap_Cause_PR();
}
//------------------------------------------------------------------------------
long HandoverRequiredMsg::getCauseValue() {
if (cause)
return cause->getValue();
......@@ -87,16 +95,19 @@ long HandoverRequiredMsg::getCauseValue() {
return 0;
}
//------------------------------------------------------------------------------
void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) {
if (ptr)
ptr->decodefromGlobalgNBId(
targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID);
}
//------------------------------------------------------------------------------
void HandoverRequiredMsg::getTAI(TAI*& ptr) {
if (ptr) ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI));
}
//------------------------------------------------------------------------------
OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
if (SourceToTarget_TransparentContainer)
return *SourceToTarget_TransparentContainer;
......@@ -104,6 +115,7 @@ OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
return OCTET_STRING_t();
}
//------------------------------------------------------------------------------
bool HandoverRequiredMsg::getPDUSessionResourceList(
std::vector<PDUSessionResourceItem_t>& list) {
if (!PDUSessionResourceList) return false;
......@@ -127,6 +139,7 @@ bool HandoverRequiredMsg::getPDUSessionResourceList(
return true;
}
//------------------------------------------------------------------------------
long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
if (directforwardingPathAvailability)
return *directforwardingPathAvailability;
......@@ -134,6 +147,7 @@ long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredPdu = ngap_msg_pdu;
......@@ -295,12 +309,12 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequiredPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequiredPdu, buf, buf_size);
// cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().error("er.encoded( %d )", er.encoded);
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......
......@@ -27,6 +27,7 @@
*/
#include "InitialContextSetupFailure.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -81,9 +82,9 @@ void InitialContextSetupFailureMsg::setMessageType() {
&(initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.InitialContextSetupFailure);
} else {
cout << "[warning] This information doesn't refer to "
"InitialContextSetupFailure Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to InitialContextSetupFailure "
"Message!");
}
}
......@@ -102,13 +103,13 @@ void InitialContextSetupFailureMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
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);
return;
}
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);
}
......@@ -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);
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);
return;
}
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);
}
......@@ -175,15 +177,15 @@ void InitialContextSetupFailureMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListCxtFail(
&ie->value.choice.PDUSessionResourceFailedToSetupListCxtFail);
if (!ret) {
cout << "encode PDUSessionResourceFailedToSetupListCxtFail IE error"
<< endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtFail IE error");
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceFailedToSetupListCxtFail IE error"
<< endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtFail IE error");
}
//------------------------------------------------------------------------------
......@@ -192,7 +194,7 @@ int InitialContextSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupFailurePdu, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -216,11 +218,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
&initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.InitialContextSetupFailure;
} else {
cout << "Check InitialContextSetupFailure message error!!!" << endl;
Logger::ngap().error("Check InitialContextSetupFailure message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0; i < initialContextSetupFailureIEs->protocolIEs.list.count;
......@@ -236,11 +238,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
initialContextSetupFailureIEs->protocolIEs.list.array[i]
->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;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -254,11 +256,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialContextSetupFailureIEs->protocolIEs.list.array[i]
->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;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -276,21 +278,22 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
.array[i]
->value.choice
.PDUSessionResourceFailedToSetupListCxtFail)) {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtFail "
"IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtFail IE "
"error");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtFail IE "
"error!"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtFail IE "
"error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP Message PDU error");
return false;
}
}
......@@ -307,7 +310,7 @@ unsigned long InitialContextSetupFailureMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t InitialContextSetupFailureMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -27,6 +27,7 @@
*/
#include "InitialContextSetupResponse.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -43,12 +44,12 @@ namespace ngap {
//------------------------------------------------------------------------------
InitialContextSetupResponseMsg::InitialContextSetupResponseMsg() {
initialContextSetupResponsePdu = NULL;
initialContextSetupResponseIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
pduSessionResourceSetupResponseList = NULL;
pduSessionResourceFailedToSetupResponseList = NULL;
initialContextSetupResponsePdu = nullptr;
initialContextSetupResponseIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
pduSessionResourceSetupResponseList = nullptr;
pduSessionResourceFailedToSetupResponseList = nullptr;
}
//------------------------------------------------------------------------------
......@@ -81,9 +82,9 @@ void InitialContextSetupResponseMsg::setMessageType() {
&(initialContextSetupResponsePdu->choice.successfulOutcome->value.choice
.InitialContextSetupResponse);
} else {
std::cout << "[Warning] This information doesn't refer to "
"InitialContextSetupResponse message!"
<< std::endl;
Logger::ngap().warn(
"This information doesn't refer to InitialContextSetupResponse "
"message!");
}
}
......@@ -102,13 +103,13 @@ void InitialContextSetupResponseMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
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);
return;
}
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);
}
......@@ -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);
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);
return;
}
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);
}
......@@ -170,16 +172,14 @@ void InitialContextSetupResponseMsg::setPduSessionResourceSetupResponseList(
->encode2PDUSessionResourceSetupListCxtRes(
&ie->value.choice.PDUSessionResourceSetupListCxtRes);
if (!ret) {
std::cout << "Encode PDUSessionResourceSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error("Encode PDUSessionResourceSetupListCxtRes IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0)
std::cout << "Encode PDUSessionResourceSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error("Encode PDUSessionResourceSetupListCxtRes IE error");
// free_wrapper((void**) &ie);
}
......@@ -221,16 +221,16 @@ void InitialContextSetupResponseMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListCxtRes(
&ie->value.choice.PDUSessionResourceFailedToSetupListCxtRes);
if (!ret) {
std::cout << "Encode PDUSessionResourceFailedToSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtRes IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0)
std::cout << "Encode PDUSessionResourceFailedToSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtRes IE error");
// free_wrapper((void**) &ie);
}
......@@ -240,7 +240,7 @@ int InitialContextSetupResponseMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupResponsePdu, buf,
buf_size);
std::cout << "er.encoded(" << er.encoded << ")" << std::endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -264,12 +264,13 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
&initialContextSetupResponsePdu->choice.successfulOutcome->value
.choice.InitialContextSetupResponse;
} else {
std::cout << "Check InitialContextSetupResponse message error!"
<< std::endl;
Logger::ngap().error("Check InitialContextSetupResponse message error");
return false;
}
} else {
std::cout << "MessageType error!" << std::endl;
Logger::ngap().error("MessageType error");
return false;
}
for (int i = 0; i < initialContextSetupResponseIEs->protocolIEs.list.count;
......@@ -286,11 +287,12 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
initialContextSetupResponseIEs->protocolIEs.list.array[i]
->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;
}
} 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;
}
} break;
......@@ -305,11 +307,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialContextSetupResponseIEs->protocolIEs.list.array[i]
->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;
}
} 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;
}
} break;
......@@ -326,14 +328,15 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
&initialContextSetupResponseIEs->protocolIEs.list
.array[i]
->value.choice.PDUSessionResourceSetupListCxtRes)) {
std::cout
<< "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListCxtRes IE error");
return false;
}
} else {
std::cout << "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListCxtRes IE error");
return false;
}
} break;
......@@ -351,21 +354,24 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
.array[i]
->value.choice
.PDUSessionResourceFailedToSetupListCxtRes)) {
std::cout << "Decoded NGAP "
"PDUSessionResourceFailedToSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes IE "
"error");
return false;
}
} else {
std::cout << "Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes "
"IE error!"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes IE "
"error");
return false;
}
} break;
default: {
std::cout << "Decoded NGAP message PDU error" << std::endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......@@ -382,7 +388,7 @@ unsigned long InitialContextSetupResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t InitialContextSetupResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -27,6 +27,7 @@
*/
#include "InitialUEMessage.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -44,14 +45,14 @@ namespace ngap {
//------------------------------------------------------------------------------
InitialUEMessageMsg::InitialUEMessageMsg() {
initialUEMessagePdu = NULL;
initialUEMessageIEs = NULL;
ranUeNgapId = NULL;
nasPdu = NULL;
userLocationInformation = NULL;
rRCEstablishmentCause = NULL;
uEContextRequest = NULL;
fivegSTmsi = NULL;
initialUEMessagePdu = nullptr;
initialUEMessageIEs = nullptr;
ranUeNgapId = nullptr;
nasPdu = nullptr;
userLocationInformation = nullptr;
rRCEstablishmentCause = nullptr;
uEContextRequest = nullptr;
fivegSTmsi = nullptr;
}
//------------------------------------------------------------------------------
......@@ -81,9 +82,8 @@ void InitialUEMessageMsg::setMessageType() {
initialUEMessageIEs = &(initialUEMessagePdu->choice.initiatingMessage->value
.choice.InitialUEMessage);
} else {
cout << "[warning] This information doesn't refer to InitialUEMessage "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to InitialUEMessage message!");
}
}
......@@ -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);
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);
return;
}
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);
}
......@@ -124,13 +125,13 @@ void InitialUEMessageMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) {
cout << "encode NAS_PDU IE error" << endl;
Logger::ngap().error("Encode NAS PDU IE error");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -169,13 +170,14 @@ void InitialUEMessageMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation);
if (!ret) {
cout << "encode UserLocationInformation IE error" << endl;
Logger::ngap().error("Encode UserLocationInformation IE error");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -196,13 +198,13 @@ void InitialUEMessageMsg::setRRCEstablishmentCause(
int ret = rRCEstablishmentCause->encode2RRCEstablishmentCause(
ie->value.choice.RRCEstablishmentCause);
if (!ret) {
cout << "encode RRCEstablishmentCause IE error" << endl;
Logger::ngap().error("Encode RRCEstablishmentCause IE error");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -224,13 +226,13 @@ void InitialUEMessageMsg::setUeContextRequest(
int ret = uEContextRequest->encode2UEContextRequest(
ie->value.choice.UEContextRequest);
if (!ret) {
cout << "encode UEContextRequest IE error" << endl;
Logger::ngap().error("Encode UEContextRequest IE error");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -239,7 +241,7 @@ int InitialUEMessageMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, initialUEMessagePdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
......@@ -259,11 +261,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
initialUEMessageIEs = &initialUEMessagePdu->choice.initiatingMessage
->value.choice.InitialUEMessage;
} else {
cout << "Check InitialUEMessage message error!!!" << endl;
Logger::ngap().error("Check InitialUEMessage message error");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("Check MessageType error");
return false;
}
for (int i = 0; i < initialUEMessageIEs->protocolIEs.list.count; i++) {
......@@ -277,13 +279,14 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialUEMessageIEs->protocolIEs.list.array[i]
->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;
}
cout << "[InitialUeMessage] Received RanUeNgapId "
<< ranUeNgapId->getRanUeNgapId() << endl;
Logger::ngap().debug(
"Received RanUeNgapId %d ", ranUeNgapId->getRanUeNgapId());
} else {
cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -296,11 +299,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!nasPdu->decodefromoctetstring(
initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.NAS_PDU)) {
cout << "Decoded NGAP NAS_PDU IE error" << endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} else {
cout << "Decoded NGAP NAS_PDU IE error" << endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} break;
......@@ -314,11 +317,12 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!userLocationInformation->decodefromUserLocationInformation(
&initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) {
cout << "Decoded NGAP UserLocationInformation IE error" << endl;
Logger::ngap().error(
"Decoded NGAP UserLocationInformation IE error");
return false;
}
} else {
cout << "Decoded NGAP UserLocationInformation IE error" << endl;
Logger::ngap().error("Decoded NGAP UserLocationInformation IE error");
return false;
}
} break;
......@@ -331,11 +335,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!rRCEstablishmentCause->decodefromRRCEstablishmentCause(
initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.RRCEstablishmentCause)) {
cout << "Decoded NGAP RRCEstablishmentCause IE error" << endl;
Logger::ngap().error("Decoded NGAP RRCEstablishmentCause IE error");
return false;
}
} else {
cout << "Decoded NGAP RRCEstablishmentCause IE error" << endl;
Logger::ngap().error("Decoded NGAP RRCEstablishmentCause IE error");
return false;
}
} break;
......@@ -348,11 +352,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!uEContextRequest->decodefromUEContextRequest(
initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.UEContextRequest)) {
cout << "Decoded NGAP UEContextRequest IE error" << endl;
Logger::ngap().error("Decoded NGAP UEContextRequest IE error");
return false;
}
} else {
cout << "Decoded NGAP UEContextRequest IE error" << endl;
Logger::ngap().error("Decoded NGAP UEContextRequest IE error");
return false;
}
} break;
......@@ -366,15 +370,16 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!fivegSTmsi->decodefrompdu(
initialUEMessageIEs->protocolIEs.list.array[i]
->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;
}
}
} break;
default: {
cout << "not decoded IE:"
<< initialUEMessageIEs->protocolIEs.list.array[i]->id << endl;
Logger::ngap().warn(
"Not decoded IE %d",
initialUEMessageIEs->protocolIEs.list.array[i]->id);
return true;
}
}
......
......@@ -27,6 +27,7 @@
*/
#include "NGReset.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
......@@ -73,9 +74,7 @@ void NGResetMsg::setMessageType() {
NgResetMessageTypeIE.encode2pdu(ngResetPdu);
ngResetIEs = &(ngResetPdu->choice.initiatingMessage->value.choice.NGReset);
} else {
cout << "[Warning] This information doesn't refer to NGReset "
"Message!!!"
<< endl;
Logger::ngap().warn("This information doesn't refer to NGReset message!");
}
}
......@@ -116,7 +115,7 @@ int NGResetMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngResetPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
......@@ -144,11 +143,11 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!cause->decodefromCause(
&ngResetIEs->protocolIEs.list.array[i]
->value.choice.Cause)) {
cout << "Decoded NGAP Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} else {
cout << "Decoded NGAP Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} break;
......@@ -160,28 +159,28 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
resetType = new ResetType();
if (!resetType->decode(&ngResetIEs->protocolIEs.list.array[i]
->value.choice.ResetType)) {
cout << "Decoded NGAP ResetType IE error" << endl;
Logger::ngap().error("Decoded NGAP ResetType IE error");
return false;
}
} else {
cout << "Decoded NGAP ResetType IE error" << endl;
Logger::ngap().error("Decoded NGAP ResetType IE error");
return false;
}
} break;
default: {
cout << "Decoded NGAP message PDU error" << endl;
Logger::ngap().error("Decoded NGAP message PDU IE error");
return false;
}
}
}
} else {
cout << "Check NGReset message error!!!";
Logger::ngap().error("Check NGReset message error!");
return false;
}
} else {
cout << "Check NGReset message error!!!";
Logger::ngap().error("Check NGReset message error!");
return false;
}
return true;
......
......@@ -27,6 +27,7 @@
*/
#include "NGSetupFailure.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -43,10 +44,10 @@ namespace ngap {
//------------------------------------------------------------------------------
NGSetupFailureMsg::NGSetupFailureMsg() {
ngSetupFailurePdu = NULL;
ngSetupFailureIEs = NULL;
cause = NULL;
timeToWait = NULL;
ngSetupFailurePdu = nullptr;
ngSetupFailureIEs = nullptr;
cause = nullptr;
timeToWait = nullptr;
// criticalityDiagnostics = NULL;
}
......@@ -74,9 +75,8 @@ void NGSetupFailureMsg::setMessageType() {
ngSetupFailureIEs = &(ngSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.NGSetupFailure);
} else {
cout << "[warning] This information doesn't refer to NGSetupFailure "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to NGSetupFailure message!");
}
}
......@@ -91,7 +91,7 @@ void NGSetupFailureMsg::addCauseIE() {
cause->encode2Cause(&ie->value.choice.Cause);
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() {
timeToWait->encode2TimeToWait(&ie->value.choice.TimeToWait);
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) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupFailurePdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
......@@ -238,11 +238,11 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ngSetupFailureIEs = &ngSetupFailurePdu->choice.initiatingMessage->value
.choice.NGSetupFailure;
} else {
cout << "Check NGSetupFailure message error!!!" << endl;
Logger::ngap().error("Check NGSetupFailure message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0; i < ngSetupFailureIEs->protocolIEs.list.count; i++) {
......@@ -256,11 +256,11 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!cause->decodefromCause(
&ngSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.Cause)) {
cout << "decoded ngap Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} else {
cout << "decoded ngap Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} break;
......@@ -273,19 +273,19 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!timeToWait->decodefromTimeToWait(
&ngSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.TimeToWait)) {
cout << "decoded ngap TimeToWait IE error" << endl;
Logger::ngap().error("Decoded NGAP TimeToWait IE error");
return false;
}
} else {
cout << "decoded ngap TimeToWait IE error" << endl;
Logger::ngap().error("Decoded NGAP TimeToWait IE error");
return false;
}
} break;
case Ngap_ProtocolIE_ID_id_CriticalityDiagnostics: {
cout << "decoded ngap: This is CriticalityDiagnostics IE" << endl;
Logger::ngap().debug("Decoded NGAP CriticalityDiagnostics IE ");
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......
......@@ -27,6 +27,7 @@
*/
#include "NGSetupRequest.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
......@@ -47,13 +48,13 @@ namespace ngap {
//------------------------------------------------------------------------------
NGSetupRequestMsg::NGSetupRequestMsg() {
ngSetupRequestPdu = NULL;
ngSetupRequestIEs = NULL;
ngSetupRequestPdu = nullptr;
ngSetupRequestIEs = nullptr;
globalRanNodeId = NULL;
ranNodeName = NULL;
supportedTAList = NULL;
defaultPagingDrx = NULL;
globalRanNodeId = nullptr;
ranNodeName = nullptr;
supportedTAList = nullptr;
defaultPagingDrx = nullptr;
}
//------------------------------------------------------------------------------
......@@ -79,9 +80,8 @@ void NGSetupRequestMsg::setMessageType() {
ngSetupRequestIEs = &(ngSetupRequestPdu->choice.initiatingMessage->value
.choice.NGSetupRequest);
} else {
cout << "[warning] This information doesn't refer to NGSetupRequest "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to NGSetupRequest message!");
}
}
......@@ -108,12 +108,12 @@ void NGSetupRequestMsg::setGlobalRanNodeID(
int ret = globalRanNodeIdIE.encode2GlobalRANNodeID(
&ie->value.choice.GlobalRANNodeID);
if (!ret) {
cout << "encode GlobalRANNodeID IE error" << endl;
Logger::ngap().error("Encode NGAP GlobalRANNodeID IE error");
return;
}
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) {
int ret = ranNodeNameIE.encode2RanNodeName(&ie->value.choice.RANNodeName);
if (!ret) {
cout << "encode RanNodeName IE error" << endl;
Logger::ngap().error("Encode NGAP RANNodeName IE error");
return;
}
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(
const std::vector<struct SupportedItem_s> list) {
if (list.size() == 0) {
cout << "[Warning] Setup failed, vector is empty!!!" << endl;
Logger::ngap().warn("Setup failed, vector is empty");
return;
}
......@@ -181,12 +181,12 @@ void NGSetupRequestMsg::setSupportedTAList(
int ret = supportedTAListIE.encode2SupportedTAList(
&ie->value.choice.SupportedTAList);
if (!ret) {
cout << "encode SupportedTAList IE error" << endl;
Logger::ngap().error("Encode SupportedTAList IE error");
return;
}
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) {
int ret =
defaultPagingDRXIE.encode2DefaultPagingDRX(ie->value.choice.PagingDRX);
if (!ret) {
cout << "encode DefaultPagingDRX IE error" << endl;
Logger::ngap().error("Encode DefaultPagingDRX IE error");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -218,7 +218,7 @@ int NGSetupRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupRequestPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
......@@ -247,11 +247,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!globalRanNodeId->decodefromGlobalRANNodeID(
&ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.GlobalRANNodeID)) {
cout << "Decoded NGAP GlobalRanNodeId IE error!" << endl;
Logger::ngap().error("Decoded NGAP GlobalRanNodeId IE error");
return false;
}
} else {
cout << "Decoded NGAP GlobalRanNodeId IE error" << endl;
Logger::ngap().error("Decoded NGAP GlobalRanNodeId IE error");
return false;
}
} break;
......@@ -264,11 +264,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranNodeName->decodefromRanNodeName(
&ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.RANNodeName)) {
cout << "Decoded NGAP RanNodeName IE error" << endl;
Logger::ngap().error("Decoded NGAP RanNodeName IE error");
return false;
}
} else {
cout << "Decoded NGAP RanNodeName IE error" << endl;
Logger::ngap().error("Decoded NGAP RanNodeName IE error");
return false;
}
} break;
......@@ -281,11 +281,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!supportedTAList->decodefromSupportedTAList(
&ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.SupportedTAList)) {
cout << "Decoded NGAP SupportedTAList IE error" << endl;
Logger::ngap().error("Decoded NGAP SupportedTAList IE error");
return false;
}
} else {
cout << "Decoded NGAP SupportedTAList IE error" << endl;
Logger::ngap().error("Decoded NGAP SupportedTAList IE error");
return false;
}
} break;
......@@ -298,26 +298,26 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!defaultPagingDrx->decodefromDefaultPagingDRX(
ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.PagingDRX)) {
cout << "Decoded NGAP DefaultPagingDRX IE error" << endl;
Logger::ngap().error("Decoded NGAP DefaultPagingDRX IE error");
return false;
}
} else {
cout << "Decoded NGAP DefaultPagingDRX IE error" << endl;
Logger::ngap().error("Decoded NGAP DefaultPagingDRX IE error");
return false;
}
} break;
default: {
cout << "Decoded NGAP message PDU error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
}
} else {
cout << "Check NGSetupRequest message error!!!";
Logger::ngap().error("Check NGSetupRequest message error");
return false;
}
} else {
cout << "Check NGSetupRequest message error!!!";
Logger::ngap().error("Check NGSetupRequest message error");
return false;
}
return true;
......
......@@ -70,7 +70,6 @@ class NGSetupRequestMsg {
Ngap_NGAP_PDU_t* ngSetupRequestPdu;
Ngap_NGSetupRequest_t* ngSetupRequestIEs;
/***************** for decoding ****************/
GlobalRanNodeId* globalRanNodeId;
RanNodeName* ranNodeName;
SupportedTAList* supportedTAList;
......
......@@ -27,6 +27,7 @@
*/
#include "NGSetupResponse.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -43,13 +44,13 @@ namespace ngap {
//------------------------------------------------------------------------------
NGSetupResponseMsg::NGSetupResponseMsg() {
ngSetupResponsePdu = NULL;
ngSetupResponsIEs = NULL;
amfName = NULL;
servedGUAMIList = NULL;
relativeAmfCapacity = NULL;
plmnSupportList = NULL;
// criticalityDiagnostics = NULL;
ngSetupResponsePdu = nullptr;
ngSetupResponsIEs = nullptr;
amfName = nullptr;
servedGUAMIList = nullptr;
relativeAmfCapacity = nullptr;
plmnSupportList = nullptr;
// criticalityDiagnostics = nullptr;
}
//------------------------------------------------------------------------------
......@@ -75,9 +76,8 @@ void NGSetupResponseMsg::setMessageType() {
ngSetupResponsIEs = &(ngSetupResponsePdu->choice.successfulOutcome->value
.choice.NGSetupResponse);
} else {
cout << "[warning] This information doesn't refer to NGSetupRespons "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to NGSetupRespons message!");
}
}
......@@ -94,12 +94,12 @@ void NGSetupResponseMsg::setAMFName(const std::string name) {
int ret = amfName->encode2AmfName(&ie->value.choice.AMFName);
if (!ret) {
cout << "encode AmfName IE error" << endl;
Logger::ngap().error("Encode NGAP AMFName IE error");
return;
}
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) {
servedGUAMIList->encode2ServedGUAMIList(&ie->value.choice.ServedGUAMIList);
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) {
&ie->value.choice.RelativeAMFCapacity);
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(
plmnSupportList->encode2PLMNSupportList(&ie->value.choice.PLMNSupportList);
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) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupResponsePdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
......@@ -220,13 +221,13 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ngSetupResponsIEs = &ngSetupResponsePdu->choice.successfulOutcome->value
.choice.NGSetupResponse;
} else {
cout << "Check NGSetupResponse message error!!!" << endl;
Logger::ngap().error("Check NGSetupResponse message error");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
cout << "ngSetupResponsePdu->present == " << ngSetupResponsePdu->present
<< endl;
Logger::ngap().error(
"MessageType error, ngSetupResponsePdu->present %d",
ngSetupResponsePdu->present);
return false;
}
for (int i = 0; i < ngSetupResponsIEs->protocolIEs.list.count; i++) {
......@@ -240,11 +241,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfName->decodefromAmfName(
&ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.AMFName)) {
cout << "decoded ngap AmfName IE error" << endl;
Logger::ngap().error("Decoded NGAP AMFName error");
return false;
}
} else {
cout << "decoded ngap AmfName IE error" << endl;
Logger::ngap().error("Decoded NGAP AMFName error");
return false;
}
} break;
......@@ -257,11 +258,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!servedGUAMIList->decodefromServedGUAMIList(
&ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.ServedGUAMIList)) {
cout << "decoded ngap ServedGUAMIList IE error!" << endl;
Logger::ngap().error("Decoded NGAP ServedGUAMIList error");
return false;
}
} else {
cout << "decoded ngap ServedGUAMIList IE error" << endl;
Logger::ngap().error("Decoded NGAP ServedGUAMIList error");
return false;
}
} break;
......@@ -274,11 +275,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!relativeAmfCapacity->decodefromRelativeAMFCapacity(
&ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.RelativeAMFCapacity)) {
cout << "decoded ngap RelativeAMFCapacity IE error" << endl;
Logger::ngap().error("Decoded NGAP RelativeAMFCapacity error");
return false;
}
} else {
cout << "decoded ngap RelativeAMFCapacity IE error" << endl;
Logger::ngap().error("Decoded NGAP RelativeAMFCapacity error");
return false;
}
} break;
......@@ -291,19 +292,20 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!plmnSupportList->decodefromPLMNSupportList(
&ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.PLMNSupportList)) {
cout << "decoded ngap PLMNSupportList IE error" << endl;
Logger::ngap().error("Decoded NGAP PLMNSupportList error");
return false;
}
} else {
cout << "decoded ngap PLMNSupportList IE error!" << endl;
Logger::ngap().error("Decoded NGAP PLMNSupportList error");
return false;
}
} break;
case Ngap_ProtocolIE_ID_id_CriticalityDiagnostics: {
cout << "decoded ngap: This is CriticalityDiagnostics IE" << endl;
Logger::ngap().debug("Decoded NGAP CriticalityDiagnostics");
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP Message PDU error");
return false;
}
}
......
......@@ -69,8 +69,6 @@ class NGSetupResponseMsg {
Ngap_NGAP_PDU_t* ngSetupResponsePdu;
Ngap_NGSetupResponse_t* ngSetupResponsIEs;
/***************** for decoding ****************/
AmfName* amfName;
ServedGUAMIList* servedGUAMIList;
RelativeAMFCapacity* relativeAmfCapacity;
......
......@@ -46,13 +46,13 @@ namespace ngap {
//------------------------------------------------------------------------------
PduSessionResourceReleaseCommandMsg::PduSessionResourceReleaseCommandMsg() {
pduSessionResourceReleaseCommandPdu = NULL;
pduSessionResourceReleaseCommandIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
ranPagingPriority = NULL;
nasPdu = NULL;
pduSessionResourceToReleaseList = NULL;
pduSessionResourceReleaseCommandPdu = nullptr;
pduSessionResourceReleaseCommandIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
ranPagingPriority = nullptr;
nasPdu = nullptr;
pduSessionResourceToReleaseList = nullptr;
}
//------------------------------------------------------------------------------
......@@ -431,7 +431,7 @@ unsigned long PduSessionResourceReleaseCommandMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t PduSessionResourceReleaseCommandMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -45,12 +45,12 @@ namespace ngap {
//------------------------------------------------------------------------------
PduSessionResourceReleaseResponseMsg::PduSessionResourceReleaseResponseMsg() {
pduSessionResourceReleaseResponsePdu = NULL;
pduSessionResourceReleaseResponseIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
pduSessionResourceReleasedList = NULL;
userLocationInformation = NULL;
pduSessionResourceReleaseResponsePdu = nullptr;
pduSessionResourceReleaseResponseIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
pduSessionResourceReleasedList = nullptr;
userLocationInformation = nullptr;
}
//------------------------------------------------------------------------------
......@@ -380,7 +380,7 @@ unsigned long PduSessionResourceReleaseResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t PduSessionResourceReleaseResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -28,6 +28,8 @@
#include "PduSessionResourceSetupResponse.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
#include "constr_TYPE.h"
......@@ -44,12 +46,12 @@ namespace ngap {
//------------------------------------------------------------------------------
PduSessionResourceSetupResponseMsg::PduSessionResourceSetupResponseMsg() {
pduSessionResourceSetupResponsePdu = NULL;
pduSessionResourceSetupResponseIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
pduSessionResourceSetupResponseList = NULL;
pduSessionResourceFailedToSetupResponseList = NULL;
pduSessionResourceSetupResponsePdu = nullptr;
pduSessionResourceSetupResponseIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
pduSessionResourceSetupResponseList = nullptr;
pduSessionResourceFailedToSetupResponseList = nullptr;
}
//------------------------------------------------------------------------------
......@@ -83,9 +85,9 @@ void PduSessionResourceSetupResponseMsg::setMessageType() {
&(pduSessionResourceSetupResponsePdu->choice.successfulOutcome->value
.choice.PDUSessionResourceSetupResponse);
} else {
cout << "[warning] This information doesn't refer to "
"PDUSessionResourceSetupResponse Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to PDUSessionResourceSetupResponse "
"message!");
}
}
......@@ -104,14 +106,14 @@ void PduSessionResourceSetupResponseMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
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);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -131,14 +133,14 @@ void PduSessionResourceSetupResponseMsg::setRanUeNgapId(
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
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);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -175,14 +177,17 @@ void PduSessionResourceSetupResponseMsg::setPduSessionResourceSetupResponseList(
->encode2PDUSessionResourceSetupListSURes(
&ie->value.choice.PDUSessionResourceSetupListSURes);
if (!ret) {
cout << "encode PDUSessionResourceSetupListSURes IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceSetupListSURes IE error");
return;
}
ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceSetupListSURes IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceSetupListSURes IE error");
}
//------------------------------------------------------------------------------
......@@ -222,14 +227,16 @@ void PduSessionResourceSetupResponseMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListSURes(
&ie->value.choice.PDUSessionResourceFailedToSetupListSURes);
if (!ret) {
cout << "encode PDUSessionResourceFailedToSetupListSURes IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceFailedToSetupListSURes IE error");
return;
}
ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceFailedToSetupListSURes IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceFailedToSetupListSURes IE error");
}
//------------------------------------------------------------------------------
......@@ -240,7 +247,7 @@ int PduSessionResourceSetupResponseMsg::encode2buffer(
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, pduSessionResourceSetupResponsePdu, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......@@ -267,11 +274,12 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
&pduSessionResourceSetupResponsePdu->choice.successfulOutcome->value
.choice.PDUSessionResourceSetupResponse;
} else {
cout << "Check PDUSessionResourceSetupResponse message error!!!" << endl;
Logger::ngap().error(
"Check PDUSessionResourceSetupResponse message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0;
......@@ -288,11 +296,11 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
pduSessionResourceSetupResponseIEs->protocolIEs.list.array[i]
->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;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error!");
return false;
}
} break;
......@@ -307,11 +315,11 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
pduSessionResourceSetupResponseIEs->protocolIEs.list.array[i]
->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;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error!");
return false;
}
} break;
......@@ -328,13 +336,13 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
&pduSessionResourceSetupResponseIEs->protocolIEs.list
.array[i]
->value.choice.PDUSessionResourceSetupListSURes)) {
cout << "decoded ngap PDUSessionResourceSetupListSURes IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListSURes IE error!");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceSetupListSURes IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListSURes IE error!");
return false;
}
} break;
......@@ -352,21 +360,21 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
.array[i]
->value.choice
.PDUSessionResourceFailedToSetupListSURes)) {
cout << "decoded ngap PDUSessionResourceFailedToSetupListSURes IE "
"error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListSURes IE "
"error!");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceFailedToSetupListSURes IE "
"error!"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListSURes IE "
"error!");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error!");
return false;
}
}
......@@ -383,7 +391,7 @@ unsigned long PduSessionResourceSetupResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t PduSessionResourceSetupResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -28,6 +28,8 @@
#include "UEContextReleaseCommand.hpp"
#include "logger.hpp"
#include <iostream>
extern "C" {
#include "Ngap_UE-NGAP-ID-pair.h"
......@@ -85,12 +87,13 @@ void UEContextReleaseCommandMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(
ie->value.choice.UE_NGAP_IDs.choice.aMF_UE_NGAP_ID);
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);
return;
}
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);
}
......@@ -113,19 +116,19 @@ void UEContextReleaseCommandMsg::setUeNgapIdPair(
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(
ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->aMF_UE_NGAP_ID);
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);
return;
}
ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(
ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->rAN_UE_NGAP_ID);
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);
return;
}
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);
}
......@@ -155,7 +158,7 @@ void UEContextReleaseCommandMsg::addCauseIE() {
ie->value.present = Ngap_UEContextReleaseCommand_IEs__value_PR_Cause;
causeValue->encode2Cause(&ie->value.choice.Cause);
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) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu);
asn_enc_rval_t er =
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;
}
......
......@@ -28,6 +28,8 @@
#include "UEContextReleaseComplete.hpp"
#include "logger.hpp"
#include <iostream>
#include <memory>
......@@ -82,12 +84,12 @@ void UEContextReleaseCompleteMsg::setAmfUeNgapId(unsigned long id) {
Ngap_UEContextReleaseComplete_IEs__value_PR_AMF_UE_NGAP_ID;
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
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);
return;
}
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);
}
......@@ -110,12 +112,12 @@ void UEContextReleaseCompleteMsg::setRanUeNgapId(uint32_t 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);
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);
return;
}
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);
}
......@@ -161,12 +163,13 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation);
if (!ret) {
cout << "encode UserLocationInformation IE error" << endl;
Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -209,7 +212,7 @@ int UEContextReleaseCompleteMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu);
asn_enc_rval_t er =
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;
}
......@@ -226,12 +229,13 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ies =
&pdu->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
} else {
cout << "Check UEContextReleaseComplete message error" << endl;
Logger::ngap().error("Check UEContextReleaseComplete message error");
return false;
}
} else {
cout << "typeOfMessage of UEContextReleaseComplete is not SuccessfulOutcome"
<< endl;
Logger::ngap().error(
"TypeOfMessage of UEContextReleaseComplete is not SuccessfulOutcome");
return false;
}
// TODO
......@@ -247,11 +251,11 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
ies->protocolIEs.list.array[i]
->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;
}
} else {
cout << "IE AMF_UE_NGAP_ID is not correct" << endl;
Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -264,11 +268,11 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
ies->protocolIEs.list.array[i]
->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;
}
} else {
cout << "IE RAN_UE_NGAP_ID is not correct" << endl;
Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......
......@@ -28,6 +28,8 @@
#include "UEContextReleaseRequest.hpp"
#include "logger.hpp"
#include <iostream>
extern "C" {
#include "asn_codecs.h"
......@@ -79,12 +81,12 @@ void UEContextReleaseRequestMsg::setAmfUeNgapId(unsigned long 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);
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);
return;
}
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);
}
......@@ -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;
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
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);
return;
}
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);
}
......@@ -137,7 +139,7 @@ int UEContextReleaseRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu);
asn_enc_rval_t er =
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;
}
......@@ -154,12 +156,13 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ies =
&pdu->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
} else {
cout << "Check UEContextReleaseRequest message error" << endl;
Logger::ngap().error("Check UEContextReleaseRequest message error");
return false;
}
} else {
cout << "typeOfMessage of UEContextReleaseRequest is not initiatingMessage"
<< endl;
Logger::ngap().error(
"TypeOfMessage of UEContextReleaseRequest is not initiatingMessage");
return false;
}
for (int i = 0; i < ies->protocolIEs.list.count; i++) {
......@@ -173,11 +176,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
ies->protocolIEs.list.array[i]
->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;
}
} else {
cout << "IE AMF_UE_NGAP_ID is not correct" << endl;
Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -190,11 +193,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
ies->protocolIEs.list.array[i]
->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;
}
} else {
cout << "IE RAN_UE_NGAP_ID is not correct" << endl;
Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -206,11 +209,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
causeValue = new Cause();
if (!causeValue->decodefromCause(
&ies->protocolIEs.list.array[i]->value.choice.Cause)) {
cout << "decode Cause error" << endl;
Logger::ngap().error("Decode NGAP Cause IE error");
return false;
}
} else {
cout << "IE Cause is not correct" << endl;
Logger::ngap().error("Decode NGAP Cause IE error");
return false;
}
} break;
......@@ -223,7 +226,7 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
bool UEContextReleaseRequestMsg::getCauseRadioNetwork(
e_Ngap_CauseRadioNetwork& causeRadioNetwork) {
if (causeValue->getValue() < 0) {
cout << "Get Cause value from UEContextReleaseRequest Error!!!" << endl;
Logger::ngap().error("Get Cause value from UEContextReleaseRequest Error");
return false;
}
causeRadioNetwork = (e_Ngap_CauseRadioNetwork) causeValue->getValue();
......
......@@ -27,6 +27,7 @@
*/
#include "UERadioCapabilityInfoIndication.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -44,12 +45,12 @@ namespace ngap {
//------------------------------------------------------------------------------
UeRadioCapabilityInfoIndicationMsg::UeRadioCapabilityInfoIndicationMsg() {
ueRadioCapabilityInfoIndicationPdu = NULL;
ueRadioCapabilityInfoIndicationIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
ueRadioCapability = NULL;
ueRadioCapabilityForPaging = NULL;
ueRadioCapabilityInfoIndicationPdu = nullptr;
ueRadioCapabilityInfoIndicationIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
ueRadioCapability = nullptr;
ueRadioCapabilityForPaging = nullptr;
}
//------------------------------------------------------------------------------
......@@ -83,9 +84,9 @@ void UeRadioCapabilityInfoIndicationMsg::setMessageType() {
&(ueRadioCapabilityInfoIndicationPdu->choice.initiatingMessage->value
.choice.UERadioCapabilityInfoIndication);
} else {
cout << "[warning] This information doesn't refer to "
"UERadioCapabilityInfoIndication Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to UERadioCapabilityInfoIndication "
"message!");
}
}
......@@ -104,14 +105,14 @@ void UeRadioCapabilityInfoIndicationMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
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);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -131,14 +132,14 @@ void UeRadioCapabilityInfoIndicationMsg::setRanUeNgapId(
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
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);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -160,14 +161,14 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapability(
int ret = ueRadioCapability->encode2UERadioCapability(
ie->value.choice.UERadioCapability);
if (!ret) {
cout << "encode UERadioCapability IE error" << endl;
Logger::ngap().error("Encode NGAP UERadioCapability IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -176,8 +177,9 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapabilityForPaging(
uint8_t* nr, size_t sizeofnr, uint8_t* eutra, size_t sizeofeutra) {
if (!ueRadioCapabilityForPaging)
ueRadioCapabilityForPaging = new UERadioCapabilityForPaging();
UERadioCapabilityForPagingOfNR* m_ueRadioCapabilityForPagingOfNR = NULL;
UERadioCapabilityForPagingOfEUTRA* m_ueRadioCapabilityForPagingOfEUTRA = NULL;
UERadioCapabilityForPagingOfNR* m_ueRadioCapabilityForPagingOfNR = nullptr;
UERadioCapabilityForPagingOfEUTRA* m_ueRadioCapabilityForPagingOfEUTRA =
nullptr;
if (nr && sizeofnr > 0) {
m_ueRadioCapabilityForPagingOfNR = new UERadioCapabilityForPagingOfNR();
m_ueRadioCapabilityForPagingOfNR->setUERadioCapabilityForPagingOfNR(
......@@ -203,14 +205,15 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapabilityForPaging(
int ret = ueRadioCapabilityForPaging->encode2UERadioCapabilityForPaging(
&ie->value.choice.UERadioCapabilityForPaging);
if (!ret) {
cout << "encode UERadioCapabilityForPaging IE error" << endl;
Logger::ngap().error("Encode NGAP UERadioCapabilityForPaging IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -222,7 +225,7 @@ int UeRadioCapabilityInfoIndicationMsg::encode2buffer(
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ueRadioCapabilityInfoIndicationPdu, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......@@ -247,11 +250,12 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
&ueRadioCapabilityInfoIndicationPdu->choice.initiatingMessage->value
.choice.UERadioCapabilityInfoIndication;
} else {
cout << "Check UERadioCapabilityInfoIndication message error!!!" << endl;
Logger::ngap().error(
"Check UERadioCapabilityInfoIndication message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0;
......@@ -267,11 +271,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i]
->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;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -285,11 +289,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i]
->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;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -303,11 +307,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
if (!ueRadioCapability->decodefromUERadioCapability(
ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i]
->value.choice.UERadioCapability)) {
cout << "decoded ngap UERadioCapability IE error" << endl;
Logger::ngap().error("Decoded NGAP UERadioCapability IE error");
return false;
}
} else {
cout << "decoded ngap UERadioCapability IE error" << endl;
Logger::ngap().error("Decoded NGAP UERadioCapability IE error");
return false;
}
} break;
......@@ -322,16 +326,18 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list
.array[i]
->value.choice.UERadioCapabilityForPaging)) {
cout << "decoded ngap UERadioCapabilityForPaging IE error" << endl;
Logger::ngap().error(
"Decoded NGAP UERadioCapabilityForPaging IE error");
return false;
}
} else {
cout << "decoded ngap UERadioCapabilityForPaging IE error" << endl;
Logger::ngap().error(
"Decoded NGAP UERadioCapabilityForPaging IE error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......
......@@ -27,6 +27,7 @@
*/
#include "UplinkNASTransport.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -43,12 +44,12 @@ namespace ngap {
//------------------------------------------------------------------------------
UplinkNASTransportMsg::UplinkNASTransportMsg() {
uplinkNASTransportPdu = NULL;
uplinkNASTransportIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
nasPdu = NULL;
userLocationInformation = NULL;
uplinkNASTransportPdu = nullptr;
uplinkNASTransportIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
nasPdu = nullptr;
userLocationInformation = nullptr;
}
//------------------------------------------------------------------------------
......@@ -78,9 +79,8 @@ void UplinkNASTransportMsg::setMessageType() {
uplinkNASTransportIEs = &(uplinkNASTransportPdu->choice.initiatingMessage
->value.choice.UplinkNASTransport);
} else {
std::cout << "[Warning] This information doesn't refer to "
"UplinkNASTransport Message!"
<< std::endl;
Logger::ngap().warn(
"This information doesn't refer to UplinkNASTransport message!");
}
}
......@@ -97,13 +97,13 @@ void UplinkNASTransportMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
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);
return;
}
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);
}
......@@ -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);
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);
return;
}
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);
}
......@@ -144,13 +144,13 @@ void UplinkNASTransportMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) {
std::cout << "Encode NAS_PDU IE error" << std::endl;
Logger::ngap().error("Encode NGAP NAS_PDU IE error");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -189,14 +189,14 @@ void UplinkNASTransportMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation);
if (!ret) {
std::cout << "Encode UserLocationInformation IE error" << std::endl;
Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0)
std::cout << "Encode UserLocationInformation IE error" << std::endl;
Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
// free_wrapper((void**) &ie);
}
......@@ -205,7 +205,7 @@ int UplinkNASTransportMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, uplinkNASTransportPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&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;
}
......@@ -225,11 +225,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
uplinkNASTransportIEs = &uplinkNASTransportPdu->choice.initiatingMessage
->value.choice.UplinkNASTransport;
} else {
std::cout << "Check UplinkNASTransport message error!!!" << std::endl;
Logger::ngap().error("Check UplinkNASTransport message error!");
return false;
}
} else {
std::cout << "MessageType error!!!" << std::endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0; i < uplinkNASTransportIEs->protocolIEs.list.count; i++) {
......@@ -243,11 +243,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
uplinkNASTransportIEs->protocolIEs.list.array[i]
->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;
}
} 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;
}
} break;
......@@ -260,11 +260,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
uplinkNASTransportIEs->protocolIEs.list.array[i]
->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;
}
} 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;
}
} break;
......@@ -277,11 +277,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!nasPdu->decodefromoctetstring(
uplinkNASTransportIEs->protocolIEs.list.array[i]
->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;
}
} else {
std::cout << "decoded ngap NAS_PDU IE error" << std::endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} break;
......@@ -294,19 +294,18 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!userLocationInformation->decodefromUserLocationInformation(
&uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) {
std::cout << "decoded ngap UserLocationInformation IE error"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP UserLocationInformation IE error");
return false;
}
} else {
std::cout << "decoded ngap UserLocationInformation IE error"
<< std::endl;
Logger::ngap().error("Decoded NGAP UserLocationInformation IE error");
return false;
}
} break;
default: {
std::cout << "decoded ngap message pdu error" << std::endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......
......@@ -27,12 +27,15 @@
*/
#include "UplinkRANStatusTransfer.hpp"
#include "logger.hpp"
#include <iostream>
#include <vector>
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
UplinkRANStatusTransfer::UplinkRANStatusTransfer() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -41,8 +44,10 @@ UplinkRANStatusTransfer::UplinkRANStatusTransfer() {
UplinkRANStatusTransferIEs = nullptr;
}
//------------------------------------------------------------------------------
UplinkRANStatusTransfer::~UplinkRANStatusTransfer() {}
//------------------------------------------------------------------------------
unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -50,6 +55,7 @@ unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
uint32_t UplinkRANStatusTransfer::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -57,6 +63,7 @@ uint32_t UplinkRANStatusTransfer::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer(
RANStatusTransferTransparentContainer*&
ranstatustransfer_transparentcontainer) {
......@@ -64,6 +71,7 @@ void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer(
ranStatusTransfer_TransparentContainer;
}
//------------------------------------------------------------------------------
bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
UplinkRANStatusTransferPDU = ngap_msg_pdu;
if (UplinkRANStatusTransferPDU->present ==
......@@ -79,11 +87,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
&UplinkRANStatusTransferPDU->choice.initiatingMessage->value.choice
.UplinkRANStatusTransfer;
} else {
cout << "Check uplinkranstatustransfer message error!!!" << endl;
Logger::ngap().error("Check UplinkRANStatusTransfer message error");
return false;
}
} else {
cout << "uplinkranstatustransfer message type error" << endl;
Logger::ngap().error("UplinkRANStatusTransfer message type error");
return false;
}
for (int i = 0; i < UplinkRANStatusTransferIEs->protocolIEs.list.count; i++) {
......@@ -98,11 +106,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
UplinkRANStatusTransferIEs->protocolIEs.list.array[i]
->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;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -116,11 +124,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
UplinkRANStatusTransferIEs->protocolIEs.list.array[i]
->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;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -137,20 +145,19 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
&UplinkRANStatusTransferIEs->protocolIEs.list.array[i]
->value.choice
.RANStatusTransfer_TransparentContainer)) {
cout << "decoded ngap ranStatusTransfer_TransparentContainer error"
<< endl;
Logger::ngap().error(
"Decoded NGAP RANStatusTransfer_TransparentContainer IE error");
return false;
}
cout << "can get the buffer of RANStatusTransfer_TransparentContainer"
<< endl;
Logger::ngap().error(
"Decoded NGAP RANStatusTransfer_TransparentContainer IE error");
} else {
cout << "cann't get the buffer of "
"RANStatusTransfer_TransparentContainer"
<< endl;
Logger::ngap().error(
"Decoded NGAP RANStatusTransfer_TransparentContainer IE error");
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......
......@@ -43,8 +43,8 @@ class UplinkRANStatusTransfer {
public:
UplinkRANStatusTransfer();
virtual ~UplinkRANStatusTransfer();
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
void getRANStatusTransfer_TransparentContainer(
RANStatusTransferTransparentContainer*&
ranstatustransfer_transparentcontainer);
......
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