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

Update NGAP messages

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