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

Merge branch 'ngap-sm-test' into pdu_session_establishment

parents c586270d 6d4ad918
################################################################################
# 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
################################################################################
#for NGAP_SMF_LAYTER
set(NGAP_SMF_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
include_directories(${SRC_TOP_DIR}/NgapSmfLayer)
file(GLOB NGAP_SMF_src_files
${SRC_TOP_DIR}/NgapSmfLayer/*.c
)
add_library(NGAP_SMF_LAYER ${NGAP_SMF_DIR}/ng_pdu_session_resource_setup_request.c ${NGAP_SMF_src_files} ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES})
This diff is collapsed.
#ifndef NG_PDU_SESSOIN_RESOURCE_MODIFY_REQUEST_H_
#define NG_PDU_SESSOIN_RESOURCE_MODIFY_REQUEST_H_
#include "Ngap_NGAP-PDU.h"
Ngap_NGAP_PDU_t *make_NGAP_pdu_session_resource_modify_request();
#endif
This diff is collapsed.
#ifndef NG_PDU_SESSOIN_RESOURCE_MODIFY_RESPONSE_H_
#define NG_PDU_SESSOIN_RESOURCE_MODIFY_RESPONSE_H_
#include "Ngap_NGAP-PDU.h"
Ngap_NGAP_PDU_t *make_NGAP_pdu_session_resource_modify_response();
#endif
This diff is collapsed.
#ifndef NG_PDU_SESSOIN_RESOURCE_NOTIFY_H_
#define NG_PDU_SESSOIN_RESOURCE_NOTIFY_H_
#include "Ngap_NGAP-PDU.h"
Ngap_NGAP_PDU_t *make_NGAP_pdu_session_resource_nofity();
#endif
This diff is collapsed.
#ifndef NG_PDU_SESSOIN_RESOURCE_RELEASE_COMMAND_H_
#define NG_PDU_SESSOIN_RESOURCE_RELEASE_COMMAND_H_
#include "Ngap_NGAP-PDU.h"
Ngap_NGAP_PDU_t *make_NGAP_pdu_session_resource_release_command();
#endif
This diff is collapsed.
#ifndef NG_PDU_SESSOIN_RESOURCE_RELEASE_RESPONSE_H_
#define NG_PDU_SESSOIN_RESOURCE_RELEASE_RESPONSE_H_
#include "Ngap_NGAP-PDU.h"
Ngap_NGAP_PDU_t *make_NGAP_pdu_session_resource_release_response();
#endif
This diff is collapsed.
#ifndef NG_PDU_SESSOIN_RESOURCE_SETUP_REQUEST_H_
#define NG_PDU_SESSOIN_RESOURCE_SETUP_REQUEST_H_
#include "Ngap_NGAP-PDU.h"
Ngap_NGAP_PDU_t *make_NGAP_pdu_session_resource_setup_request();
#endif
This diff is collapsed.
#ifndef NG_PDU_SESSOIN_RESOURCE_SETUP_RESPONSE_H_
#define NG_PDU_SESSOIN_RESOURCE_SETUP_RESPONSE_H_
#include "Ngap_NGAP-PDU.h"
Ngap_NGAP_PDU_t *make_NGAP_pdu_session_resource_setup_response();
#endif
......@@ -37,6 +37,10 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
Logger::smf_api_server().info("post_sm_contexts...");
std::string ngap_msg_str = "hello world";
m_smf_app->create_n2_sm_information(NULL, 0, 0, ngap_msg_str);
return ;
//decode NAS message and assign the necessary informations to smf::pdu_session_create_sm_context_request
//and pass this message to SMF to handle this message
......
......@@ -43,6 +43,8 @@ typedef uint32_t sctp_assoc_id_t;
#define AMF_UE_NGAP_ID_FMT "0x%08"PRIX32
#define INVALID_AMF_UE_NGAP_ID 0x0
#define AMF_UE_NGAP_ID_MASK_ 0x0000FFFFFFFFFF
typedef uint8_t ksi_t;
#define KSI_NO_KEY_AVAILABLE 0x07
......
#include <stdint.h>
#include "ngap_common.h"
#include "dynamic_memory_check.h"
//#include "log.h"
/*
int asn_debug = 0;
int asn1_xer_print = 0;
ssize_t
ngap_generate_unsuccessfull_outcome (
uint8_t ** buffer,
uint32_t * length,
e_Ngap_ProcedureCode procedureCode,
Ngap_Criticality_t criticality,
asn_TYPE_descriptor_t * td,
void *sptr)
{
NGAP_PDU_t pdu;
ssize_t encoded;
memset (&pdu, 0, sizeof (NGAP_PDU_t));
pdu.present = NGAP_PDU_PR_unsuccessfulOutcome;
pdu.choice.unsuccessfulOutcome.procedureCode = procedureCode;
pdu.choice.unsuccessfulOutcome.criticality = criticality;
ANY_fromType (&pdu.choice.unsuccessfulOutcome.value, td, sptr);
if (asn1_xer_print) {
xer_fprint (stdout, &asn_DEF_NGAP_PDU, (void *)&pdu);
}
ASN_STRUCT_FREE_CONTENTS_ONLY (*td, sptr);
if ((encoded = uper_encode_to_new_buffer (&asn_DEF_NGAP_PDU, 0, &pdu, (void **)buffer)) < 0) {
OAILOG_ERROR (LOG_NGAP, "Encoding of %s failed\n", td->name);
return -1;
}
*length = encoded;
return encoded;
}
ssize_t
ngap_generate_initiating_message (
uint8_t ** buffer,
uint32_t * length,
e_Ngap_ProcedureCode procedureCode,
Ngap_Criticality_t criticality,
asn_TYPE_descriptor_t * td,
void *sptr)
{
NGAP_PDU_t pdu;
ssize_t encoded;
memset (&pdu, 0, sizeof (NGAP_PDU_t));
pdu.present = NGAP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = procedureCode;
pdu.choice.initiatingMessage.criticality = criticality;
ANY_fromType (&pdu.choice.initiatingMessage.value, td, sptr);
if (asn1_xer_print) {
xer_fprint (stdout, &asn_DEF_NGAP_PDU, (void *)&pdu);
}
ASN_STRUCT_FREE_CONTENTS_ONLY (*td, sptr);
if ((encoded = uper_encode_to_new_buffer (&asn_DEF_NGAP_PDU, 0, &pdu, (void **)buffer)) < 0) {
OAILOG_ERROR (LOG_NGAP, "Encoding of %s failed\n", td->name);
return -1;
}
*length = encoded;
return encoded;
}
Ngap_IE_t *
ngap_new_ie (
Ngap_ProtocolIE_ID_t id,
Ngap_Criticality_t criticality,
asn_TYPE_descriptor_t * type,
void *sptr)
{
Ngap_IE_t *buff;
if ((buff = malloc (sizeof (Ngap_IE_t))) == NULL) {
// Possible error on malloc
return NULL;
}
memset ((void *)buff, 0, sizeof (Ngap_IE_t));
buff->id = id;
buff->criticality = criticality;
if (ANY_fromType (&buff->value, type, sptr) < 0) {
OAILOG_ERROR (LOG_NGAP, "Encoding of %s failed\n", type->name);
free_wrapper ((void**) &buff);
return NULL;
}
if (asn1_xer_print)
if (xer_fprint (stdout, &asn_DEF_Ngap_IE, buff) < 0) {
free_wrapper ((void**) &buff);
return NULL;
}
return buff;
}
*/
This diff is collapsed.
......@@ -321,6 +321,7 @@ file(GLOB NAS_src_files
${SRC_TOP_DIR}/utils/bstr/*.c
${SRC_TOP_DIR}/nas/security/*.c
${SRC_TOP_DIR}/common/*.c
${SRC_TOP_DIR}/ngap/*.c
)
set(NAS_include_files
......
......@@ -25,11 +25,20 @@ include_directories(${SRC_TOP_DIR}/itti)
include_directories(${SRC_TOP_DIR}/gtpv2c)
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories(${SRC_TOP_DIR}/smf)
include_directories(${SRC_TOP_DIR}/ngap)
include_directories(${SRC_TOP_DIR}/NgapSmfLayer)
include_directories(${SRC_TOP_DIR}/udp)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
add_library (SMF STATIC
${SRC_TOP_DIR}/NgapSmfLayer/ng_pdu_session_resource_setup_request.c
${SRC_TOP_DIR}/NgapSmfLayer/ng_pdu_session_resource_setup_response.c
${SRC_TOP_DIR}/NgapSmfLayer/ng_pdu_session_resource_release_command.c
${SRC_TOP_DIR}/NgapSmfLayer/ng_pdu_session_resource_release_response.c
${SRC_TOP_DIR}/NgapSmfLayer/ng_pdu_session_resource_modify_request.c
${SRC_TOP_DIR}/NgapSmfLayer/ng_pdu_session_resource_modify_response.c
${SRC_TOP_DIR}/NgapSmfLayer/ng_pdu_session_resource_notify.c
smf_app.cpp
smf_config.cpp
smf_context.cpp
......
......@@ -47,6 +47,11 @@
extern "C"{
#include "nas_message.h"
#include "mmData.h"
//#include "Ngap_InitiatingMessage.h"
//#include "Ngap_SuccessfulOutcome.h"
#include "../NgapSmfLayer/ng_pdu_session_resource_setup_request.h"
#include "../NgapSmfLayer/ng_pdu_session_resource_setup_response.h"
}
#include <stdexcept>
......@@ -2415,6 +2420,25 @@ void smf_app::create_n2_sm_information(std::shared_ptr<itti_n11_create_sm_contex
{
//TODO: should work with BUPT to finish this function
Logger::smf_app().info("Create N2 SM Information, ngap message type %d, ie type %d\n", ngap_msg_type, ngap_ie_type);
#if 0
switch(ngap_ie_type)
{
case Ngap_InitiatingMessage__value_PR_PDUSessionResourceSetupRequest:
make_NGAP_pdu_session_resource_setup_request();
break;
case Ngap_InitiatingMessage__value_PR_PDUSessionResourceSetupRequest:
make_NGAP_pdu_session_resource_setup_response();
break;
default:
printf("don't know ngap_ie_type:%d\n", ngap_ie_type);
}
#endif
make_NGAP_pdu_session_resource_setup_request();
make_NGAP_pdu_session_resource_setup_response();
}
//------------------------------------------------------------------------------
......
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