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

Merge branch 'fix_n2_ho' into 'develop'

Fix n2 ho

See merge request oai/cn5g/oai-cn5g-amf!48
parents e975eb79 5103c14a
...@@ -58,29 +58,32 @@ namespace config { ...@@ -58,29 +58,32 @@ namespace config {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
amf_config::amf_config() { amf_config::amf_config() {
nrf_addr.ipv4_addr.s_addr = INADDR_ANY; nrf_addr.ipv4_addr.s_addr = INADDR_ANY;
nrf_addr.port = 80; nrf_addr.port = 80;
nrf_addr.api_version = "v1"; nrf_addr.api_version = "v1";
enable_nf_registration = false; ausf_addr.ipv4_addr.s_addr = INADDR_ANY;
enable_smf_selection = false; ausf_addr.port = 80;
enable_external_ausf = false; ausf_addr.api_version = "v1";
enable_external_udm = false; enable_nf_registration = false;
instance = 0; enable_smf_selection = false;
n2 = {}; enable_external_ausf = false;
n11 = {}; enable_external_udm = false;
statistics_interval = 0; instance = 0;
guami = {}; n2 = {};
guami_list = {}; n11 = {};
relativeAMFCapacity = 0; statistics_interval = 0;
plmn_list = {}; guami = {};
auth_conf auth_para = {}; guami_list = {};
nas_cfg = {}; relativeAMFCapacity = 0;
smf_pool = {}; plmn_list = {};
enable_nf_registration = false; auth_conf auth_para = {};
enable_smf_selection = false; nas_cfg = {};
enable_external_ausf = false; smf_pool = {};
enable_external_udm = false; enable_nf_registration = false;
use_fqdn_dns = false; enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
use_fqdn_dns = false;
struct { struct {
struct in_addr ipv4_addr; struct in_addr ipv4_addr;
......
...@@ -1291,7 +1291,7 @@ bool amf_n1::get_authentication_vectors_from_ausf( ...@@ -1291,7 +1291,7 @@ bool amf_n1::get_authentication_vectors_from_ausf(
Logger::amf_n1().debug("********* has auts *********"); Logger::amf_n1().debug("********* has auts *********");
char* auts_s = (char*) malloc(auts_len * 2 + 1); char* auts_s = (char*) malloc(auts_len * 2 + 1);
// char *rand_s = (char *)malloc(RAND_LENGTH * 2 + 1); // char *rand_s = (char *)malloc(RAND_LENGTH * 2 + 1);
memset(auts_s, 0, sizeof(auts_s)); memset(auts_s, 0, auts_len * 2);
// memset(rand_s, 0, sizeof(rand_s)); // memset(rand_s, 0, sizeof(rand_s));
// uint8_t rand_value[RAND_LENGTH]; // uint8_t rand_value[RAND_LENGTH];
......
...@@ -210,29 +210,31 @@ void amf_n11::handle_itti_message( ...@@ -210,29 +210,31 @@ void amf_n11::handle_itti_message(
Logger::amf_n11().debug("SMF URI: %s", remote_uri.c_str()); Logger::amf_n11().debug("SMF URI: %s", remote_uri.c_str());
std::string n2SmMsg = {};
nlohmann::json pdu_session_update_request = {}; nlohmann::json pdu_session_update_request = {};
// if (itti_msg.is_n2sm_set){ if (itti_msg.is_n2sm_set) {
pdu_session_update_request["n2SmInfoType"] = itti_msg.n2sm_info_type; pdu_session_update_request["n2SmInfoType"] = itti_msg.n2sm_info_type;
pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg"; pdu_session_update_request["n2SmInfo"]["contentId"] = "n2msg";
std::string json_part = pdu_session_update_request.dump(); octet_stream_2_hex_stream(
std::string n2SmMsg = {}; (uint8_t*) bdata(itti_msg.n2sm), blength(itti_msg.n2sm), n2SmMsg);
octet_stream_2_hex_stream( }
(uint8_t*) bdata(itti_msg.n2sm), blength(itti_msg.n2sm), n2SmMsg);
// For N2 HO // For N2 HO
if (itti_msg.n2sm_info_type.compare("HANDOVER_REQUIRED") == 0) { if (itti_msg.ho_state.compare("PREPARING") == 0) {
pdu_session_update_request["hoState"] = "PREPARING"; pdu_session_update_request["hoState"] = "PREPARING";
} else if (itti_msg.n2sm_info_type.compare("HANDOVER_REQ_ACK") == 0) { } else if (itti_msg.ho_state.compare("PREPARED") == 0) {
pdu_session_update_request["hoState"] = "PREPARED"; pdu_session_update_request["hoState"] = "PREPARED";
} else if (itti_msg.n2sm_info_type.compare("SECONDARY_RAT_USAGE") == 0) { } else if (itti_msg.ho_state.compare("COMPLETED") == 0) {
pdu_session_update_request["hoState"] = "COMPLETED"; pdu_session_update_request["hoState"] = "COMPLETED";
} }
std::string json_part = pdu_session_update_request.dump();
curl_http_client( curl_http_client(
remote_uri, json_part, "", n2SmMsg, supi, itti_msg.pdu_session_id, remote_uri, json_part, "", n2SmMsg, supi, itti_msg.pdu_session_id,
itti_msg.promise_id); itti_msg.promise_id);
stacs.display(); // stacs.display();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -516,6 +518,7 @@ void amf_n11::curl_http_client( ...@@ -516,6 +518,7 @@ void amf_n11::curl_http_client(
mime_parser parser = {}; mime_parser parser = {};
std::string body = {}; std::string body = {};
std::shared_ptr<pdu_session_context> psc = {}; std::shared_ptr<pdu_session_context> psc = {};
bool is_multipart = true;
if (!amf_app_inst->find_pdu_session_context(supi, pdu_session_id, psc)) { if (!amf_app_inst->find_pdu_session_context(supi, pdu_session_id, psc)) {
Logger::amf_n11().warn( Logger::amf_n11().warn(
...@@ -537,6 +540,9 @@ void amf_n11::curl_http_client( ...@@ -537,6 +540,9 @@ void amf_n11::curl_http_client(
parser.create_multipart_related_content( parser.create_multipart_related_content(
body, jsonData, CURL_MIME_BOUNDARY, n2SmMsg, body, jsonData, CURL_MIME_BOUNDARY, n2SmMsg,
multipart_related_content_part_e::NGAP); multipart_related_content_part_e::NGAP);
} else {
body = jsonData;
is_multipart = false;
} }
Logger::amf_n11().debug( Logger::amf_n11().debug(
...@@ -553,9 +559,13 @@ void amf_n11::curl_http_client( ...@@ -553,9 +559,13 @@ void amf_n11::curl_http_client(
if (curl) { if (curl) {
CURLcode res = {}; CURLcode res = {};
struct curl_slist* headers = nullptr; struct curl_slist* headers = nullptr;
std::string content_type = {};
std::string content_type = "content-type: multipart/related; boundary=" + if (is_multipart) {
std::string(CURL_MIME_BOUNDARY); content_type = "content-type: multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY);
} else {
content_type = "content-type: application/json";
}
headers = curl_slist_append(headers, content_type.c_str()); headers = curl_slist_append(headers, content_type.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, remoteUri.c_str()); curl_easy_setopt(curl, CURLOPT_URL, remoteUri.c_str());
......
This diff is collapsed.
...@@ -101,6 +101,7 @@ enum class http_response_codes_e { ...@@ -101,6 +101,7 @@ enum class http_response_codes_e {
constexpr auto CURL_MIME_BOUNDARY = "----Boundary"; constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define CURL_TIMEOUT_MS 1000L #define CURL_TIMEOUT_MS 1000L
#define BUFFER_SIZE_4096 4096
#define BUFFER_SIZE_2048 2048 #define BUFFER_SIZE_2048 2048
#define BUFFER_SIZE_1024 1024 #define BUFFER_SIZE_1024 1024
#define BUFFER_SIZE_512 512 #define BUFFER_SIZE_512 512
...@@ -108,4 +109,7 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary"; ...@@ -108,4 +109,7 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define FUTURE_STATUS_TIMEOUT_MS 100 #define FUTURE_STATUS_TIMEOUT_MS 100
#define UE_AGGREGATE_MAXIMUM_BIT_RATE_DL 300000000
#define UE_AGGREGATE_MAXIMUM_BIT_RATE_UL 200000000
#endif #endif
...@@ -64,6 +64,7 @@ nas_context::nas_context() : _vector(), _5g_he_av(), _5g_av(), kamf() { ...@@ -64,6 +64,7 @@ nas_context::nas_context() : _vector(), _5g_he_av(), _5g_av(), kamf() {
is_auth_vectors_present = false; is_auth_vectors_present = false;
to_be_register_by_new_suci = false; to_be_register_by_new_suci = false;
ueSecurityCaplen = 0; ueSecurityCaplen = 0;
nas_status = {};
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -44,6 +44,7 @@ pdu_session_context::pdu_session_context() { ...@@ -44,6 +44,7 @@ pdu_session_context::pdu_session_context() {
smf_available = false; smf_available = false;
snssai = {}; snssai = {};
plmn = {}; plmn = {};
is_ho_accepted = false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -53,8 +53,8 @@ class ue_ngap_context { ...@@ -53,8 +53,8 @@ class ue_ngap_context {
sctp_stream_id_t sctp_stream_recv; // used to decide which ue in gNB sctp_stream_id_t sctp_stream_recv; // used to decide which ue in gNB
sctp_stream_id_t sctp_stream_send; // used to decide which ue in gNB sctp_stream_id_t sctp_stream_send; // used to decide which ue in gNB
sctp_assoc_id_t gnb_assoc_id; // to find which gnb this UE belongs to sctp_assoc_id_t gnb_assoc_id; // to find which gnb this UE belongs to
sctp_assoc_id_t target_gnb_assoc_id; sctp_assoc_id_t target_gnb_assoc_id; // for HO
bool ueContextRequest; bool ueContextRequest;
uint32_t s_tmsi_5g; uint32_t s_tmsi_5g;
......
...@@ -105,6 +105,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 { ...@@ -105,6 +105,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
uint32_t ran_ue_ngap_id; uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id; long amf_ue_ngap_id;
uint32_t promise_id; uint32_t promise_id;
std::string ho_state;
}; };
class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 { class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
......
...@@ -133,7 +133,7 @@ int _5GSMobilityIdentity::_5g_s_tmsi_encode2buffer(uint8_t* buf, int len) { ...@@ -133,7 +133,7 @@ int _5GSMobilityIdentity::_5g_s_tmsi_encode2buffer(uint8_t* buf, int len) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int _5GSMobilityIdentity::_5g_s_tmsi_decodefrombuffer(uint8_t* buf, int len) { int _5GSMobilityIdentity::_5g_s_tmsi_decodefrombuffer(uint8_t* buf, int len) {
int decoded_size = 0; int decoded_size = 0;
_5g_s_tmsi = (_5G_S_TMSI_t*) calloc(1, sizeof(_5G_S_TMSI_t)); if (!_5g_s_tmsi) _5g_s_tmsi = (_5G_S_TMSI_t*) calloc(1, sizeof(_5G_S_TMSI_t));
decoded_size++; // type of identity decoded_size++; // type of identity
uint8_t octet = *(buf + decoded_size); uint8_t octet = *(buf + decoded_size);
decoded_size++; decoded_size++;
......
...@@ -36,6 +36,8 @@ UESecurityCapability::UESecurityCapability(uint8_t iei) { ...@@ -36,6 +36,8 @@ UESecurityCapability::UESecurityCapability(uint8_t iei) {
_iei = iei; _iei = iei;
_5g_EASel = 0; _5g_EASel = 0;
_5g_IASel = 0; _5g_IASel = 0;
EEASel = 0;
EIASel = 0;
length = 0; length = 0;
} }
...@@ -44,6 +46,8 @@ UESecurityCapability::UESecurityCapability() { ...@@ -44,6 +46,8 @@ UESecurityCapability::UESecurityCapability() {
_iei = 0; _iei = 0;
_5g_EASel = 0; _5g_EASel = 0;
_5g_IASel = 0; _5g_IASel = 0;
EEASel = 0;
EIASel = 0;
length = 0; length = 0;
} }
......
...@@ -68,7 +68,7 @@ bool GlobalgNBId::decodefromGlobalgNBId(Ngap_GlobalGNB_ID_t* globalgnbid) { ...@@ -68,7 +68,7 @@ bool GlobalgNBId::decodefromGlobalgNBId(Ngap_GlobalGNB_ID_t* globalgnbid) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GlobalgNBId::getGlobalgNBId(PlmnId*& plmn, GNB_ID*& gnbid) { void GlobalgNBId::getGlobalgNBId(PlmnId*& plmn, GNB_ID*& gnbid) {
plmn = plmnId; if (plmnId) plmn = plmnId;
gnbid = gNB_ID; if (gNB_ID) gnbid = gNB_ID;
} }
} // namespace ngap } // namespace ngap
...@@ -65,7 +65,6 @@ bool PDUSessionResourceHandoverRequestAckTransfer:: ...@@ -65,7 +65,6 @@ bool PDUSessionResourceHandoverRequestAckTransfer::
// return false; // return false;
} }
cout << "rc.consumed to decode = " << rc.consumed << endl; cout << "rc.consumed to decode = " << rc.consumed << endl;
cout << endl;
dLForwardingUP_TNLInformation = new UpTransportLayerInformation(); dLForwardingUP_TNLInformation = new UpTransportLayerInformation();
if (!dLForwardingUP_TNLInformation->decodefromUpTransportLayerInformation( if (!dLForwardingUP_TNLInformation->decodefromUpTransportLayerInformation(
*handoverRequestAcknowledegTransferIEs *handoverRequestAcknowledegTransferIEs
......
...@@ -94,7 +94,7 @@ bool PDUSessionResourceHandoverRequiredTransfer::decodefromIE( ...@@ -94,7 +94,7 @@ bool PDUSessionResourceHandoverRequiredTransfer::decodefromIE(
bool PDUSessionResourceHandoverRequiredTransfer:: bool PDUSessionResourceHandoverRequiredTransfer::
getDirectForwardingPathAvailability( getDirectForwardingPathAvailability(
long* directForwardingPathAvailability) { long* directForwardingPathAvailability) {
directForwardingPathAvailability = (long*) DirectForwardingPathAvailability; *directForwardingPathAvailability = (long) *DirectForwardingPathAvailability;
return true; return true;
} }
......
...@@ -67,8 +67,10 @@ bool PDUSessionResourceListHORqd::decodefromPDUSessionResourceListHORqd( ...@@ -67,8 +67,10 @@ bool PDUSessionResourceListHORqd::decodefromPDUSessionResourceListHORqd(
} }
void PDUSessionResourceListHORqd::getPDUSessionResourceListHORqd( void PDUSessionResourceListHORqd::getPDUSessionResourceListHORqd(
PDUSessionResourceItemHORqd*& m_pduSessionResourceItemHORqd, int& num) { PDUSessionResourceItemHORqd*& m_pduSessionResourceItemHORqd, int& num) {
m_pduSessionResourceItemHORqd = pduSessionResourceItemHORqd; if (pduSessionResourceItemHORqd) {
num = numofpduSessionResourceItemHORqd; m_pduSessionResourceItemHORqd = pduSessionResourceItemHORqd;
num = numofpduSessionResourceItemHORqd;
}
} }
} // namespace ngap } // namespace ngap
...@@ -34,7 +34,9 @@ using namespace std; ...@@ -34,7 +34,9 @@ using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PacketLossRate::PacketLossRate() {} PacketLossRate::PacketLossRate() {
packetlossrate = 0;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PacketLossRate::~PacketLossRate() {} PacketLossRate::~PacketLossRate() {}
......
...@@ -38,10 +38,7 @@ QosFlowItemWithDataForWarding::QosFlowItemWithDataForWarding() { ...@@ -38,10 +38,7 @@ QosFlowItemWithDataForWarding::QosFlowItemWithDataForWarding() {
QosFlowItemWithDataForWarding::~QosFlowItemWithDataForWarding() {} QosFlowItemWithDataForWarding::~QosFlowItemWithDataForWarding() {}
void QosFlowItemWithDataForWarding::getQosFlowItemWithDataForWarding( void QosFlowItemWithDataForWarding::getQosFlowItemWithDataForWarding(
Ngap_QosFlowIdentifier_t& m_QosFlowIdentifier) { Ngap_QosFlowIdentifier_t& m_QosFlowIdentifier) {
if (!qosFlowIdentifier) if (!qosFlowIdentifier) return;
printf("qosFlowIdentifier null\n");
else
printf("qosFlowIdentifier \n");
if (qosFlowIdentifier->getQosFlowIdentifier(value)) { if (qosFlowIdentifier->getQosFlowIdentifier(value)) {
m_QosFlowIdentifier = (Ngap_QosFlowIdentifier_t) value; m_QosFlowIdentifier = (Ngap_QosFlowIdentifier_t) value;
} }
...@@ -51,10 +48,8 @@ bool QosFlowItemWithDataForWarding::decodeformQosFlowItemWithDataForWarding( ...@@ -51,10 +48,8 @@ bool QosFlowItemWithDataForWarding::decodeformQosFlowItemWithDataForWarding(
if (qosFlowIdentifier == nullptr) qosFlowIdentifier = new QosFlowIdentifier(); if (qosFlowIdentifier == nullptr) qosFlowIdentifier = new QosFlowIdentifier();
if (!qosFlowIdentifier->decodefromQosFlowIdentifier( if (!qosFlowIdentifier->decodefromQosFlowIdentifier(
&(qosFlowItemWithDataForWarding->qosFlowIdentifier))) { &(qosFlowItemWithDataForWarding->qosFlowIdentifier))) {
printf("false\n");
return false; return false;
} }
printf("true\n");
return true; return true;
} }
} // namespace ngap } // namespace ngap
...@@ -89,9 +89,11 @@ bool SecurityIndication::encode2SecurityIndication( ...@@ -89,9 +89,11 @@ bool SecurityIndication::encode2SecurityIndication(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool SecurityIndication::decodefromSecurityIndication( bool SecurityIndication::decodefromSecurityIndication(
Ngap_SecurityIndication_t* securityIndication) { Ngap_SecurityIndication_t* securityIndication) {
integrityProtectionIndication = new IntegrityProtectionIndication(); if (!integrityProtectionIndication)
confidentialityProtectionIndication = integrityProtectionIndication = new IntegrityProtectionIndication();
new ConfidentialityProtectionIndication(); if (!confidentialityProtectionIndication)
confidentialityProtectionIndication =
new ConfidentialityProtectionIndication();
if (!integrityProtectionIndication->decodefromIntegrityProtectionIndication( if (!integrityProtectionIndication->decodefromIntegrityProtectionIndication(
securityIndication->integrityProtectionIndication)) securityIndication->integrityProtectionIndication))
......
...@@ -70,7 +70,7 @@ bool ServedGUAMIItem::encode2ServedGUAMIItem( ...@@ -70,7 +70,7 @@ bool ServedGUAMIItem::encode2ServedGUAMIItem(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool ServedGUAMIItem::decodefromServedGUAMIItem(Ngap_ServedGUAMIItem* pdu) { bool ServedGUAMIItem::decodefromServedGUAMIItem(Ngap_ServedGUAMIItem* pdu) {
guamiGroup = new GUAMI(); if (!guamiGroup) guamiGroup = new GUAMI();
if (!guamiGroup->decodefromGUAMI(&pdu->gUAMI)) return false; if (!guamiGroup->decodefromGUAMI(&pdu->gUAMI)) return false;
if (pdu->backupAMFName) { if (pdu->backupAMFName) {
backupAMFNameIsSet = true; backupAMFNameIsSet = true;
......
...@@ -35,8 +35,8 @@ namespace ngap { ...@@ -35,8 +35,8 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
TAI::TAI() { TAI::TAI() {
plmnId = NULL; plmnId = nullptr;
tac = NULL; tac = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -68,7 +68,7 @@ bool TAI::decodefromTAI(Ngap_TAI_t* tai) { ...@@ -68,7 +68,7 @@ bool TAI::decodefromTAI(Ngap_TAI_t* tai) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void TAI::getTAI(PlmnId*& m_plmnId, TAC*& m_tac) { void TAI::getTAI(PlmnId*& m_plmnId, TAC*& m_tac) {
m_plmnId = plmnId; if (plmnId) m_plmnId = plmnId;
m_tac = tac; if (tac) m_tac = tac;
} }
} // namespace ngap } // namespace ngap
...@@ -105,7 +105,7 @@ bool UEAssociationLogicalNGConnectionItem::encode( ...@@ -105,7 +105,7 @@ bool UEAssociationLogicalNGConnectionItem::encode(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool UEAssociationLogicalNGConnectionItem::decode( bool UEAssociationLogicalNGConnectionItem::decode(
Ngap_UE_associatedLogicalNG_connectionItem_t* item) { Ngap_UE_associatedLogicalNG_connectionItem_t* item) {
amfUeNgapId = new AMF_UE_NGAP_ID(); if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(*item->aMF_UE_NGAP_ID)) { if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(*item->aMF_UE_NGAP_ID)) {
cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << endl; cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << endl;
return false; return false;
......
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
using namespace std; using namespace std;
extern "C" {
#include "dynamic_memory_check.h"
}
namespace ngap { namespace ngap {
dRBSubjectList::dRBSubjectList() { dRBSubjectList::dRBSubjectList() {
drbsubjectitem = nullptr; drbsubjectitem = nullptr;
...@@ -46,7 +51,10 @@ bool dRBSubjectList::encodefromdRBSubjectlist( ...@@ -46,7 +51,10 @@ bool dRBSubjectList::encodefromdRBSubjectlist(
1, sizeof(Ngap_DRBsSubjectToStatusTransferItem_t)); 1, sizeof(Ngap_DRBsSubjectToStatusTransferItem_t));
if (!ie) return false; if (!ie) return false;
if (!drbsubjectitem) return false; if (!drbsubjectitem) {
free_wrapper((void**) &ie);
return false;
}
if (!drbsubjectitem[i].encodedRBSubjectItem(ie)) { if (!drbsubjectitem[i].encodedRBSubjectItem(ie)) {
cout << "encodefromdRBSubjectlist error" << endl; cout << "encodefromdRBSubjectlist error" << endl;
return false; return false;
......
...@@ -104,7 +104,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer( ...@@ -104,7 +104,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
new RANStatusTransferTransparentContainer(); new RANStatusTransferTransparentContainer();
} }
Ngap_DRB_ID_t* dRB_id = (Ngap_DRB_ID_t*) calloc(1, sizeof(Ngap_DRB_ID_t)); Ngap_DRB_ID_t* dRB_id = (Ngap_DRB_ID_t*) calloc(1, sizeof(Ngap_DRB_ID_t));
dRB_id = &drb_id; *dRB_id = drb_id;
COUNTValueForPDCP_SN18* UL_value = COUNTValueForPDCP_SN18* UL_value =
(COUNTValueForPDCP_SN18*) calloc(1, sizeof(COUNTValueForPDCP_SN18)); (COUNTValueForPDCP_SN18*) calloc(1, sizeof(COUNTValueForPDCP_SN18));
UL_value->setvalue(ul_pcdp, ul_hfn_pdcp); UL_value->setvalue(ul_pcdp, ul_hfn_pdcp);
......
...@@ -89,11 +89,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -89,11 +89,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs = &handoverCommandPdu->choice.successfulOutcome->value handoverCommandIEs = &handoverCommandPdu->choice.successfulOutcome->value
.choice.HandoverCommand; .choice.HandoverCommand;
} else { } else {
Logger::ngap().error("Check HandoverCommand message error"); Logger::ngap().error("Check Handover Command message error");
return false; return false;
} }
} else { } else {
Logger::ngap().error("HandoverRequired MessageType error"); Logger::ngap().error("Handover Command MessageType error");
return false; return false;
} }
for (int i = 0; i < handoverCommandIEs->protocolIEs.list.count; i++) { for (int i = 0; i < handoverCommandIEs->protocolIEs.list.count; i++) {
...@@ -107,11 +107,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -107,11 +107,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverCommandIEs->protocolIEs.list.array[i] handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error"); Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error"); Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -124,11 +124,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -124,11 +124,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverCommandIEs->protocolIEs.list.array[i] handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error"); Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error"); Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -141,7 +141,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -141,7 +141,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
*ngap_handovertype = handoverCommandIEs->protocolIEs.list.array[i] *ngap_handovertype = handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.HandoverType; ->value.choice.HandoverType;
} else { } else {
Logger::ngap().error("Decoded ngap Handover Type IE error"); Logger::ngap().error("Decoded NGAP Handover Type IE error");
return false; return false;
} }
} break; } break;
...@@ -152,7 +152,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -152,7 +152,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceHandoverList) { Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceHandoverList) {
} else { } else {
Logger::ngap().error( Logger::ngap().error(
"Decoded ngap PDUSessionResourceHandoverList IE error"); "Decoded NGAP PDUSessionResourceHandoverList IE error");
return false; return false;
} }
} break; } break;
...@@ -163,7 +163,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -163,7 +163,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceToReleaseListHOCmd) { Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceToReleaseListHOCmd) {
} else { } else {
Logger::ngap().error( Logger::ngap().error(
"Decoded ngap PDUSessionResourceToReleaseListHOCmd IE error"); "Decoded NGAP PDUSessionResourceToReleaseListHOCmd IE error");
return false; return false;
} }
} break; } break;
...@@ -174,7 +174,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -174,7 +174,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
Ngap_HandoverCommandIEs__value_PR_TargetToSource_TransparentContainer) { Ngap_HandoverCommandIEs__value_PR_TargetToSource_TransparentContainer) {
} else { } else {
Logger::ngap().error( Logger::ngap().error(
"Decoded ngap TargetToSource_TransparentContainer IE error"); "Decoded NGAP TargetToSource_TransparentContainer IE error");
return false; return false;
} }
} break; } break;
...@@ -184,7 +184,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -184,7 +184,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present == handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_CriticalityDiagnostics) { Ngap_HandoverCommandIEs__value_PR_CriticalityDiagnostics) {
} else { } else {
Logger::ngap().error("Decoded ngap CriticalityDiagnostics IE error"); Logger::ngap().error("Decoded NGAP CriticalityDiagnostics IE error");
return false; return false;
} }
} break; } break;
...@@ -203,7 +203,8 @@ int HandoverCommandMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -203,7 +203,8 @@ 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);
Logger::ngap().debug("er.encoded( %d )", er.encoded); Logger::ngap().debug(
"Encode Handover Command to buffer, er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -230,7 +231,7 @@ void HandoverCommandMsg::setMessageType() { ...@@ -230,7 +231,7 @@ void HandoverCommandMsg::setMessageType() {
.choice.HandoverCommand); .choice.HandoverCommand);
} else { } else {
Logger::ngap().warn( Logger::ngap().warn(
"This information doesn't refer to HandoverCommand message"); "This information doesn't refer to Handover Command message");
} }
} }
......
...@@ -53,7 +53,13 @@ HandoverNotifyMsg::HandoverNotifyMsg() { ...@@ -53,7 +53,13 @@ HandoverNotifyMsg::HandoverNotifyMsg() {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
HandoverNotifyMsg::~HandoverNotifyMsg(){}; HandoverNotifyMsg::~HandoverNotifyMsg() {
if (amfUeNgapId) delete (amfUeNgapId);
if (ranUeNgapId) delete (ranUeNgapId);
if (userLocationInformation) delete (userLocationInformation);
if (handoverNotifyPdu) free(handoverNotifyPdu);
if (handoverNotifyIEs) free(handoverNotifyIEs);
};
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
unsigned long HandoverNotifyMsg::getAmfUeNgapId() { unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
...@@ -68,7 +74,8 @@ int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -68,7 +74,8 @@ 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);
Logger::ngap().debug("er.encoded( %d )", er.encoded); Logger::ngap().debug(
"Encode Handover Notify to buffer, er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -106,11 +113,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -106,11 +113,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverNotifyIEs->protocolIEs.list.array[i] handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error"); Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error"); Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -123,29 +130,33 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -123,29 +130,33 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverNotifyIEs->protocolIEs.list.array[i] handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error"); Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error"); Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
case Ngap_ProtocolIE_ID_id_UserLocationInformation: { case Ngap_ProtocolIE_ID_id_UserLocationInformation: {
if (handoverNotifyIEs->protocolIEs.list.array[i]->criticality == // TODO: Temporarily disable Criticality check to be tested with dsTest
Ngap_Criticality_ignore && /*if (handoverNotifyIEs->protocolIEs.list.array[i]->criticality ==
handoverNotifyIEs->protocolIEs.list.array[i]->value.present == Ngap_Criticality_ignore &&
Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation) { handoverNotifyIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation) {
*/
if (handoverNotifyIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverNotifyIEs__value_PR_UserLocationInformation) {
userLocationInformation = new UserLocationInformation(); userLocationInformation = new UserLocationInformation();
if (!userLocationInformation->decodefromUserLocationInformation( if (!userLocationInformation->decodefromUserLocationInformation(
&handoverNotifyIEs->protocolIEs.list.array[i] &handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) { ->value.choice.UserLocationInformation)) {
Logger::ngap().error( Logger::ngap().error(
"Decoded ngap UserLocationInformation IE error"); "Decoded NGAP UserLocationInformation IE error");
return false; return false;
} }
} else { } else {
Logger::ngap().error("Decoded ngap UserLocationInformation IE error"); Logger::ngap().error("Decoded NGAP UserLocationInformation IE error");
return false; return false;
} }
} break; } break;
...@@ -164,8 +175,6 @@ void HandoverNotifyMsg::setUserLocationInfoNR( ...@@ -164,8 +175,6 @@ void HandoverNotifyMsg::setUserLocationInfoNR(
if (!userLocationInformation) if (!userLocationInformation)
userLocationInformation = new UserLocationInformation(); userLocationInformation = new UserLocationInformation();
// userLocationInformation->setInformation(UserLocationInformationEUTRA *
// informationEUTRA);
UserLocationInformationNR* informationNR = new UserLocationInformationNR(); UserLocationInformationNR* informationNR = new UserLocationInformationNR();
NR_CGI* nR_CGI = new NR_CGI(); NR_CGI* nR_CGI = new NR_CGI();
PlmnId* plmnId_cgi = new PlmnId(); PlmnId* plmnId_cgi = new PlmnId();
...@@ -216,24 +225,32 @@ bool HandoverNotifyMsg::getUserLocationInfoNR( ...@@ -216,24 +225,32 @@ 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;
UserLocationInformationNR* informationNR; UserLocationInformationNR* informationNR = nullptr;
userLocationInformation->getInformation(informationNR); userLocationInformation->getInformation(informationNR);
if (!informationNR) return false;
if (userLocationInformation->getChoiceOfUserLocationInformation() != if (userLocationInformation->getChoiceOfUserLocationInformation() !=
Ngap_UserLocationInformation_PR_userLocationInformationNR) Ngap_UserLocationInformation_PR_userLocationInformationNR)
return false; return false;
NR_CGI* nR_CGI;
TAI* nR_TAI; NR_CGI* nR_CGI = nullptr;
TAI* nR_TAI = nullptr;
informationNR->getInformationNR(nR_CGI, nR_TAI); informationNR->getInformationNR(nR_CGI, nR_TAI);
PlmnId* cgi_plmnId; if (!nR_CGI or !nR_TAI) return false;
NRCellIdentity* nRCellIdentity;
PlmnId* cgi_plmnId = nullptr;
NRCellIdentity* nRCellIdentity = nullptr;
nR_CGI->getNR_CGI(cgi_plmnId, nRCellIdentity); nR_CGI->getNR_CGI(cgi_plmnId, nRCellIdentity);
if (!cgi_plmnId or !nRCellIdentity) return false;
cgi_plmnId->getMcc(cig.mcc); cgi_plmnId->getMcc(cig.mcc);
cgi_plmnId->getMnc(cig.mnc); cgi_plmnId->getMnc(cig.mnc);
cig.nrCellID = nRCellIdentity->getNRCellIdentity(); cig.nrCellID = nRCellIdentity->getNRCellIdentity();
PlmnId* tai_plmnId; PlmnId* tai_plmnId = nullptr;
TAC* tac; TAC* tac = nullptr;
nR_TAI->getTAI(tai_plmnId, tac); nR_TAI->getTAI(tai_plmnId, tac);
if (!tai_plmnId or !tac) return false;
tai_plmnId->getMcc(tai.mcc); tai_plmnId->getMcc(tai.mcc);
tai_plmnId->getMnc(tai.mnc); tai_plmnId->getMnc(tai.mnc);
tai.tac = tac->getTac(); tai.tac = tac->getTac();
......
...@@ -45,6 +45,7 @@ HandoverPreparationFailure::HandoverPreparationFailure() { ...@@ -45,6 +45,7 @@ HandoverPreparationFailure::HandoverPreparationFailure() {
ranUeNgapId = nullptr; ranUeNgapId = nullptr;
cause = nullptr; cause = nullptr;
hoPreparationFailureIEs = nullptr; hoPreparationFailureIEs = nullptr;
hoPreparationFailurePdu = nullptr;
CriticalityDiagnostics = nullptr; CriticalityDiagnostics = nullptr;
} }
...@@ -172,7 +173,9 @@ int HandoverPreparationFailure::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -172,7 +173,9 @@ 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);
Logger::ngap().debug("er.encoded( %d )", er.encoded); Logger::ngap().debug(
"Encode Handover Preparation Failure to buffer, er.encoded( %d )",
er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -260,7 +263,7 @@ void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -260,7 +263,7 @@ void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
void HandoverPreparationFailure::setCause( void HandoverPreparationFailure::setCause(
Ngap_Cause_PR m_causePresent, long value) // Ngap_Cause_PR m_causePresent, long value) //
{ {
if (!cause) cause = new Cause; if (!cause) cause = new Cause();
Ngap_HandoverPreparationFailureIEs_t* ie = Ngap_HandoverPreparationFailureIEs_t* ie =
(Ngap_HandoverPreparationFailureIEs_t*) calloc( (Ngap_HandoverPreparationFailureIEs_t*) calloc(
1, sizeof(Ngap_HandoverPreparationFailureIEs_t)); 1, sizeof(Ngap_HandoverPreparationFailureIEs_t));
......
...@@ -229,7 +229,8 @@ int HandoverRequest::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -229,7 +229,8 @@ 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);
Logger::ngap().debug("er.encoded( %d )", er.encoded); Logger::ngap().debug(
"Encode Handover Request to buffer, er.encoded( %d)", er.encoded);
return er.encoded; return er.encoded;
} }
...@@ -302,7 +303,7 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs ...@@ -302,7 +303,7 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
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();
Ngap_HandoverRequestIEs_t* ie = Ngap_HandoverRequestIEs_t* ie =
(Ngap_HandoverRequestIEs_t*) calloc(1, sizeof(Ngap_HandoverRequestIEs_t)); (Ngap_HandoverRequestIEs_t*) calloc(1, sizeof(Ngap_HandoverRequestIEs_t));
ie->id = Ngap_ProtocolIE_ID_id_Cause; ie->id = Ngap_ProtocolIE_ID_id_Cause;
......
...@@ -242,7 +242,8 @@ int HandoverRequestAck::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -242,7 +242,8 @@ 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);
Logger::ngap().debug("er.encoded( %d )", er.encoded); Logger::ngap().debug(
"Encode Handover Request Ack to buffer, er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
......
...@@ -97,14 +97,25 @@ long HandoverRequiredMsg::getCauseValue() { ...@@ -97,14 +97,25 @@ long HandoverRequiredMsg::getCauseValue() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) { void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) {
if (ptr) if (ptr && targetid) {
ptr->decodefromGlobalgNBId( if (targetid->present == Ngap_TargetID_PR_targetRANNodeID) {
targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID); if (targetid->choice.targetRANNodeID->globalRANNodeID.present ==
Ngap_GlobalRANNodeID_PR_globalGNB_ID) {
ptr->decodefromGlobalgNBId(targetid->choice.targetRANNodeID
->globalRANNodeID.choice.globalGNB_ID);
return;
}
}
}
return;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void HandoverRequiredMsg::getTAI(TAI*& ptr) { void HandoverRequiredMsg::getTAI(TAI*& ptr) {
if (ptr) ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI)); if (ptr) {
if (targetid->present == Ngap_TargetID_PR_targetRANNodeID)
ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI));
}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -120,15 +131,16 @@ bool HandoverRequiredMsg::getPDUSessionResourceList( ...@@ -120,15 +131,16 @@ bool HandoverRequiredMsg::getPDUSessionResourceList(
std::vector<PDUSessionResourceItem_t>& list) { std::vector<PDUSessionResourceItem_t>& list) {
if (!PDUSessionResourceList) return false; if (!PDUSessionResourceList) return false;
PDUSessionResourceItemHORqd* m_pduSessionResourceItemHORqd; PDUSessionResourceItemHORqd* m_pduSessionResourceItemHORqd = nullptr;
int num = 0; int num = 0;
PDUSessionResourceList->getPDUSessionResourceListHORqd( PDUSessionResourceList->getPDUSessionResourceListHORqd(
m_pduSessionResourceItemHORqd, num); m_pduSessionResourceItemHORqd, num);
if (!m_pduSessionResourceItemHORqd) return false;
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
PDUSessionResourceItem_t response; PDUSessionResourceItem_t response = {};
PDUSessionID* m_pDUSessionID; PDUSessionID* m_pDUSessionID = nullptr;
m_pduSessionResourceItemHORqd[i].getPDUSessionResourceItemHORqd( m_pduSessionResourceItemHORqd[i].getPDUSessionResourceItemHORqd(
m_pDUSessionID, response.HandoverRequiredTransfer); m_pDUSessionID, response.HandoverRequiredTransfer);
m_pDUSessionID->getPDUSessionID(response.pduSessionId); m_pDUSessionID->getPDUSessionID(response.pduSessionId);
...@@ -314,7 +326,8 @@ int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -314,7 +326,8 @@ 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);
Logger::ngap().debug("er.encoded( %d )", er.encoded); Logger::ngap().debug(
"Encode Handover Required to buffer, er.encoded( %d)", er.encoded);
return er.encoded; return er.encoded;
} }
......
...@@ -30,30 +30,37 @@ ...@@ -30,30 +30,37 @@
#include "logger.hpp" #include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" //#include "asn_codecs.h"
#include "constr_TYPE.h" //#include "constr_TYPE.h"
#include "constraints.h" //#include "constraints.h"
#include "dynamic_memory_check.h" #include "dynamic_memory_check.h"
#include "per_decoder.h" #include "per_decoder.h"
#include "per_encoder.h" #include "per_encoder.h"
} }
#include <iostream> #include <iostream>
using namespace std; // using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
InitialContextSetupFailureMsg::InitialContextSetupFailureMsg() { InitialContextSetupFailureMsg::InitialContextSetupFailureMsg() {
initialContextSetupFailurePdu = NULL; initialContextSetupFailurePdu = nullptr;
initialContextSetupFailureIEs = NULL; initialContextSetupFailureIEs = nullptr;
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
pduSessionResourceFailedToSetupFailureList = NULL; pduSessionResourceFailedToSetupFailureList = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
InitialContextSetupFailureMsg::~InitialContextSetupFailureMsg() {} InitialContextSetupFailureMsg::~InitialContextSetupFailureMsg() {
if (initialContextSetupFailurePdu) free(initialContextSetupFailurePdu);
if (initialContextSetupFailureIEs) free(initialContextSetupFailureIEs);
if (amfUeNgapId) delete (amfUeNgapId);
if (ranUeNgapId) delete (ranUeNgapId);
if (pduSessionResourceFailedToSetupFailureList)
delete (pduSessionResourceFailedToSetupFailureList);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void InitialContextSetupFailureMsg::setMessageType() { void InitialContextSetupFailureMsg::setMessageType() {
...@@ -199,7 +206,6 @@ int InitialContextSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -199,7 +206,6 @@ int InitialContextSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Decapsulation
bool InitialContextSetupFailureMsg::decodefrompdu( bool InitialContextSetupFailureMsg::decodefrompdu(
Ngap_NGAP_PDU_t* ngap_msg_pdu) { Ngap_NGAP_PDU_t* ngap_msg_pdu) {
initialContextSetupFailurePdu = ngap_msg_pdu; initialContextSetupFailurePdu = ngap_msg_pdu;
......
...@@ -55,7 +55,6 @@ class InitialContextSetupFailureMsg { ...@@ -55,7 +55,6 @@ class InitialContextSetupFailureMsg {
std::vector<PDUSessionResourceFailedToSetupItem_t> list); std::vector<PDUSessionResourceFailedToSetupItem_t> list);
int encode2buffer(uint8_t* buf, int buf_size); int encode2buffer(uint8_t* buf, int buf_size);
// Decapsulation
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu); bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId(); uint32_t getRanUeNgapId();
......
...@@ -53,6 +53,7 @@ PduSessionResourceSetupRequestMsg::PduSessionResourceSetupRequestMsg() { ...@@ -53,6 +53,7 @@ PduSessionResourceSetupRequestMsg::PduSessionResourceSetupRequestMsg() {
nasPdu = nullptr; nasPdu = nullptr;
pduSessionResourceSetupRequestList = nullptr; pduSessionResourceSetupRequestList = nullptr;
uEAggregateMaxBitRate = nullptr; uEAggregateMaxBitRate = nullptr;
pduSessionAggregateMaximumBitRate = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -78,6 +79,7 @@ void PduSessionResourceSetupRequestMsg::setUEAggregateMaxBitRate( ...@@ -78,6 +79,7 @@ void PduSessionResourceSetupRequestMsg::setUEAggregateMaxBitRate(
ie->value.choice.UEAggregateMaximumBitRate); ie->value.choice.UEAggregateMaximumBitRate);
if (!ret) { if (!ret) {
Logger::ngap().error("Encode NGAP UEAggregateMaxBitRate IE error"); Logger::ngap().error("Encode NGAP UEAggregateMaxBitRate IE error");
free_wrapper((void**) &ie);
return; return;
} }
......
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