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

Code cleanup

parent eb3c40bf
...@@ -567,9 +567,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -567,9 +567,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError.setError(problem_details); smContextCreateError.setError(problem_details);
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//if (smf_n1_inst.create_n1_sm_container(
// smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
// cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message, smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) { cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
...@@ -628,9 +625,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -628,9 +625,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject //PDU Session Establishment Reject
//if (smf_n1_inst.create_n1_sm_container(smreq->req,
//PDU_SESSION_ESTABLISHMENT_REJECT,
// n1_sm_message, cause_n1)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(smreq->req, if (smf_n1_inst.create_n1_pdu_session_establishment_reject(smreq->req,
n1_sm_message, cause_n1)) { n1_sm_message, cause_n1)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex); smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
...@@ -682,9 +676,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -682,9 +676,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject including cause "#81 Invalid PTI value" (section 7.3.1 @3GPP TS 24.501) //PDU Session Establishment Reject including cause "#81 Invalid PTI value" (section 7.3.1 @3GPP TS 24.501)
//if (smf_n1_inst.create_n1_sm_container(
// smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
// cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message, smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE)) { cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE)) {
...@@ -725,12 +716,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -725,12 +716,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject //PDU Session Establishment Reject
//(24.501 (section 7.4)) implementation dependent->do similar to UE: response with a 5GSM STATUS message including cause "#98 message type not compatible with protocol state." //(24.501 (section 7.4)) implementation dependent->do similar to UE: response with a 5GSM STATUS message including cause "#98 message type not compatible with protocol state."
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message,
cause_value_5gsm_e::CAUSE_98_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE)) {
*/
if (smf_n1_inst.create_n1_pdu_session_establishment_reject( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, smreq->req,
n1_sm_message, n1_sm_message,
...@@ -771,10 +756,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -771,10 +756,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject, 24.501 cause "#27 Missing or unknown DNN" //PDU Session Establishment Reject, 24.501 cause "#27 Missing or unknown DNN"
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN)) {
*/
if (smf_n1_inst.create_n1_pdu_session_establishment_reject( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message, smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN)) { cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN)) {
...@@ -867,12 +848,6 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -867,12 +848,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject, with cause "29 User authentication or authorization failed" //PDU Session Establishment Reject, with cause "29 User authentication or authorization failed"
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message,
cause_value_5gsm_e::CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED)) {
*/
if (smf_n1_inst.create_n1_pdu_session_establishment_reject( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, smreq->req,
n1_sm_message, n1_sm_message,
......
...@@ -731,10 +731,6 @@ void smf_context::handle_itti_msg( ...@@ -731,10 +731,6 @@ void smf_context::handle_itti_msg(
//N2 SM Information //N2 SM Information
smf_n2 smf_n2_inst = { }; smf_n2 smf_n2_inst = { };
std::string n2_sm_info, n2_sm_info_hex; std::string n2_sm_info, n2_sm_info_hex;
//smf_n2_inst.create_n2_sm_information(
// session_report_msg, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
// n2_sm_info);
smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer( smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer(
session_report_msg, n2_sm_info_type_e::PDU_RES_SETUP_REQ, session_report_msg, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
n2_sm_info); n2_sm_info);
...@@ -1157,16 +1153,10 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1157,16 +1153,10 @@ void smf_context::handle_pdu_session_create_sm_context_request(
smContextCreateError.setError(problem_details); smContextCreateError.setError(problem_details);
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
/* if (smf_n1_inst.create_n1_sm_container( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message, n1_sm_message,
cause_value_5gsm_e::CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED)) { cause_value_5gsm_e::CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED)) {
*/
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req,
n1_sm_message,
cause_value_5gsm_e::CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_msg_hex); smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_msg_hex);
//trigger to send reply to AMF //trigger to send reply to AMF
smf_app_inst->trigger_http_response( smf_app_inst->trigger_http_response(
...@@ -1338,10 +1328,6 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1338,10 +1328,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData); smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject //PDU Session Establishment Reject
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_28_UNKNOWN_PDU_SESSION_TYPE)) {
*/
if (smf_n1_inst.create_n1_pdu_session_establishment_reject( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message, smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_28_UNKNOWN_PDU_SESSION_TYPE)) { cause_value_5gsm_e::CAUSE_28_UNKNOWN_PDU_SESSION_TYPE)) {
...@@ -1463,10 +1449,6 @@ void smf_context::handle_pdu_session_create_sm_context_request( ...@@ -1463,10 +1449,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
if (sm_context_resp->res.get_cause() == NO_RESOURCES_AVAILABLE) { if (sm_context_resp->res.get_cause() == NO_RESOURCES_AVAILABLE) {
cause_n1 = cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES; cause_n1 = cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES;
} }
/* smf_n1_inst.create_n1_sm_container(sm_context_resp_pending->res,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message, cause_n1);
*/
smf_n1_inst.create_n1_pdu_session_establishment_reject(sm_context_resp_pending->res, smf_n1_inst.create_n1_pdu_session_establishment_reject(sm_context_resp_pending->res,
n1_sm_message, cause_n1); n1_sm_message, cause_n1);
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_msg_hex); smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_msg_hex);
...@@ -1806,17 +1788,9 @@ void smf_context::handle_pdu_session_update_sm_context_request( ...@@ -1806,17 +1788,9 @@ void smf_context::handle_pdu_session_update_sm_context_request(
std::string n1_sm_msg_to_be_created, n1_sm_msg_hex_to_be_created; std::string n1_sm_msg_to_be_created, n1_sm_msg_hex_to_be_created;
std::string n2_sm_info_to_be_created, n2_sm_info_hex_to_be_created; std::string n2_sm_info_to_be_created, n2_sm_info_hex_to_be_created;
//N1 SM (PDU Session Modification Command) //N1 SM (PDU Session Modification Command)
/* if (not smf_n1_inst.create_n1_sm_container(
n11_sm_context_resp->res, PDU_SESSION_MODIFICATION_COMMAND,
n1_sm_msg_to_be_created, cause_value_5gsm_e::CAUSE_0_UNKNOWN) or //TODO: need cause?
*/
if (not smf_n1_inst.create_n1_pdu_session_modification_command( if (not smf_n1_inst.create_n1_pdu_session_modification_command(
n11_sm_context_resp->res, n1_sm_msg_to_be_created, cause_value_5gsm_e::CAUSE_0_UNKNOWN) or //TODO: need cause? n11_sm_context_resp->res, n1_sm_msg_to_be_created, cause_value_5gsm_e::CAUSE_0_UNKNOWN) or //TODO: need cause?
//N2 SM (PDU Session Resource Modify Request Transfer IE) //N2 SM (PDU Session Resource Modify Request Transfer IE)
// not smf_n2_inst.create_n2_sm_information(
// n11_sm_context_resp->res, 1, n2_sm_info_type_e::PDU_RES_MOD_REQ,
// n2_sm_info_to_be_created)) {
not smf_n2_inst.create_n2_pdu_session_resource_modify_request_transfer( not smf_n2_inst.create_n2_pdu_session_resource_modify_request_transfer(
n11_sm_context_resp->res, n2_sm_info_type_e::PDU_RES_MOD_REQ, n11_sm_context_resp->res, n2_sm_info_type_e::PDU_RES_MOD_REQ,
n2_sm_info_to_be_created)) { n2_sm_info_to_be_created)) {
...@@ -1978,10 +1952,6 @@ void smf_context::handle_pdu_session_update_sm_context_request( ...@@ -1978,10 +1952,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
smContextUpdateError.setError(problem_details); smContextUpdateError.setError(problem_details);
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextUpdateError.setN1SmMsg(refToBinaryData); smContextUpdateError.setN1SmMsg(refToBinaryData);
/* if (smf_n1_inst.create_n1_sm_container(
sm_context_req_msg, PDU_SESSION_RELEASE_REJECT, n1_sm_msg,
cause_value_5gsm_e::CAUSE_43_INVALID_PDU_SESSION_IDENTITY)) {
*/
if (smf_n1_inst.create_n1_pdu_session_release_reject( if (smf_n1_inst.create_n1_pdu_session_release_reject(
sm_context_req_msg, n1_sm_msg, sm_context_req_msg, n1_sm_msg,
cause_value_5gsm_e::CAUSE_43_INVALID_PDU_SESSION_IDENTITY)) { cause_value_5gsm_e::CAUSE_43_INVALID_PDU_SESSION_IDENTITY)) {
...@@ -2146,10 +2116,6 @@ void smf_context::handle_pdu_session_update_sm_context_request( ...@@ -2146,10 +2116,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
smContextUpdateError.setN1SmMsg(refToBinaryData); smContextUpdateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject //PDU Session Establishment Reject
//24.501: response with a 5GSM STATUS message including cause "#95 Semantically incorrect message" //24.501: response with a 5GSM STATUS message including cause "#95 Semantically incorrect message"
/* if (smf_n1_inst.create_n1_sm_container(
sm_context_req_msg, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_msg,
cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
*/
if (smf_n1_inst.create_n1_pdu_session_establishment_reject( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
sm_context_req_msg, n1_sm_msg, sm_context_req_msg, n1_sm_msg,
cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) { cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
...@@ -2241,10 +2207,6 @@ void smf_context::handle_pdu_session_update_sm_context_request( ...@@ -2241,10 +2207,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextUpdateError.setN1SmMsg(refToBinaryData); smContextUpdateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject, 24.501 cause "#26 Insufficient resources" //PDU Session Establishment Reject, 24.501 cause "#26 Insufficient resources"
/* if (smf_n1_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_msg,
cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES)) {
*/
if (smf_n1_inst.create_n1_pdu_session_establishment_reject( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_msg, smreq->req, n1_sm_msg,
cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES)) { cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES)) {
...@@ -2404,9 +2366,6 @@ void smf_context::handle_pdu_session_update_sm_context_request( ...@@ -2404,9 +2366,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
// Create N2 SM Information: PDU Session Resource Setup Request Transfer IE // Create N2 SM Information: PDU Session Resource Setup Request Transfer IE
//N2 SM Information //N2 SM Information
//smf_n2_inst.create_n2_sm_information(
// sm_context_resp_pending->res, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
// n2_sm_info);
smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer( smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer(
sm_context_resp_pending->res, n2_sm_info_type_e::PDU_RES_SETUP_REQ, sm_context_resp_pending->res, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
n2_sm_info); n2_sm_info);
...@@ -2482,10 +2441,6 @@ void smf_context::handle_pdu_session_update_sm_context_request( ...@@ -2482,10 +2441,6 @@ void smf_context::handle_pdu_session_update_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID); refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextUpdateError.setN1SmMsg(refToBinaryData); smContextUpdateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject //PDU Session Establishment Reject
/* if (smf_n1_inst.create_n1_sm_container(
sm_context_req_msg, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_msg,
cause_value_5gsm_e::CAUSE_38_NETWORK_FAILURE)) {
*/
if (smf_n1_inst.create_n1_pdu_session_establishment_reject( if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
sm_context_req_msg, n1_sm_msg, sm_context_req_msg, n1_sm_msg,
cause_value_5gsm_e::CAUSE_38_NETWORK_FAILURE)) { cause_value_5gsm_e::CAUSE_38_NETWORK_FAILURE)) {
...@@ -2674,22 +2629,13 @@ void smf_context::handle_pdu_session_modification_network_requested( ...@@ -2674,22 +2629,13 @@ void smf_context::handle_pdu_session_modification_network_requested(
//TODO: handle encode N1, N2 failure //TODO: handle encode N1, N2 failure
//N1: PDU_SESSION_MODIFICATION_COMMAND //N1: PDU_SESSION_MODIFICATION_COMMAND
/* smf_n1_inst.create_n1_sm_container(itti_msg->msg,
PDU_SESSION_MODIFICATION_COMMAND,
n1_sm_msg,
cause_value_5gsm_e::CAUSE_0_UNKNOWN);
*/
smf_n1_inst.create_n1_pdu_session_modification_command(itti_msg->msg, smf_n1_inst.create_n1_pdu_session_modification_command(itti_msg->msg,
n1_sm_msg, n1_sm_msg,
cause_value_5gsm_e::CAUSE_0_UNKNOWN); cause_value_5gsm_e::CAUSE_0_UNKNOWN);
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex); smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
itti_msg->msg.set_n1_sm_message(n1_sm_msg_hex); itti_msg->msg.set_n1_sm_message(n1_sm_msg_hex);
//N2: PDU Session Resource Modify Response Transfer //N2: PDU Session Resource Modify Response Transfer
//smf_n2_inst.create_n2_sm_information(itti_msg->msg, 1,
// n2_sm_info_type_e::PDU_RES_MOD_REQ,
// n2_sm_info);
smf_n2_inst.create_n2_pdu_session_resource_modify_request_transfer(itti_msg->msg, smf_n2_inst.create_n2_pdu_session_resource_modify_request_transfer(itti_msg->msg,
n2_sm_info_type_e::PDU_RES_MOD_REQ, n2_sm_info_type_e::PDU_RES_MOD_REQ,
n2_sm_info); n2_sm_info);
......
...@@ -52,6 +52,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co ...@@ -52,6 +52,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co
int bytes = { 0 }; int bytes = { 0 };
unsigned char data[BUF_LEN] = { '\0' }; unsigned char data[BUF_LEN] = { '\0' };
nas_message_t nas_msg = { }; nas_message_t nas_msg = { };
bool result = false;
nas_msg.header.extended_protocol_discriminator = EPD_5GS_SESSION_MANAGEMENT_MESSAGES; nas_msg.header.extended_protocol_discriminator = EPD_5GS_SESSION_MANAGEMENT_MESSAGES;
nas_msg.header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED; nas_msg.header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED;
...@@ -125,6 +126,10 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co ...@@ -125,6 +126,10 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co
} else { } else {
Logger::smf_app().warn( Logger::smf_app().warn(
"SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64); "SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64);
//free memory
if (qos_flow.qos_rules.size() > 0) {
free_wrapper((void**) &sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie);
}
return false; return false;
} }
...@@ -197,6 +202,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co ...@@ -197,6 +202,7 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co
Logger::smf_app().info("Encode PDU Session Establishment Accept"); Logger::smf_app().info("Encode PDU Session Establishment Accept");
//Encode NAS message //Encode NAS message
bytes = nas_message_encode(data, &nas_msg, sizeof(data)/*don't know the size*/, nullptr); bytes = nas_message_encode(data, &nas_msg, sizeof(data)/*don't know the size*/, nullptr);
#if DEBUG_IS_ON #if DEBUG_IS_ON
Logger::smf_app().debug("Buffer Data: "); Logger::smf_app().debug("Buffer Data: ");
for (int i = 0; i < bytes; i++) for (int i = 0; i < bytes; i++)
...@@ -204,14 +210,20 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co ...@@ -204,14 +210,20 @@ bool smf_n1::create_n1_pdu_session_establishment_accept(pdu_session_create_sm_co
printf(" (bytes %d)\n", bytes); printf(" (bytes %d)\n", bytes);
#endif #endif
std::string n1Message((char*) data, bytes); if (bytes > 0) {
nas_msg_str = n1Message; std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message;
result = true;
} else {
result = false;
}
//free memory //free memory
if (qos_flow.qos_rules.size() > 0) { if (qos_flow.qos_rules.size() > 0) {
free_wrapper((void**) &sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie); free_wrapper((void**) &sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie);
} }
free_wrapper((void**) &sm_msg->pdu_session_establishment_accept.qosflowdescriptions.qosflowdescriptionscontents); free_wrapper((void**) &sm_msg->pdu_session_establishment_accept.qosflowdescriptions.qosflowdescriptionscontents);
return result;
} }
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
...@@ -222,6 +234,7 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(pdu_session_msg &msg, ...@@ -222,6 +234,7 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
int bytes = { 0 }; int bytes = { 0 };
unsigned char data[BUF_LEN] = { '\0' }; unsigned char data[BUF_LEN] = { '\0' };
nas_message_t nas_msg = { }; nas_message_t nas_msg = { };
bool result = false;
nas_msg.header.extended_protocol_discriminator = EPD_5GS_SESSION_MANAGEMENT_MESSAGES; nas_msg.header.extended_protocol_discriminator = EPD_5GS_SESSION_MANAGEMENT_MESSAGES;
nas_msg.header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED; nas_msg.header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED;
...@@ -311,8 +324,16 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(pdu_session_msg &msg, ...@@ -311,8 +324,16 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
printf("%02x ", data[i]); printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes); printf(" (bytes %d)\n", bytes);
#endif #endif
std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message; if (bytes > 0) {
std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message;
result = true;
} else {
result = false;
}
return result;
} }
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
...@@ -322,7 +343,7 @@ bool smf_n1::create_n1_pdu_session_modification_request(pdu_session_update_sm_co ...@@ -322,7 +343,7 @@ bool smf_n1::create_n1_pdu_session_modification_request(pdu_session_update_sm_co
cause_value_5gsm_e sm_cause) { cause_value_5gsm_e sm_cause) {
//TODO: //TODO:
Logger::smf_app().info("Create N1 SM Container, PDU Session Modification Request"); Logger::smf_app().info("Create N1 SM Container, PDU Session Modification Request");
return true;
} }
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
...@@ -335,6 +356,7 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_update_sm_co ...@@ -335,6 +356,7 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_update_sm_co
int bytes = { 0 }; int bytes = { 0 };
unsigned char data[BUF_LEN] = { '\0' }; unsigned char data[BUF_LEN] = { '\0' };
nas_message_t nas_msg = { }; nas_message_t nas_msg = { };
bool result = false;
nas_msg.header.extended_protocol_discriminator = EPD_5GS_SESSION_MANAGEMENT_MESSAGES; nas_msg.header.extended_protocol_discriminator = EPD_5GS_SESSION_MANAGEMENT_MESSAGES;
nas_msg.header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED; nas_msg.header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED;
...@@ -437,12 +459,19 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_update_sm_co ...@@ -437,12 +459,19 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_update_sm_co
printf(" (bytes %d)\n", bytes); printf(" (bytes %d)\n", bytes);
#endif #endif
std::string n1Message((char*) data, bytes); if (bytes > 0 ){
nas_msg_str = n1Message; std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message;
result = true;
} else {
result = false;
}
//free memory //free memory
free_wrapper((void**) &sm_msg->pdu_session_modification_command.qosrules.qosrulesie); free_wrapper((void**) &sm_msg->pdu_session_modification_command.qosrules.qosrulesie);
free_wrapper((void**) &sm_msg->pdu_session_modification_command.qosflowdescriptions.qosflowdescriptionscontents); free_wrapper((void**) &sm_msg->pdu_session_modification_command.qosflowdescriptions.qosflowdescriptionscontents);
return result;
} }
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
...@@ -455,6 +484,7 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_modification ...@@ -455,6 +484,7 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_modification
int bytes = { 0 }; int bytes = { 0 };
unsigned char data[BUF_LEN] = { '\0' }; unsigned char data[BUF_LEN] = { '\0' };
nas_message_t nas_msg = { }; nas_message_t nas_msg = { };
bool result = false;
nas_msg.header.extended_protocol_discriminator = EPD_5GS_SESSION_MANAGEMENT_MESSAGES; nas_msg.header.extended_protocol_discriminator = EPD_5GS_SESSION_MANAGEMENT_MESSAGES;
nas_msg.header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED; nas_msg.header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED;
...@@ -557,12 +587,19 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_modification ...@@ -557,12 +587,19 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_modification
printf(" (bytes %d)\n", bytes); printf(" (bytes %d)\n", bytes);
#endif #endif
std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message;
if (bytes > 0){
std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message;
result = true;
} else {
result = false;
}
//free memory //free memory
free_wrapper((void**) &sm_msg->pdu_session_modification_command.qosrules.qosrulesie); free_wrapper((void**) &sm_msg->pdu_session_modification_command.qosrules.qosrulesie);
free_wrapper((void**) &sm_msg->pdu_session_modification_command.qosflowdescriptions.qosflowdescriptionscontents); free_wrapper((void**) &sm_msg->pdu_session_modification_command.qosflowdescriptions.qosflowdescriptionscontents);
return result;
} }
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
...@@ -612,8 +649,14 @@ bool smf_n1::create_n1_pdu_session_release_reject(pdu_session_update_sm_context_ ...@@ -612,8 +649,14 @@ bool smf_n1::create_n1_pdu_session_release_reject(pdu_session_update_sm_context_
printf(" (bytes %d)\n", bytes); printf(" (bytes %d)\n", bytes);
#endif #endif
std::string n1Message((char*) data, bytes); if (bytes > 0) {
nas_msg_str = n1Message; std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message;
return true;
} else {
return false;
}
} }
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
...@@ -669,8 +712,14 @@ bool smf_n1::create_n1_pdu_session_release_command(pdu_session_update_sm_context ...@@ -669,8 +712,14 @@ bool smf_n1::create_n1_pdu_session_release_command(pdu_session_update_sm_context
printf(" (bytes %d)\n", bytes); printf(" (bytes %d)\n", bytes);
#endif #endif
std::string n1Message((char*) data, bytes); if (bytes > 0){
nas_msg_str = n1Message; std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message;
return true;
} else {
return false;
}
} }
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
...@@ -679,6 +728,7 @@ bool create_n1_pdu_session_release_command(pdu_session_modification_network_requ ...@@ -679,6 +728,7 @@ bool create_n1_pdu_session_release_command(pdu_session_modification_network_requ
cause_value_5gsm_e sm_cause) { cause_value_5gsm_e sm_cause) {
Logger::smf_app().info("Create N1 SM Container, PDU Session Release Command (pdu_session_modification_network_requested)"); Logger::smf_app().info("Create N1 SM Container, PDU Session Release Command (pdu_session_modification_network_requested)");
//TODO: //TODO:
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -86,7 +86,7 @@ class smf_n1 { ...@@ -86,7 +86,7 @@ class smf_n1 {
std::string &nas_msg_str, std::string &nas_msg_str,
cause_value_5gsm_e sm_cause); cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_create_sm_context_response &msg, uint8_t msg_type, bool create_n1_pdu_session_establishment_reject(pdu_session_update_sm_context_response &msg, uint8_t msg_type,
std::string &nas_msg_str, std::string &nas_msg_str,
cause_value_5gsm_e sm_cause); cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_update_sm_context_request &msg, uint8_t msg_type, bool create_n1_pdu_session_establishment_reject(pdu_session_update_sm_context_request &msg, uint8_t msg_type,
......
...@@ -66,6 +66,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c ...@@ -66,6 +66,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c
std::string &ngap_msg_str) { std::string &ngap_msg_str) {
Logger::smf_n2().info("Create N2 SM Information, PDU Session Resource Setup Request Transfer"); Logger::smf_n2().info("Create N2 SM Information, PDU Session Resource Setup Request Transfer");
bool result = false;
Ngap_PDUSessionResourceSetupRequestTransfer_t *ngap_IEs = nullptr; Ngap_PDUSessionResourceSetupRequestTransfer_t *ngap_IEs = nullptr;
ngap_IEs = (Ngap_PDUSessionResourceSetupRequestTransfer_t*) calloc( ngap_IEs = (Ngap_PDUSessionResourceSetupRequestTransfer_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceSetupRequestTransfer_t)); 1, sizeof(Ngap_PDUSessionResourceSetupRequestTransfer_t));
...@@ -120,6 +121,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c ...@@ -120,6 +121,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c
} else { } else {
Logger::smf_n2().warn( Logger::smf_n2().warn(
"SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64); "SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64);
free_wrapper((void**) &pduSessionAggregateMaximumBitRate);
return false; return false;
} }
...@@ -274,19 +276,19 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c ...@@ -274,19 +276,19 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c
Logger::smf_n2().warn( Logger::smf_n2().warn(
"NGAP PDU Session Resource Setup Request Transfer encode failed (encode size %d)", "NGAP PDU Session Resource Setup Request Transfer encode failed (encode size %d)",
encoded_size); encoded_size);
return false; result = false;
} } else {
#if DEBUG_IS_ON #if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: "); Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) for (int i = 0; i < encoded_size; i++)
printf("%02x ", (char) buffer[i]); printf("%02x ", (char) buffer[i]);
printf(" (%d bytes)\n", (int) encoded_size); printf(" (%d bytes)\n", (int) encoded_size);
#endif #endif
std::string ngap_message((char*) buffer, encoded_size); std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message; ngap_msg_str = ngap_message;
result = true;
}
//free memory //free memory
free_wrapper((void**) &pduSessionAggregateMaximumBitRate); free_wrapper((void**) &pduSessionAggregateMaximumBitRate);
free_wrapper( free_wrapper(
...@@ -308,6 +310,8 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c ...@@ -308,6 +310,8 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_c
free_wrapper((void**) &ngap_QosFlowSetupRequestItem); free_wrapper((void**) &ngap_QosFlowSetupRequestItem);
free_wrapper((void**) &ngap_IEs); free_wrapper((void**) &ngap_IEs);
free_wrapper((void**) &buffer); free_wrapper((void**) &buffer);
return result;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -316,6 +320,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u ...@@ -316,6 +320,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u
std::string &ngap_msg_str) { std::string &ngap_msg_str) {
Logger::smf_n2().info("Create N2 SM Information, PDU Session Resource Setup Request Transfer"); Logger::smf_n2().info("Create N2 SM Information, PDU Session Resource Setup Request Transfer");
bool result = false;
Ngap_PDUSessionResourceSetupRequestTransfer_t *ngap_IEs = nullptr; Ngap_PDUSessionResourceSetupRequestTransfer_t *ngap_IEs = nullptr;
ngap_IEs = (Ngap_PDUSessionResourceSetupRequestTransfer_t*) calloc( ngap_IEs = (Ngap_PDUSessionResourceSetupRequestTransfer_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceSetupRequestTransfer_t)); 1, sizeof(Ngap_PDUSessionResourceSetupRequestTransfer_t));
...@@ -383,6 +388,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u ...@@ -383,6 +388,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u
} else { } else {
Logger::smf_n2().warn( Logger::smf_n2().warn(
"SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64); "SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64);
free_wrapper((void**) &pduSessionAggregateMaximumBitRate);
return false; return false;
} }
...@@ -537,18 +543,19 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u ...@@ -537,18 +543,19 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u
Logger::smf_n2().warn( Logger::smf_n2().warn(
"NGAP PDU Session Resource Setup Request Transfer encode failed (encode size %d)", "NGAP PDU Session Resource Setup Request Transfer encode failed (encode size %d)",
encoded_size); encoded_size);
return false; result = false;
} } else {
#if DEBUG_IS_ON #if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: "); Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) for (int i = 0; i < encoded_size; i++)
printf("%02x ", (char) buffer[i]); printf("%02x ", (char) buffer[i]);
printf(" (%d bytes)\n", (int) encoded_size); printf(" (%d bytes)\n", (int) encoded_size);
#endif #endif
std::string ngap_message((char*) buffer, encoded_size); std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message; ngap_msg_str = ngap_message;
result = true;
}
//free memory //free memory
free_wrapper((void**) &pduSessionAggregateMaximumBitRate); free_wrapper((void**) &pduSessionAggregateMaximumBitRate);
...@@ -572,6 +579,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u ...@@ -572,6 +579,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u
free_wrapper((void**) &ngap_IEs); free_wrapper((void**) &ngap_IEs);
free_wrapper((void**) &buffer); free_wrapper((void**) &buffer);
return result;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -580,6 +588,7 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_ ...@@ -580,6 +588,7 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_
std::string &ngap_msg_str) { std::string &ngap_msg_str) {
Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Modify Request Transfer"); Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Modify Request Transfer");
bool result = false;
//get default QoS info //get default QoS info
std::map<uint8_t, qos_flow_context_updated> qos_flows = { }; std::map<uint8_t, qos_flow_context_updated> qos_flows = { };
sm_context_res.get_all_qos_flow_context_updateds(qos_flows); sm_context_res.get_all_qos_flow_context_updateds(qos_flows);
...@@ -805,18 +814,19 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_ ...@@ -805,18 +814,19 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_
Logger::smf_n2().warn( Logger::smf_n2().warn(
"NGAP PDU Session Resource Modify Request Transfer encode failed (encoded size %d)", "NGAP PDU Session Resource Modify Request Transfer encode failed (encoded size %d)",
encoded_size); encoded_size);
return false; result = false;
} } else {
#if DEBUG_IS_ON #if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: "); Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) for (int i = 0; i < encoded_size; i++)
printf("%02x ", (char) buffer[i]); printf("%02x ", (char) buffer[i]);
printf(" (%d bytes)\n", (int) encoded_size); printf(" (%d bytes)\n", (int) encoded_size);
#endif #endif
std::string ngap_message((char*) buffer, encoded_size); std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message; ngap_msg_str = ngap_message;
result = true;
}
//free memory //free memory
free_wrapper((void**) &pduSessionAggregateMaximumBitRate); free_wrapper((void**) &pduSessionAggregateMaximumBitRate);
...@@ -845,6 +855,8 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_ ...@@ -845,6 +855,8 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_
free_wrapper((void**) &qosFlowAddOrModifyRequestList); free_wrapper((void**) &qosFlowAddOrModifyRequestList);
free_wrapper((void**) &ngap_IEs); free_wrapper((void**) &ngap_IEs);
free_wrapper((void**) &buffer); free_wrapper((void**) &buffer);
return result;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -853,7 +865,7 @@ bool smf_n2::create_n2_pdu_session_resource_release_command_transfer(pdu_session ...@@ -853,7 +865,7 @@ bool smf_n2::create_n2_pdu_session_resource_release_command_transfer(pdu_session
std::string &ngap_msg_str) { std::string &ngap_msg_str) {
Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Release Command Transfer IE"); Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Release Command Transfer IE");
bool result = false;
Ngap_PDUSessionResourceReleaseCommandTransfer_t *ngap_resource_release_command_transfer = Ngap_PDUSessionResourceReleaseCommandTransfer_t *ngap_resource_release_command_transfer =
nullptr; nullptr;
ngap_resource_release_command_transfer = ngap_resource_release_command_transfer =
...@@ -891,22 +903,24 @@ bool smf_n2::create_n2_pdu_session_resource_release_command_transfer(pdu_session ...@@ -891,22 +903,24 @@ bool smf_n2::create_n2_pdu_session_resource_release_command_transfer(pdu_session
Logger::smf_n2().warn( Logger::smf_n2().warn(
"NGAP PDU Session Release Command encode failed (encoded size %d)", "NGAP PDU Session Release Command encode failed (encoded size %d)",
encoded_size); encoded_size);
return false; result = false;
} } else {
#if DEBUG_IS_ON #if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: "); Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) for (int i = 0; i < encoded_size; i++)
printf("%02x ", (char) buffer[i]); printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size); Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
#endif #endif
std::string ngap_message((char*) buffer, encoded_size); std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message; ngap_msg_str = ngap_message;
result = true;
}
//free memory //free memory
free_wrapper((void**) &ngap_resource_release_command_transfer); free_wrapper((void**) &ngap_resource_release_command_transfer);
free_wrapper((void**) &buffer); free_wrapper((void**) &buffer);
return result;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -915,6 +929,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_r ...@@ -915,6 +929,7 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_r
std::string &ngap_msg_str) { std::string &ngap_msg_str) {
Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Setup Request Transfer IE"); Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Setup Request Transfer IE");
//TODO: //TODO:
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -923,6 +938,7 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_ ...@@ -923,6 +938,7 @@ bool smf_n2::create_n2_pdu_session_resource_modify_request_transfer(pdu_session_
std::string &ngap_msg_str) { std::string &ngap_msg_str) {
Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Modify Request Transfer IE"); Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Modify Request Transfer IE");
//TODO: //TODO:
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -930,6 +946,8 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session ...@@ -930,6 +946,8 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session
std::string &ngap_msg_str) { std::string &ngap_msg_str) {
//PDU Session Resource Modify Response Transfer IE for testing purpose //PDU Session Resource Modify Response Transfer IE for testing purpose
Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Modify Response Transfer IE"); Logger::smf_n2().debug("Create N2 SM Information: NGAP PDU Session Resource Modify Response Transfer IE");
bool result = false;
//struct Ngap_UPTransportLayerInformation *dL_NGU_UP_TNLInformation; /* OPTIONAL */ //struct Ngap_UPTransportLayerInformation *dL_NGU_UP_TNLInformation; /* OPTIONAL */
//struct Ngap_UPTransportLayerInformation *uL_NGU_UP_TNLInformation; /* OPTIONAL */ //struct Ngap_UPTransportLayerInformation *uL_NGU_UP_TNLInformation; /* OPTIONAL */
//struct Ngap_QosFlowAddOrModifyResponseList *qosFlowAddOrModifyResponseList; /* OPTIONAL */ //struct Ngap_QosFlowAddOrModifyResponseList *qosFlowAddOrModifyResponseList; /* OPTIONAL */
...@@ -1005,18 +1023,19 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session ...@@ -1005,18 +1023,19 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session
Logger::smf_n2().warn( Logger::smf_n2().warn(
" NGAP PDU Session Resource Modify Response Transfer encode failed (encoded size %d)", " NGAP PDU Session Resource Modify Response Transfer encode failed (encoded size %d)",
encoded_size); encoded_size);
return false; result = false;
} } else {
#if DEBUG_IS_ON #if DEBUG_IS_ON
Logger::smf_n2().debug("N2 SM buffer data: "); Logger::smf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) for (int i = 0; i < encoded_size; i++)
printf("%02x ", (char) buffer[i]); printf("%02x ", (char) buffer[i]);
Logger::smf_n2().debug(" (%d bytes) \n", encoded_size); Logger::smf_n2().debug(" (%d bytes) \n", encoded_size);
#endif #endif
std::string ngap_message((char*) buffer, encoded_size); std::string ngap_message((char*) buffer, encoded_size);
ngap_msg_str = ngap_message; ngap_msg_str = ngap_message;
result = true;
}
//free memory //free memory
free_wrapper( free_wrapper(
...@@ -1035,8 +1054,7 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session ...@@ -1035,8 +1054,7 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session
free_wrapper((void**) &ngap_resource_response_transfer); free_wrapper((void**) &ngap_resource_response_transfer);
free_wrapper((void**) &buffer); free_wrapper((void**) &buffer);
return result;
//TODO:
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -388,10 +388,6 @@ void session_create_sm_context_procedure::handle_itti_msg( ...@@ -388,10 +388,6 @@ void session_create_sm_context_procedure::handle_itti_msg(
cause_value_5gsm_e::CAUSE_50_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED; cause_value_5gsm_e::CAUSE_50_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED;
} }
/* smf_n1_inst.create_n1_sm_container(n11_triggered_pending->res,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_msg, cause_n1);
*/
smf_n1_inst.create_n1_pdu_session_establishment_reject(n11_triggered_pending->res, smf_n1_inst.create_n1_pdu_session_establishment_reject(n11_triggered_pending->res,
n1_sm_msg, cause_n1); n1_sm_msg, cause_n1);
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex); smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
...@@ -409,20 +405,11 @@ void session_create_sm_context_procedure::handle_itti_msg( ...@@ -409,20 +405,11 @@ void session_create_sm_context_procedure::handle_itti_msg(
cause_value_5gsm_e::CAUSE_50_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED; cause_value_5gsm_e::CAUSE_50_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED;
} }
//smf_n1_inst.create_n1_sm_container(n11_triggered_pending->res,
//PDU_SESSION_ESTABLISHMENT_ACCEPT,
// n1_sm_msg, cause_n1);
smf_n1_inst.create_n1_pdu_session_establishment_accept(n11_triggered_pending->res, smf_n1_inst.create_n1_pdu_session_establishment_accept(n11_triggered_pending->res,
n1_sm_msg, cause_n1); n1_sm_msg, cause_n1);
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex); smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex); n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex);
//N2 SM Information (Step 11, section 4.3.2.2.1 @ 3GPP TS 23.502): PDUSessionRessourceSetupRequestTransfer IE //N2 SM Information (Step 11, section 4.3.2.2.1 @ 3GPP TS 23.502): PDUSessionRessourceSetupRequestTransfer IE
//smf_n2_inst.create_n2_sm_information(
// n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
// n2_sm_info);
smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer( smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer(
n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_SETUP_REQ, n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
n2_sm_info); n2_sm_info);
...@@ -1075,9 +1062,6 @@ void session_update_sm_context_procedure::handle_itti_msg( ...@@ -1075,9 +1062,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex); smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex); n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex);
//N2 SM Information //N2 SM Information
//smf_n2_inst.create_n2_sm_information(
// n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_MOD_RSP,
// n2_sm_info);
smf_n2_inst.create_n2_pdu_session_resource_modify_response_transfer( smf_n2_inst.create_n2_pdu_session_resource_modify_response_transfer(
n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_MOD_RSP, n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_MOD_RSP,
n2_sm_info); n2_sm_info);
...@@ -1113,9 +1097,6 @@ void session_update_sm_context_procedure::handle_itti_msg( ...@@ -1113,9 +1097,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
// Create N2 SM Information: PDU Session Resource Setup Request Transfer IE // Create N2 SM Information: PDU Session Resource Setup Request Transfer IE
//N2 SM Information //N2 SM Information
//smf_n2_inst.create_n2_sm_information(
// n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
// n2_sm_info);
smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer( smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer(
n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_SETUP_REQ, n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
n2_sm_info); n2_sm_info);
...@@ -1177,10 +1158,6 @@ void session_update_sm_context_procedure::handle_itti_msg( ...@@ -1177,10 +1158,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
Logger::smf_app().info("PDU Session Release UE-initiated (Step 1))"); Logger::smf_app().info("PDU Session Release UE-initiated (Step 1))");
//N1 SM //N1 SM
/* smf_n1_inst.create_n1_sm_container(
n11_triggered_pending->res, PDU_SESSION_RELEASE_COMMAND, n1_sm_msg,
cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES); //TODO: check Cause
*/
smf_n1_inst.create_n1_pdu_session_release_command( smf_n1_inst.create_n1_pdu_session_release_command(
n11_triggered_pending->res, n1_sm_msg, n11_triggered_pending->res, n1_sm_msg,
cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES); //TODO: check Cause cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES); //TODO: check Cause
...@@ -1190,9 +1167,6 @@ void session_update_sm_context_procedure::handle_itti_msg( ...@@ -1190,9 +1167,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
//include N2 SM Resource Release Request only when User Plane connection is activated //include N2 SM Resource Release Request only when User Plane connection is activated
if (sps->get_upCnx_state() == upCnx_state_e::UPCNX_STATE_ACTIVATED) { if (sps->get_upCnx_state() == upCnx_state_e::UPCNX_STATE_ACTIVATED) {
//N2 SM Information //N2 SM Information
//smf_n2_inst.create_n2_sm_information(
// n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_REL_CMD,
// n2_sm_info);
smf_n2_inst.create_n2_pdu_session_resource_release_command_transfer( smf_n2_inst.create_n2_pdu_session_resource_release_command_transfer(
n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_REL_CMD, n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_REL_CMD,
n2_sm_info); n2_sm_info);
......
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