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