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

Merge branch 'improve_ngap_lib' into 'develop'

Improve ngap lib

See merge request oai/cn5g/oai-cn5g-amf!47
parents deb5969e 6db97984
......@@ -87,7 +87,7 @@ void amf_n2_task(void* args_p) {
auto* msg = shared_msg.get();
switch (msg->msg_type) {
case NEW_SCTP_ASSOCIATION: {
Logger::amf_n2().info("Received NEW_SCTP_ASSOCIATION");
Logger::amf_n2().info("Received new SCTP_ASSOCIATION");
itti_new_sctp_association* m =
dynamic_cast<itti_new_sctp_association*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
......@@ -121,20 +121,20 @@ void amf_n2_task(void* args_p) {
} break;
case ITTI_DL_NAS_TRANSPORT: {
Logger::amf_n2().info(
"Encoding DOWNLINK NAS TRANSPORT message, sending ");
"Encoding DOWNLINK NAS TRANSPORT message, sending");
itti_dl_nas_transport* m = dynamic_cast<itti_dl_nas_transport*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case PDU_SESSION_RESOURCE_SETUP_REQUEST: {
Logger::amf_n2().info(
"Encoding PDU SESSION RESOURCE SETUP REQUEST message, sending ");
"Encoding PDU SESSION RESOURCE SETUP REQUEST message, sending");
itti_pdu_session_resource_setup_request* m =
dynamic_cast<itti_pdu_session_resource_setup_request*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case INITIAL_CONTEXT_SETUP_REQUEST: {
Logger::amf_n2().info(
"Encoding INITIAL CONTEXT SETUP REQUEST message, sending ");
"Encoding INITIAL CONTEXT SETUP REQUEST message, sending");
itti_initial_context_setup_request* m =
dynamic_cast<itti_initial_context_setup_request*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
......@@ -174,7 +174,7 @@ void amf_n2_task(void* args_p) {
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case HANDOVER_REQUIRED: {
Logger::amf_n2().info("Received HANDOVER_REQUIRED message,handling");
Logger::amf_n2().info("Received HANDOVER_REQUIRED message, handling");
itti_handover_required* m = dynamic_cast<itti_handover_required*>(msg);
if (!amf_n2_inst->handle_itti_message(ref(*m)))
amf_n2_inst->send_handover_preparation_failure(
......@@ -182,25 +182,26 @@ void amf_n2_task(void* args_p) {
m->handoverReq->getRanUeNgapId(), m->assoc_id);
} break;
case HANDOVER_REQUEST_ACK: {
Logger::amf_n2().info("Received HANDOVER_REQUEST_ACK message,handling");
Logger::amf_n2().info(
"Received HANDOVER_REQUEST_ACK message, handling");
itti_handover_request_Ack* m =
dynamic_cast<itti_handover_request_Ack*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case HANDOVER_NOTIFY: {
Logger::amf_n2().info("Received HANDOVER_NOTIFY message,handling");
Logger::amf_n2().info("Received HANDOVER_NOTIFY message, handling");
itti_handover_notify* m = dynamic_cast<itti_handover_notify*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case UPLINK_RAN_STATUS_TRANSFER: {
Logger::amf_n2().info(
"Received UPLINK_RAN_STATUS_TRANSFER message,handling");
"Received UPLINK_RAN_STATUS_TRANSFER message, handling");
itti_uplink_ran_status_transfer* m =
dynamic_cast<itti_uplink_ran_status_transfer*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case PAGING: {
Logger::amf_n2().info("Received Paging message,handling");
Logger::amf_n2().info("Received Paging message, handling");
itti_paging* m = dynamic_cast<itti_paging*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
......@@ -225,7 +226,7 @@ amf_n2::~amf_n2() {}
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_paging& itti_msg) {
Logger::amf_n2().debug("Handling Paging message...");
Logger::amf_n2().debug("Handle Paging message...");
std::shared_ptr<ue_ngap_context> unc = {};
......@@ -275,10 +276,11 @@ void amf_n2::handle_itti_message(itti_new_sctp_association& new_assoc) {}
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
Logger::amf_n2().debug("Handle NG Setup Request...");
Logger::amf_n2().debug(
"Parameters: assoc_id %d, stream %d", itti_msg.assoc_id, itti_msg.stream);
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) {
Logger::amf_n2().error(
"No existed gNB context with assoc_id(%d)", itti_msg.assoc_id);
......@@ -299,9 +301,9 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
gnb_infos gnbItem = {};
// Get IE Global RAN Node ID
uint32_t gnb_id = {};
std::string gnb_mcc;
std::string gnb_mnc;
uint32_t gnb_id = {};
std::string gnb_mcc = {};
std::string gnb_mnc = {};
if (!itti_msg.ngSetupReq->getGlobalGnbID(gnb_id, gnb_mcc, gnb_mnc)) {
Logger::amf_n2().error("Missing Mandatory IE Global RAN Node ID");
return;
......@@ -312,7 +314,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
gnbItem.mcc = gnb_mcc;
gnbItem.mnc = gnb_mnc;
std::string gnb_name;
std::string gnb_name = {};
if (!itti_msg.ngSetupReq->getRanNodeName(gnb_name)) {
Logger::amf_n2().warn("IE RanNodeName not existed");
} else {
......@@ -321,6 +323,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
Logger::amf_n2().debug("IE RanNodeName: %s", gnb_name.c_str());
}
// store Paging DRX in gNB context
int defPagingDrx = itti_msg.ngSetupReq->getDefaultPagingDRX();
if (defPagingDrx == -1) {
Logger::amf_n2().error("Missing Mandatory IE DefaultPagingDRX");
......@@ -331,29 +334,25 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
// Get supported TA List
vector<SupportedItem_t> s_ta_list;
if (!itti_msg.ngSetupReq->getSupportedTAList(s_ta_list)) {
Logger::amf_n2().error("Missing Mandatory IE Supported TA List");
return;
}
// TODO: should be removed, since we stored list of common PLMNs
// gnbItem.mcc = s_ta_list[0].b_plmn_list[0].mcc;
// gnbItem.mnc = s_ta_list[0].b_plmn_list[0].mnc;
// gnbItem.tac = s_ta_list[0].tac;
// association GlobalRANNodeID with assoc_id
// store RAN Node Name in gNB context, if present
// verify PLMN Identity and TAC with configuration and store supportedTAList
// Verify PLMN Identity and TAC with configuration and store supportedTAList
// in gNB context, if verified; else response NG SETUP FAILURE with cause
// "Unknown PLMN"(9.3.1.2, ts38413)
std::vector<SupportedItem_t> common_plmn_list = get_common_plmn(s_ta_list);
if (common_plmn_list.size() == 0) {
// if (!verifyPlmn(s_ta_list)) {
// encode NG SETUP FAILURE MESSAGE and send back
void* buffer = calloc(1, 1000);
void* buffer = calloc(1, BUFFER_SIZE_1024);
NGSetupFailureMsg ngSetupFailure;
ngSetupFailure.setMessageType();
ngSetupFailure.setCauseRadioNetwork(
Ngap_CauseRadioNetwork_unspecified, Ngap_TimeToWait_v5s);
int encoded = ngSetupFailure.encode2buffer((uint8_t*) buffer, 1000);
bstring b = blk2bstr(buffer, encoded);
int encoded =
ngSetupFailure.encode2buffer((uint8_t*) buffer, BUFFER_SIZE_1024);
bstring b = blk2bstr(buffer, encoded);
sctp_s_38412.sctp_send_msg(itti_msg.assoc_id, itti_msg.stream, &b);
Logger::amf_n2().error(
"No common PLMN, encoding NG_SETUP_FAILURE with cause (Unknown PLMN)");
......@@ -368,15 +367,13 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
set_gnb_id_2_gnb_context(gnb_id, gc);
// store Paging DRX in gNB context
Logger::amf_n2().debug("Encoding NG_SETUP_RESPONSE ...");
// encode NG SETUP RESPONSE message with information stored in configuration
// file and send_msg
void* buffer = calloc(1, 1000);
void* buffer = calloc(1, BUFFER_SIZE_1024);
NGSetupResponseMsg ngSetupResp;
ngSetupResp.setMessageType();
ngSetupResp.setAMFName(amf_cfg.AMF_Name);
// ngSetupResp.setRelativeAmfCapacity(amf_cfg.relativeAMFCapacity);
std::vector<struct GuamiItem_s> guami_list;
for (int i = 0; i < amf_cfg.guami_list.size(); i++) {
struct GuamiItem_s tmp;
......@@ -403,8 +400,9 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
}
plmn_list.push_back(tmp);
}
ngSetupResp.setPlmnSupportList(plmn_list);
int encoded = ngSetupResp.encode2buffer((uint8_t*) buffer, 1000);
int encoded = ngSetupResp.encode2buffer((uint8_t*) buffer, BUFFER_SIZE_1024);
bstring b = blk2bstr(buffer, encoded);
sctp_s_38412.sctp_send_msg(itti_msg.assoc_id, itti_msg.stream, &b);
Logger::amf_n2().debug("Sending NG_SETUP_RESPONSE Ok");
......@@ -419,10 +417,11 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ng_reset& itti_msg) {
Logger::amf_n2().debug("Handle NG Reset...");
Logger::amf_n2().debug(
"Parameters: assoc_id %d, stream %d", itti_msg.assoc_id, itti_msg.stream);
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) {
Logger::amf_n2().error(
"No existed gNB context with assoc_id(%d)", itti_msg.assoc_id);
......@@ -467,7 +466,8 @@ void amf_n2::handle_itti_message(itti_ng_reset& itti_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ng_shutdown& itti_msg) {
std::shared_ptr<gnb_context> gc;
Logger::amf_n2().debug("Handle NG Shutdown ...");
std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) {
Logger::amf_n2().error(
"No existed gNB context with assoc_id(%d)", itti_msg.assoc_id);
......@@ -484,7 +484,7 @@ void amf_n2::handle_itti_message(itti_ng_shutdown& itti_msg) {
ran_ue_ngap_id = ue_context.second->ran_ue_ngap_id;
long amf_ue_ngap_id = ue_context.second->amf_ue_ngap_id;
// get NAS context
std::shared_ptr<nas_context> nc;
std::shared_ptr<nas_context> nc = {};
if (amf_n1_inst->is_amf_ue_id_2_nas_context(amf_ue_ngap_id)) {
nc = amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id);
stacs.update_5gmm_state(nc.get()->imsi, "5GMM-DEREGISTERED");
......@@ -511,9 +511,10 @@ void amf_n2::handle_itti_message(itti_ng_shutdown& itti_msg) {
}
//------------------------------------------------------------------------------
// INITIAL_UE_MESSAGE Handler
void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
// create ngap-ue context and store in gNB context to store UE information in
Logger::amf_n2().debug("Handle Initial UE Message...");
// Create NGAP-UE context and store in gNB context to store UE information in
// gNB, for example, here RAN UE NGAP ID and location information and RRC
// Establishment Cause send NAS-PDU to NAS layer Get INITIAL_UE_MESSAGE IEs
......@@ -527,7 +528,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
return;
}
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
gc = assoc_id_2_gnb_context(init_ue_msg.assoc_id);
if (gc.get()->ng_state == NGAP_RESETING ||
gc.get()->ng_state == NGAP_SHUTDOWN) {
......@@ -544,13 +545,13 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
if (!init_ue_msg.initUeMsg) return;
// UE NGAP Context
uint32_t ran_ue_ngap_id;
if ((ran_ue_ngap_id = init_ue_msg.initUeMsg->getRanUENgapID()) == -1) {
uint32_t ran_ue_ngap_id = 0;
if ((ran_ue_ngap_id = init_ue_msg.initUeMsg->getRanUENgapID()) == 0) {
Logger::amf_n2().error("Missing Mandatory IE (RanUeNgapId)");
return;
}
std::shared_ptr<ue_ngap_context> unc;
std::shared_ptr<ue_ngap_context> unc = {};
if (!is_ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id)) {
Logger::amf_n2().debug(
"Create a new UE NGAP context with ran_ue_ngap_id 0x%x",
......@@ -573,8 +574,8 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
if (gc.get()->next_sctp_stream >= gc.get()->instreams)
gc.get()->next_sctp_stream = 1;
unc.get()->gnb_assoc_id = init_ue_msg.assoc_id;
NrCgi_t cgi;
Tai_t tai;
NrCgi_t cgi = {};
Tai_t tai = {};
if (init_ue_msg.initUeMsg->getUserLocationInfoNR(cgi, tai)) {
itti_msg->cgi = cgi;
......@@ -599,7 +600,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
itti_msg->ueCtxReq = init_ue_msg.initUeMsg->getUeContextRequest();
}
std::string _5g_s_tmsi;
std::string _5g_s_tmsi = {};
if (!init_ue_msg.initUeMsg->get5GS_TMSI(_5g_s_tmsi)) {
itti_msg->is_5g_s_tmsi_present = false;
Logger::amf_n2().debug("5g_s_tmsi not present");
......@@ -612,8 +613,8 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
unc.get()->s_setid, unc.get()->s_pointer, unc.get()->s_tmsi);
}
uint8_t* nas_buf;
size_t nas_len = 0;
uint8_t* nas_buf = nullptr;
size_t nas_len = 0;
if (init_ue_msg.initUeMsg->getNasPdu(nas_buf, nas_len)) {
bstring nas = blk2bstr(nas_buf, nas_len);
itti_msg->nas_buf = nas;
......@@ -636,19 +637,21 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ul_nas_transport& ul_nas_transport) {
unsigned long amf_ue_ngap_id = ul_nas_transport.ulNas->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = ul_nas_transport.ulNas->getRanUeNgapId();
std::shared_ptr<gnb_context> gc;
Logger::amf_n2().debug("Handle UL NAS Transport...");
unsigned long amf_ue_ngap_id = ul_nas_transport.ulNas->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = ul_nas_transport.ulNas->getRanUeNgapId();
std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(ul_nas_transport.assoc_id)) {
Logger::amf_n2().error(
"gNB with assoc_id(%d) is illegal", ul_nas_transport.assoc_id);
"gNB with assoc_id (%d) is illegal", ul_nas_transport.assoc_id);
return;
}
gc = assoc_id_2_gnb_context(ul_nas_transport.assoc_id);
std::shared_ptr<ue_ngap_context> unc;
std::shared_ptr<ue_ngap_context> unc = {};
if (!is_ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id)) {
Logger::amf_n2().error(
"UE with ran_ue_ngap_id(0x%x) is not attached to gnb with assoc_id "
"UE with ran_ue_ngap_id (0x%x) is not attached to gnb with assoc_id "
"(%d)",
ran_ue_ngap_id, ul_nas_transport.assoc_id);
return;
......@@ -680,7 +683,7 @@ void amf_n2::handle_itti_message(itti_ul_nas_transport& ul_nas_transport) {
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->is_guti_valid = false;
uint8_t* nas_buf = NULL;
uint8_t* nas_buf = nullptr;
size_t nas_len = 0;
if (ul_nas_transport.ulNas->getNasPdu(nas_buf, nas_len)) {
itti_msg->nas_msg = blk2bstr(nas_buf, nas_len);
......@@ -710,7 +713,8 @@ void amf_n2::handle_itti_message(itti_ul_nas_transport& ul_nas_transport) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
std::shared_ptr<ue_ngap_context> unc;
Logger::amf_n2().debug("Handle DL NAS Transport ...");
std::shared_ptr<ue_ngap_context> unc = {};
unc = ran_ue_id_2_ue_ngap_context(dl_nas_transport.ran_ue_ngap_id);
if (unc.get() == nullptr) {
Logger::amf_n2().error(
......@@ -718,7 +722,7 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
dl_nas_transport.ran_ue_ngap_id);
return;
}
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
gc = assoc_id_2_gnb_context(unc.get()->gnb_assoc_id);
if (gc.get() == nullptr) {
Logger::amf_n2().error(
......@@ -734,8 +738,8 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
ngap_msg->setRanUeNgapId(dl_nas_transport.ran_ue_ngap_id);
ngap_msg->setNasPdu(
(uint8_t*) bdata(dl_nas_transport.nas), blength(dl_nas_transport.nas));
uint8_t buffer[1024];
int encoded_size = ngap_msg->encode2buffer(buffer, 1024);
uint8_t buffer[BUFFER_SIZE_1024];
int encoded_size = ngap_msg->encode2buffer(buffer, BUFFER_SIZE_1024);
bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(
gc.get()->sctp_assoc_id, unc.get()->sctp_stream_send, &b);
......@@ -743,6 +747,7 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
Logger::amf_n2().debug("Handle Initial Context Setup Request ...");
std::shared_ptr<ue_ngap_context> unc = {};
unc = ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
if (unc.get() == nullptr) {
......@@ -762,7 +767,7 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
msg->setMessageType();
msg->setAmfUeNgapId(itti_msg.amf_ue_ngap_id);
msg->setRanUeNgapId(itti_msg.ran_ue_ngap_id);
Guami_t guami;
Guami_t guami = {};
guami.mcc = amf_cfg.guami.mcc;
guami.mnc = amf_cfg.guami.mnc;
guami.regionID = amf_cfg.guami.regionID;
......@@ -808,11 +813,11 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
if (itti_msg.is_pdu_exist) {
// TODO: with multiple PDU Sessions
std::vector<PDUSessionResourceSetupRequestItem_t> list;
PDUSessionResourceSetupRequestItem_t item;
item.pduSessionId = itti_msg.pdu_session_id;
PDUSessionResourceSetupRequestItem_t item = {};
item.pduSessionId = itti_msg.pdu_session_id;
// Get NSSAI from PDU Session Context
std::shared_ptr<nas_context> nc;
std::shared_ptr<nas_context> nc = {};
if (amf_n1_inst->is_amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id))
nc = amf_n1_inst->amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id);
else {
......@@ -823,7 +828,7 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
}
string supi = "imsi-" + nc.get()->imsi;
Logger::amf_n2().debug("SUPI (%s)", supi.c_str());
std::shared_ptr<pdu_session_context> psc;
std::shared_ptr<pdu_session_context> psc = {};
if (!amf_app_inst->find_pdu_session_context(
supi, itti_msg.pdu_session_id, psc)) {
......@@ -873,20 +878,22 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(
itti_pdu_session_resource_setup_request& itti_msg) {
std::shared_ptr<ue_ngap_context> unc;
Logger::amf_n2().debug("Handle PDU Session Resource Setup Request ...");
std::shared_ptr<ue_ngap_context> unc = {};
unc = ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
if (unc.get() == nullptr) {
Logger::amf_n2().error(
"Illegal UE with ran_ue_ngap_id (0x%x)", itti_msg.ran_ue_ngap_id);
return;
}
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
gc = assoc_id_2_gnb_context(unc.get()->gnb_assoc_id);
if (gc.get() == nullptr) {
Logger::amf_n2().error(
"Illegal gNB with assoc id (0x%x)", unc.get()->gnb_assoc_id);
return;
}
PduSessionResourceSetupRequestMsg* psrsr =
new PduSessionResourceSetupRequestMsg();
psrsr->setMessageType();
......@@ -894,16 +901,16 @@ void amf_n2::handle_itti_message(
psrsr->setRanUeNgapId(itti_msg.ran_ue_ngap_id);
std::vector<PDUSessionResourceSetupRequestItem_t> list;
PDUSessionResourceSetupRequestItem_t item;
item.pduSessionId = itti_msg.pdu_session_id;
uint8_t* nas_pdu = (uint8_t*) calloc(1, blength(itti_msg.nas) + 1);
PDUSessionResourceSetupRequestItem_t item = {};
item.pduSessionId = itti_msg.pdu_session_id;
uint8_t* nas_pdu = (uint8_t*) calloc(1, blength(itti_msg.nas) + 1);
memcpy(nas_pdu, (uint8_t*) bdata(itti_msg.nas), blength(itti_msg.nas));
nas_pdu[blength(itti_msg.nas)] = '\0';
item.pduSessionNAS_PDU = nas_pdu;
item.sizeofpduSessionNAS_PDU = blength(itti_msg.nas);
// Get NSSAI from PDU Session Context
std::shared_ptr<nas_context> nc;
std::shared_ptr<nas_context> nc = {};
if (amf_n1_inst->is_amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id))
nc = amf_n1_inst->amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id);
else {
......@@ -914,7 +921,7 @@ void amf_n2::handle_itti_message(
}
string supi = "imsi-" + nc.get()->imsi;
Logger::amf_n2().debug("SUPI (%s)", supi.c_str());
std::shared_ptr<pdu_session_context> psc;
std::shared_ptr<pdu_session_context> psc = {};
if (!amf_app_inst->find_pdu_session_context(
supi, itti_msg.pdu_session_id, psc)) {
......@@ -957,14 +964,16 @@ void amf_n2::handle_itti_message(
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(
itti_pdu_session_resource_release_command& itti_msg) {
std::shared_ptr<ue_ngap_context> unc;
Logger::amf_n2().debug("Handle PDU Session Resource Release Command ...");
std::shared_ptr<ue_ngap_context> unc = {};
unc = ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
if (unc.get() == nullptr) {
Logger::amf_n2().error(
"Illegal UE with ran_ue_ngap_id (0x%x)", itti_msg.ran_ue_ngap_id);
return;
}
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
gc = assoc_id_2_gnb_context(unc.get()->gnb_assoc_id);
if (gc.get() == nullptr) {
Logger::amf_n2().error(
......@@ -984,8 +993,8 @@ void amf_n2::handle_itti_message(
release_cmd_msg->setNasPdu(nas_pdu, blength(itti_msg.nas));
std::vector<PDUSessionResourceToReleaseItem_t> list;
PDUSessionResourceToReleaseItem_t item;
item.pduSessionId = itti_msg.pdu_session_id;
PDUSessionResourceToReleaseItem_t item = {};
item.pduSessionId = itti_msg.pdu_session_id;
item.pduSessionResourceReleaseCommandTransfer.buf =
(uint8_t*) bdata(itti_msg.n2sm);
......@@ -1014,10 +1023,10 @@ void amf_n2::handle_itti_message(
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ue_context_release_request& itti_msg) {
Logger::amf_n2().debug("Handling UE context release request ...");
unsigned long amf_ue_ngap_id = itti_msg.ueCtxRel->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.ueCtxRel->getRanUeNgapId();
e_Ngap_CauseRadioNetwork cause;
Logger::amf_n2().debug("Handle UE Context Release Request ...");
unsigned long amf_ue_ngap_id = itti_msg.ueCtxRel->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.ueCtxRel->getRanUeNgapId();
e_Ngap_CauseRadioNetwork cause = {};
itti_msg.ueCtxRel->getCauseRadioNetwork(cause);
UEContextReleaseCommandMsg* ueCtxRelCmd = new UEContextReleaseCommandMsg();
ueCtxRelCmd->setMessageType();
......@@ -1029,17 +1038,18 @@ void amf_n2::handle_itti_message(itti_ue_context_release_request& itti_msg) {
sctp_s_38412.sctp_send_msg(itti_msg.assoc_id, itti_msg.stream, &b);
}
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) {
Logger::amf_n2().debug("Handling UE Context Release Command ...");
std::shared_ptr<ue_ngap_context> unc;
std::shared_ptr<ue_ngap_context> unc = {};
unc = ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
if (unc.get() == nullptr) {
Logger::amf_n2().error(
"Illegal UE with ran_ue_ngap_id (0x%x)", itti_msg.ran_ue_ngap_id);
return;
}
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
gc = assoc_id_2_gnb_context(unc.get()->gnb_assoc_id);
if (gc.get() == nullptr) {
Logger::amf_n2().error(
......@@ -1062,8 +1072,8 @@ void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) {
(e_Ngap_CauseRadioNetwork) itti_msg.cause.getValue());
}
uint8_t buffer[200]; // TODO: remove hardcoded value
int encoded_size = ueCtxRelCmd->encode2buffer(buffer, 200);
uint8_t buffer[BUFFER_SIZE_256];
int encoded_size = ueCtxRelCmd->encode2buffer(buffer, BUFFER_SIZE_256);
bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(
......@@ -1073,7 +1083,7 @@ void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
Logger::amf_n2().debug("Handling UE Context Release Complete ...");
Logger::amf_n2().debug("Handle UE Context Release Complete ...");
unsigned long amf_ue_ngap_id = itti_msg.ueCtxRelCmpl->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.ueCtxRelCmpl->getRanUeNgapId();
// TODO: User Location Information IE
......@@ -1086,19 +1096,19 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(
itti_ue_radio_capability_indication& itti_msg) {
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) {
Logger::amf_n2().error(
"No existed gNB context with assoc_id (%d)", itti_msg.assoc_id);
return;
}
gc = assoc_id_2_gnb_context(itti_msg.assoc_id);
unsigned long amf_ue_ngap_id;
gc = assoc_id_2_gnb_context(itti_msg.assoc_id);
unsigned long amf_ue_ngap_id = {0};
itti_msg.ueRadioCap->getAmfUeNgapId(amf_ue_ngap_id);
uint32_t ran_ue_ngap_id;
uint32_t ran_ue_ngap_id = {0};
itti_msg.ueRadioCap->getRanUeNgapId(ran_ue_ngap_id);
uint8_t* ue_radio_cap;
size_t size;
uint8_t* ue_radio_cap = nullptr;
size_t size = {0};
if (!itti_msg.ueRadioCap->getUERadioCapability(ue_radio_cap, size)) {
Logger::amf_n2().warn("No IE UERadioCapability");
}
......@@ -1108,6 +1118,7 @@ void amf_n2::handle_itti_message(
//------------------------------------------------------------------------------
bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
// TODO: Experimental procedure, to be tested
Logger::amf_n2().debug("Handling Handover Required ...");
unsigned long amf_ue_ngap_id = itti_msg.handoverReq->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.handoverReq->getRanUeNgapId();
......@@ -1392,6 +1403,7 @@ bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
// TODO: Experimental procedure, to be tested
Logger::amf_n2().debug("Handling Handover Request Ack ...");
unsigned long amf_ue_ngap_id = itti_msg.handoverrequestAck->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.handoverrequestAck->getRanUeNgapId();
Logger::amf_n2().debug(
......@@ -1597,6 +1609,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
// TODO: Experimental procedure, to be tested
Logger::amf_n2().debug("Handling Handover Notify ...");
unsigned long amf_ue_ngap_id = itti_msg.handovernotify->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.handovernotify->getRanUeNgapId();
Logger::amf_n2().debug(
......@@ -1717,17 +1730,6 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
sctp_s_38412.sctp_send_msg(unc.get()->gnb_assoc_id, 0, &b);
/*std::shared_ptr<nas_context> nc =
amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id); string supi = "imsi-" +
nc.get()->imsi; std::shared_ptr<pdu_session_context> psc =
amf_n11_inst->supi_to_pdu_ctx(supi); itti_nsmf_pdusession_update_sm_context
*itti_nsmf_msg = new itti_nsmf_pdusession_update_sm_context(TASK_AMF_N2,
TASK_AMF_N11); itti_nsmf_msg->supi = supi; itti_nsmf_msg->pdu_session_id =
psc.get()->pdu_session_id; itti_nsmf_msg->n2sm = psc.get()->n2sm;
std::shared_ptr<itti_nsmf_pdusession_update_sm_context> i =
std::shared_ptr<itti_nsmf_pdusession_update_sm_context>(itti_nsmf_msg);
//int ret = itti_inst->send_msg(i);*/
if (!is_amf_ue_id_2_ue_ngap_context(amf_ue_ngap_id)) {
Logger::amf_n2().error(
"No UE NGAP context with amf_ue_ngap_id (0x%x)", amf_ue_ngap_id);
......@@ -1743,6 +1745,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_uplink_ran_status_transfer& itti_msg) {
Logger::amf_n2().debug("Handling Uplink RAN Status Transfer ...");
unsigned long amf_ue_ngap_id = itti_msg.uplinkrantransfer->getAmfUeNgapId();
Logger::amf_n2().error(
"Uplink RAN Status Transfer amf_ue_ngap_id (%d)", amf_ue_ngap_id);
......@@ -1786,14 +1789,14 @@ void amf_n2::handle_itti_message(itti_uplink_ran_status_transfer& itti_msg) {
(COUNTValueForPDCP_SN18*) calloc(1, sizeof(COUNTValueForPDCP_SN18));
UL18->getcountvalue(amf_UL_value);
DL18->getcountvalue(amf_DL_value);
long amf_ul_pdcp;
long amf_hfn_ul_pdcp;
long amf_ul_pdcp = {0};
long amf_hfn_ul_pdcp = {0};
amf_UL_value->getvalue(amf_ul_pdcp, amf_hfn_ul_pdcp);
long amf_dl_pdcp;
long amf_hfn_dl_pdcp;
long amf_dl_pdcp = {0};
long amf_hfn_dl_pdcp = {0};
amf_DL_value->getvalue(amf_dl_pdcp, amf_hfn_dl_pdcp);
long amf_drb_id;
amf_drb_id = *amf_dRB_id;
long amf_drb_id = {0};
amf_drb_id = *amf_dRB_id;
std::unique_ptr<DownlinkRANStatusTransfer> downLinkranstatustransfer =
std::make_unique<DownlinkRANStatusTransfer>();
......@@ -1802,9 +1805,10 @@ void amf_n2::handle_itti_message(itti_uplink_ran_status_transfer& itti_msg) {
downLinkranstatustransfer->setRanUeNgapId(unc.get()->target_ran_ue_ngap_id);
downLinkranstatustransfer->setRANStatusTransfer_TransparentContainer(
amf_drb_id, amf_ul_pdcp, amf_hfn_ul_pdcp, amf_dl_pdcp, amf_hfn_dl_pdcp);
uint8_t buffer[1024];
int encode_size = downLinkranstatustransfer->encodetobuffer(buffer, 1024);
bstring b = blk2bstr(buffer, encode_size);
uint8_t buffer[BUFFER_SIZE_1024];
int encode_size =
downLinkranstatustransfer->encodetobuffer(buffer, BUFFER_SIZE_1024);
bstring b = blk2bstr(buffer, encode_size);
sctp_s_38412.sctp_send_msg(unc.get()->target_gnb_assoc_id, 0, &b);
}
......@@ -1828,7 +1832,6 @@ void amf_n2::send_handover_preparation_failure(
sctp_s_38412.sctp_send_msg(gnb_assoc_id, 0, &b);
}
// Context management functions
//------------------------------------------------------------------------------
bool amf_n2::is_ran_ue_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id) const {
......
......@@ -39,20 +39,20 @@ namespace ngap {
//------------------------------------------------------------------------------
AmfName::AmfName() {
amfname = NULL;
amfname = nullptr;
}
//------------------------------------------------------------------------------
AmfName::~AmfName() {
free(amfname);
amfname = NULL;
amfname = nullptr;
}
//------------------------------------------------------------------------------
void AmfName::setValue(const std::string m_amfName) {
if (amfname) {
free(amfname);
amfname = NULL;
amfname = nullptr;
}
amfname = (char*) calloc(1, m_amfName.size() + 1);
memcpy(amfname, m_amfName.c_str(), m_amfName.size());
......@@ -61,13 +61,14 @@ void AmfName::setValue(const std::string m_amfName) {
//------------------------------------------------------------------------------
void AmfName::getValue(std::string& m_amfName) {
m_amfName = amfname;
if (amfname) m_amfName = amfname;
}
//------------------------------------------------------------------------------
bool AmfName::encode2AmfName(Ngap_AMFName_t* amfNameIe) {
if (OCTET_STRING_fromBuf(amfNameIe, amfname, strlen(amfname)) < 0)
return false;
if (amfname)
if (OCTET_STRING_fromBuf(amfNameIe, amfname, strlen(amfname)) < 0)
return false;
return true;
}
......
......@@ -70,7 +70,6 @@ bool AMFSetID::encode2bitstring(Ngap_AMFSetID_t& amfsetid) {
//------------------------------------------------------------------------------
bool AMFSetID::decodefrombitstring(Ngap_AMFSetID_t& amfsetid) {
if (!amfsetid.buf) return false;
printf("test for amfsetid\n");
for (int i = 0; i < amfsetid.size; i++) {
printf("%x ", amfsetid.buf[i]);
}
......
......@@ -40,7 +40,7 @@ namespace ngap {
//------------------------------------------------------------------------------
AllowedNSSAI::AllowedNSSAI() {
snssai = NULL;
snssai = nullptr;
numofSnssai = 0;
}
......@@ -66,7 +66,6 @@ bool AllowedNSSAI::getAllowedNSSAI(S_NSSAI*& m_snssai, int& m_numofsnssai) {
//------------------------------------------------------------------------------
bool AllowedNSSAI::encode2AllowedNSSAI(Ngap_AllowedNSSAI_t* allowedNssaiList) {
cout << "AllowedNSSAI::numOfSnssai " << numofSnssai << endl;
for (int i = 0; i < numofSnssai; i++) {
Ngap_AllowedNSSAI_Item_t* allowednssaiitem =
(Ngap_AllowedNSSAI_Item_t*) calloc(1, sizeof(Ngap_AllowedNSSAI_Item_t));
......
......@@ -35,7 +35,7 @@ namespace ngap {
//------------------------------------------------------------------------------
AssociatedQosFlowItem::AssociatedQosFlowItem() {
qosFlowIdentifier = NULL;
qosFlowIdentifier = nullptr;
qosFlowMappingIndication = -1;
}
......@@ -74,6 +74,8 @@ bool AssociatedQosFlowItem::encode2AssociatedQosFlowItem(
(long*) calloc(1, sizeof(long));
*associatedQosFlowItem->qosFlowMappingIndication = qosFlowMappingIndication;
}
if (!qosFlowIdentifier) return false;
if (!qosFlowIdentifier->encode2QosFlowIdentifier(
&associatedQosFlowItem->qosFlowIdentifier))
return false;
......
......@@ -35,7 +35,7 @@ namespace ngap {
//------------------------------------------------------------------------------
AssociatedQosFlowList::AssociatedQosFlowList() {
associatedQosFlowItem = NULL;
associatedQosFlowItem = nullptr;
numofassociatedQosFlowItem = 0;
}
......@@ -65,6 +65,7 @@ bool AssociatedQosFlowList::encode2AssociatedQosFlowList(
Ngap_AssociatedQosFlowItem_t* ie = (Ngap_AssociatedQosFlowItem_t*) calloc(
1, sizeof(Ngap_AssociatedQosFlowItem_t));
if (!ie) return false;
if (!associatedQosFlowItem) return false;
if (!associatedQosFlowItem[i].encode2AssociatedQosFlowItem(ie))
return false;
if (ASN_SEQUENCE_ADD(&associatedQosFlowList.list, ie) != 0) return false;
......
......@@ -43,8 +43,8 @@ namespace ngap {
//------------------------------------------------------------------------------
BroadcastPLMNItem::BroadcastPLMNItem() {
plmn = NULL;
snssai = NULL;
plmn = nullptr;
snssai = nullptr;
numOfSnssai = 0;
}
......@@ -70,8 +70,9 @@ void BroadcastPLMNItem::getPlmnSliceSupportList(
//------------------------------------------------------------------------------
bool BroadcastPLMNItem::encode2BroadcastPLMNItem(
Ngap_BroadcastPLMNItem_t* plmnItem) {
if (!plmn) return false;
if (!snssai) return false;
if (!plmn->encode2octetstring(plmnItem->pLMNIdentity)) return false;
cout << "BroadcastPLMNItem::numOfSnssai " << numOfSnssai << endl;
for (int i = 0; i < numOfSnssai; i++) {
Ngap_SliceSupportItem_t* slice =
(Ngap_SliceSupportItem_t*) calloc(1, sizeof(Ngap_SliceSupportItem_t));
......@@ -89,7 +90,7 @@ bool BroadcastPLMNItem::decodefromBroadcastPLMNItem(
if (plmn == nullptr) plmn = new PlmnId();
if (!plmn->decodefromoctetstring(pdu->pLMNIdentity)) return false;
numOfSnssai = pdu->tAISliceSupportList.list.count;
snssai = new S_NSSAI[numOfSnssai]();
if (snssai == nullptr) snssai = new S_NSSAI[numOfSnssai]();
for (int i = 0; i < numOfSnssai; i++) {
if (!snssai[i].decodefromS_NSSAI(
&pdu->tAISliceSupportList.list.array[i]->s_NSSAI))
......
......@@ -43,16 +43,12 @@ bool COUNTValueForPDCP_SN18::encodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t* countvalue) {
countvalue->pDCP_SN18 = pdcp;
countvalue->hFN_PDCP_SN18 = hfn_pdcp;
cout << "the encode pdcp_sn18 is" << countvalue->pDCP_SN18 << endl;
cout << "the encode hfn_pdcp_sn18 is" << countvalue->hFN_PDCP_SN18 << endl;
return true;
}
bool COUNTValueForPDCP_SN18::decodedCOUNTValueForPDCP_SN18(
Ngap_COUNTValueForPDCP_SN18_t& countValue) {
pdcp = countValue.pDCP_SN18;
hfn_pdcp = countValue.hFN_PDCP_SN18;
cout << "the decode pdcp_sn18 is" << countValue.pDCP_SN18 << endl;
cout << "the decode hfn_pdcp_sn18 is" << countValue.hFN_PDCP_SN18 << endl;
return true;
}
} // namespace ngap
......@@ -78,12 +78,15 @@ void CoreNetworkAssistanceInfo::setCoreNetworkAssistanceInfo(
//------------------------------------------------------------------------------
bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo(
Ngap_CoreNetworkAssistanceInformation_t* coreNetworkAssistanceInformation) {
if (!ueIdentityIndexValue) return false;
if (!ueIdentityIndexValue->encode2UEIdentityIndexValue(
&coreNetworkAssistanceInformation->uEIdentityIndexValue))
return false;
if (!periodicRegUpdateTimer) return false;
if (!periodicRegUpdateTimer->encode2PeriodicRegistrationUpdateTimer(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false;
if (!tai) return false;
for (int i = 0; i < numoftai; i++) {
Ngap_TAIListForInactiveItem_t* taiListForInactiveItem =
(Ngap_TAIListForInactiveItem_t*) calloc(
......@@ -129,7 +132,7 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false;
numoftai = coreNetworkAssistanceInformation->tAIListForInactive.list.count;
tai = new TAI[numoftai]();
if (tai == nullptr) tai = new TAI[numoftai]();
for (int i = 0; i < numoftai; i++) {
if (!tai[i].decodefromTAI(
&coreNetworkAssistanceInformation->tAIListForInactive.list.array[i]
......@@ -137,13 +140,13 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
return false;
}
if (coreNetworkAssistanceInformation->uESpecificDRX) {
pagingDRX = new DefaultPagingDRX();
if (pagingDRX == nullptr) pagingDRX = new DefaultPagingDRX();
if (!pagingDRX->decodefromDefaultPagingDRX(
*(coreNetworkAssistanceInformation->uESpecificDRX)))
return false;
}
if (coreNetworkAssistanceInformation->mICOModeIndication) {
micoModeInd = new MICOModeIndication();
if (micoModeInd == nullptr) micoModeInd = new MICOModeIndication();
if (!micoModeInd->decodefromMICOModeIndication(
coreNetworkAssistanceInformation->mICOModeIndication))
return false;
......
......@@ -101,6 +101,7 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) {
ie->value.choice.CriticalityDiagnostics.procedureCriticality =
procedureCriticalityIE;
}
if (numberOfIEsCriticalityDiagnostics) {
Ngap_CriticalityDiagnostics_IE_List_t* ieList =
(Ngap_CriticalityDiagnostics_IE_List_t*) calloc(
......@@ -109,8 +110,10 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) {
Ngap_CriticalityDiagnostics_IE_Item_t* ieItem =
(Ngap_CriticalityDiagnostics_IE_Item_t*) calloc(
1, sizeof(Ngap_CriticalityDiagnostics_IE_Item_t));
iEsCriticalityDiagnostics[i].encode2pdu(ieItem);
ASN_SEQUENCE_ADD(&ieList->list, ieItem);
if (iEsCriticalityDiagnostics) {
iEsCriticalityDiagnostics[i].encode2pdu(ieItem);
ASN_SEQUENCE_ADD(&ieList->list, ieItem);
}
}
ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics = ieList;
}
......
......@@ -35,8 +35,8 @@ namespace ngap {
//------------------------------------------------------------------------------
DLQoSFlowPerTNLInformation::DLQoSFlowPerTNLInformation() {
uPTransportLayerInformation = NULL;
associatedQosFlowList = NULL;
uPTransportLayerInformation = nullptr;
associatedQosFlowList = nullptr;
}
//------------------------------------------------------------------------------
......@@ -63,9 +63,11 @@ bool DLQoSFlowPerTNLInformation::getDLQoSFlowPerTNLInformation(
//------------------------------------------------------------------------------
bool DLQoSFlowPerTNLInformation::encode2DLQoSFlowPerTNLInformation(
Ngap_QosFlowPerTNLInformation_t* qosFlowPerTNLInformation) {
if (!uPTransportLayerInformation) return false;
if (!uPTransportLayerInformation->encode2UpTransportLayerInformation(
qosFlowPerTNLInformation->uPTransportLayerInformation))
return false;
if (!associatedQosFlowList) return false;
if (!associatedQosFlowList->encode2AssociatedQosFlowList(
qosFlowPerTNLInformation->associatedQosFlowList))
return false;
......
......@@ -39,20 +39,6 @@ DataForwardingNotPossible::DataForwardingNotPossible() {}
//------------------------------------------------------------------------------
DataForwardingNotPossible::~DataForwardingNotPossible() {}
//------------------------------------------------------------------------------
#if 0
void DataForwardingNotPossible::setDataForwardingNotPossible(const uint32_t m_gtp_teid)
{
gtp_teid = m_gtp_teid;
}
bool DataForwardingNotPossible::getDataForwardingNotPossible(uint32_t &m_gtp_teid)
{
m_gtp_teid = gtp_teid;
return true;
}
#endif
//------------------------------------------------------------------------------
bool DataForwardingNotPossible::encode2DataForwardingNotPossible(
Ngap_DataForwardingNotPossible_t& dataForwardingNotPossible) {
......
......@@ -20,64 +20,69 @@
*/
#include "dRBsSubjectToStatusTransferItem.hpp"
#include "logger.hpp"
#include <iostream>
#include <vector>
using namespace std;
namespace ngap {
dRBSubjectItem::dRBSubjectItem() {
drb_id = NULL;
drb_ul = NULL;
drb_dl = NULL;
drb_id = nullptr;
drb_ul = nullptr;
drb_dl = nullptr;
}
dRBSubjectItem::~dRBSubjectItem() {}
void dRBSubjectItem::setdRBSubjectItem(
Ngap_DRB_ID_t* dRB_ID, dRBStatusUL* dRB_UL, dRBStatusDL* dRB_DL) {
drb_id = dRB_ID;
drb_ul = dRB_UL;
drb_dl = dRB_DL;
}
void dRBSubjectItem::getdRBSubjectItem(
Ngap_DRB_ID_t*& dRB_ID, dRBStatusUL*& dRB_UL, dRBStatusDL*& dRB_DL) {
dRB_ID = drb_id;
dRB_UL = drb_ul;
dRB_DL = drb_dl;
}
bool dRBSubjectItem::decodefromdRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (dRB_item->dRB_ID) {
drb_id = &dRB_item->dRB_ID;
cout << "the decode drb_id is" << *drb_id << endl;
}
drb_ul = new dRBStatusUL();
if (!drb_ul->decodedRBStatusUL(&dRB_item->dRBStatusUL)) {
cout << "decode from dRBSubjectItem dRBStatusUL error" << endl;
return false;
}
drb_dl = new dRBStatusDL();
if (!drb_dl->decodedRBStatusDL(&dRB_item->dRBStatusDL)) {
cout << "decode from dRBSubjectItem dRBStatusDL error" << endl;
return false;
}
cout << "decode from dRBSubjectItem successfully" << endl;
return true;
}
bool dRBSubjectItem::encodedRBSubjectItem(
Ngap_DRBsSubjectToStatusTransferItem_t* dRB_item) {
if (drb_id) {
dRB_item->dRB_ID = *drb_id;
cout << "the encode drb_id is" << *drb_id << endl;
}
if (!drb_ul) return false;
if (!drb_ul->encodedRBStatusUL(&dRB_item->dRBStatusUL)) {
cout << "encode from dRBSubjectItem dRBStatusUL error" << endl;
return false;
}
if (!drb_dl) return false;
if (!drb_dl->encodedRBStatusDL(&dRB_item->dRBStatusDL)) {
cout << "encode from dRBSubjectItem dRBStatusDL error" << endl;
return false;
}
cout << "encode from dRBSubjectItem successfully" << endl;
Logger::ngap().debug("Encode from dRBSubjectItem successfully");
return true;
}
} // namespace ngap
......@@ -26,7 +26,7 @@
using namespace std;
namespace ngap {
dRBSubjectList::dRBSubjectList() {
drbsubjectitem = NULL;
drbsubjectitem = nullptr;
numofitem = 0;
}
dRBSubjectList::~dRBSubjectList() {}
......@@ -45,6 +45,8 @@ bool dRBSubjectList::encodefromdRBSubjectlist(
(Ngap_DRBsSubjectToStatusTransferItem_t*) calloc(
1, sizeof(Ngap_DRBsSubjectToStatusTransferItem_t));
if (!ie) return false;
if (!drbsubjectitem) return false;
if (!drbsubjectitem[i].encodedRBSubjectItem(ie)) {
cout << "encodefromdRBSubjectlist error" << endl;
return false;
......
......@@ -45,14 +45,14 @@ namespace ngap {
//------------------------------------------------------------------------------
DownLinkNasTransportMsg::DownLinkNasTransportMsg() {
downLinkNasTransportPdu = NULL;
downLinkNasTransportIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
oldAmfName = NULL;
ranPagingPriority = NULL;
nasPdu = NULL;
indexToRFSP = NULL;
downLinkNasTransportPdu = nullptr;
downLinkNasTransportIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
oldAmfName = nullptr;
ranPagingPriority = nullptr;
nasPdu = nullptr;
indexToRFSP = nullptr;
}
//------------------------------------------------------------------------------
......@@ -241,7 +241,7 @@ int DownLinkNasTransportMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, downLinkNasTransportPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, downLinkNasTransportPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......
......@@ -20,6 +20,7 @@
*/
#include "DownlinkRANStatusTransfer.hpp"
#include "logger.hpp"
#include <iostream>
#include <vector>
......@@ -31,6 +32,7 @@ extern "C" {
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -39,8 +41,10 @@ DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
DownlinkranstatustransferPDU = nullptr;
}
//------------------------------------------------------------------------------
DownlinkRANStatusTransfer::~DownlinkRANStatusTransfer() {}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -55,16 +59,18 @@ void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(id);
......@@ -79,16 +85,17 @@ void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
long drb_id, long ul_pcdp, long ul_hfn_pdcp, long dl_pcdp,
long dl_hfn_pdcp) {
......@@ -128,7 +135,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
->encoderanstatustransfer_transparentcontainer(
&ie->value.choice.RANStatusTransfer_TransparentContainer);
if (!ret) {
cout << "encode ranstatustransfer_transparentcontainer error" << endl;
Logger::ngap().error(
"Encode RANStatusTransfer_TransparentContainer IE error");
// free_wrapper((void**) &dRB_id);
free_wrapper((void**) &UL_value);
free_wrapper((void**) &DL_value);
......@@ -142,7 +150,8 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
}
if (ASN_SEQUENCE_ADD(&DownlinkranstatustransferIEs->protocolIEs.list, ie) !=
0) {
cout << "encode ranstatustransfer_transparentcontainer error 2" << endl;
Logger::ngap().error(
"Encode ranstatustransfer_transparentcontainer IE error");
}
/* free_wrapper((void**) &dRB_id);
free_wrapper((void**) &UL_value);
......@@ -157,6 +166,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
*/
}
//------------------------------------------------------------------------------
void DownlinkRANStatusTransfer::setmessagetype() {
if (!DownlinkranstatustransferPDU) {
DownlinkranstatustransferPDU =
......@@ -180,18 +190,18 @@ void DownlinkRANStatusTransfer::setmessagetype() {
&(DownlinkranstatustransferPDU->choice.initiatingMessage->value.choice
.DownlinkRANStatusTransfer);
} else {
cout << "[warning] This information doesn't refer to "
"downlinkranstatustransfer Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to DownlinkRANStatusTransfer Message");
}
}
//------------------------------------------------------------------------------
int DownlinkRANStatusTransfer::encodetobuffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, DownlinkranstatustransferPDU);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, DownlinkranstatustransferPDU, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
} // namespace ngap
......@@ -40,6 +40,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverCommandMsg::HandoverCommandMsg() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -52,8 +53,11 @@ HandoverCommandMsg::HandoverCommandMsg() {
handoverCommandPdu = nullptr;
handoverCommandIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverCommandMsg::~HandoverCommandMsg() {}
//------------------------------------------------------------------------------
unsigned long HandoverCommandMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -61,6 +65,7 @@ unsigned long HandoverCommandMsg::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
uint32_t HandoverCommandMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -68,6 +73,7 @@ uint32_t HandoverCommandMsg::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverCommandPdu = ngap_msg_pdu;
......@@ -192,14 +198,16 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverCommandMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverCommandPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverCommandPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setMessageType() {
if (!handoverCommandPdu)
handoverCommandPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
......@@ -226,6 +234,7 @@ void HandoverCommandMsg::setMessageType() {
}
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -248,6 +257,7 @@ void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id);
......@@ -271,6 +281,7 @@ void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setHandoverType(long type) {
if (!ngap_handovertype) ngap_handovertype = new Ngap_HandoverType_t();
Ngap_HandoverCommandIEs_t* ie =
......@@ -285,6 +296,7 @@ void HandoverCommandMsg::setHandoverType(long type) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setPduSessionResourceHandoverList(
std::vector<PDUSessionResourceHandoverItem_t> list) {
if (!PDUSessionResourceHandoverList)
......@@ -320,6 +332,7 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverCommandMsg::setTargetToSource_TransparentContainer(
OCTET_STRING_t targetTosource) {
if (!TargetToSource_TransparentContainer)
......
......@@ -60,8 +60,8 @@ class HandoverCommandMsg {
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
/*void getHandoverType(Ngap_HandoverType_t &handovertype);
void getCause(Cause cause);
void getTargetID(Ngap_TargetID_t targetID);
......@@ -73,7 +73,6 @@ class HandoverCommandMsg {
private:
Ngap_NGAP_PDU_t* handoverCommandPdu;
Ngap_HandoverCommand_t* handoverCommandIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId;
Ngap_HandoverType_t* ngap_handovertype;
......
......@@ -42,6 +42,8 @@ extern "C" {
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverNotifyMsg::HandoverNotifyMsg() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -50,7 +52,10 @@ HandoverNotifyMsg::HandoverNotifyMsg() {
handoverNotifyIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverNotifyMsg::~HandoverNotifyMsg(){};
//------------------------------------------------------------------------------
unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -58,14 +63,16 @@ unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverNotifyPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverNotifyPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverNotifyPdu = ngap_msg_pdu;
......@@ -150,6 +157,8 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
}
return true;
}
//------------------------------------------------------------------------------
void HandoverNotifyMsg::setUserLocationInfoNR(
struct NrCgi_s cig, struct Tai_s tai) {
if (!userLocationInformation)
......@@ -194,6 +203,7 @@ void HandoverNotifyMsg::setUserLocationInfoNR(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
uint32_t HandoverNotifyMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -201,6 +211,7 @@ uint32_t HandoverNotifyMsg::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverNotifyMsg::getUserLocationInfoNR(
struct NrCgi_s& cig, struct Tai_s& tai) {
if (!userLocationInformation) return false;
......
......@@ -39,6 +39,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverPreparationFailure::HandoverPreparationFailure() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -47,8 +48,10 @@ HandoverPreparationFailure::HandoverPreparationFailure() {
CriticalityDiagnostics = nullptr;
}
//------------------------------------------------------------------------------
HandoverPreparationFailure::~HandoverPreparationFailure() {}
//------------------------------------------------------------------------------
unsigned long HandoverPreparationFailure::getAmfUeNgapId() const {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -56,6 +59,7 @@ unsigned long HandoverPreparationFailure::getAmfUeNgapId() const {
return 0;
}
//------------------------------------------------------------------------------
uint32_t HandoverPreparationFailure::getRanUeNgapId() const {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -63,6 +67,7 @@ uint32_t HandoverPreparationFailure::getRanUeNgapId() const {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
hoPreparationFailurePdu = ngap_msg_pdu;
......@@ -162,14 +167,16 @@ bool HandoverPreparationFailure::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverPreparationFailure::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, hoPreparationFailurePdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, hoPreparationFailurePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setMessageType() {
if (!hoPreparationFailurePdu)
hoPreparationFailurePdu =
......@@ -198,6 +205,7 @@ void HandoverPreparationFailure::setMessageType() {
}
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -222,6 +230,7 @@ void HandoverPreparationFailure::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(ran_ue_ngap_id);
......@@ -247,6 +256,7 @@ void HandoverPreparationFailure::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverPreparationFailure::setCause(
Ngap_Cause_PR m_causePresent, long value) //
{
......@@ -266,6 +276,7 @@ void HandoverPreparationFailure::setCause(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
Ngap_Cause_PR HandoverPreparationFailure::getChoiceOfCause() const {
if (cause)
return cause->getChoiceOfCause();
......
......@@ -39,6 +39,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverRequest::HandoverRequest() {
amfUeNgapId = nullptr;
handovertype = nullptr;
......@@ -54,8 +55,11 @@ HandoverRequest::HandoverRequest() {
handoverRequestPdu = nullptr;
handoverRequestIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverRequest::~HandoverRequest() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequest::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -63,6 +67,7 @@ unsigned long HandoverRequest::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
/*bool HandoverRequest::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu)
{
handoverCommandPdu = ngap_msg_pdu;
......@@ -219,14 +224,16 @@ error" << endl; return false;
return true;
}*/
//------------------------------------------------------------------------------
int HandoverRequest::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequestPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
void HandoverRequest::setMessageType() {
if (!handoverRequestPdu)
handoverRequestPdu = (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
......@@ -253,6 +260,7 @@ void HandoverRequest::setMessageType() {
}
}
//------------------------------------------------------------------------------
void HandoverRequest::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id);
......@@ -276,6 +284,7 @@ void HandoverRequest::setAmfUeNgapId(unsigned long id) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setHandoverType(long type) // 0--intra5gs
{
if (!handovertype) handovertype = new Ngap_HandoverType_t();
......@@ -290,6 +299,7 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
{
if (!cause) cause = new Cause;
......@@ -307,6 +317,7 @@ void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setUEAggregateMaximumBitRate(
long bit_rate_downlink, long bit_rate_uplink) {
if (!ueAggregateMaximumBitRate)
......@@ -329,6 +340,8 @@ void HandoverRequest::setUEAggregateMaximumBitRate(
Logger::ngap().error("Encode UEAggregateMaximumBitRate IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setUESecurityCapabilities(
uint16_t m_NR_EncryptionAlgs, uint16_t m_NR_IntegrityProtectionAlgs,
uint16_t m_E_UTRA_EncryptionAlgs,
......@@ -352,6 +365,7 @@ void HandoverRequest::setUESecurityCapabilities(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setGUAMI(
PlmnId* m_plmnId, AMFRegionID* m_aMFRegionID, AMFSetID* m_aMFSetID,
AMFPointer* m_aMFPointer) {
......@@ -370,6 +384,8 @@ void HandoverRequest::setGUAMI(
if (ret != 0) Logger::ngap().error("Encode GUAMI IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
if (!allowedNSSAI) allowedNSSAI = new Ngap_AllowedNSSAI_t();
......@@ -395,6 +411,8 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
if (ret != 0) Logger::ngap().error("Encode AllowedNSSAI IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
if (!SecurityContext) SecurityContext = new Ngap_SecurityContext_t();
......@@ -414,6 +432,7 @@ void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setPduSessionResourceSetupList(
std::vector<PDUSessionResourceSetupRequestItem_t> list) {
if (!PDUSessionResourceSetupList)
......@@ -457,6 +476,7 @@ void HandoverRequest::setPduSessionResourceSetupList(
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setSourceToTarget_TransparentContainer(
OCTET_STRING_t sourceTotarget) {
if (!SourceToTarget_TransparentContainer)
......@@ -475,6 +495,8 @@ void HandoverRequest::setSourceToTarget_TransparentContainer(
Logger::ngap().error("Encode SourceToTarget_TransparentContainer IE error");
// free_wrapper((void**) &ie);
}
//------------------------------------------------------------------------------
void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) {
if (!mobilityrestrictionlist) {
mobilityrestrictionlist = new MobilityRestrictionList();
......
......@@ -76,7 +76,7 @@ class HandoverRequest {
void setMobilityRestrictionList(PlmnId* m_plmnId);
int encode2buffer(uint8_t* buf, int buf_size);
// bool decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
private:
Ngap_NGAP_PDU_t* handoverRequestPdu;
......
......@@ -41,6 +41,7 @@ using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverRequestAck::HandoverRequestAck() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -53,13 +54,18 @@ HandoverRequestAck::HandoverRequestAck() {
handovertype = nullptr;
}
//------------------------------------------------------------------------------
HandoverRequestAck::~HandoverRequestAck() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequestAck::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
}
//------------------------------------------------------------------------------
void HandoverRequestAck::setMessageType() {
if (!handoverRequestAckPdu)
handoverRequestAckPdu =
......@@ -87,18 +93,22 @@ void HandoverRequestAck::setMessageType() {
}
}
//------------------------------------------------------------------------------
uint32_t HandoverRequestAck::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
else
return 0;
}
//------------------------------------------------------------------------------
OCTET_STRING_t HandoverRequestAck::getTargetToSource_TransparentContainer() {
if (TargetToSource_TransparentContainer)
return *TargetToSource_TransparentContainer;
return OCTET_STRING_t();
}
//------------------------------------------------------------------------------
bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
std::vector<PDUSessionResourceAdmittedItem_t>& list) {
if (!pduSessionResourceAdmittedList) return false;
......@@ -121,6 +131,7 @@ bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
return true;
}
//------------------------------------------------------------------------------
bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverRequestAckPdu = ngap_msg_pdu;
......@@ -226,14 +237,16 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverRequestAck::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequestAckPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequestAckPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
//------------------------------------------------------------------------------
/* void HandoverRequestAck::setMessageType()
{
if (!handoverRequestAckPdu) handoverRequestAckPdu =
......
......@@ -54,8 +54,8 @@ class HandoverRequestAck {
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
void setMessageType(); // Initialize the PDU and populate the MessageType;
OCTET_STRING_t getTargetToSource_TransparentContainer();
......
......@@ -21,6 +21,8 @@
#include "HandoverRequiredMsg.hpp"
#include "logger.hpp"
#include "TAI.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "asn_codecs.h"
......@@ -32,12 +34,11 @@ extern "C" {
#include <iostream>
#include <vector>
#include "TAI.hpp"
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
HandoverRequiredMsg::HandoverRequiredMsg() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -50,8 +51,11 @@ HandoverRequiredMsg::HandoverRequiredMsg() {
handoverRequiredPdu = nullptr;
handoverRequiredIEs = nullptr;
}
//------------------------------------------------------------------------------
HandoverRequiredMsg::~HandoverRequiredMsg() {}
//------------------------------------------------------------------------------
unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -59,6 +63,7 @@ unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
uint32_t HandoverRequiredMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -66,6 +71,7 @@ uint32_t HandoverRequiredMsg::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
if (handovertype)
return *handovertype;
......@@ -73,6 +79,7 @@ Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
return Ngap_HandoverType_t();
}
//------------------------------------------------------------------------------
Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
if (cause)
return cause->getChoiceOfCause();
......@@ -80,6 +87,7 @@ Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
return Ngap_Cause_PR();
}
//------------------------------------------------------------------------------
long HandoverRequiredMsg::getCauseValue() {
if (cause)
return cause->getValue();
......@@ -87,16 +95,19 @@ long HandoverRequiredMsg::getCauseValue() {
return 0;
}
//------------------------------------------------------------------------------
void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) {
if (ptr)
ptr->decodefromGlobalgNBId(
targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID);
}
//------------------------------------------------------------------------------
void HandoverRequiredMsg::getTAI(TAI*& ptr) {
if (ptr) ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI));
}
//------------------------------------------------------------------------------
OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
if (SourceToTarget_TransparentContainer)
return *SourceToTarget_TransparentContainer;
......@@ -104,6 +115,7 @@ OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
return OCTET_STRING_t();
}
//------------------------------------------------------------------------------
bool HandoverRequiredMsg::getPDUSessionResourceList(
std::vector<PDUSessionResourceItem_t>& list) {
if (!PDUSessionResourceList) return false;
......@@ -127,6 +139,7 @@ bool HandoverRequiredMsg::getPDUSessionResourceList(
return true;
}
//------------------------------------------------------------------------------
long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
if (directforwardingPathAvailability)
return *directforwardingPathAvailability;
......@@ -134,6 +147,7 @@ long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
return 0;
}
//------------------------------------------------------------------------------
bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredPdu = ngap_msg_pdu;
......@@ -295,12 +309,12 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
return true;
}
//------------------------------------------------------------------------------
int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequiredPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequiredPdu, buf, buf_size);
// cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().error("er.encoded( %d )", er.encoded);
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......
......@@ -27,6 +27,7 @@
*/
#include "InitialContextSetupFailure.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -81,9 +82,9 @@ void InitialContextSetupFailureMsg::setMessageType() {
&(initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.InitialContextSetupFailure);
} else {
cout << "[warning] This information doesn't refer to "
"InitialContextSetupFailure Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to InitialContextSetupFailure "
"Message!");
}
}
......@@ -102,13 +103,13 @@ void InitialContextSetupFailureMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -127,13 +128,14 @@ void InitialContextSetupFailureMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -175,15 +177,15 @@ void InitialContextSetupFailureMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListCxtFail(
&ie->value.choice.PDUSessionResourceFailedToSetupListCxtFail);
if (!ret) {
cout << "encode PDUSessionResourceFailedToSetupListCxtFail IE error"
<< endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtFail IE error");
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceFailedToSetupListCxtFail IE error"
<< endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtFail IE error");
}
//------------------------------------------------------------------------------
......@@ -192,7 +194,7 @@ int InitialContextSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupFailurePdu, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -216,11 +218,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
&initialContextSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.InitialContextSetupFailure;
} else {
cout << "Check InitialContextSetupFailure message error!!!" << endl;
Logger::ngap().error("Check InitialContextSetupFailure message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0; i < initialContextSetupFailureIEs->protocolIEs.list.count;
......@@ -236,11 +238,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
initialContextSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -254,11 +256,11 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialContextSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -276,21 +278,22 @@ bool InitialContextSetupFailureMsg::decodefrompdu(
.array[i]
->value.choice
.PDUSessionResourceFailedToSetupListCxtFail)) {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtFail "
"IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtFail IE "
"error");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceFailedToSetupListCxtFail IE "
"error!"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtFail IE "
"error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP Message PDU error");
return false;
}
}
......@@ -307,7 +310,7 @@ unsigned long InitialContextSetupFailureMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t InitialContextSetupFailureMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -27,6 +27,7 @@
*/
#include "InitialContextSetupRequest.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -44,20 +45,20 @@ namespace ngap {
//------------------------------------------------------------------------------
InitialContextSetupRequestMsg::InitialContextSetupRequestMsg() {
initialContextSetupRequestPdu = NULL;
initialContextSetupRequestIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
oldAmfName = NULL;
uEAggregateMaxBitRate = NULL;
coreNetworkAssistanceInfo = NULL;
guami = NULL;
pduSessionResourceSetupRequestList = NULL;
allowedNssai = NULL;
uESecurityCapabilities = NULL;
securityKey = NULL;
nasPdu = NULL;
ueRadioCapability = NULL;
initialContextSetupRequestPdu = nullptr;
initialContextSetupRequestIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
oldAmfName = nullptr;
uEAggregateMaxBitRate = nullptr;
coreNetworkAssistanceInfo = nullptr;
guami = nullptr;
pduSessionResourceSetupRequestList = nullptr;
allowedNssai = nullptr;
uESecurityCapabilities = nullptr;
securityKey = nullptr;
nasPdu = nullptr;
ueRadioCapability = nullptr;
}
//------------------------------------------------------------------------------
......@@ -90,9 +91,9 @@ void InitialContextSetupRequestMsg::setMessageType() {
&(initialContextSetupRequestPdu->choice.initiatingMessage->value.choice
.InitialContextSetupRequest);
} else {
cout << "[warning] This information doesn't refer to "
"InitialContextSetupRequest Message!!!"
<< endl;
Logger::ngap().warn(
" This information doesn't refer to InitialContextSetupRequest "
"Message!");
}
}
......@@ -111,13 +112,13 @@ void InitialContextSetupRequestMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error!");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&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);
}
......@@ -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);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error!");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&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);
}
......@@ -160,13 +162,14 @@ void InitialContextSetupRequestMsg::setOldAmfName(const std::string name) {
int ret = oldAmfName->encode2AmfName(&ie->value.choice.AMFName);
if (!ret) {
cout << "encode oldAmfName IE error" << endl;
Logger::ngap().error("Encode oldAmfName IE error!");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -190,13 +193,13 @@ void InitialContextSetupRequestMsg::setUEAggregateMaxBitRate(
int ret = uEAggregateMaxBitRate->encode2UEAggregateMaxBitRate(
ie->value.choice.UEAggregateMaximumBitRate);
if (!ret) {
cout << "encode UEAggregateMaxBitRate IE error" << endl;
Logger::ngap().error("Encode UEAggregateMaxBitRate IE error!");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -240,14 +243,14 @@ void InitialContextSetupRequestMsg::setCoreNetworkAssistanceInfo(
int ret = coreNetworkAssistanceInfo->encode2CoreNetworkAssistanceInfo(
&ie->value.choice.CoreNetworkAssistanceInformation);
if (!ret) {
cout << "encode CoreNetworkAssistanceInformation IE error" << endl;
Logger::ngap().error("Encode CoreNetworkAssistanceInformation IE error!");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode CoreNetworkAssistanceInformation IE error" << endl;
Logger::ngap().error("Encode CoreNetworkAssistanceInformation IE error!");
// free_wrapper((void**) &ie);
}
......@@ -288,14 +291,15 @@ void InitialContextSetupRequestMsg::setCoreNetworkAssistanceInfo(
int ret = coreNetworkAssistanceInfo->encode2CoreNetworkAssistanceInfo(
&ie->value.choice.CoreNetworkAssistanceInformation);
if (!ret) {
cout << "encode CoreNetworkAssistanceInformation IE error" << endl;
Logger::ngap().error("Encode CoreNetworkAssistanceInformation IE error!");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode CoreNetworkAssistanceInformation IE error" << endl;
Logger::ngap().error("Encode CoreNetworkAssistanceInformation IE error!");
// free_wrapper((void**) &ie);
}
......@@ -324,13 +328,14 @@ void InitialContextSetupRequestMsg::setGuami(Guami_t value) {
int ret = guami->encode2GUAMI(&ie->value.choice.GUAMI);
if (!ret) {
cout << "encode GUAMI IE error" << endl;
Logger::ngap().error("Encode GUAMI IE error!");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -345,32 +350,22 @@ void InitialContextSetupRequestMsg::setPduSessionResourceSetupRequestList(
for (int i = 0; i < list.size(); i++) {
PDUSessionID* m_pDUSessionID = new PDUSessionID();
cout << "encoding pduSessionId" << endl;
m_pDUSessionID->setPDUSessionID(list[i].pduSessionId);
cout << "encoding pduSessionId over" << endl;
NAS_PDU* m_nAS_PDU = NULL;
NAS_PDU* m_nAS_PDU = nullptr;
if (list[i].pduSessionNAS_PDU) {
cout << "encoding nas-pdu" << endl;
m_nAS_PDU = new NAS_PDU();
m_nAS_PDU->setNasPdu(
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();
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);
cout << "encoding over" << endl;
m_pduSessionResourceSetupItemCxtReq[i].setPDUSessionResourceSetupItemCxtReq(
m_pDUSessionID, m_nAS_PDU, m_s_NSSAI,
list[i].pduSessionResourceSetupRequestTransfer);
}
cout << "setPDUSessionResourceSetupListCxtReq" << endl;
pduSessionResourceSetupRequestList->setPDUSessionResourceSetupListCxtReq(
m_pduSessionResourceSetupItemCxtReq, list.size());
cout << "setPDUSessionResourceSetupListCxtReq over" << endl;
Ngap_InitialContextSetupRequestIEs_t* ie =
(Ngap_InitialContextSetupRequestIEs_t*) calloc(
......@@ -380,20 +375,19 @@ void InitialContextSetupRequestMsg::setPduSessionResourceSetupRequestList(
ie->value.present =
Ngap_InitialContextSetupRequestIEs__value_PR_PDUSessionResourceSetupListCxtReq;
cout << "encode2PDUSessionResourceSetupListCxtReq" << endl;
int ret = pduSessionResourceSetupRequestList
->encode2PDUSessionResourceSetupListCxtReq(
&ie->value.choice.PDUSessionResourceSetupListCxtReq);
cout << "encode2PDUSessionResourceSetupListCxtReq over" << endl;
if (!ret) {
cout << "encode PDUSessionResourceSetupListCxtReq IE error" << endl;
Logger::ngap().error("Encode PDUSessionResourceSetupListCxtReq IE error!");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceSetupListCxtReq IE error" << endl;
Logger::ngap().error("Encode PDUSessionResourceSetupListCxtReq IE error!");
// free_wrapper((void**) &ie);
}
......@@ -418,13 +412,14 @@ void InitialContextSetupRequestMsg::setAllowedNssai(std::vector<S_Nssai> list) {
int ret = allowedNssai->encode2AllowedNSSAI(&ie->value.choice.AllowedNSSAI);
if (!ret) {
cout << "encode AllowedNSSAI IE error" << endl;
Logger::ngap().error("Encode AllowedNSSAI IE error!");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -450,13 +445,14 @@ void InitialContextSetupRequestMsg::setUESecurityCapability(
int ret = uESecurityCapabilities->encode2UESecurityCapabilities(
ie->value.choice.UESecurityCapabilities);
if (!ret) {
cout << "encode UESecurityCapabilities IE error" << endl;
Logger::ngap().error("Encode UESecurityCapabilities IE error!");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -475,13 +471,14 @@ void InitialContextSetupRequestMsg::setSecurityKey(uint8_t* key) {
int ret = securityKey->encode2bitstring(ie->value.choice.SecurityKey);
if (!ret) {
cout << "encode SecurityKey IE error" << endl;
Logger::ngap().error("Encode SecurityKey IE error!");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -500,13 +497,14 @@ void InitialContextSetupRequestMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) {
cout << "encode NAS_PDU IE error" << endl;
Logger::ngap().error("Encode NAS PDU error!");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -528,13 +526,14 @@ void InitialContextSetupRequestMsg::setUERadioCapability(
int ret = ueRadioCapability->encode2UERadioCapability(
ie->value.choice.UERadioCapability);
if (!ret) {
cout << "encode UERadioCapability IE error" << endl;
Logger::ngap().error("Encode UERadioCapability IE error!");
free_wrapper((void**) &ie);
return;
}
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);
}
......@@ -544,7 +543,7 @@ int InitialContextSetupRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupRequestPdu, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -572,7 +571,7 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0; i < initialContextSetupRequestIEs->protocolIEs.list.count;
......@@ -588,11 +587,11 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -606,11 +605,11 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -624,11 +623,11 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!oldAmfName->decodefromAmfName(
&initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.AMFName)) {
cout << "decoded ngap OldAMFName IE error" << endl;
Logger::ngap().error("Decoded NGAP OldAMFName IE error");
return false;
}
} else {
cout << "decoded ngap OldAMFName IE error" << endl;
Logger::ngap().error("Decoded NGAP OldAMFName IE error");
return false;
}
} break;
......@@ -642,11 +641,13 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!uEAggregateMaxBitRate->decodefromUEAggregateMaxBitRate(
initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.UEAggregateMaximumBitRate)) {
cout << "decoded ngap UEAggregateMaximumBitRate IE error" << endl;
Logger::ngap().error(
"Decoded NGAP UEAggregateMaximumBitRate IE error");
return false;
}
} else {
cout << "decoded ngap UEAggregateMaximumBitRate IE error" << endl;
Logger::ngap().error(
"Decoded NGAP UEAggregateMaximumBitRate IE error");
return false;
}
} break;
......@@ -660,13 +661,13 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!coreNetworkAssistanceInfo->decodefromCoreNetworkAssistanceInfo(
&initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.CoreNetworkAssistanceInformation)) {
cout << "decoded ngap CoreNetworkAssistanceInformation IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP CoreNetworkAssistanceInformation IE error");
return false;
}
} else {
cout << "decoded ngap CoreNetworkAssistanceInformation IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP CoreNetworkAssistanceInformation IE error");
return false;
}
} break;
......@@ -680,11 +681,12 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!guami->decodefromGUAMI(
&initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.GUAMI)) {
cout << "decoded ngap GUAMI IE error" << endl;
Logger::ngap().error("Decoded NGAP GUAMI IE error");
return false;
}
} else {
cout << "decoded ngap GUAMI IE error" << endl;
Logger::ngap().error("Decoded NGAP GUAMI IE error");
return false;
}
} break;
......@@ -701,13 +703,13 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
&initialContextSetupRequestIEs->protocolIEs.list
.array[i]
->value.choice.PDUSessionResourceSetupListCxtReq)) {
cout << "decoded ngap PDUSessionResourceSetupListCxtReq IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListCxtReq IE error");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceSetupListCxtReq IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListCxtReq IE error");
return false;
}
} break;
......@@ -721,11 +723,11 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!allowedNssai->decodefromAllowedNSSAI(
&initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.AllowedNSSAI)) {
cout << "decoded ngap AllowedNSSAI IE error" << endl;
Logger::ngap().error("Decoded NGAP AllowedNSSAI IE error");
return false;
}
} else {
cout << "decoded ngap AllowedNSSAI IE error" << endl;
Logger::ngap().error("Decoded NGAP AllowedNSSAI IE error");
return false;
}
} break;
......@@ -739,11 +741,12 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!uESecurityCapabilities->decodefromUESecurityCapabilities(
initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.UESecurityCapabilities)) {
cout << "decoded ngap UESecurityCapabilities IE error" << endl;
Logger::ngap().error(
"Decoded NGAP UESecurityCapabilities IE error");
return false;
}
} else {
cout << "decoded ngap UESecurityCapabilities IE error" << endl;
Logger::ngap().error("Decoded NGAP UESecurityCapabilities IE error");
return false;
}
} break;
......@@ -757,11 +760,11 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!securityKey->decodefrombitstring(
initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.SecurityKey)) {
cout << "decoded ngap SecurityKey IE error" << endl;
Logger::ngap().error("Decoded NGAP SecurityKey IE error");
return false;
}
} else {
cout << "decoded ngap SecurityKey IE error" << endl;
Logger::ngap().error("Decoded NGAP SecurityKey IE error");
return false;
}
} break;
......@@ -775,17 +778,17 @@ bool InitialContextSetupRequestMsg::decodefrompdu(
if (!nasPdu->decodefromoctetstring(
initialContextSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.NAS_PDU)) {
cout << "decoded ngap NAS_PDU IE error" << endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} else {
cout << "decoded ngap NAS_PDU IE error" << endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP Message PDU error");
return false;
}
}
......@@ -802,7 +805,7 @@ unsigned long InitialContextSetupRequestMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t InitialContextSetupRequestMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -27,6 +27,7 @@
*/
#include "InitialContextSetupResponse.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -43,12 +44,12 @@ namespace ngap {
//------------------------------------------------------------------------------
InitialContextSetupResponseMsg::InitialContextSetupResponseMsg() {
initialContextSetupResponsePdu = NULL;
initialContextSetupResponseIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
pduSessionResourceSetupResponseList = NULL;
pduSessionResourceFailedToSetupResponseList = NULL;
initialContextSetupResponsePdu = nullptr;
initialContextSetupResponseIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
pduSessionResourceSetupResponseList = nullptr;
pduSessionResourceFailedToSetupResponseList = nullptr;
}
//------------------------------------------------------------------------------
......@@ -81,9 +82,9 @@ void InitialContextSetupResponseMsg::setMessageType() {
&(initialContextSetupResponsePdu->choice.successfulOutcome->value.choice
.InitialContextSetupResponse);
} else {
std::cout << "[Warning] This information doesn't refer to "
"InitialContextSetupResponse message!"
<< std::endl;
Logger::ngap().warn(
"This information doesn't refer to InitialContextSetupResponse "
"message!");
}
}
......@@ -102,13 +103,13 @@ void InitialContextSetupResponseMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl;
if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -127,13 +128,14 @@ void InitialContextSetupResponseMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl;
if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -170,16 +172,14 @@ void InitialContextSetupResponseMsg::setPduSessionResourceSetupResponseList(
->encode2PDUSessionResourceSetupListCxtRes(
&ie->value.choice.PDUSessionResourceSetupListCxtRes);
if (!ret) {
std::cout << "Encode PDUSessionResourceSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error("Encode PDUSessionResourceSetupListCxtRes IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0)
std::cout << "Encode PDUSessionResourceSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error("Encode PDUSessionResourceSetupListCxtRes IE error");
// free_wrapper((void**) &ie);
}
......@@ -221,16 +221,16 @@ void InitialContextSetupResponseMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListCxtRes(
&ie->value.choice.PDUSessionResourceFailedToSetupListCxtRes);
if (!ret) {
std::cout << "Encode PDUSessionResourceFailedToSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtRes IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialContextSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0)
std::cout << "Encode PDUSessionResourceFailedToSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Encode PDUSessionResourceFailedToSetupListCxtRes IE error");
// free_wrapper((void**) &ie);
}
......@@ -240,7 +240,7 @@ int InitialContextSetupResponseMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialContextSetupResponsePdu, buf,
buf_size);
std::cout << "er.encoded(" << er.encoded << ")" << std::endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -264,12 +264,13 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
&initialContextSetupResponsePdu->choice.successfulOutcome->value
.choice.InitialContextSetupResponse;
} else {
std::cout << "Check InitialContextSetupResponse message error!"
<< std::endl;
Logger::ngap().error("Check InitialContextSetupResponse message error");
return false;
}
} else {
std::cout << "MessageType error!" << std::endl;
Logger::ngap().error("MessageType error");
return false;
}
for (int i = 0; i < initialContextSetupResponseIEs->protocolIEs.list.count;
......@@ -286,11 +287,12 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
initialContextSetupResponseIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
std::cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
std::cout << "Decoded NGAP AMF_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -305,11 +307,11 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialContextSetupResponseIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
std::cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
std::cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -326,14 +328,15 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
&initialContextSetupResponseIEs->protocolIEs.list
.array[i]
->value.choice.PDUSessionResourceSetupListCxtRes)) {
std::cout
<< "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListCxtRes IE error");
return false;
}
} else {
std::cout << "Decoded NGAP PDUSessionResourceSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListCxtRes IE error");
return false;
}
} break;
......@@ -351,21 +354,24 @@ bool InitialContextSetupResponseMsg::decodefrompdu(
.array[i]
->value.choice
.PDUSessionResourceFailedToSetupListCxtRes)) {
std::cout << "Decoded NGAP "
"PDUSessionResourceFailedToSetupListCxtRes IE error"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes IE "
"error");
return false;
}
} else {
std::cout << "Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes "
"IE error!"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListCxtRes IE "
"error");
return false;
}
} break;
default: {
std::cout << "Decoded NGAP message PDU error" << std::endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......@@ -382,7 +388,7 @@ unsigned long InitialContextSetupResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t InitialContextSetupResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -27,6 +27,7 @@
*/
#include "InitialUEMessage.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -44,14 +45,14 @@ namespace ngap {
//------------------------------------------------------------------------------
InitialUEMessageMsg::InitialUEMessageMsg() {
initialUEMessagePdu = NULL;
initialUEMessageIEs = NULL;
ranUeNgapId = NULL;
nasPdu = NULL;
userLocationInformation = NULL;
rRCEstablishmentCause = NULL;
uEContextRequest = NULL;
fivegSTmsi = NULL;
initialUEMessagePdu = nullptr;
initialUEMessageIEs = nullptr;
ranUeNgapId = nullptr;
nasPdu = nullptr;
userLocationInformation = nullptr;
rRCEstablishmentCause = nullptr;
uEContextRequest = nullptr;
fivegSTmsi = nullptr;
}
//------------------------------------------------------------------------------
......@@ -81,9 +82,8 @@ void InitialUEMessageMsg::setMessageType() {
initialUEMessageIEs = &(initialUEMessagePdu->choice.initiatingMessage->value
.choice.InitialUEMessage);
} else {
cout << "[warning] This information doesn't refer to InitialUEMessage "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to InitialUEMessage message!");
}
}
......@@ -100,13 +100,14 @@ void InitialUEMessageMsg::setRanUENgapID(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -124,13 +125,13 @@ void InitialUEMessageMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) {
cout << "encode NAS_PDU IE error" << endl;
Logger::ngap().error("Encode NAS PDU IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode NAS_PDU IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NAS PDU IE error");
// free_wrapper((void**) &ie);
}
......@@ -169,13 +170,14 @@ void InitialUEMessageMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation);
if (!ret) {
cout << "encode UserLocationInformation IE error" << endl;
Logger::ngap().error("Encode UserLocationInformation IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UserLocationInformation IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode UserLocationInformation IE error");
// free_wrapper((void**) &ie);
}
......@@ -196,13 +198,13 @@ void InitialUEMessageMsg::setRRCEstablishmentCause(
int ret = rRCEstablishmentCause->encode2RRCEstablishmentCause(
ie->value.choice.RRCEstablishmentCause);
if (!ret) {
cout << "encode RRCEstablishmentCause IE error" << endl;
Logger::ngap().error("Encode RRCEstablishmentCause IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RRCEstablishmentCause IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode RRCEstablishmentCause IE error");
// free_wrapper((void**) &ie);
}
......@@ -224,13 +226,13 @@ void InitialUEMessageMsg::setUeContextRequest(
int ret = uEContextRequest->encode2UEContextRequest(
ie->value.choice.UEContextRequest);
if (!ret) {
cout << "encode UEContextRequest IE error" << endl;
Logger::ngap().error("Encode UEContextRequest IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&initialUEMessageIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UEContextRequest IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode UEContextRequest IE error");
// free_wrapper((void**) &ie);
}
......@@ -239,7 +241,7 @@ int InitialUEMessageMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, initialUEMessagePdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, initialUEMessagePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -259,11 +261,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
initialUEMessageIEs = &initialUEMessagePdu->choice.initiatingMessage
->value.choice.InitialUEMessage;
} else {
cout << "Check InitialUEMessage message error!!!" << endl;
Logger::ngap().error("Check InitialUEMessage message error");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("Check MessageType error");
return false;
}
for (int i = 0; i < initialUEMessageIEs->protocolIEs.list.count; i++) {
......@@ -277,13 +279,14 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
cout << "[InitialUeMessage] Received RanUeNgapId "
<< ranUeNgapId->getRanUeNgapId() << endl;
Logger::ngap().debug(
"Received RanUeNgapId %d ", ranUeNgapId->getRanUeNgapId());
} else {
cout << "Decoded NGAP RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -296,11 +299,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!nasPdu->decodefromoctetstring(
initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.NAS_PDU)) {
cout << "Decoded NGAP NAS_PDU IE error" << endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} else {
cout << "Decoded NGAP NAS_PDU IE error" << endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} break;
......@@ -314,11 +317,12 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!userLocationInformation->decodefromUserLocationInformation(
&initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) {
cout << "Decoded NGAP UserLocationInformation IE error" << endl;
Logger::ngap().error(
"Decoded NGAP UserLocationInformation IE error");
return false;
}
} else {
cout << "Decoded NGAP UserLocationInformation IE error" << endl;
Logger::ngap().error("Decoded NGAP UserLocationInformation IE error");
return false;
}
} break;
......@@ -331,11 +335,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!rRCEstablishmentCause->decodefromRRCEstablishmentCause(
initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.RRCEstablishmentCause)) {
cout << "Decoded NGAP RRCEstablishmentCause IE error" << endl;
Logger::ngap().error("Decoded NGAP RRCEstablishmentCause IE error");
return false;
}
} else {
cout << "Decoded NGAP RRCEstablishmentCause IE error" << endl;
Logger::ngap().error("Decoded NGAP RRCEstablishmentCause IE error");
return false;
}
} break;
......@@ -348,11 +352,11 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!uEContextRequest->decodefromUEContextRequest(
initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.UEContextRequest)) {
cout << "Decoded NGAP UEContextRequest IE error" << endl;
Logger::ngap().error("Decoded NGAP UEContextRequest IE error");
return false;
}
} else {
cout << "Decoded NGAP UEContextRequest IE error" << endl;
Logger::ngap().error("Decoded NGAP UEContextRequest IE error");
return false;
}
} break;
......@@ -366,15 +370,16 @@ bool InitialUEMessageMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!fivegSTmsi->decodefrompdu(
initialUEMessageIEs->protocolIEs.list.array[i]
->value.choice.FiveG_S_TMSI)) {
cout << "decode ngap FiveG_S_TMSI IE error" << endl;
Logger::ngap().error("Decoded NGAP FiveG_S_TMSI IE error");
return false;
}
}
} break;
default: {
cout << "not decoded IE:"
<< initialUEMessageIEs->protocolIEs.list.array[i]->id << endl;
Logger::ngap().warn(
"Not decoded IE %d",
initialUEMessageIEs->protocolIEs.list.array[i]->id);
return true;
}
}
......
......@@ -27,6 +27,7 @@
*/
#include "NGReset.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
......@@ -73,9 +74,7 @@ void NGResetMsg::setMessageType() {
NgResetMessageTypeIE.encode2pdu(ngResetPdu);
ngResetIEs = &(ngResetPdu->choice.initiatingMessage->value.choice.NGReset);
} else {
cout << "[Warning] This information doesn't refer to NGReset "
"Message!!!"
<< endl;
Logger::ngap().warn("This information doesn't refer to NGReset message!");
}
}
......@@ -116,7 +115,7 @@ int NGResetMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngResetPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngResetPdu, buf, buf_size);
printf("er.encoded(%ld)\n", er.encoded);
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -144,11 +143,11 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!cause->decodefromCause(
&ngResetIEs->protocolIEs.list.array[i]
->value.choice.Cause)) {
cout << "Decoded NGAP Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} else {
cout << "Decoded NGAP Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} break;
......@@ -160,28 +159,28 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
resetType = new ResetType();
if (!resetType->decode(&ngResetIEs->protocolIEs.list.array[i]
->value.choice.ResetType)) {
cout << "Decoded NGAP ResetType IE error" << endl;
Logger::ngap().error("Decoded NGAP ResetType IE error");
return false;
}
} else {
cout << "Decoded NGAP ResetType IE error" << endl;
Logger::ngap().error("Decoded NGAP ResetType IE error");
return false;
}
} break;
default: {
cout << "Decoded NGAP message PDU error" << endl;
Logger::ngap().error("Decoded NGAP message PDU IE error");
return false;
}
}
}
} else {
cout << "Check NGReset message error!!!";
Logger::ngap().error("Check NGReset message error!");
return false;
}
} else {
cout << "Check NGReset message error!!!";
Logger::ngap().error("Check NGReset message error!");
return false;
}
return true;
......
......@@ -27,6 +27,7 @@
*/
#include "NGSetupFailure.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -43,10 +44,10 @@ namespace ngap {
//------------------------------------------------------------------------------
NGSetupFailureMsg::NGSetupFailureMsg() {
ngSetupFailurePdu = NULL;
ngSetupFailureIEs = NULL;
cause = NULL;
timeToWait = NULL;
ngSetupFailurePdu = nullptr;
ngSetupFailureIEs = nullptr;
cause = nullptr;
timeToWait = nullptr;
// criticalityDiagnostics = NULL;
}
......@@ -74,9 +75,8 @@ void NGSetupFailureMsg::setMessageType() {
ngSetupFailureIEs = &(ngSetupFailurePdu->choice.unsuccessfulOutcome->value
.choice.NGSetupFailure);
} else {
cout << "[warning] This information doesn't refer to NGSetupFailure "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to NGSetupFailure message!");
}
}
......@@ -91,7 +91,7 @@ void NGSetupFailureMsg::addCauseIE() {
cause->encode2Cause(&ie->value.choice.Cause);
int ret = ASN_SEQUENCE_ADD(&ngSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode Cause IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP Cause IE error");
}
//------------------------------------------------------------------------------
......@@ -105,7 +105,7 @@ void NGSetupFailureMsg::addTimeToWaitIE() {
timeToWait->encode2TimeToWait(&ie->value.choice.TimeToWait);
int ret = ASN_SEQUENCE_ADD(&ngSetupFailureIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode TimeToWait IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP TimeToWait IE error");
}
//------------------------------------------------------------------------------
......@@ -219,7 +219,7 @@ int NGSetupFailureMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupFailurePdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngSetupFailurePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -238,11 +238,11 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ngSetupFailureIEs = &ngSetupFailurePdu->choice.initiatingMessage->value
.choice.NGSetupFailure;
} else {
cout << "Check NGSetupFailure message error!!!" << endl;
Logger::ngap().error("Check NGSetupFailure message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0; i < ngSetupFailureIEs->protocolIEs.list.count; i++) {
......@@ -256,11 +256,11 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!cause->decodefromCause(
&ngSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.Cause)) {
cout << "decoded ngap Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} else {
cout << "decoded ngap Cause IE error" << endl;
Logger::ngap().error("Decoded NGAP Cause IE error");
return false;
}
} break;
......@@ -273,19 +273,19 @@ bool NGSetupFailureMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!timeToWait->decodefromTimeToWait(
&ngSetupFailureIEs->protocolIEs.list.array[i]
->value.choice.TimeToWait)) {
cout << "decoded ngap TimeToWait IE error" << endl;
Logger::ngap().error("Decoded NGAP TimeToWait IE error");
return false;
}
} else {
cout << "decoded ngap TimeToWait IE error" << endl;
Logger::ngap().error("Decoded NGAP TimeToWait IE error");
return false;
}
} break;
case Ngap_ProtocolIE_ID_id_CriticalityDiagnostics: {
cout << "decoded ngap: This is CriticalityDiagnostics IE" << endl;
Logger::ngap().debug("Decoded NGAP CriticalityDiagnostics IE ");
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......
......@@ -27,6 +27,7 @@
*/
#include "NGSetupRequest.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
......@@ -47,13 +48,13 @@ namespace ngap {
//------------------------------------------------------------------------------
NGSetupRequestMsg::NGSetupRequestMsg() {
ngSetupRequestPdu = NULL;
ngSetupRequestIEs = NULL;
ngSetupRequestPdu = nullptr;
ngSetupRequestIEs = nullptr;
globalRanNodeId = NULL;
ranNodeName = NULL;
supportedTAList = NULL;
defaultPagingDrx = NULL;
globalRanNodeId = nullptr;
ranNodeName = nullptr;
supportedTAList = nullptr;
defaultPagingDrx = nullptr;
}
//------------------------------------------------------------------------------
......@@ -79,9 +80,8 @@ void NGSetupRequestMsg::setMessageType() {
ngSetupRequestIEs = &(ngSetupRequestPdu->choice.initiatingMessage->value
.choice.NGSetupRequest);
} else {
cout << "[warning] This information doesn't refer to NGSetupRequest "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to NGSetupRequest message!");
}
}
......@@ -108,12 +108,12 @@ void NGSetupRequestMsg::setGlobalRanNodeID(
int ret = globalRanNodeIdIE.encode2GlobalRANNodeID(
&ie->value.choice.GlobalRANNodeID);
if (!ret) {
cout << "encode GlobalRANNodeID IE error" << endl;
Logger::ngap().error("Encode NGAP GlobalRANNodeID IE error");
return;
}
ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode GlobalRANNodeID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP GlobalRANNodeID IE error");
}
//------------------------------------------------------------------------------
......@@ -129,19 +129,19 @@ void NGSetupRequestMsg::setRanNodeName(const std::string ranNodeName) {
int ret = ranNodeNameIE.encode2RanNodeName(&ie->value.choice.RANNodeName);
if (!ret) {
cout << "encode RanNodeName IE error" << endl;
Logger::ngap().error("Encode NGAP RANNodeName IE error");
return;
}
ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RANNodeName IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP RANNodeName IE error");
}
//------------------------------------------------------------------------------
void NGSetupRequestMsg::setSupportedTAList(
const std::vector<struct SupportedItem_s> list) {
if (list.size() == 0) {
cout << "[Warning] Setup failed, vector is empty!!!" << endl;
Logger::ngap().warn("Setup failed, vector is empty");
return;
}
......@@ -181,12 +181,12 @@ void NGSetupRequestMsg::setSupportedTAList(
int ret = supportedTAListIE.encode2SupportedTAList(
&ie->value.choice.SupportedTAList);
if (!ret) {
cout << "encode SupportedTAList IE error" << endl;
Logger::ngap().error("Encode SupportedTAList IE error");
return;
}
ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode SupportedTAList IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode SupportedTAList IE error");
}
//------------------------------------------------------------------------------
......@@ -203,13 +203,13 @@ void NGSetupRequestMsg::setDefaultPagingDRX(e_Ngap_PagingDRX value) {
int ret =
defaultPagingDRXIE.encode2DefaultPagingDRX(ie->value.choice.PagingDRX);
if (!ret) {
cout << "encode DefaultPagingDRX IE error" << endl;
Logger::ngap().error("Encode DefaultPagingDRX IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ngSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode DefaultPagingDRX IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode DefaultPagingDRX IE error");
// free_wrapper((void**) &ie);
}
......@@ -218,7 +218,7 @@ int NGSetupRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupRequestPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngSetupRequestPdu, buf, buf_size);
printf("er.encoded(%ld)\n", er.encoded);
Logger::ngap().debug("er.encoded( %d )", er.encoded);
return er.encoded;
}
......@@ -247,11 +247,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!globalRanNodeId->decodefromGlobalRANNodeID(
&ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.GlobalRANNodeID)) {
cout << "Decoded NGAP GlobalRanNodeId IE error!" << endl;
Logger::ngap().error("Decoded NGAP GlobalRanNodeId IE error");
return false;
}
} else {
cout << "Decoded NGAP GlobalRanNodeId IE error" << endl;
Logger::ngap().error("Decoded NGAP GlobalRanNodeId IE error");
return false;
}
} break;
......@@ -264,11 +264,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranNodeName->decodefromRanNodeName(
&ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.RANNodeName)) {
cout << "Decoded NGAP RanNodeName IE error" << endl;
Logger::ngap().error("Decoded NGAP RanNodeName IE error");
return false;
}
} else {
cout << "Decoded NGAP RanNodeName IE error" << endl;
Logger::ngap().error("Decoded NGAP RanNodeName IE error");
return false;
}
} break;
......@@ -281,11 +281,11 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!supportedTAList->decodefromSupportedTAList(
&ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.SupportedTAList)) {
cout << "Decoded NGAP SupportedTAList IE error" << endl;
Logger::ngap().error("Decoded NGAP SupportedTAList IE error");
return false;
}
} else {
cout << "Decoded NGAP SupportedTAList IE error" << endl;
Logger::ngap().error("Decoded NGAP SupportedTAList IE error");
return false;
}
} break;
......@@ -298,26 +298,26 @@ bool NGSetupRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!defaultPagingDrx->decodefromDefaultPagingDRX(
ngSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.PagingDRX)) {
cout << "Decoded NGAP DefaultPagingDRX IE error" << endl;
Logger::ngap().error("Decoded NGAP DefaultPagingDRX IE error");
return false;
}
} else {
cout << "Decoded NGAP DefaultPagingDRX IE error" << endl;
Logger::ngap().error("Decoded NGAP DefaultPagingDRX IE error");
return false;
}
} break;
default: {
cout << "Decoded NGAP message PDU error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
}
} else {
cout << "Check NGSetupRequest message error!!!";
Logger::ngap().error("Check NGSetupRequest message error");
return false;
}
} else {
cout << "Check NGSetupRequest message error!!!";
Logger::ngap().error("Check NGSetupRequest message error");
return false;
}
return true;
......
......@@ -70,7 +70,6 @@ class NGSetupRequestMsg {
Ngap_NGAP_PDU_t* ngSetupRequestPdu;
Ngap_NGSetupRequest_t* ngSetupRequestIEs;
/***************** for decoding ****************/
GlobalRanNodeId* globalRanNodeId;
RanNodeName* ranNodeName;
SupportedTAList* supportedTAList;
......
......@@ -27,6 +27,7 @@
*/
#include "NGSetupResponse.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -43,13 +44,13 @@ namespace ngap {
//------------------------------------------------------------------------------
NGSetupResponseMsg::NGSetupResponseMsg() {
ngSetupResponsePdu = NULL;
ngSetupResponsIEs = NULL;
amfName = NULL;
servedGUAMIList = NULL;
relativeAmfCapacity = NULL;
plmnSupportList = NULL;
// criticalityDiagnostics = NULL;
ngSetupResponsePdu = nullptr;
ngSetupResponsIEs = nullptr;
amfName = nullptr;
servedGUAMIList = nullptr;
relativeAmfCapacity = nullptr;
plmnSupportList = nullptr;
// criticalityDiagnostics = nullptr;
}
//------------------------------------------------------------------------------
......@@ -75,9 +76,8 @@ void NGSetupResponseMsg::setMessageType() {
ngSetupResponsIEs = &(ngSetupResponsePdu->choice.successfulOutcome->value
.choice.NGSetupResponse);
} else {
cout << "[warning] This information doesn't refer to NGSetupRespons "
"Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to NGSetupRespons message!");
}
}
......@@ -94,12 +94,12 @@ void NGSetupResponseMsg::setAMFName(const std::string name) {
int ret = amfName->encode2AmfName(&ie->value.choice.AMFName);
if (!ret) {
cout << "encode AmfName IE error" << endl;
Logger::ngap().error("Encode NGAP AMFName IE error");
return;
}
ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AmfName IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP AMFName IE error");
}
//------------------------------------------------------------------------------
......@@ -139,7 +139,7 @@ void NGSetupResponseMsg::setGUAMIList(std::vector<struct GuamiItem_s> list) {
servedGUAMIList->encode2ServedGUAMIList(&ie->value.choice.ServedGUAMIList);
int ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode ServedGUAMIList IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP ServedGUAMIList IE error");
}
//------------------------------------------------------------------------------
......@@ -157,7 +157,8 @@ void NGSetupResponseMsg::setRelativeAmfCapacity(long capacity) {
&ie->value.choice.RelativeAMFCapacity);
int ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RelativeAMFCapacity IE error" << endl;
if (ret != 0)
Logger::ngap().error("Encode NGAP RelativeAMFCapacity IE error");
}
//------------------------------------------------------------------------------
......@@ -192,7 +193,7 @@ void NGSetupResponseMsg::setPlmnSupportList(
plmnSupportList->encode2PLMNSupportList(&ie->value.choice.PLMNSupportList);
int ret = ASN_SEQUENCE_ADD(&ngSetupResponsIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode PLMNSupportList IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP PLMNSupportList IE error");
}
//------------------------------------------------------------------------------
......@@ -200,7 +201,7 @@ int NGSetupResponseMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, ngSetupResponsePdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ngSetupResponsePdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......@@ -220,13 +221,13 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ngSetupResponsIEs = &ngSetupResponsePdu->choice.successfulOutcome->value
.choice.NGSetupResponse;
} else {
cout << "Check NGSetupResponse message error!!!" << endl;
Logger::ngap().error("Check NGSetupResponse message error");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
cout << "ngSetupResponsePdu->present == " << ngSetupResponsePdu->present
<< endl;
Logger::ngap().error(
"MessageType error, ngSetupResponsePdu->present %d",
ngSetupResponsePdu->present);
return false;
}
for (int i = 0; i < ngSetupResponsIEs->protocolIEs.list.count; i++) {
......@@ -240,11 +241,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfName->decodefromAmfName(
&ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.AMFName)) {
cout << "decoded ngap AmfName IE error" << endl;
Logger::ngap().error("Decoded NGAP AMFName error");
return false;
}
} else {
cout << "decoded ngap AmfName IE error" << endl;
Logger::ngap().error("Decoded NGAP AMFName error");
return false;
}
} break;
......@@ -257,11 +258,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!servedGUAMIList->decodefromServedGUAMIList(
&ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.ServedGUAMIList)) {
cout << "decoded ngap ServedGUAMIList IE error!" << endl;
Logger::ngap().error("Decoded NGAP ServedGUAMIList error");
return false;
}
} else {
cout << "decoded ngap ServedGUAMIList IE error" << endl;
Logger::ngap().error("Decoded NGAP ServedGUAMIList error");
return false;
}
} break;
......@@ -274,11 +275,11 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!relativeAmfCapacity->decodefromRelativeAMFCapacity(
&ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.RelativeAMFCapacity)) {
cout << "decoded ngap RelativeAMFCapacity IE error" << endl;
Logger::ngap().error("Decoded NGAP RelativeAMFCapacity error");
return false;
}
} else {
cout << "decoded ngap RelativeAMFCapacity IE error" << endl;
Logger::ngap().error("Decoded NGAP RelativeAMFCapacity error");
return false;
}
} break;
......@@ -291,19 +292,20 @@ bool NGSetupResponseMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!plmnSupportList->decodefromPLMNSupportList(
&ngSetupResponsIEs->protocolIEs.list.array[i]
->value.choice.PLMNSupportList)) {
cout << "decoded ngap PLMNSupportList IE error" << endl;
Logger::ngap().error("Decoded NGAP PLMNSupportList error");
return false;
}
} else {
cout << "decoded ngap PLMNSupportList IE error!" << endl;
Logger::ngap().error("Decoded NGAP PLMNSupportList error");
return false;
}
} break;
case Ngap_ProtocolIE_ID_id_CriticalityDiagnostics: {
cout << "decoded ngap: This is CriticalityDiagnostics IE" << endl;
Logger::ngap().debug("Decoded NGAP CriticalityDiagnostics");
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP Message PDU error");
return false;
}
}
......
......@@ -69,8 +69,6 @@ class NGSetupResponseMsg {
Ngap_NGAP_PDU_t* ngSetupResponsePdu;
Ngap_NGSetupResponse_t* ngSetupResponsIEs;
/***************** for decoding ****************/
AmfName* amfName;
ServedGUAMIList* servedGUAMIList;
RelativeAMFCapacity* relativeAmfCapacity;
......
......@@ -46,13 +46,13 @@ namespace ngap {
//------------------------------------------------------------------------------
PduSessionResourceReleaseCommandMsg::PduSessionResourceReleaseCommandMsg() {
pduSessionResourceReleaseCommandPdu = NULL;
pduSessionResourceReleaseCommandIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
ranPagingPriority = NULL;
nasPdu = NULL;
pduSessionResourceToReleaseList = NULL;
pduSessionResourceReleaseCommandPdu = nullptr;
pduSessionResourceReleaseCommandIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
ranPagingPriority = nullptr;
nasPdu = nullptr;
pduSessionResourceToReleaseList = nullptr;
}
//------------------------------------------------------------------------------
......@@ -431,7 +431,7 @@ unsigned long PduSessionResourceReleaseCommandMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t PduSessionResourceReleaseCommandMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -45,12 +45,12 @@ namespace ngap {
//------------------------------------------------------------------------------
PduSessionResourceReleaseResponseMsg::PduSessionResourceReleaseResponseMsg() {
pduSessionResourceReleaseResponsePdu = NULL;
pduSessionResourceReleaseResponseIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
pduSessionResourceReleasedList = NULL;
userLocationInformation = NULL;
pduSessionResourceReleaseResponsePdu = nullptr;
pduSessionResourceReleaseResponseIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
pduSessionResourceReleasedList = nullptr;
userLocationInformation = nullptr;
}
//------------------------------------------------------------------------------
......@@ -380,7 +380,7 @@ unsigned long PduSessionResourceReleaseResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t PduSessionResourceReleaseResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -27,6 +27,7 @@
*/
#include "PduSessionResourceSetupRequest.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -76,13 +77,14 @@ void PduSessionResourceSetupRequestMsg::setUEAggregateMaxBitRate(
int ret = uEAggregateMaxBitRate->encode2UEAggregateMaxBitRate(
ie->value.choice.UEAggregateMaximumBitRate);
if (!ret) {
cout << "encode UEAggregateMaxBitRate IE error" << endl;
Logger::ngap().error("Encode NGAP UEAggregateMaxBitRate IE error");
return;
}
ret = ASN_SEQUENCE_ADD(
&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() {
&(pduSessionResourceSetupRequestPdu->choice.initiatingMessage->value
.choice.PDUSessionResourceSetupRequest);
} else {
cout << "[warning] This information doesn't refer to "
"PDUSessionResourceSetupRequest Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to PDUSessionResourceSetupRequest "
"message!");
}
}
......@@ -133,14 +135,14 @@ void PduSessionResourceSetupRequestMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -160,14 +162,14 @@ void PduSessionResourceSetupRequestMsg::setRanUeNgapId(
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -188,14 +190,14 @@ void PduSessionResourceSetupRequestMsg::setRanPagingPriority(uint8_t priority) {
int ret = ranPagingPriority->encode2RANPagingPriority(
ie->value.choice.RANPagingPriority);
if (!ret) {
cout << "encode RANPagingPriority IE error" << endl;
Logger::ngap().error("Encode NGAP RANPagingPriority IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -215,14 +217,14 @@ void PduSessionResourceSetupRequestMsg::setNasPdu(
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) {
cout << "encode NAS_PDU IE error" << endl;
Logger::ngap().error("Encode NGAP NAS_PDU IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&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);
}
......@@ -266,7 +268,9 @@ void PduSessionResourceSetupRequestMsg::setPduSessionResourceSetupRequestList(
->encode2PDUSessionResourceSetupListSUReq(
&ie->value.choice.PDUSessionResourceSetupListSUReq);
if (!ret) {
cout << "encode PDUSessionResourceSetupListSUReq IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceSetupListSUReq IE error");
free_wrapper((void**) &ie);
return;
}
......@@ -274,7 +278,8 @@ void PduSessionResourceSetupRequestMsg::setPduSessionResourceSetupRequestList(
ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupRequestIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceSetupListSUReq IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceSetupListSUReq IE error");
// free_wrapper((void**) &ie);
}
......@@ -301,7 +306,7 @@ int PduSessionResourceSetupRequestMsg::encode2buffer(
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, pduSessionResourceSetupRequestPdu, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......@@ -314,7 +319,7 @@ void PduSessionResourceSetupRequestMsg::encode2buffer_new(
&asn_DEF_Ngap_NGAP_PDU, NULL, pduSessionResourceSetupRequestPdu,
(void**) &buffer);
cout << "er.encoded(" << encoded_size << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", encoded_size);
memcpy((void*) buf, (void*) buffer, encoded_size);
free(buffer);
}
......@@ -340,11 +345,13 @@ bool PduSessionResourceSetupRequestMsg::decodefrompdu(
&pduSessionResourceSetupRequestPdu->choice.initiatingMessage->value
.choice.PDUSessionResourceSetupRequest;
} else {
cout << "Check PDUSessionResourceSetupRequest message error!!!" << endl;
Logger::ngap().error(
"Check PDUSessionResourceSetupRequest message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0; i < pduSessionResourceSetupRequestIEs->protocolIEs.list.count;
......@@ -360,11 +367,11 @@ bool PduSessionResourceSetupRequestMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
pduSessionResourceSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -378,11 +385,11 @@ bool PduSessionResourceSetupRequestMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
pduSessionResourceSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -396,11 +403,11 @@ bool PduSessionResourceSetupRequestMsg::decodefrompdu(
if (!ranPagingPriority->decodefromRANPagingPriority(
pduSessionResourceSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.RANPagingPriority)) {
cout << "decoded ngap RANPagingPriority IE error" << endl;
Logger::ngap().error("Decoded NGAP RANPagingPriority IE error");
return false;
}
} else {
cout << "decoded ngap RANPagingPriority IE error" << endl;
Logger::ngap().error("Decoded NGAP RANPagingPriority IE error");
return false;
}
} break;
......@@ -414,11 +421,11 @@ bool PduSessionResourceSetupRequestMsg::decodefrompdu(
if (!nasPdu->decodefromoctetstring(
pduSessionResourceSetupRequestIEs->protocolIEs.list.array[i]
->value.choice.NAS_PDU)) {
cout << "decoded ngap NAS_PDU IE error" << endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} else {
cout << "decoded ngap NAS_PDU IE error" << endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} break;
......@@ -435,18 +442,20 @@ bool PduSessionResourceSetupRequestMsg::decodefrompdu(
&pduSessionResourceSetupRequestIEs->protocolIEs.list
.array[i]
->value.choice.PDUSessionResourceSetupListSUReq)) {
cout << "decoded ngap PDUSessionResourceSetupListSUReq IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListSUReq IE error");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceSetupListSUReq IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListSUReq IE error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP Message PDU error");
return false;
}
}
......@@ -463,7 +472,7 @@ unsigned long PduSessionResourceSetupRequestMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t PduSessionResourceSetupRequestMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -28,6 +28,8 @@
#include "PduSessionResourceSetupResponse.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
#include "constr_TYPE.h"
......@@ -44,12 +46,12 @@ namespace ngap {
//------------------------------------------------------------------------------
PduSessionResourceSetupResponseMsg::PduSessionResourceSetupResponseMsg() {
pduSessionResourceSetupResponsePdu = NULL;
pduSessionResourceSetupResponseIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
pduSessionResourceSetupResponseList = NULL;
pduSessionResourceFailedToSetupResponseList = NULL;
pduSessionResourceSetupResponsePdu = nullptr;
pduSessionResourceSetupResponseIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
pduSessionResourceSetupResponseList = nullptr;
pduSessionResourceFailedToSetupResponseList = nullptr;
}
//------------------------------------------------------------------------------
......@@ -83,9 +85,9 @@ void PduSessionResourceSetupResponseMsg::setMessageType() {
&(pduSessionResourceSetupResponsePdu->choice.successfulOutcome->value
.choice.PDUSessionResourceSetupResponse);
} else {
cout << "[warning] This information doesn't refer to "
"PDUSessionResourceSetupResponse Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to PDUSessionResourceSetupResponse "
"message!");
}
}
......@@ -104,14 +106,14 @@ void PduSessionResourceSetupResponseMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -131,14 +133,14 @@ void PduSessionResourceSetupResponseMsg::setRanUeNgapId(
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -175,14 +177,17 @@ void PduSessionResourceSetupResponseMsg::setPduSessionResourceSetupResponseList(
->encode2PDUSessionResourceSetupListSURes(
&ie->value.choice.PDUSessionResourceSetupListSURes);
if (!ret) {
cout << "encode PDUSessionResourceSetupListSURes IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceSetupListSURes IE error");
return;
}
ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceSetupListSURes IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceSetupListSURes IE error");
}
//------------------------------------------------------------------------------
......@@ -222,14 +227,16 @@ void PduSessionResourceSetupResponseMsg::setPduSessionResourceFailedToSetupList(
->encode2PDUSessionResourceFailedToSetupListSURes(
&ie->value.choice.PDUSessionResourceFailedToSetupListSURes);
if (!ret) {
cout << "encode PDUSessionResourceFailedToSetupListSURes IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceFailedToSetupListSURes IE error");
return;
}
ret = ASN_SEQUENCE_ADD(
&pduSessionResourceSetupResponseIEs->protocolIEs.list, ie);
if (ret != 0)
cout << "encode PDUSessionResourceFailedToSetupListSURes IE error" << endl;
Logger::ngap().error(
"Encode NGAP PDUSessionResourceFailedToSetupListSURes IE error");
}
//------------------------------------------------------------------------------
......@@ -240,7 +247,7 @@ int PduSessionResourceSetupResponseMsg::encode2buffer(
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, pduSessionResourceSetupResponsePdu, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......@@ -267,11 +274,12 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
&pduSessionResourceSetupResponsePdu->choice.successfulOutcome->value
.choice.PDUSessionResourceSetupResponse;
} else {
cout << "Check PDUSessionResourceSetupResponse message error!!!" << endl;
Logger::ngap().error(
"Check PDUSessionResourceSetupResponse message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0;
......@@ -288,11 +296,11 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
pduSessionResourceSetupResponseIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error!");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error!");
return false;
}
} break;
......@@ -307,11 +315,11 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
pduSessionResourceSetupResponseIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error!");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error!");
return false;
}
} break;
......@@ -328,13 +336,13 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
&pduSessionResourceSetupResponseIEs->protocolIEs.list
.array[i]
->value.choice.PDUSessionResourceSetupListSURes)) {
cout << "decoded ngap PDUSessionResourceSetupListSURes IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListSURes IE error!");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceSetupListSURes IE error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceSetupListSURes IE error!");
return false;
}
} break;
......@@ -352,21 +360,21 @@ bool PduSessionResourceSetupResponseMsg::decodefrompdu(
.array[i]
->value.choice
.PDUSessionResourceFailedToSetupListSURes)) {
cout << "decoded ngap PDUSessionResourceFailedToSetupListSURes IE "
"error"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListSURes IE "
"error!");
return false;
}
} else {
cout << "decoded ngap PDUSessionResourceFailedToSetupListSURes IE "
"error!"
<< endl;
Logger::ngap().error(
"Decoded NGAP PDUSessionResourceFailedToSetupListSURes IE "
"error!");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error!");
return false;
}
}
......@@ -383,7 +391,7 @@ unsigned long PduSessionResourceSetupResponseMsg::getAmfUeNgapId() {
//------------------------------------------------------------------------------
uint32_t PduSessionResourceSetupResponseMsg::getRanUeNgapId() {
if (!ranUeNgapId) return -1;
if (!ranUeNgapId) return 0;
return ranUeNgapId->getRanUeNgapId();
}
......
......@@ -28,6 +28,8 @@
#include "UEContextReleaseCommand.hpp"
#include "logger.hpp"
#include <iostream>
extern "C" {
#include "Ngap_UE-NGAP-ID-pair.h"
......@@ -85,12 +87,13 @@ void UEContextReleaseCommandMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(
ie->value.choice.UE_NGAP_IDs.choice.aMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode UE_NGAP_IDs IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -113,19 +116,19 @@ void UEContextReleaseCommandMsg::setUeNgapIdPair(
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(
ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->aMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(
ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->rAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode UE_NGAP_IDs IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -155,7 +158,7 @@ void UEContextReleaseCommandMsg::addCauseIE() {
ie->value.present = Ngap_UEContextReleaseCommand_IEs__value_PR_Cause;
causeValue->encode2Cause(&ie->value.choice.Cause);
int ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode Cause IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP Cause IE error");
}
//------------------------------------------------------------------------------
......@@ -163,7 +166,7 @@ int UEContextReleaseCommandMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu);
asn_enc_rval_t er =
aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, pdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......
......@@ -28,6 +28,8 @@
#include "UEContextReleaseComplete.hpp"
#include "logger.hpp"
#include <iostream>
#include <memory>
......@@ -82,12 +84,12 @@ void UEContextReleaseCompleteMsg::setAmfUeNgapId(unsigned long id) {
Ngap_UEContextReleaseComplete_IEs__value_PR_AMF_UE_NGAP_ID;
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -110,12 +112,12 @@ void UEContextReleaseCompleteMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
Ngap_UEContextReleaseComplete_IEs__value_PR_RAN_UE_NGAP_ID;
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -161,12 +163,13 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation);
if (!ret) {
cout << "encode UserLocationInformation IE error" << endl;
Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode UserLocationInformation IE error" << endl;
if (ret != 0)
Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
// free_wrapper((void**) &ie);
}
......@@ -209,7 +212,7 @@ int UEContextReleaseCompleteMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu);
asn_enc_rval_t er =
aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, pdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......@@ -226,12 +229,13 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ies =
&pdu->choice.successfulOutcome->value.choice.UEContextReleaseComplete;
} else {
cout << "Check UEContextReleaseComplete message error" << endl;
Logger::ngap().error("Check UEContextReleaseComplete message error");
return false;
}
} else {
cout << "typeOfMessage of UEContextReleaseComplete is not SuccessfulOutcome"
<< endl;
Logger::ngap().error(
"TypeOfMessage of UEContextReleaseComplete is not SuccessfulOutcome");
return false;
}
// TODO
......@@ -247,11 +251,11 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
ies->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decode AMF_UE_NGAP_ID error" << endl;
Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "IE AMF_UE_NGAP_ID is not correct" << endl;
Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -264,11 +268,11 @@ bool UEContextReleaseCompleteMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
ies->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decode RAN_UE_NGAP_ID error" << endl;
Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "IE RAN_UE_NGAP_ID is not correct" << endl;
Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......
......@@ -28,6 +28,8 @@
#include "UEContextReleaseRequest.hpp"
#include "logger.hpp"
#include <iostream>
extern "C" {
#include "asn_codecs.h"
......@@ -79,12 +81,12 @@ void UEContextReleaseRequestMsg::setAmfUeNgapId(unsigned long id) {
ie->value.present = Ngap_UEContextReleaseRequest_IEs__value_PR_AMF_UE_NGAP_ID;
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -100,12 +102,12 @@ void UEContextReleaseRequestMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
ie->value.present = Ngap_UEContextReleaseRequest_IEs__value_PR_RAN_UE_NGAP_ID;
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -137,7 +139,7 @@ int UEContextReleaseRequestMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, pdu);
asn_enc_rval_t er =
aper_encode_to_buffer(&asn_DEF_Ngap_NGAP_PDU, NULL, pdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......@@ -154,12 +156,13 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
ies =
&pdu->choice.initiatingMessage->value.choice.UEContextReleaseRequest;
} else {
cout << "Check UEContextReleaseRequest message error" << endl;
Logger::ngap().error("Check UEContextReleaseRequest message error");
return false;
}
} else {
cout << "typeOfMessage of UEContextReleaseRequest is not initiatingMessage"
<< endl;
Logger::ngap().error(
"TypeOfMessage of UEContextReleaseRequest is not initiatingMessage");
return false;
}
for (int i = 0; i < ies->protocolIEs.list.count; i++) {
......@@ -173,11 +176,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
ies->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decode AMF_UE_NGAP_ID error" << endl;
Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "IE AMF_UE_NGAP_ID is not correct" << endl;
Logger::ngap().error("Decode NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -190,11 +193,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
ies->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decode RAN_UE_NGAP_ID error" << endl;
Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "IE RAN_UE_NGAP_ID is not correct" << endl;
Logger::ngap().error("Decode NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -206,11 +209,11 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
causeValue = new Cause();
if (!causeValue->decodefromCause(
&ies->protocolIEs.list.array[i]->value.choice.Cause)) {
cout << "decode Cause error" << endl;
Logger::ngap().error("Decode NGAP Cause IE error");
return false;
}
} else {
cout << "IE Cause is not correct" << endl;
Logger::ngap().error("Decode NGAP Cause IE error");
return false;
}
} break;
......@@ -223,7 +226,7 @@ bool UEContextReleaseRequestMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
bool UEContextReleaseRequestMsg::getCauseRadioNetwork(
e_Ngap_CauseRadioNetwork& causeRadioNetwork) {
if (causeValue->getValue() < 0) {
cout << "Get Cause value from UEContextReleaseRequest Error!!!" << endl;
Logger::ngap().error("Get Cause value from UEContextReleaseRequest Error");
return false;
}
causeRadioNetwork = (e_Ngap_CauseRadioNetwork) causeValue->getValue();
......
......@@ -27,6 +27,7 @@
*/
#include "UERadioCapabilityInfoIndication.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -44,12 +45,12 @@ namespace ngap {
//------------------------------------------------------------------------------
UeRadioCapabilityInfoIndicationMsg::UeRadioCapabilityInfoIndicationMsg() {
ueRadioCapabilityInfoIndicationPdu = NULL;
ueRadioCapabilityInfoIndicationIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
ueRadioCapability = NULL;
ueRadioCapabilityForPaging = NULL;
ueRadioCapabilityInfoIndicationPdu = nullptr;
ueRadioCapabilityInfoIndicationIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
ueRadioCapability = nullptr;
ueRadioCapabilityForPaging = nullptr;
}
//------------------------------------------------------------------------------
......@@ -83,9 +84,9 @@ void UeRadioCapabilityInfoIndicationMsg::setMessageType() {
&(ueRadioCapabilityInfoIndicationPdu->choice.initiatingMessage->value
.choice.UERadioCapabilityInfoIndication);
} else {
cout << "[warning] This information doesn't refer to "
"UERadioCapabilityInfoIndication Message!!!"
<< endl;
Logger::ngap().warn(
"This information doesn't refer to UERadioCapabilityInfoIndication "
"message!");
}
}
......@@ -104,14 +105,14 @@ void UeRadioCapabilityInfoIndicationMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -131,14 +132,14 @@ void UeRadioCapabilityInfoIndicationMsg::setRanUeNgapId(
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -160,14 +161,14 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapability(
int ret = ueRadioCapability->encode2UERadioCapability(
ie->value.choice.UERadioCapability);
if (!ret) {
cout << "encode UERadioCapability IE error" << endl;
Logger::ngap().error("Encode NGAP UERadioCapability IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UERadioCapability IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode NGAP UERadioCapability IE error");
// free_wrapper((void**) &ie);
}
......@@ -176,8 +177,9 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapabilityForPaging(
uint8_t* nr, size_t sizeofnr, uint8_t* eutra, size_t sizeofeutra) {
if (!ueRadioCapabilityForPaging)
ueRadioCapabilityForPaging = new UERadioCapabilityForPaging();
UERadioCapabilityForPagingOfNR* m_ueRadioCapabilityForPagingOfNR = NULL;
UERadioCapabilityForPagingOfEUTRA* m_ueRadioCapabilityForPagingOfEUTRA = NULL;
UERadioCapabilityForPagingOfNR* m_ueRadioCapabilityForPagingOfNR = nullptr;
UERadioCapabilityForPagingOfEUTRA* m_ueRadioCapabilityForPagingOfEUTRA =
nullptr;
if (nr && sizeofnr > 0) {
m_ueRadioCapabilityForPagingOfNR = new UERadioCapabilityForPagingOfNR();
m_ueRadioCapabilityForPagingOfNR->setUERadioCapabilityForPagingOfNR(
......@@ -203,14 +205,15 @@ void UeRadioCapabilityInfoIndicationMsg::setUERadioCapabilityForPaging(
int ret = ueRadioCapabilityForPaging->encode2UERadioCapabilityForPaging(
&ie->value.choice.UERadioCapabilityForPaging);
if (!ret) {
cout << "encode UERadioCapabilityForPaging IE error" << endl;
Logger::ngap().error("Encode NGAP UERadioCapabilityForPaging IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UERadioCapabilityForPaging IE error" << endl;
if (ret != 0)
Logger::ngap().error("Encode NGAP UERadioCapabilityForPaging IE error");
// free_wrapper((void**) &ie);
}
......@@ -222,7 +225,7 @@ int UeRadioCapabilityInfoIndicationMsg::encode2buffer(
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, ueRadioCapabilityInfoIndicationPdu, buf,
buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......@@ -247,11 +250,12 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
&ueRadioCapabilityInfoIndicationPdu->choice.initiatingMessage->value
.choice.UERadioCapabilityInfoIndication;
} else {
cout << "Check UERadioCapabilityInfoIndication message error!!!" << endl;
Logger::ngap().error(
"Check UERadioCapabilityInfoIndication message error!");
return false;
}
} else {
cout << "MessageType error!!!" << endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0;
......@@ -267,11 +271,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -285,11 +289,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -303,11 +307,11 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
if (!ueRadioCapability->decodefromUERadioCapability(
ueRadioCapabilityInfoIndicationIEs->protocolIEs.list.array[i]
->value.choice.UERadioCapability)) {
cout << "decoded ngap UERadioCapability IE error" << endl;
Logger::ngap().error("Decoded NGAP UERadioCapability IE error");
return false;
}
} else {
cout << "decoded ngap UERadioCapability IE error" << endl;
Logger::ngap().error("Decoded NGAP UERadioCapability IE error");
return false;
}
} break;
......@@ -322,16 +326,18 @@ bool UeRadioCapabilityInfoIndicationMsg::decodefrompdu(
&ueRadioCapabilityInfoIndicationIEs->protocolIEs.list
.array[i]
->value.choice.UERadioCapabilityForPaging)) {
cout << "decoded ngap UERadioCapabilityForPaging IE error" << endl;
Logger::ngap().error(
"Decoded NGAP UERadioCapabilityForPaging IE error");
return false;
}
} else {
cout << "decoded ngap UERadioCapabilityForPaging IE error" << endl;
Logger::ngap().error(
"Decoded NGAP UERadioCapabilityForPaging IE error");
return false;
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......
......@@ -27,6 +27,7 @@
*/
#include "UplinkNASTransport.hpp"
#include "logger.hpp"
extern "C" {
#include "asn_codecs.h"
......@@ -43,12 +44,12 @@ namespace ngap {
//------------------------------------------------------------------------------
UplinkNASTransportMsg::UplinkNASTransportMsg() {
uplinkNASTransportPdu = NULL;
uplinkNASTransportIEs = NULL;
amfUeNgapId = NULL;
ranUeNgapId = NULL;
nasPdu = NULL;
userLocationInformation = NULL;
uplinkNASTransportPdu = nullptr;
uplinkNASTransportIEs = nullptr;
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
nasPdu = nullptr;
userLocationInformation = nullptr;
}
//------------------------------------------------------------------------------
......@@ -78,9 +79,8 @@ void UplinkNASTransportMsg::setMessageType() {
uplinkNASTransportIEs = &(uplinkNASTransportPdu->choice.initiatingMessage
->value.choice.UplinkNASTransport);
} else {
std::cout << "[Warning] This information doesn't refer to "
"UplinkNASTransport Message!"
<< std::endl;
Logger::ngap().warn(
"This information doesn't refer to UplinkNASTransport message!");
}
}
......@@ -97,13 +97,13 @@ void UplinkNASTransportMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) {
std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode AMF_UE_NGAP_ID IE error" << std::endl;
if (ret != 0) Logger::ngap().error("Encode NGAP AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -120,13 +120,13 @@ void UplinkNASTransportMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) {
std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode RAN_UE_NGAP_ID IE error" << std::endl;
if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie);
}
......@@ -144,13 +144,13 @@ void UplinkNASTransportMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) {
std::cout << "Encode NAS_PDU IE error" << std::endl;
Logger::ngap().error("Encode NGAP NAS_PDU IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0) std::cout << "Encode NAS_PDU IE error" << std::endl;
if (ret != 0) Logger::ngap().error("Encode NGAP NAS_PDU IE error");
// free_wrapper((void**) &ie);
}
......@@ -189,14 +189,14 @@ void UplinkNASTransportMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation);
if (!ret) {
std::cout << "Encode UserLocationInformation IE error" << std::endl;
Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&uplinkNASTransportIEs->protocolIEs.list, ie);
if (ret != 0)
std::cout << "Encode UserLocationInformation IE error" << std::endl;
Logger::ngap().error("Encode NGAP UserLocationInformation IE error");
// free_wrapper((void**) &ie);
}
......@@ -205,7 +205,7 @@ int UplinkNASTransportMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, uplinkNASTransportPdu);
asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, uplinkNASTransportPdu, buf, buf_size);
std::cout << "er.encoded(" << er.encoded << ")" << std::endl;
Logger::ngap().debug("er.encoded (%d)", er.encoded);
return er.encoded;
}
......@@ -225,11 +225,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
uplinkNASTransportIEs = &uplinkNASTransportPdu->choice.initiatingMessage
->value.choice.UplinkNASTransport;
} else {
std::cout << "Check UplinkNASTransport message error!!!" << std::endl;
Logger::ngap().error("Check UplinkNASTransport message error!");
return false;
}
} else {
std::cout << "MessageType error!!!" << std::endl;
Logger::ngap().error("MessageType error!");
return false;
}
for (int i = 0; i < uplinkNASTransportIEs->protocolIEs.list.count; i++) {
......@@ -243,11 +243,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
std::cout << "decoded ngap AMF_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
std::cout << "decoded ngap AMF_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -260,11 +260,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
std::cout << "decoded ngap RAN_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
std::cout << "decoded ngap RAN_UE_NGAP_ID IE error" << std::endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -277,11 +277,11 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!nasPdu->decodefromoctetstring(
uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.NAS_PDU)) {
std::cout << "decoded ngap NAS_PDU IE error" << std::endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} else {
std::cout << "decoded ngap NAS_PDU IE error" << std::endl;
Logger::ngap().error("Decoded NGAP NAS_PDU IE error");
return false;
}
} break;
......@@ -294,19 +294,18 @@ bool UplinkNASTransportMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!userLocationInformation->decodefromUserLocationInformation(
&uplinkNASTransportIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) {
std::cout << "decoded ngap UserLocationInformation IE error"
<< std::endl;
Logger::ngap().error(
"Decoded NGAP UserLocationInformation IE error");
return false;
}
} else {
std::cout << "decoded ngap UserLocationInformation IE error"
<< std::endl;
Logger::ngap().error("Decoded NGAP UserLocationInformation IE error");
return false;
}
} break;
default: {
std::cout << "decoded ngap message pdu error" << std::endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......
......@@ -27,12 +27,15 @@
*/
#include "UplinkRANStatusTransfer.hpp"
#include "logger.hpp"
#include <iostream>
#include <vector>
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
UplinkRANStatusTransfer::UplinkRANStatusTransfer() {
amfUeNgapId = nullptr;
ranUeNgapId = nullptr;
......@@ -41,8 +44,10 @@ UplinkRANStatusTransfer::UplinkRANStatusTransfer() {
UplinkRANStatusTransferIEs = nullptr;
}
//------------------------------------------------------------------------------
UplinkRANStatusTransfer::~UplinkRANStatusTransfer() {}
//------------------------------------------------------------------------------
unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID();
......@@ -50,6 +55,7 @@ unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
uint32_t UplinkRANStatusTransfer::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId();
......@@ -57,6 +63,7 @@ uint32_t UplinkRANStatusTransfer::getRanUeNgapId() {
return 0;
}
//------------------------------------------------------------------------------
void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer(
RANStatusTransferTransparentContainer*&
ranstatustransfer_transparentcontainer) {
......@@ -64,6 +71,7 @@ void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer(
ranStatusTransfer_TransparentContainer;
}
//------------------------------------------------------------------------------
bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
UplinkRANStatusTransferPDU = ngap_msg_pdu;
if (UplinkRANStatusTransferPDU->present ==
......@@ -79,11 +87,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
&UplinkRANStatusTransferPDU->choice.initiatingMessage->value.choice
.UplinkRANStatusTransfer;
} else {
cout << "Check uplinkranstatustransfer message error!!!" << endl;
Logger::ngap().error("Check UplinkRANStatusTransfer message error");
return false;
}
} else {
cout << "uplinkranstatustransfer message type error" << endl;
Logger::ngap().error("UplinkRANStatusTransfer message type error");
return false;
}
for (int i = 0; i < UplinkRANStatusTransferIEs->protocolIEs.list.count; i++) {
......@@ -98,11 +106,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
UplinkRANStatusTransferIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -116,11 +124,11 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
UplinkRANStatusTransferIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl;
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
} break;
......@@ -137,20 +145,19 @@ bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
&UplinkRANStatusTransferIEs->protocolIEs.list.array[i]
->value.choice
.RANStatusTransfer_TransparentContainer)) {
cout << "decoded ngap ranStatusTransfer_TransparentContainer error"
<< endl;
Logger::ngap().error(
"Decoded NGAP RANStatusTransfer_TransparentContainer IE error");
return false;
}
cout << "can get the buffer of RANStatusTransfer_TransparentContainer"
<< endl;
Logger::ngap().error(
"Decoded NGAP RANStatusTransfer_TransparentContainer IE error");
} else {
cout << "cann't get the buffer of "
"RANStatusTransfer_TransparentContainer"
<< endl;
Logger::ngap().error(
"Decoded NGAP RANStatusTransfer_TransparentContainer IE error");
}
} break;
default: {
cout << "decoded ngap message pdu error" << endl;
Logger::ngap().error("Decoded NGAP message PDU error");
return false;
}
}
......
......@@ -43,8 +43,8 @@ class UplinkRANStatusTransfer {
public:
UplinkRANStatusTransfer();
virtual ~UplinkRANStatusTransfer();
unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
void getRANStatusTransfer_TransparentContainer(
RANStatusTransferTransparentContainer*&
ranstatustransfer_transparentcontainer);
......
......@@ -75,7 +75,6 @@ class ngap_app : public sctp_application {
void handle_sctp_shutdown(sctp_assoc_id_t assoc_id);
// gnb context management
bool is_assoc_id_2_gnb_context(const sctp_assoc_id_t& assoc_id) const;
void set_assoc_id_2_gnb_context(
const sctp_assoc_id_t& assoc_id, std::shared_ptr<gnb_context> gc);
......
......@@ -92,12 +92,12 @@ int ngap_amf_handle_ng_setup_request(
int ngap_amf_handle_initial_ue_message(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti initial ue message to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Initial UE Message to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
// decode INITIAL_UE_MESSAGE
InitialUEMessageMsg* initUeMsg = new InitialUEMessageMsg();
if (!initUeMsg->decodefrompdu(message_p)) {
Logger::ngap().error("decoding initialuemessage message error");
Logger::ngap().error("Decoding InitialUEMessage error");
return -1;
}
itti_initial_ue_message* init_ue_msg =
......@@ -148,7 +148,7 @@ int ngap_amf_handle_uplink_nas_transport(
int ngap_amf_handle_initial_context_setup_response(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Handling Initial Context Setup Response...");
Logger::ngap().debug("Handling Initial Context Setup Response");
InitialContextSetupResponseMsg* initCtxResp =
new InitialContextSetupResponseMsg();
if (!initCtxResp->decodefrompdu(message_p)) {
......@@ -197,7 +197,7 @@ int ngap_amf_handle_initial_context_setup_failure(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti initial context setup failure to TASK_AMF_N2");
"Sending ITTI Initial Context Setup Failure to TASK_AMF_N2");
return 0;
}
......@@ -206,7 +206,7 @@ int ngap_amf_handle_ue_radio_cap_indication(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti ue radio capability indication to TASK_AMF_N2");
"Sending ITTI UE Radio Capability Indication to TASK_AMF_N2");
UeRadioCapabilityInfoIndicationMsg* ueRadioCap =
new UeRadioCapabilityInfoIndicationMsg();
if (!ueRadioCap->decodefrompdu(message_p)) {
......@@ -234,7 +234,7 @@ int ngap_amf_handle_ue_context_release_request(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti ue context release request to TASK_AMF_N2");
"Sending ITTI UE Context Release Request to TASK_AMF_N2");
UEContextReleaseRequestMsg* ueCtxRelReq = new UEContextReleaseRequestMsg();
if (!ueCtxRelReq->decodefrompdu(message_p)) {
Logger::ngap().error("Decoding UEContextReleaseRequest message error");
......@@ -261,7 +261,7 @@ int ngap_amf_handle_ue_context_release_complete(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti ue context release complete to TASK_AMF_N2");
"Sending ITTI UE Context Release Complete to TASK_AMF_N2");
UEContextReleaseCompleteMsg* ueCtxRelCmpl = new UEContextReleaseCompleteMsg();
if (!ueCtxRelCmpl->decodefrompdu(message_p)) {
......@@ -303,7 +303,7 @@ int ngap_amf_handle_pdu_session_resource_release_response(
if (!pduresp->getPduSessionResourceReleasedList(list)) {
Logger::ngap().error(
"Decoding PduSessionResourceReleaseResponseMsg "
"getPduSessionResourceReleasedList IE error");
"getPduSessionResourceReleasedList IE error");
return -1;
}
// TODO: add the full list
......@@ -314,7 +314,7 @@ int ngap_amf_handle_pdu_session_resource_release_response(
bstring n2sm = blk2bstr(
transferIe, list[0].pduSessionResourceReleaseResponseTransfer.size);
Logger::ngap().debug(
"Sending itti PDUSessionResourceReleaseResponse to TASK_AMF_N11");
"Sending ITTI PDUSessionResourceReleaseResponse to TASK_AMF_N11");
itti_nsmf_pdusession_update_sm_context* itti_msg =
new itti_nsmf_pdusession_update_sm_context(TASK_NGAP, TASK_AMF_N11);
......@@ -352,7 +352,7 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
if (!pduresp->getPduSessionResourceSetupResponseList(list)) {
Logger::ngap().error(
"Decoding PduSessionResourceSetupResponseMsg "
"getPduSessionResourceSetupResponseList IE error");
"getPduSessionResourceSetupResponseList IE error");
// return -1;
} else {
// TODO: for multiple PDU Sessions
......@@ -458,7 +458,7 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
int ngap_amf_handle_error_indication(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti ngap error indication to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI NGAP Error Indication to TASK_AMF_N2");
return 0;
}
......@@ -466,7 +466,7 @@ int ngap_amf_handle_error_indication(
int ngap_amf_configuration_update(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti amf configuration update to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI AMF Configuration Update to TASK_AMF_N2");
return 0;
}
......@@ -474,7 +474,7 @@ int ngap_amf_configuration_update(
int amf_status_indication(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti amf status indication to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI AMF Status Indication to TASK_AMF_N2");
return 0;
}
......@@ -482,7 +482,7 @@ int amf_status_indication(
int cell_traffic_trace(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti cell_traffic_trace to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Cell Traffic Trace to TASK_AMF_N2");
return 0;
}
......@@ -490,7 +490,7 @@ int cell_traffic_trace(
int deactivate_trace(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti deactivate trace to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Deactivate Trace to TASK_AMF_N2");
return 0;
}
......@@ -498,7 +498,7 @@ int deactivate_trace(
int downlink_nas_transport(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti downlink nas transport to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Downlink NAS Transport to TASK_AMF_N2");
return 0;
}
......@@ -507,7 +507,7 @@ int downlink_non_UEassociated_nrppa_transport(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti downlink non UEassociated nrppa transport to TASK_AMF_N2");
"Sending ITTI Downlink Non UEAssociated NRPPA Transport to TASK_AMF_N2");
return 0;
}
......@@ -516,7 +516,7 @@ int downlink_ran_configuration_transfer(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti downlink ran configuration transfer to TASK_AMF_N2");
"Sending ITTI Downlink RAN Configuration Transfer to TASK_AMF_N2");
return 0;
}
......@@ -525,7 +525,7 @@ int downlink_ran_status_transfer(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti downlink ran status transfer to TASK_AMF_N2");
"Sending ITTI Downlink RAN Status Transfer to TASK_AMF_N2");
return 0;
}
......@@ -534,7 +534,7 @@ int downlink_ue_associated_nappa_transport(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti downlink ue associated nappa transport to TASK_AMF_N2");
"Sending ITTI Downlink UE Associated NAPPA Transport to TASK_AMF_N2");
return 0;
}
......@@ -633,7 +633,7 @@ int location_reporting_control(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti location reporting control to TASK_AMF_N2");
"Sending ITTI Location Reporting Control to TASK_AMF_N2");
return 0;
}
......@@ -642,7 +642,7 @@ int location_reporting_failure_indication(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti location reporting failure indication to TASK_AMF_N2");
"Sending ITTI Location Reporting Failure Indication to TASK_AMF_N2");
return 0;
}
......@@ -650,7 +650,7 @@ int location_reporting_failure_indication(
int location_report(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti location report to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Location Report to TASK_AMF_N2");
return 0;
}
......@@ -659,7 +659,7 @@ int nas_non_delivery_indication(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti nas non delivery indication to TASK_AMF_N2");
"Sending ITTI NAS Non Delivery Indication to TASK_AMF_N2");
return 0;
}
......@@ -695,7 +695,7 @@ int ng_reset(
int overload_start(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti overload start to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Overload Start to TASK_AMF_N2");
return 0;
}
......@@ -703,7 +703,7 @@ int overload_start(
int overload_stop(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti overload stop to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Overload Stop to TASK_AMF_N2");
return 0;
}
......@@ -711,7 +711,7 @@ int overload_stop(
int paging(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti paging to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Paging to TASK_AMF_N2");
return 0;
}
......@@ -719,8 +719,7 @@ int paging(
int ngap_amf_handle_path_switch_request(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti ngap amf handle path switch request to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Path Switch Request to TASK_AMF_N2");
return 0;
}
......@@ -729,7 +728,7 @@ int pdu_session_resource_modify(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti pdu session resource modify to TASK_AMF_N2");
"Sending ITTI PDU Session Resource Modify to TASK_AMF_N2");
return 0;
}
......@@ -738,7 +737,7 @@ int pdu_session_resource_modify_indication(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti pdu session resource modify indication to TASK_AMF_N2");
"Sending ITTI PDU Session Resource Modify Indication to TASK_AMF_N2");
return 0;
}
......@@ -747,7 +746,7 @@ int pdu_session_resource_notify(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti pdu session resource notify to TASK_AMF_N2");
"Sending ITTI PDU Session Resource Notify to TASK_AMF_N2");
return 0;
}
......@@ -755,7 +754,7 @@ int pdu_session_resource_notify(
int private_message(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti private message to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Private Message to TASK_AMF_N2");
return 0;
}
......@@ -763,7 +762,7 @@ int private_message(
int pws_cancel(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti pws cancel to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI PWS Cancel to TASK_AMF_N2");
return 0;
}
......@@ -771,7 +770,7 @@ int pws_cancel(
int pws_failure_indication(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti pws failure indication to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI PWS Failure Indication to TASK_AMF_N2");
return 0;
}
......@@ -779,7 +778,7 @@ int pws_failure_indication(
int pws_restart_indication(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti pws restart indication to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI PWS Restart Indication to TASK_AMF_N2");
return 0;
}
......@@ -787,7 +786,7 @@ int pws_restart_indication(
int ran_configuration_update(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti ran configuration update to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI RAN Configuration Update to TASK_AMF_N2");
return 0;
}
......@@ -795,7 +794,7 @@ int ran_configuration_update(
int reroute_nas_request(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti reroute nas request to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Reroute NAS Request to TASK_AMF_N2");
return 0;
}
......@@ -804,7 +803,7 @@ int rrc_inactive_transition_report(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti rrc inactive transition report to TASK_AMF_N2");
"Sending ITTI RRC Inactive Transition Report to TASK_AMF_N2");
return 0;
}
......@@ -812,7 +811,7 @@ int rrc_inactive_transition_report(
int trace_failure_indication(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti trace failure indication to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Trace Failure Indication to TASK_AMF_N2");
return 0;
}
......@@ -820,7 +819,7 @@ int trace_failure_indication(
int trace_start(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti trace start to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI Trace Start to TASK_AMF_N2");
return 0;
}
......@@ -828,7 +827,7 @@ int trace_start(
int ue_context_modification(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti ue context modification to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI UE Context Modification to TASK_AMF_N2");
return 0;
}
......@@ -836,7 +835,7 @@ int ue_context_modification(
int ue_radio_capability_check(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti ue radio capability check to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI UE Radio Capability Check to TASK_AMF_N2");
return 0;
}
......@@ -844,7 +843,7 @@ int ue_radio_capability_check(
int ue_tnla_binding_release(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti ue tnla binding release to TASK_AMF_N2");
Logger::ngap().debug("Sending ITTI UE TNLA Binding Release to TASK_AMF_N2");
return 0;
}
......@@ -853,7 +852,7 @@ int uplink_non_ue_associated_nrppa_transport(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti uplink non ue associated nrppa transport to TASK_AMF_N2");
"Sending ITTI Uplink Non UE Associated NRPPA Transport to TASK_AMF_N2");
return 0;
}
......@@ -862,7 +861,7 @@ int uplink_ran_configuration_transfer(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti uplink ran configuration transfer to TASK_AMF_N2");
"Sending ITTI Uplink RAN Configuration Transfer to TASK_AMF_N2");
return 0;
}
......@@ -901,7 +900,7 @@ int uplink_ue_associated_nrppa_transport(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug(
"Sending itti uplink ue associated nrppa transport to TASK_AMF_N2");
"Sending ITTI Uplink UE Associated NRPPA Transport to TASK_AMF_N2");
return 0;
}
......
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