Commit 32bac856 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Code cleanup

parent 516f67d2
...@@ -361,6 +361,7 @@ void amf_n2::handle_itti_message( ...@@ -361,6 +361,7 @@ void amf_n2::handle_itti_message(
} }
// store Paging DRX in gNB context // store Paging DRX in gNB context
// TODO: To fix DefaultPagingDRX value
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");
...@@ -636,14 +637,14 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) { ...@@ -636,14 +637,14 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
if (init_ue_msg.initUeMsg->getRRCEstablishmentCause() == -1) { if (init_ue_msg.initUeMsg->getRRCEstablishmentCause() == -1) {
Logger::amf_n2().warn("IE RRCEstablishmentCause not present"); Logger::amf_n2().warn("IE RRCEstablishmentCause not present");
itti_msg->rrc_cause = -1; // not present itti_msg->rrc_cause = -1; // not present, TODO with optional
} else { } else {
itti_msg->rrc_cause = init_ue_msg.initUeMsg->getRRCEstablishmentCause(); itti_msg->rrc_cause = init_ue_msg.initUeMsg->getRRCEstablishmentCause();
} }
if (init_ue_msg.initUeMsg->getUeContextRequest() == -1) { if (init_ue_msg.initUeMsg->getUeContextRequest() == -1) {
Logger::amf_n2().warn("IE UeContextRequest not present"); Logger::amf_n2().warn("IE UeContextRequest not present");
itti_msg->ueCtxReq = -1; // not present itti_msg->ueCtxReq = -1; // not present, TODO with optional
} else { } else {
itti_msg->ueCtxReq = init_ue_msg.initUeMsg->getUeContextRequest(); itti_msg->ueCtxReq = init_ue_msg.initUeMsg->getUeContextRequest();
} }
...@@ -661,11 +662,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) { ...@@ -661,11 +662,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
unc->s_setid, unc->s_pointer, unc->s_tmsi); unc->s_setid, unc->s_pointer, unc->s_tmsi);
} }
// uint8_t* nas_buf = nullptr; if (!init_ue_msg.initUeMsg->getNasPdu(itti_msg->nas_buf)) {
// size_t nas_len = 0;
if (init_ue_msg.initUeMsg->getNasPdu(itti_msg->nas_buf)) {
// itti_msg->nas_buf = blk2bstr(nas_buf, nas_len);
} else {
Logger::amf_n2().error("Missing IE NAS-PDU"); Logger::amf_n2().error("Missing IE NAS-PDU");
return; return;
} }
...@@ -748,14 +745,12 @@ void amf_n2::handle_itti_message(itti_ul_nas_transport& ul_nas_transport) { ...@@ -748,14 +745,12 @@ 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 = nullptr;
// size_t nas_len = 0; if (!ul_nas_transport.ulNas->getNasPdu(itti_msg->nas_msg)) {
if (ul_nas_transport.ulNas->getNasPdu(itti_msg->nas_msg)) {
// itti_msg->nas_msg = blk2bstr(nas_buf, nas_len);
} else {
Logger::amf_n2().error("Missing IE NAS-PDU"); Logger::amf_n2().error("Missing IE NAS-PDU");
return; return;
} }
// UserLocation // UserLocation
NrCgi_t cgi = {}; NrCgi_t cgi = {};
Tai_t tai = {}; Tai_t tai = {};
...@@ -803,8 +798,7 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) { ...@@ -803,8 +798,7 @@ void amf_n2::handle_itti_message(itti_dl_nas_transport& dl_nas_transport) {
ngap_msg->setAmfUeNgapId(dl_nas_transport.amf_ue_ngap_id); ngap_msg->setAmfUeNgapId(dl_nas_transport.amf_ue_ngap_id);
ngap_msg->setRanUeNgapId(dl_nas_transport.ran_ue_ngap_id); ngap_msg->setRanUeNgapId(dl_nas_transport.ran_ue_ngap_id);
ngap_msg->setNasPdu(dl_nas_transport.nas); ngap_msg->setNasPdu(dl_nas_transport.nas);
// (uint8_t*) bdata(bstrcpy(dl_nas_transport.nas)),
// blength(dl_nas_transport.nas));
uint8_t buffer[BUFFER_SIZE_1024]; uint8_t buffer[BUFFER_SIZE_1024];
int encoded_size = ngap_msg->encode2Buffer(buffer, BUFFER_SIZE_1024); int encoded_size = ngap_msg->encode2Buffer(buffer, BUFFER_SIZE_1024);
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
...@@ -873,10 +867,8 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) { ...@@ -873,10 +867,8 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
} }
msg->setAllowedNssai(list); msg->setAllowedNssai(list);
// bdestroy_wrapper(&itti_msg.nas);
// bdestroy_wrapper(&itti_msg.kgnb);
if (itti_msg.is_sr or itti_msg.is_pdu_exist) { if (itti_msg.is_sr or itti_msg.is_pdu_exist) {
// Set UE RAdio Capability if available // Set UE Radio Capability if available
if (gc->ue_radio_cap_ind) { if (gc->ue_radio_cap_ind) {
msg->setUERadioCapability(gc->ue_radio_cap_ind); msg->setUERadioCapability(gc->ue_radio_cap_ind);
} }
...@@ -980,12 +972,6 @@ void amf_n2::handle_itti_message( ...@@ -980,12 +972,6 @@ void amf_n2::handle_itti_message(
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* buf_tmp = (uint8_t*) bdata(itti_msg.nas);
// if (buf_tmp != nullptr) memcpy(nas_pdu, buf_tmp, blength(itti_msg.nas));
// nas_pdu[blength(itti_msg.nas)] = '\0';
// item.pduSessionNAS_PDU = nas_pdu;
// item.sizeofpduSessionNAS_PDU = blength(itti_msg.nas);
item.nas_pdu = bstrcpy(itti_msg.nas); item.nas_pdu = bstrcpy(itti_msg.nas);
// Get NSSAI from PDU Session Context // Get NSSAI from PDU Session Context
...@@ -1075,16 +1061,7 @@ void amf_n2::handle_itti_message( ...@@ -1075,16 +1061,7 @@ void amf_n2::handle_itti_message(
tmp.sd = itti_msg.s_NSSAI.getSd(); tmp.sd = itti_msg.s_NSSAI.getSd();
tmp.sst = itti_msg.s_NSSAI.getSst(); tmp.sst = itti_msg.s_NSSAI.getSst();
item.s_nssai = std::optional<S_Nssai>(tmp); item.s_nssai = std::optional<S_Nssai>(tmp);
// item.s_nssai.sd = itti_msg.s_NSSAI.getSd();
// item.s_nssai.sst = itti_msg.s_NSSAI.getSst();
// TODO: to be removed
// uint8_t* nas_pdu = (uint8_t*) calloc(1, blength(itti_msg.nas) + 1);
// uint8_t* buf_tmp = (uint8_t*) bdata(itti_msg.nas);
// if (buf_tmp != nullptr) memcpy(nas_pdu, buf_tmp, blength(itti_msg.nas));
// nas_pdu[blength(itti_msg.nas)] = '\0';
// item.pduSessionNAS_PDU = nas_pdu;
// item.sizeofpduSessionNAS_PDU = blength(itti_msg.nas);
item.nas_pdu = bstrcpy(itti_msg.nas); item.nas_pdu = bstrcpy(itti_msg.nas);
list.push_back(item); list.push_back(item);
...@@ -1131,11 +1108,6 @@ void amf_n2::handle_itti_message( ...@@ -1131,11 +1108,6 @@ void amf_n2::handle_itti_message(
release_cmd_msg->setAmfUeNgapId(itti_msg.amf_ue_ngap_id); release_cmd_msg->setAmfUeNgapId(itti_msg.amf_ue_ngap_id);
release_cmd_msg->setRanUeNgapId(itti_msg.ran_ue_ngap_id); release_cmd_msg->setRanUeNgapId(itti_msg.ran_ue_ngap_id);
// TODO: Should be removed
// uint8_t* nas_pdu = (uint8_t*) calloc(1, blength(itti_msg.nas) + 1);
// uint8_t* buf_tmp = (uint8_t*) bdata(itti_msg.nas);
// if (buf_tmp != nullptr) memcpy(nas_pdu, buf_tmp, blength(itti_msg.nas));
// nas_pdu[blength(itti_msg.nas)] = '\0';
release_cmd_msg->setNasPdu(itti_msg.nas); release_cmd_msg->setNasPdu(itti_msg.nas);
std::vector<PDUSessionResourceToReleaseItem_t> list; std::vector<PDUSessionResourceToReleaseItem_t> list;
...@@ -1159,24 +1131,27 @@ void amf_n2::handle_itti_message( ...@@ -1159,24 +1131,27 @@ void amf_n2::handle_itti_message(
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(gc->sctp_assoc_id, unc->sctp_stream_send, &b); sctp_s_38412.sctp_send_msg(gc->sctp_assoc_id, unc->sctp_stream_send, &b);
// free memory // free memory
// free_wrapper((void**) &nas_pdu);
bdestroy_wrapper(&b); bdestroy_wrapper(&b);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
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("Handle 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);
std::unique_ptr<UEContextReleaseCommandMsg> ueCtxRelCmd = std::unique_ptr<UEContextReleaseCommandMsg> ueCtxRelCmd =
std::make_unique<UEContextReleaseCommandMsg>(); std::make_unique<UEContextReleaseCommandMsg>();
ueCtxRelCmd->setUeNgapIdPair(amf_ue_ngap_id, ran_ue_ngap_id); ueCtxRelCmd->setUeNgapIdPair(amf_ue_ngap_id, ran_ue_ngap_id);
ueCtxRelCmd->setCauseRadioNetwork(cause); ueCtxRelCmd->setCauseRadioNetwork(cause);
uint8_t buffer[BUFFER_SIZE_512]; uint8_t buffer[BUFFER_SIZE_512];
int encoded_size = ueCtxRelCmd->encode2Buffer(buffer, BUFFER_SIZE_512); int encoded_size = ueCtxRelCmd->encode2Buffer(buffer, BUFFER_SIZE_512);
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
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);
bdestroy_wrapper(&b); bdestroy_wrapper(&b);
} }
...@@ -1221,11 +1196,8 @@ void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) { ...@@ -1221,11 +1196,8 @@ void amf_n2::handle_itti_message(itti_ue_context_release_command& itti_msg) {
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(gc->sctp_assoc_id, unc->sctp_stream_send, &b); sctp_s_38412.sctp_send_msg(gc->sctp_assoc_id, unc->sctp_stream_send, &b);
bdestroy_wrapper(&b); bdestroy_wrapper(&b);
// return;
/* // Send ITTI to N11 SBI, notify CommunicationFailure Report, RAN Cause
* Send ITTI to N11 SBI, notify CommunicationFailure Report, RAN Cause
*/
std::shared_ptr<nas_context> nc = {}; std::shared_ptr<nas_context> nc = {};
if (!amf_n1_inst->is_amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id, nc)) { if (!amf_n1_inst->is_amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id, nc)) {
Logger::amf_n2().warn( Logger::amf_n2().warn(
...@@ -1687,16 +1659,14 @@ bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1687,16 +1659,14 @@ bool amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
item.s_nssai.sd = psc->snssai.sD; item.s_nssai.sd = psc->snssai.sD;
// item.pduSessionNAS_PDU = nullptr; // item.pduSessionNAS_PDU = nullptr;
unsigned int data_len = n2_sm.length(); unsigned int data_len = n2_sm.length();
unsigned char* data = (unsigned char*) malloc(data_len + 1); item.pduSessionResourceSetupRequestTransfer.buf =
memset(data, 0, data_len + 1); (unsigned char*) malloc(data_len + 1);
memcpy((void*) data, (void*) n2_sm.c_str(), data_len); memcpy(
item.pduSessionResourceSetupRequestTransfer.buf = data; (void*) item.pduSessionResourceSetupRequestTransfer.buf,
(void*) n2_sm.c_str(), data_len);
item.pduSessionResourceSetupRequestTransfer.size = data_len; item.pduSessionResourceSetupRequestTransfer.size = data_len;
list.push_back(item); list.push_back(item);
// free memory
// free_wrapper((void**) &data);
} }
} else { } else {
result = false; result = false;
} }
...@@ -1814,7 +1784,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1814,7 +1784,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
} }
} }
// send HandoverCommandMsg to Source gNB // Send HandoverCommandMsg to Source gNB
std::unique_ptr<HandoverCommandMsg> handovercommand = std::unique_ptr<HandoverCommandMsg> handovercommand =
std::make_unique<HandoverCommandMsg>(); std::make_unique<HandoverCommandMsg>();
handovercommand->setAmfUeNgapId(amf_ue_ngap_id); handovercommand->setAmfUeNgapId(amf_ue_ngap_id);
...@@ -2056,41 +2026,41 @@ void amf_n2::handle_itti_message(itti_uplink_ran_status_transfer& itti_msg) { ...@@ -2056,41 +2026,41 @@ void amf_n2::handle_itti_message(itti_uplink_ran_status_transfer& itti_msg) {
ran_status_transfer); ran_status_transfer);
dRBSubjectList amf_m_list = {}; dRBSubjectList amf_m_list = {};
ran_status_transfer.getdRBSubject_list(amf_m_list); ran_status_transfer.getdRBSubject_list(amf_m_list);
std::vector<dRBSubjectItem> dRBSubjectItemList; std::vector<dRBSubjectItem> drb_subject_item_list;
amf_m_list.getdRBSubjectItem(dRBSubjectItemList); amf_m_list.getdRBSubjectItem(drb_subject_item_list);
// TODO: check size // TODO: check size
dRBStatusDL statusDL = {}; dRBStatusDL status_dl = {};
dRBStatusUL statusUL = {}; dRBStatusUL status_ul = {};
Ngap_DRB_ID_t dRBID = {}; Ngap_DRB_ID_t drb_id = {};
dRBSubjectItemList[0].getdRBSubjectItem(dRBID, statusUL, statusDL); drb_subject_item_list[0].getdRBSubjectItem(drb_id, status_ul, status_dl);
dRBStatusUL18 statusUL18 = {}; dRBStatusUL18 status_ul_18 = {};
DRBStatusDL18 statusDL18 = {}; DRBStatusDL18 status_dl_18 = {};
statusDL.getDRBStatusDL18(statusDL18); status_dl.getDRBStatusDL18(status_dl_18);
statusUL.getdRBStatusUL(statusUL18); status_ul.getdRBStatusUL(status_ul_18);
COUNTValueForPDCP_SN18 countValueUL = {}; COUNTValueForPDCP_SN18 count_value_ul = {};
COUNTValueForPDCP_SN18 countValueDL = {}; COUNTValueForPDCP_SN18 count_value_dl = {};
statusUL18.getcountvalue(countValueUL); status_ul_18.getcountvalue(count_value_ul);
statusDL18.getcountvalue(countValueDL); status_dl_18.getcountvalue(count_value_dl);
long amf_ul_pdcp = {0}; long amf_ul_pdcp = {0};
long amf_hfn_ul_pdcp = {0}; long amf_hfn_ul_pdcp = {0};
countValueUL.getvalue(amf_ul_pdcp, amf_hfn_ul_pdcp); count_value_ul.getvalue(amf_ul_pdcp, amf_hfn_ul_pdcp);
long amf_dl_pdcp = {0}; long amf_dl_pdcp = {0};
long amf_hfn_dl_pdcp = {0}; long amf_hfn_dl_pdcp = {0};
countValueDL.getvalue(amf_dl_pdcp, amf_hfn_dl_pdcp); count_value_dl.getvalue(amf_dl_pdcp, amf_hfn_dl_pdcp);
long amf_drb_id = {0}; long amf_drb_id = {0};
amf_drb_id = dRBID; amf_drb_id = drb_id;
std::unique_ptr<DownlinkRANStatusTransfer> downLinkranstatustransfer = std::unique_ptr<DownlinkRANStatusTransfer> dl_ran_status_transfer =
std::make_unique<DownlinkRANStatusTransfer>(); std::make_unique<DownlinkRANStatusTransfer>();
downLinkranstatustransfer->setAmfUeNgapId(amf_ue_ngap_id); dl_ran_status_transfer->setAmfUeNgapId(amf_ue_ngap_id);
downLinkranstatustransfer->setRanUeNgapId(unc->target_ran_ue_ngap_id); dl_ran_status_transfer->setRanUeNgapId(unc->target_ran_ue_ngap_id);
downLinkranstatustransfer->setRANStatusTransfer_TransparentContainer( dl_ran_status_transfer->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[BUFFER_SIZE_1024]; uint8_t buffer[BUFFER_SIZE_1024];
int encode_size = int encode_size =
downLinkranstatustransfer->encode2Buffer(buffer, BUFFER_SIZE_1024); dl_ran_status_transfer->encode2Buffer(buffer, BUFFER_SIZE_1024);
bstring b = blk2bstr(buffer, encode_size); bstring b = blk2bstr(buffer, encode_size);
sctp_s_38412.sctp_send_msg(unc->target_gnb_assoc_id, 0, &b); sctp_s_38412.sctp_send_msg(unc->target_gnb_assoc_id, 0, &b);
bdestroy_wrapper(&b); bdestroy_wrapper(&b);
...@@ -2118,18 +2088,19 @@ void amf_n2::handle_itti_message(itti_rereoute_nas& itti_msg) { ...@@ -2118,18 +2088,19 @@ void amf_n2::handle_itti_message(itti_rereoute_nas& itti_msg) {
return; return;
} }
RerouteNASRequest rerouteNASRequest = {}; RerouteNASRequest reroute_nas_request = {};
rerouteNASRequest.setRanUeNgapId(itti_msg.ran_ue_ngap_id); reroute_nas_request.setRanUeNgapId(itti_msg.ran_ue_ngap_id);
rerouteNASRequest.setAmfUeNgapId(itti_msg.amf_ue_ngap_id); reroute_nas_request.setAmfUeNgapId(itti_msg.amf_ue_ngap_id);
if (!rerouteNASRequest.setAMFSetID(itti_msg.amf_set_id)) return; if (!reroute_nas_request.setAMFSetID(itti_msg.amf_set_id)) return;
if (unc->initialUEMsg.size > 0) if (unc->initialUEMsg.size > 0)
rerouteNASRequest.setNgapMessage( reroute_nas_request.setNgapMessage(
unc->initialUEMsg); // Include InitialUEMessage unc->initialUEMsg); // Include InitialUEMessage
// TODO: AllowedNSSAI (Optional) // TODO: AllowedNSSAI (Optional)
uint8_t buffer[BUFFER_SIZE_2048]; uint8_t buffer[BUFFER_SIZE_2048];
int encoded_size = rerouteNASRequest.encode2Buffer(buffer, BUFFER_SIZE_2048); int encoded_size =
reroute_nas_request.encode2Buffer(buffer, BUFFER_SIZE_2048);
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
amf_n2_inst->sctp_s_38412.sctp_send_msg( amf_n2_inst->sctp_s_38412.sctp_send_msg(
...@@ -2142,15 +2113,15 @@ void amf_n2::send_handover_preparation_failure( ...@@ -2142,15 +2113,15 @@ void amf_n2::send_handover_preparation_failure(
const unsigned long amf_ue_ngap_id, const uint32_t ran_ue_ngap_id, const unsigned long amf_ue_ngap_id, const uint32_t ran_ue_ngap_id,
const sctp_assoc_id_t& gnb_assoc_id) { const sctp_assoc_id_t& gnb_assoc_id) {
// Create HandoverPreparationFailure message to be sent to target gNB // Create HandoverPreparationFailure message to be sent to target gNB
std::unique_ptr<HandoverPreparationFailure> hoPreparationFailure = std::unique_ptr<HandoverPreparationFailure> ho_preparation_failure_msg =
std::make_unique<HandoverPreparationFailure>(); std::make_unique<HandoverPreparationFailure>();
hoPreparationFailure->setAmfUeNgapId(amf_ue_ngap_id); ho_preparation_failure_msg->setAmfUeNgapId(amf_ue_ngap_id);
hoPreparationFailure->setRanUeNgapId(amf_ue_ngap_id); ho_preparation_failure_msg->setRanUeNgapId(amf_ue_ngap_id);
hoPreparationFailure->setCause(Ngap_Cause_PR_NOTHING); ho_preparation_failure_msg->setCause(Ngap_Cause_PR_NOTHING);
uint8_t buffer[BUFFER_SIZE_1024]; uint8_t buffer[BUFFER_SIZE_1024];
int encoded_size = int encoded_size =
hoPreparationFailure->encode2Buffer(buffer, BUFFER_SIZE_1024); ho_preparation_failure_msg->encode2Buffer(buffer, BUFFER_SIZE_1024);
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(gnb_assoc_id, 0, &b); sctp_s_38412.sctp_send_msg(gnb_assoc_id, 0, &b);
......
...@@ -78,6 +78,7 @@ int ngap_amf_handle_ng_setup_request( ...@@ -78,6 +78,7 @@ int ngap_amf_handle_ng_setup_request(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -124,6 +125,7 @@ int ngap_amf_handle_initial_ue_message( ...@@ -124,6 +125,7 @@ int ngap_amf_handle_initial_ue_message(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -152,6 +154,7 @@ int ngap_amf_handle_uplink_nas_transport( ...@@ -152,6 +154,7 @@ int ngap_amf_handle_uplink_nas_transport(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -183,13 +186,15 @@ int ngap_amf_handle_initial_context_setup_response( ...@@ -183,13 +186,15 @@ int ngap_amf_handle_initial_context_setup_response(
Logger::ngap().debug( Logger::ngap().debug(
"Decode PduSessionResourceSetupResponseList IE error or this IE is not " "Decode PduSessionResourceSetupResponseList IE error or this IE is not "
"available"); "available");
return 0; // TODO:
return RETURNok;
} }
Logger::ngap().debug( Logger::ngap().debug(
"Sending ITTI Initial Context Setup Response to TASK_AMF_SBI"); "Sending ITTI Initial Context Setup Response to TASK_AMF_SBI");
auto itti_msg = std::make_shared<itti_nsmf_pdusession_update_sm_context>( auto itti_msg = std::make_shared<itti_nsmf_pdusession_update_sm_context>(
TASK_NGAP, TASK_AMF_SBI); TASK_NGAP, TASK_AMF_SBI);
// TODO: with multiple PDU sessions
itti_msg->pdu_session_id = list[0].pduSessionId; itti_msg->pdu_session_id = list[0].pduSessionId;
itti_msg->n2sm = blk2bstr( itti_msg->n2sm = blk2bstr(
list[0].pduSessionResourceSetupResponseTransfer.buf, list[0].pduSessionResourceSetupResponseTransfer.buf,
...@@ -204,6 +209,7 @@ int ngap_amf_handle_initial_context_setup_response( ...@@ -204,6 +209,7 @@ int ngap_amf_handle_initial_context_setup_response(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_SBI", "Could not send ITTI message %s to task TASK_AMF_SBI",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -244,6 +250,7 @@ int ngap_amf_handle_ue_radio_cap_indication( ...@@ -244,6 +250,7 @@ int ngap_amf_handle_ue_radio_cap_indication(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -271,6 +278,7 @@ int ngap_amf_handle_ue_context_release_request( ...@@ -271,6 +278,7 @@ int ngap_amf_handle_ue_context_release_request(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -309,6 +317,7 @@ int ngap_amf_handle_ue_context_release_complete( ...@@ -309,6 +317,7 @@ int ngap_amf_handle_ue_context_release_complete(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -372,6 +381,7 @@ int ngap_amf_handle_pdu_session_resource_release_response( ...@@ -372,6 +381,7 @@ int ngap_amf_handle_pdu_session_resource_release_response(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_SBI", "Could not send ITTI message %s to task TASK_AMF_SBI",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -438,8 +448,9 @@ int ngap_amf_handle_pdu_session_resource_setup_response( ...@@ -438,8 +448,9 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_SBI", "Could not send ITTI message %s to task TASK_AMF_SBI",
i->get_msg_name()); i->get_msg_name());
return RETURNerror;
} }
return 0; return RETURNok;
} }
// TTN: Should be removed // TTN: Should be removed
...@@ -573,6 +584,7 @@ int ngap_amf_handle_pdu_session_resource_modify_response( ...@@ -573,6 +584,7 @@ int ngap_amf_handle_pdu_session_resource_modify_response(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_SBI", "Could not send ITTI message %s to task TASK_AMF_SBI",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
} }
...@@ -737,6 +749,7 @@ int handover_preparation( ...@@ -737,6 +749,7 @@ int handover_preparation(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -782,6 +795,7 @@ int handover_notification( ...@@ -782,6 +795,7 @@ int handover_notification(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -812,6 +826,7 @@ int handover_request( ...@@ -812,6 +826,7 @@ int handover_request(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
...@@ -895,6 +910,7 @@ int ng_reset( ...@@ -895,6 +910,7 @@ int ng_reset(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
...@@ -1196,6 +1212,7 @@ int uplink_ran_status_transfer( ...@@ -1196,6 +1212,7 @@ int uplink_ran_status_transfer(
Logger::ngap().error( Logger::ngap().error(
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
itti_msg->get_msg_name()); itti_msg->get_msg_name());
return RETURNerror;
} }
return RETURNok; return RETURNok;
} }
......
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