Commit 853160e1 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup

parent 74893fdc
......@@ -32,7 +32,6 @@ include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/utils/bstr)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/common/ngap)
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories(${SRC_TOP_DIR}/nas/ies)
include_directories(${SRC_TOP_DIR}/nas/sm/msg)
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdint.h>
#include "ngap_common.h"
#include "dynamic_memory_check.h"
//--------------------------------------------------------------------
int check_NGAP_pdu_constraints(Ngap_NGAP_PDU_t *pdu) {
int ret = -1;
char errbuf[512];
size_t errlen = sizeof(errbuf);
ret = asn_check_constraints(&asn_DEF_Ngap_NGAP_PDU, pdu, errbuf, &errlen);
if (ret != 0) {
printf("Constraint validation failed:%s\n", errbuf);
}
return ret;
}
//--------------------------------------------------------------------
int ngap_amf_decode_pdu(Ngap_NGAP_PDU_t *pdu, const_bstring const raw) {
Ngap_NGAP_PDU_t *decoded_pdu = pdu;
asn_dec_rval_t rc = asn_decode(NULL, ATS_ALIGNED_CANONICAL_PER,
&asn_DEF_Ngap_NGAP_PDU, (void**) &decoded_pdu,
bdata(raw), blength(raw));
if (rc.code != RC_OK) {
printf("asn_decode failed(%d)\n", rc.code);
return rc.code;
}
return rc.code;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef FILE_NGAP_COMMON_SEEN
#define FILE_NGAP_COMMON_SEEN
#include "common_defs.h"
#include "common_types.h"
#include "bstrlib.h"
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProcedureCode.h"
#include "Ngap_TriggeringMessage.h"
#include "Ngap_Criticality.h"
#include "Ngap_CriticalityDiagnostics-IE-Item.h"
#include "assertions.h"
#define NGAP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
do {\
IE_TYPE **ptr; \
ie = NULL; \
for (ptr = container->protocolIEs.list.array; \
ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \
ptr++) { \
if((*ptr)->id == IE_ID) { \
ie = *ptr; \
break; \
} \
} \
if (mandatory) DevAssert(ie != NULL); \
} while(0)
typedef int (*ngap_message_decoded_callback)(const sctp_assoc_id_t assoc_id,
const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU *message_p);
int check_NGAP_pdu_constraints(Ngap_NGAP_PDU_t *pdu);
int ngap_amf_decode_pdu(Ngap_NGAP_PDU_t *pdu, const_bstring const raw);
#endif
......@@ -201,7 +201,6 @@ typedef struct qos_profile_s {
#define NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL "/sm-contexts"
#define NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL "/sm-contexts/"
//for CURL
#define AMF_CURL_TIMEOUT_MS 100L
#define AMF_NUMBER_RETRIES 3
......
......@@ -34,7 +34,6 @@ include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/utils/bstr)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/common/ngap)
file(GLOB NAS_src_files
${NAS_DIR}/*.c
......
......@@ -282,7 +282,6 @@ include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/common/ngap)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/utils/bstr)
include_directories(${SRC_TOP_DIR}/pfcp)
......
......@@ -22,7 +22,6 @@
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories(${SRC_TOP_DIR}/common/ngap)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/pfcp)
......@@ -46,7 +45,6 @@ include_directories(${SRC_TOP_DIR}/api-server/model)
include_directories(${SRC_TOP_DIR}/api-server/)
add_library (SMF STATIC
${SRC_TOP_DIR}/common/ngap/ngap_common.c
smf_app.cpp
smf_config.cpp
smf_context.cpp
......
......@@ -265,7 +265,6 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
//Message Type
sm_msg->header.message_type = PDU_SESSION_ESTABLISHMENT_REJECT;
Logger::smf_n1().debug("NAS header, Extended Protocol Discriminator 0x%x, Security Header Type: 0x%x", nas_msg.header.extended_protocol_discriminator, nas_msg.header.security_header_type);
Logger::smf_n1().debug("SM header, PDU Session Identity 0x%x, Procedure Transaction Identity 0x%x, Message Type 0x%x", sm_msg->header.pdu_session_identity, sm_msg->header.procedure_transaction_identity, sm_msg->header.message_type);
//5GSM Cause
......@@ -287,30 +286,6 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
sm_msg->pdu_session_establishment_reject.allowedsscmode.is_ssc3_allowed =
SSC_MODE3_NOT_ALLOWED;
/*
//EAPMessage
unsigned char bitStream_eapmessage[2] = {0x01,0x02};
bstring eapmessage_tmp = bfromcstralloc(2, "\0");
eapmessage_tmp->slen = 2;
memcpy(eapmessage_tmp->data,bitStream_eapmessage,sizeof(bitStream_eapmessage));
sm_msg->pdu_session_establishment_reject.eapmessage = bfromcstralloc(2, "\0");
sm_msg->pdu_session_establishment_reject.eapmessage->slen = 2;
//ExtendedProtocolConfigurationOptions
unsigned char bitStream_extendedprotocolconfigurationoptions[4];
bitStream_extendedprotocolconfigurationoptions[0] = 0x12;
bitStream_extendedprotocolconfigurationoptions[1] = 0x13;
bitStream_extendedprotocolconfigurationoptions[2] = 0x14;
bitStream_extendedprotocolconfigurationoptions[3] = 0x15;
bstring extendedprotocolconfigurationoptions_tmp = bfromcstralloc(4, "\0");
extendedprotocolconfigurationoptions_tmp->slen = 4;
memcpy(extendedprotocolconfigurationoptions_tmp->data,bitStream_extendedprotocolconfigurationoptions,sizeof(bitStream_extendedprotocolconfigurationoptions));
sm_msg->pdu_session_establishment_reject.extendedprotocolconfigurationoptions = extendedprotocolconfigurationoptions_tmp;
//5GSM CongestionReattemptIndicator
sm_msg->pdu_session_establishment_reject._5gsmcongestionreattemptindicator.abo = THE_BACKOFF_TIMER_IS_APPLIED_IN_ALL_PLMNS;
*/
Logger::smf_n1().debug("SM MSG, 5GSM Cause: 0x%x", sm_msg->pdu_session_establishment_reject._5gsmcause);
Logger::smf_n1().debug("SM MSG, Allowed SSC Mode, SSC1 allowed 0x%x, SSC2 allowed 0x%x, SSC3 allowed 0x%x", sm_msg->pdu_session_establishment_reject.allowedsscmode.is_ssc1_allowed, sm_msg->pdu_session_establishment_reject.allowedsscmode.is_ssc2_allowed,
sm_msg->pdu_session_establishment_reject.allowedsscmode.is_ssc3_allowed);
......@@ -336,16 +311,6 @@ bool smf_n1::create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
return result;
}
//-----------------------------------------------------------------------------------------------------
//For testing purpose
bool smf_n1::create_n1_pdu_session_modification_request(pdu_session_update_sm_context_response &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause) {
//TODO:
Logger::smf_n1().info("Create N1 SM Container, PDU Session Modification Request");
return true;
}
//-----------------------------------------------------------------------------------------------------
bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_update_sm_context_response &sm_context_res,
std::string &nas_msg_str,
......@@ -411,7 +376,6 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_update_sm_co
sm_msg->pdu_session_modification_command.presence = 0xff; //TODO: to be updated
//5GSMCause
sm_msg->pdu_session_modification_command._5gsmcause = static_cast<uint8_t>(sm_cause);
//SessionAMBR (default)
sc.get()->get_session_ambr(sm_msg->pdu_session_modification_command.sessionambr, sm_context_res.get_snssai(), sm_context_res.get_dnn());
......@@ -539,7 +503,6 @@ bool smf_n1::create_n1_pdu_session_modification_command(pdu_session_modification
sm_msg->pdu_session_modification_command.presence = 0xff; //TODO: to be updated
//5GSMCause
sm_msg->pdu_session_modification_command._5gsmcause = static_cast<uint8_t>(sm_cause);
//SessionAMBR (default)
sc.get()->get_session_ambr(sm_msg->pdu_session_modification_command.sessionambr, msg.get_snssai(), msg.get_dnn());
......
......@@ -100,11 +100,6 @@ class smf_n1 {
cause_value_5gsm_e sm_cause);
*/
//For testing purpose
bool create_n1_pdu_session_modification_request(pdu_session_update_sm_context_response &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Modification Command
* Included in PDU Session Update SM Context Response (PDU Session Modification UE-Initiated procedure - step 1)
......
......@@ -136,8 +136,6 @@ smf_n11::smf_n11() {
void smf_n11::send_n1n2_message_transfer_request(
std::shared_ptr<itti_n11_create_sm_context_response> sm_context_res) {
//Transfer N1/N2 message via AMF by using N_amf_Communication_N1N2MessageTransfer (see TS29518_Namf_Communication.yaml)
//TODO: use RestSDK for client, use curl to send data for the moment
Logger::smf_n11().debug("Send Communication_N1N2MessageTransfer to AMF (HTTP version %d)", sm_context_res->http_version);
mime_parser parser = {};
......
......@@ -349,7 +349,6 @@ bool smf_n2::create_n2_pdu_session_resource_setup_request_transfer(pdu_session_u
qos_flow.qfi.qfi, qos_flow.qos_profile.priority_level,
qos_flow.qos_profile.arp.priority_level);
//check the QoS Flow
if ((qos_flow.qfi.qfi < QOS_FLOW_IDENTIFIER_FIRST )
or (qos_flow.qfi.qfi > QOS_FLOW_IDENTIFIER_LAST )) {
......@@ -869,21 +868,6 @@ bool smf_n2::create_n2_pdu_session_resource_release_command_transfer(pdu_session
1, sizeof(Ngap_PDUSessionResourceReleaseCommandTransfer_t));
//TODO: To be completed, here's an example
/*
typedef struct Ngap_Cause {
Ngap_Cause_PR present;
union Ngap_Cause_u {
Ngap_CauseRadioNetwork_t radioNetwork;
Ngap_CauseTransport_t transport;
Ngap_CauseNas_t nas;
Ngap_CauseProtocol_t protocol;
Ngap_CauseMisc_t misc;
struct Ngap_ProtocolIE_SingleContainer *choice_Extensions;
} choice;
asn_struct_ctx_t _asn_ctx;
} Ngap_Cause_t;
*/
ngap_resource_release_command_transfer->cause.present =
Ngap_Cause_PR_radioNetwork;
ngap_resource_release_command_transfer->cause.choice.radioNetwork = 1;
......@@ -944,12 +928,6 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session
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 *uL_NGU_UP_TNLInformation; /* OPTIONAL */
//struct Ngap_QosFlowAddOrModifyResponseList *qosFlowAddOrModifyResponseList; /* OPTIONAL */
//struct Ngap_QosFlowPerTNLInformationList *additionalDLQosFlowPerTNLInformation; /* OPTIONAL */
// struct Ngap_QosFlowListWithCause *qosFlowFailedToAddOrModifyList; /* OPTIONAL */
Ngap_PDUSessionResourceModifyResponseTransfer_t *ngap_resource_response_transfer =
nullptr;
ngap_resource_response_transfer =
......@@ -1053,15 +1031,6 @@ bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session
return result;
}
//------------------------------------------------------------------------------
/*
bool smf_n2::create_n2_pdu_session_resource_modify_response_transfer(pdu_session_modification_network_requested &msg,
n2_sm_info_type_e ngap_info_type,
std::string &ngap_msg_str) {
//TODO:
}
*/
//---------------------------------------------------------------------------------------------
int smf_n2::decode_n2_sm_information(
std::shared_ptr<Ngap_PDUSessionResourceSetupResponseTransfer_t> &ngap_IE,
......
......@@ -1015,27 +1015,6 @@ void session_update_sm_context_procedure::handle_itti_msg(
N2_SM_CONTENT_ID;
switch (session_procedure_type) {
//FOR TESTING PURPOSE
case session_management_procedures_type_e::PDU_SESSION_TEST: {
//N1 SM
smf_n1::get_instance().create_n1_pdu_session_modification_request(
n11_triggered_pending->res, n1_sm_msg, cause_value_5gsm_e::CAUSE_0_UNKNOWN);
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);
//N2 SM Information
smf_n2::get_instance().create_n2_pdu_session_resource_modify_response_transfer(
n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_MOD_RSP,
n2_sm_info);
smf_app_inst->convert_string_2_hex(n2_sm_info, n2_sm_info_hex);
n11_triggered_pending->res.set_n2_sm_information(n2_sm_info_hex);
//fill the content of SmContextUpdatedData
sm_context_updated_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
"PDU_RES_MOD_RSP"; //NGAP message
n11_triggered_pending->res.set_json_data(sm_context_updated_data);
}
break;
//PDU Session Establishment UE-Requested
case session_management_procedures_type_e::PDU_SESSION_ESTABLISHMENT_UE_REQUESTED: {
//No need to create N1/N2 Container, just Cause
......
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