Commit 6674bd27 authored by Shivam Gandhi's avatar Shivam Gandhi

Merge branch 'develop' into 'amf-event-exposure'

# Conflicts:
#   src/amf-app/amf_app.hpp
parents 8bf0ea17 58efab83
# RELEASE NOTES: # # RELEASE NOTES: #
## v1.1.0 -- July 2021 ##
* Session Release
* NRF registration
- with FQDN DNS resolution
* Multiple PDU support
* Bug fixes
* Full support for Ubuntu18 and RHEL8
## v1.0.0 -- September 2020 ## ## v1.0.0 -- September 2020 ##
* Initial release * Initial release
......
...@@ -147,7 +147,7 @@ pipeline { ...@@ -147,7 +147,7 @@ pipeline {
sh 'sed -e "s#AMF_IMAGE_TAG#' + amfTag + '#" ci-scripts/dsTesterDockerCompose/docker-compose.tplt > ci-scripts/dsTesterDockerCompose/docker-compose.yml' sh 'sed -e "s#AMF_IMAGE_TAG#' + amfTag + '#" ci-scripts/dsTesterDockerCompose/docker-compose.tplt > ci-scripts/dsTesterDockerCompose/docker-compose.yml'
dir('ci-scripts/dsTesterDockerCompose') { dir('ci-scripts/dsTesterDockerCompose') {
sh 'docker-compose up -d > ../../archives/compose_amf_up.log 2>&1' sh 'docker-compose up -d > ../../archives/compose_amf_up.log 2>&1'
sh 'sleep 60' sh 'sleep 100'
// Do a check on number of healthy containers // Do a check on number of healthy containers
// 2 == mysql + amf // 2 == mysql + amf
ret = sh returnStdout: true, script: 'docker-compose ps -a | grep -v unhealthy | grep -c healthy || true' ret = sh returnStdout: true, script: 'docker-compose ps -a | grep -v unhealthy | grep -c healthy || true'
......
...@@ -67,7 +67,9 @@ pipeline { ...@@ -67,7 +67,9 @@ pipeline {
"Build RHEL8 AMF Image", "Build RHEL8 AMF Image",
"Static Code Analysis", "Static Code Analysis",
"Code Formatting Checker", "Code Formatting Checker",
"Test with DsTester" "Bracket Test with DsTester",
"Test with DsTester on Docker environment",
"Test with DsTester on OC environment"
]) ])
} }
...@@ -367,10 +369,12 @@ pipeline { ...@@ -367,10 +369,12 @@ pipeline {
} }
} }
} }
stage ('Testing in CN-5G-FED environment') { stage('Testing whole 5g Core Network Functions') {
parallel {
stage ('Testing in CN-5G-FED Docker environment') {
steps { steps {
script { script {
gitlabCommitStatus(name: "Test with DsTester") { gitlabCommitStatus(name: "Test with DsTester on Docker environment") {
localStatus = build job: params.CN5G_FED_PipelineName, localStatus = build job: params.CN5G_FED_PipelineName,
parameters: [ parameters: [
string(name: 'AMF_TAG', value: String.valueOf(amf_tag)), string(name: 'AMF_TAG', value: String.valueOf(amf_tag)),
...@@ -379,9 +383,9 @@ pipeline { ...@@ -379,9 +383,9 @@ pipeline {
localResult = localStatus.getResult() localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) { if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "Federation Test Job is OK" echo "Docker Federation Test Job is OK"
} else { } else {
echo "Federation Test Job is KO" echo "Docker Federation Test Job is KO"
sh "ci-scripts/fail.sh" sh "ci-scripts/fail.sh"
} }
} }
...@@ -397,6 +401,38 @@ pipeline { ...@@ -397,6 +401,38 @@ pipeline {
} }
} }
} }
stage ('Testing in CN-5G-FED OC environment') {
steps {
script {
gitlabCommitStatus(name: "Test with DsTester on OC environment") {
localStatus = build job: params.CN5G_FED_OC_PipelineName,
parameters: [
string(name: 'AMF_TAG', value: String.valueOf(amf_tag)),
string(name: 'AMF_BRANCH', value: String.valueOf(amf_branch))
], propagate: false
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "OC Federation Test Job is OK"
} else {
echo "OC Federation Test Job is KO"
sh "ci-scripts/fail.sh"
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: params.CN5G_FED_OC_PipelineName,
filter: '*_results_oai_cn5g_oc.html',
selector: lastCompleted())
}
}
}
}
}
}
} }
post { post {
success { success {
...@@ -472,6 +508,10 @@ pipeline { ...@@ -472,6 +508,10 @@ pipeline {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' *_results_oai_amf_bt.html" sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' *_results_oai_amf_bt.html"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' *_results_oai_amf_bt.html" sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' *_results_oai_amf_bt.html"
} }
if (fileExists('test_results_oai_cn5g_oc.html')) {
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_LINK#${gitlabMergeRequestLink}#g' *_results_oai_cn5g_oc.html"
sh "sed -i -e 's#TEMPLATE_MERGE_REQUEST_TEMPLATE#${env.gitlabMergeRequestTitle}#' *_results_oai_cn5g_oc.html"
}
} else { } else {
sh "python3 ci-scripts/generateHtmlReport.py --job_name=${JOB_NAME} --job_id=${BUILD_ID} --job_url=${BUILD_URL} --git_url=${GIT_URL} --git_src_branch=${GIT_BRANCH} --git_src_commit=${GIT_COMMIT}" sh "python3 ci-scripts/generateHtmlReport.py --job_name=${JOB_NAME} --job_id=${BUILD_ID} --job_url=${BUILD_URL} --git_url=${GIT_URL} --git_src_branch=${GIT_BRANCH} --git_src_commit=${GIT_COMMIT}"
} }
...@@ -488,6 +528,10 @@ pipeline { ...@@ -488,6 +528,10 @@ pipeline {
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' *_results_oai_amf_bt.html" sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' *_results_oai_amf_bt.html"
archiveArtifacts artifacts: '*_results_oai_amf_bt.html' archiveArtifacts artifacts: '*_results_oai_amf_bt.html'
} }
if (fileExists('test_results_oai_cn5g_oc.html')) {
sh "sed -i -e 's#TEMPLATE_TIME#${JOB_TIMESTAMP}#' *_results_oai_cn5g_oc.html"
archiveArtifacts artifacts: '*_results_oai_cn5g_oc.html'
}
// Sending email to commiter // Sending email to commiter
if (params.sendToCommitterEmail != null) { if (params.sendToCommitterEmail != null) {
......
...@@ -76,6 +76,7 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 . ...@@ -76,6 +76,7 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
WORKDIR /usr/local/lib WORKDIR /usr/local/lib
COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 . COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 . COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_chrono.so.1.67.0 .
COPY --from=oai-amf-builder /usr/local/lib/libpistache.so . COPY --from=oai-amf-builder /usr/local/lib/libpistache.so .
RUN ldconfig RUN ldconfig
......
...@@ -97,6 +97,7 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 . ...@@ -97,6 +97,7 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
WORKDIR /usr/local/lib WORKDIR /usr/local/lib
COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 . COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 . COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_chrono.so.1.67.0 .
COPY --from=oai-amf-builder /usr/local/lib/libpistache.so . COPY --from=oai-amf-builder /usr/local/lib/libpistache.so .
RUN ldconfig RUN ldconfig
......
...@@ -45,7 +45,7 @@ Based on document **3GPP TS 23.501 V16.0.0 §6.2.1**. ...@@ -45,7 +45,7 @@ Based on document **3GPP TS 23.501 V16.0.0 §6.2.1**.
| 4 | Registration management | :heavy_check_mark: | | | 4 | Registration management | :heavy_check_mark: | |
| 5 | Connection management | :heavy_check_mark: | | | 5 | Connection management | :heavy_check_mark: | |
| 6 | Reachability management | :x: | | | 6 | Reachability management | :x: | |
| 7 | Mobility Management | :x: | | | 7 | Mobility Management | :heavy_check_mark: | (Experimental) Support N2 Handover |
| 8 | Lawful intercept (for AMF events and interface to LI System) | :x: | | | 8 | Lawful intercept (for AMF events and interface to LI System) | :x: | |
| 9 | Provide transport for SM messages between UE and SMF | :heavy_check_mark: | | | 9 | Provide transport for SM messages between UE and SMF | :heavy_check_mark: | |
| 10 | Transparent proxy for routing SM messages | :x: | | | 10 | Transparent proxy for routing SM messages | :x: | |
......
...@@ -102,8 +102,8 @@ AMF = ...@@ -102,8 +102,8 @@ AMF =
# STRING, {"yes", "no"}, # STRING, {"yes", "no"},
NF_REGISTRATION = "@NF_REGISTRATION@"; # Set to yes if AMF resgisters to an NRF NF_REGISTRATION = "@NF_REGISTRATION@"; # Set to yes if AMF resgisters to an NRF
SMF_SELECTION = "@SMF_SELECTION@"; # Set to yes to enable SMF discovery and selection SMF_SELECTION = "@SMF_SELECTION@"; # Set to yes to enable SMF discovery and selection
EXTERNAL_AUSF = "no"; # Set to yes if AMF works with an external AUSF EXTERNAL_AUSF = "@EXTERNAL_AUSF@"; # Set to yes if AMF works with an external AUSF
EXTERNAL_UDM = "no"; # Set to yes if AMF works with an external UDM EXTERNAL_UDM = "@EXTERNAL_UDM@"; # Set to yes if AMF works with an external UDM
USE_FQDN_DNS = "@USE_FQDN_DNS@"; # Set to yes if AMF relies on a DNS to resolve NRF/SMF/UDM/AUSF's FQDN USE_FQDN_DNS = "@USE_FQDN_DNS@"; # Set to yes if AMF relies on a DNS to resolve NRF/SMF/UDM/AUSF's FQDN
} }
......
...@@ -4,6 +4,10 @@ set -euo pipefail ...@@ -4,6 +4,10 @@ set -euo pipefail
CONFIG_DIR="/openair-amf/etc" CONFIG_DIR="/openair-amf/etc"
# Default values
EXTERNAL_AUSF=${EXTERNAL_AUSF:-no}
EXTERNAL_UDM=${EXTERNAL_UDM:-no}
for c in ${CONFIG_DIR}/*.conf; do for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered # grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs) VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
......
...@@ -64,7 +64,15 @@ void amf_app_task(void*); ...@@ -64,7 +64,15 @@ void amf_app_task(void*);
uint32_t golbal_tmsi = 1; uint32_t golbal_tmsi = 1;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
amf_app::amf_app(const amf_config& amf_cfg) { amf_app::amf_app(const amf_config& amf_cfg)
: m_amf_ue_ngap_id2ue_ctx(),
m_ue_ctx_key(),
m_supi2ue_ctx(),
m_curl_handle_responses_n2_sm() {
amf_ue_ngap_id2ue_ctx = {};
ue_ctx_key = {};
supi2ue_ctx = {};
curl_handle_responses_n2_sm = {};
Logger::amf_app().startup("Creating AMF application functionality layer"); Logger::amf_app().startup("Creating AMF application functionality layer");
if (itti_inst->create_task(TASK_AMF_APP, amf_app_task, nullptr)) { if (itti_inst->create_task(TASK_AMF_APP, amf_app_task, nullptr)) {
Logger::amf_app().error("Cannot create task TASK_AMF_APP"); Logger::amf_app().error("Cannot create task TASK_AMF_APP");
...@@ -207,6 +215,7 @@ void amf_app::set_supi_2_ue_context( ...@@ -207,6 +215,7 @@ void amf_app::set_supi_2_ue_context(
supi2ue_ctx[supi] = uc; supi2ue_ctx[supi] = uc;
} }
//------------------------------------------------------------------------------
bool amf_app::find_pdu_session_context( bool amf_app::find_pdu_session_context(
const string& supi, const std::uint8_t pdu_session_id, const string& supi, const std::uint8_t pdu_session_id,
std::shared_ptr<pdu_session_context>& psc) { std::shared_ptr<pdu_session_context>& psc) {
...@@ -217,6 +226,7 @@ bool amf_app::find_pdu_session_context( ...@@ -217,6 +226,7 @@ bool amf_app::find_pdu_session_context(
return true; return true;
} }
//------------------------------------------------------------------------------
bool amf_app::get_pdu_sessions_context( bool amf_app::get_pdu_sessions_context(
const string& supi, const string& supi,
std::vector<std::shared_ptr<pdu_session_context>>& sessions_ctx) { std::vector<std::shared_ptr<pdu_session_context>>& sessions_ctx) {
...@@ -305,6 +315,7 @@ void amf_app::handle_itti_message( ...@@ -305,6 +315,7 @@ void amf_app::handle_itti_message(
} else { } else {
unc = amf_n2_inst->ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id); unc = amf_n2_inst->ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
unc.get()->amf_ue_ngap_id = amf_ue_ngap_id; unc.get()->amf_ue_ngap_id = amf_ue_ngap_id;
amf_n2_inst->set_amf_ue_ngap_id_2_ue_ngap_context(amf_ue_ngap_id, unc);
} }
if (uc.get() == nullptr) { if (uc.get() == nullptr) {
...@@ -645,3 +656,24 @@ void amf_app::trigger_nf_deregistration() { ...@@ -645,3 +656,24 @@ void amf_app::trigger_nf_deregistration() {
itti_msg->get_msg_name()); itti_msg->get_msg_name());
} }
} }
//---------------------------------------------------------------------------------------------
void amf_app::add_promise(
uint32_t id, boost::shared_ptr<boost::promise<std::string>>& p) {
std::unique_lock lock(m_curl_handle_responses_n2_sm);
curl_handle_responses_n2_sm.emplace(id, p);
}
//------------------------------------------------------------------------------
void amf_app::trigger_process_response(uint32_t pid, std::string n2_sm) {
Logger::amf_app().debug(
"Trigger process response: Set promise with ID %u "
"to ready",
pid);
std::unique_lock lock(m_curl_handle_responses_n2_sm);
if (curl_handle_responses_n2_sm.count(pid) > 0) {
curl_handle_responses_n2_sm[pid]->set_value(n2_sm);
// Remove this promise from list
curl_handle_responses_n2_sm.erase(pid);
}
}
...@@ -49,6 +49,10 @@ ...@@ -49,6 +49,10 @@
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/thread/future.hpp> #include <boost/thread/future.hpp>
#include "uint_generator.hpp"
#include <boost/thread.hpp>
#include <boost/thread/future.hpp>
using namespace config; using namespace config;
static uint32_t amf_app_ue_ngap_id_generator = 1; static uint32_t amf_app_ue_ngap_id_generator = 1;
...@@ -80,8 +84,6 @@ class amf_app { ...@@ -80,8 +84,6 @@ class amf_app {
void handle_itti_message(itti_nas_signalling_establishment_request& itti_msg); void handle_itti_message(itti_nas_signalling_establishment_request& itti_msg);
void handle_itti_message(itti_n1n2_message_transfer_request& itti_msg); void handle_itti_message(itti_n1n2_message_transfer_request& itti_msg);
mutable std::shared_mutex m_amf_event_subscriptions;
bool is_amf_ue_id_2_ue_context(const long& amf_ue_ngap_id) const; bool is_amf_ue_id_2_ue_context(const long& amf_ue_ngap_id) const;
std::shared_ptr<ue_context> amf_ue_id_2_ue_context( std::shared_ptr<ue_context> amf_ue_id_2_ue_context(
const long& amf_ue_ngap_id) const; const long& amf_ue_ngap_id) const;
......
...@@ -84,7 +84,6 @@ extern statistics stacs; ...@@ -84,7 +84,6 @@ extern statistics stacs;
extern void convert_string_2_hex(std::string& input, std::string& output); extern void convert_string_2_hex(std::string& input, std::string& output);
extern unsigned char* format_string_as_hex(std::string str); extern unsigned char* format_string_as_hex(std::string str);
extern int ncc;
Sha256 ctx; Sha256 ctx;
random_state_t random_state; random_state_t random_state;
static uint8_t no_random_delta = 0; static uint8_t no_random_delta = 0;
...@@ -210,7 +209,6 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) { ...@@ -210,7 +209,6 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
uint32_t ulcount = uint32_t ulcount =
secu->ul_count.seq_num | (secu->ul_count.overflow << 8); secu->ul_count.seq_num | (secu->ul_count.overflow << 8);
Authentication_5gaka::derive_kgnb(0, 0x01, kamf, kgnb); Authentication_5gaka::derive_kgnb(0, 0x01, kamf, kgnb);
ncc = 1;
print_buffer("amf_n1", "kamf", kamf, 32); print_buffer("amf_n1", "kamf", kamf, 32);
// Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb); // Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb);
bstring kgnb_bs = blk2bstr(kgnb, 32); bstring kgnb_bs = blk2bstr(kgnb, 32);
...@@ -457,58 +455,6 @@ void amf_n1::nas_signalling_establishment_request_handle( ...@@ -457,58 +455,6 @@ void amf_n1::nas_signalling_establishment_request_handle(
} }
} }
//------------------------------------------------------------------------------
void amf_n1::uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg) {
uint8_t* buf = (uint8_t*) bdata(plain_msg);
uint8_t message_type = *(buf + 2);
switch (message_type) {
case AUTHENTICATION_RESPONSE: {
Logger::amf_n1().debug(
"Received authentication response message, handling...");
authentication_response_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case AUTHENTICATION_FAILURE: {
Logger::amf_n1().debug(
"Received authentication failure message, handling...");
authentication_failure_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case SECURITY_MODE_COMPLETE: {
Logger::amf_n1().debug(
"Received security mode complete message, handling...");
security_mode_complete_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case SECURITY_MODE_REJECT: {
Logger::amf_n1().debug(
"Received security mode reject message, handling...");
security_mode_reject_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case UL_NAS_TRANSPORT: {
Logger::amf_n1().debug("Received UL NAS transport message, handling...");
ul_nas_transport_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case UE_INIT_DEREGISTER: {
Logger::amf_n1().debug(
"Received de-registration request message, handling...");
ue_initiate_de_registration_handle(
ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case IDENTITY_RESPONSE: {
Logger::amf_n1().debug("received identity response message , handle ...");
identity_response_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
case REGISTRATION_COMPLETE: {
Logger::amf_n1().debug(
"Received registration complete message, handling...");
registration_complete_handle(ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
// TODO
} break;
default: {
// TODO:
}
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n1::uplink_nas_msg_handle( void amf_n1::uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
...@@ -1082,15 +1028,16 @@ void amf_n1::registration_request_handle( ...@@ -1082,15 +1028,16 @@ void amf_n1::registration_request_handle(
if (!regReq->getUeSecurityCapability( if (!regReq->getUeSecurityCapability(
encrypt_alg, integrity_alg, security_cap_eea, security_cap_eia)) { encrypt_alg, integrity_alg, security_cap_eea, security_cap_eia)) {
Logger::amf_n1().warn("No Optional IE UESecurityCapability available"); Logger::amf_n1().warn("No Optional IE UESecurityCapability available");
} else {
nc.get()->ueSecurityCaplen = regReq->ie_ue_security_capability->getLength();
} }
nc.get()->ueSecurityCapEnc = encrypt_alg; nc.get()->ueSecurityCapEnc = encrypt_alg;
nc.get()->ueSecurityCapInt = integrity_alg; nc.get()->ueSecurityCapInt = integrity_alg;
nc.get()->ueSecurityCapEEA = security_cap_eea; nc.get()->ueSecurityCapEEA = security_cap_eea;
nc.get()->ueSecurityCapEIA = security_cap_eia; nc.get()->ueSecurityCapEIA = security_cap_eia;
nc.get()->ueSecurityCaplen = regReq->ie_ue_security_capability->getLength();
// Get Requested NSSAI (Optional IE), if provided // Get Requested NSSAI (Optional IE), if provided
std::vector<SNSSAI_t> requestedNssai = {}; std::vector<SNSSAI_t> requestedNssai = {};
if (!regReq->getRequestedNssai(requestedNssai)) { if (!regReq->getRequestedNssai(requestedNssai)) {
...@@ -1422,9 +1369,9 @@ bool amf_n1::_5g_aka_confirmation_from_ausf( ...@@ -1422,9 +1369,9 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
Logger::amf_n1().debug("_5g_aka_confirmation_from_ausf"); Logger::amf_n1().debug("_5g_aka_confirmation_from_ausf");
std::string remoteUri = nc.get()->Href; std::string remoteUri = nc.get()->Href;
std::string msgBody; std::string msgBody = {};
std::string Response; std::string response = {};
std::string resStar_string; std::string resStar_string = {};
std::map<std::string, std::string>::iterator iter; std::map<std::string, std::string>::iterator iter;
iter = rand_record.find(nc.get()->imsi); iter = rand_record.find(nc.get()->imsi);
...@@ -1450,12 +1397,12 @@ bool amf_n1::_5g_aka_confirmation_from_ausf( ...@@ -1450,12 +1397,12 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
msgBody = confirmationdata_j.dump(); msgBody = confirmationdata_j.dump();
// TODO: Should be updated // TODO: Should be updated
amf_n11_inst->curl_http_client(remoteUri, "PUT", msgBody, Response); amf_n11_inst->curl_http_client(remoteUri, "PUT", msgBody, response);
free_wrapper((void**) &resStar_s); free_wrapper((void**) &resStar_s);
try { try {
ConfirmationDataResponse confirmationdataresponse; ConfirmationDataResponse confirmationdataresponse;
nlohmann::json::parse(Response.c_str()).get_to(confirmationdataresponse); nlohmann::json::parse(response.c_str()).get_to(confirmationdataresponse);
unsigned char* kseaf_hex = unsigned char* kseaf_hex =
format_string_as_hex(confirmationdataresponse.getKseaf()); format_string_as_hex(confirmationdataresponse.getKseaf());
memcpy(nc.get()->_5g_av[0].kseaf, kseaf_hex, 32); memcpy(nc.get()->_5g_av[0].kseaf, kseaf_hex, 32);
...@@ -2004,7 +1951,6 @@ bool amf_n1::start_security_mode_control_procedure( ...@@ -2004,7 +1951,6 @@ bool amf_n1::start_security_mode_control_procedure(
nc.get()->is_current_security_available = true; nc.get()->is_current_security_available = true;
} }
// SecurityModeCommand* smc = new SecurityModeCommand();
std::unique_ptr<SecurityModeCommand> smc = std::unique_ptr<SecurityModeCommand> smc =
std::make_unique<SecurityModeCommand>(); std::make_unique<SecurityModeCommand>();
smc->setHeader(PLAIN_5GS_MSG); smc->setHeader(PLAIN_5GS_MSG);
...@@ -2201,7 +2147,6 @@ void amf_n1::security_mode_complete_handle( ...@@ -2201,7 +2147,6 @@ void amf_n1::security_mode_complete_handle(
uint8_t kgnb[32]; uint8_t kgnb[32];
uint32_t ulcount = secu->ul_count.seq_num | (secu->ul_count.overflow << 8); uint32_t ulcount = secu->ul_count.seq_num | (secu->ul_count.overflow << 8);
Authentication_5gaka::derive_kgnb(0, 0x01, kamf, kgnb); Authentication_5gaka::derive_kgnb(0, 0x01, kamf, kgnb);
ncc = 1;
print_buffer("amf_n1", "kamf", kamf, 32); print_buffer("amf_n1", "kamf", kamf, 32);
// Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb); // Authentication_5gaka::derive_kgnb(ulcount, 0x01, kamf, kgnb);
bstring kgnb_bs = blk2bstr(kgnb, 32); bstring kgnb_bs = blk2bstr(kgnb, 32);
...@@ -2587,10 +2532,8 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2587,10 +2532,8 @@ void amf_n1::ul_nas_transport_handle(
Logger::amf_n1().error("Cannot decode Payload Container"); Logger::amf_n1().error("Cannot decode Payload Container");
return; return;
} }
// send_itti_to_smf_services_consumer(ran_ue_ngap_id, amf_ue_ngap_id, itti_nsmf_pdusession_create_sm_context* itti_msg =
// request_type, pdu_session_id, dnn, sm_msg); new itti_nsmf_pdusession_create_sm_context(TASK_AMF_N1, TASK_AMF_N11);
itti_smf_services_consumer* itti_msg =
new itti_smf_services_consumer(TASK_AMF_N1, TASK_AMF_N11);
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id; itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id; itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type; itti_msg->req_type = request_type;
...@@ -2599,8 +2542,8 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2599,8 +2542,8 @@ void amf_n1::ul_nas_transport_handle(
itti_msg->sm_msg = sm_msg; itti_msg->sm_msg = sm_msg;
itti_msg->snssai.sST = snssai.sst; itti_msg->snssai.sST = snssai.sst;
itti_msg->snssai.sD = std::to_string(snssai.sd); itti_msg->snssai.sD = std::to_string(snssai.sd);
std::shared_ptr<itti_smf_services_consumer> i = std::shared_ptr<itti_nsmf_pdusession_create_sm_context> i =
std::shared_ptr<itti_smf_services_consumer>(itti_msg); std::shared_ptr<itti_nsmf_pdusession_create_sm_context>(itti_msg);
int ret = itti_inst->send_msg(i); int ret = itti_inst->send_msg(i);
if (0 != ret) { if (0 != ret) {
Logger::amf_n1().error( Logger::amf_n1().error(
...@@ -2638,10 +2581,8 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2638,10 +2581,8 @@ void amf_n1::ul_nas_transport_handle(
Logger::amf_n1().error("Cannot decode Payload Container"); Logger::amf_n1().error("Cannot decode Payload Container");
return; return;
} }
// send_itti_to_smf_services_consumer(ran_ue_ngap_id, amf_ue_ngap_id, itti_nsmf_pdusession_create_sm_context* itti_msg =
// request_type, pdu_session_id, dnn, sm_msg); new itti_nsmf_pdusession_create_sm_context(TASK_AMF_N1, TASK_AMF_N11);
itti_smf_services_consumer* itti_msg =
new itti_smf_services_consumer(TASK_AMF_N1, TASK_AMF_N11);
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id; itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id; itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type; itti_msg->req_type = request_type;
...@@ -2652,8 +2593,8 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2652,8 +2593,8 @@ void amf_n1::ul_nas_transport_handle(
itti_msg->snssai.sD = std::to_string(snssai.sd); itti_msg->snssai.sD = std::to_string(snssai.sd);
itti_msg->plmn.mnc = plmn.mnc; itti_msg->plmn.mnc = plmn.mnc;
itti_msg->plmn.mcc = plmn.mcc; itti_msg->plmn.mcc = plmn.mcc;
std::shared_ptr<itti_smf_services_consumer> i = std::shared_ptr<itti_nsmf_pdusession_create_sm_context> i =
std::shared_ptr<itti_smf_services_consumer>(itti_msg); std::shared_ptr<itti_nsmf_pdusession_create_sm_context>(itti_msg);
int ret = itti_inst->send_msg(i); int ret = itti_inst->send_msg(i);
if (0 != ret) { if (0 != ret) {
Logger::amf_n1().error( Logger::amf_n1().error(
...@@ -2665,28 +2606,6 @@ void amf_n1::ul_nas_transport_handle( ...@@ -2665,28 +2606,6 @@ void amf_n1::ul_nas_transport_handle(
} }
} }
//------------------------------------------------------------------------------
void amf_n1::send_itti_to_smf_services_consumer(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, uint8_t request_type,
uint8_t pdu_session_id, bstring dnn, bstring sm_msg) {
itti_smf_services_consumer* itti_msg =
new itti_smf_services_consumer(TASK_AMF_N1, TASK_AMF_N11);
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type;
itti_msg->pdu_sess_id = pdu_session_id;
itti_msg->dnn = dnn;
itti_msg->sm_msg = sm_msg;
std::shared_ptr<itti_smf_services_consumer> i =
std::shared_ptr<itti_smf_services_consumer>(itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
i->get_msg_name());
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n1::dump_nas_message(uint8_t* buf, int len) { void amf_n1::dump_nas_message(uint8_t* buf, int len) {
for (int i = 0; i < len; i++) for (int i = 0; i < len; i++)
......
...@@ -69,8 +69,6 @@ class amf_n1 { ...@@ -69,8 +69,6 @@ class amf_n1 {
SecurityHeaderType type, std::shared_ptr<nas_context> nc, SecurityHeaderType type, std::shared_ptr<nas_context> nc,
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
std::string snn, uint8_t ulCount); std::string snn, uint8_t ulCount);
void uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg);
void uplink_nas_msg_handle( void uplink_nas_msg_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg,
plmn_t plmn); plmn_t plmn);
...@@ -152,9 +150,6 @@ class amf_n1 { ...@@ -152,9 +150,6 @@ class amf_n1 {
void annex_a_4_33501( void annex_a_4_33501(
uint8_t ck[16], uint8_t ik[16], uint8_t* input, uint8_t rand[16], uint8_t ck[16], uint8_t ik[16], uint8_t* input, uint8_t rand[16],
std::string serving_network, uint8_t* output); std::string serving_network, uint8_t* output);
void send_itti_to_smf_services_consumer(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, uint8_t request_type,
uint8_t pdu_session_id, bstring dnn, bstring sm_msg);
void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state); void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state);
void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state); void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state);
......
This diff is collapsed.
...@@ -45,7 +45,7 @@ class amf_n11 { ...@@ -45,7 +45,7 @@ class amf_n11 {
amf_n11(); amf_n11();
~amf_n11(); ~amf_n11();
void handle_itti_message(itti_smf_services_consumer&); void handle_itti_message(itti_nsmf_pdusession_create_sm_context&);
void handle_pdu_session_initial_request( void handle_pdu_session_initial_request(
std::string supi, std::shared_ptr<pdu_session_context> psc, std::string supi, std::shared_ptr<pdu_session_context> psc,
std::string smf_addr, std::string smf_api_version, bstring sm_msg, std::string smf_addr, std::string smf_api_version, bstring sm_msg,
...@@ -66,11 +66,12 @@ class amf_n11 { ...@@ -66,11 +66,12 @@ class amf_n11 {
void curl_http_client( void curl_http_client(
std::string remoteUri, std::string jsonData, std::string n1SmMsg, std::string remoteUri, std::string jsonData, std::string n1SmMsg,
std::string n2SmMsg, std::string supi, uint8_t pdu_session_id); std::string n2SmMsg, std::string supi, uint8_t pdu_session_id,
uint32_t promise_id = 0);
void curl_http_client( void curl_http_client(
std::string remoteUri, std::string Method, std::string msgBody, std::string remoteUri, std::string Method, std::string msgBody,
std::string& Response); std::string& response);
bool discover_smf( bool discover_smf(
std::string& smf_addr, std::string& smf_api_version, std::string& smf_addr, std::string& smf_api_version,
......
This diff is collapsed.
...@@ -58,26 +58,40 @@ class amf_n2 : public ngap::ngap_app { ...@@ -58,26 +58,40 @@ class amf_n2 : public ngap::ngap_app {
void handle_itti_message(itti_ue_radio_capability_indication& itti_msg); void handle_itti_message(itti_ue_radio_capability_indication& itti_msg);
void handle_itti_message(itti_ue_context_release_command& itti_msg); void handle_itti_message(itti_ue_context_release_command& itti_msg);
void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg); void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg);
void handle_itti_message(itti_handover_required& itti_msg); bool handle_itti_message(itti_handover_required& itti_msg);
void handle_itti_message(itti_handover_request_Ack& itti_msg); void handle_itti_message(itti_handover_request_Ack& itti_msg);
void handle_itti_message(itti_handover_notify& itti_msg); void handle_itti_message(itti_handover_notify& itti_msg);
void handle_itti_message(itti_uplinkranstatsutransfer& itti_msg); void handle_itti_message(itti_uplink_ran_status_transfer& itti_msg);
void send_handover_preparation_failure(
const unsigned long amf_ue_ngap_id, const uint32_t ran_ue_ngap_id,
const sctp_assoc_id_t& gnb_assoc_id);
bool verifyPlmn(std::vector<SupportedItem_t> list); bool verifyPlmn(std::vector<SupportedItem_t> list);
std::vector<SupportedItem_t> get_common_plmn( std::vector<SupportedItem_t> get_common_plmn(
std::vector<SupportedItem_t> list); std::vector<SupportedItem_t> list);
std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context( std::shared_ptr<ue_ngap_context> ran_ue_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id) const; const uint32_t& ran_ue_ngap_id) const;
bool is_ran_ue_id_2_ue_ngap_context(const uint32_t& ran_ue_ngap_id) const; bool is_ran_ue_id_2_ue_ngap_context(const uint32_t& ran_ue_ngap_id) const;
void set_ran_ue_ngap_id_2_ue_ngap_context( void set_ran_ue_ngap_id_2_ue_ngap_context(
const uint32_t& ran_ue_ngap_id, std::shared_ptr<ue_ngap_context> unc); const uint32_t& ran_ue_ngap_id, std::shared_ptr<ue_ngap_context> unc);
std::shared_ptr<ue_ngap_context> amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id) const;
bool is_amf_ue_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id) const;
void set_amf_ue_ngap_id_2_ue_ngap_context(
const unsigned long& amf_ue_ngap_id,
std::shared_ptr<ue_ngap_context> unc);
private: private:
std::map<uint32_t, std::shared_ptr<ue_ngap_context>> std::map<uint32_t, std::shared_ptr<ue_ngap_context>>
ranid2uecontext; // ran ue ngap id ranid2uecontext; // ran ue ngap id
mutable std::shared_mutex m_ranid2uecontext; mutable std::shared_mutex m_ranid2uecontext;
std::map<unsigned long, std::shared_ptr<ue_ngap_context>>
amfueid2uecontext; // amf ue id
mutable std::shared_mutex m_amfueid2uecontext;
}; };
} // namespace amf_application } // namespace amf_application
......
...@@ -136,8 +136,11 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary"; ...@@ -136,8 +136,11 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define AUSF_CURL_TIMEOUT_MS 100L #define AUSF_CURL_TIMEOUT_MS 100L
#define CURL_TIMEOUT_MS 100L #define CURL_TIMEOUT_MS 100L
#define BUFFER_SIZE_2048 2048
#define BUFFER_SIZE_1024 1024 #define BUFFER_SIZE_1024 1024
#define BUFFER_SIZE_512 512 #define BUFFER_SIZE_512 512
#define BUFFER_SIZE_256 256 #define BUFFER_SIZE_256 256
#define FUTURE_STATUS_TIMEOUT_MS 100
#endif #endif
...@@ -55,5 +55,7 @@ class pdu_session_context { ...@@ -55,5 +55,7 @@ class pdu_session_context {
snssai_t snssai; snssai_t snssai;
plmn_t plmn; plmn_t plmn;
std::string smf_context_location; std::string smf_context_location;
bool is_ho_accepted;
}; };
#endif #endif
...@@ -48,17 +48,20 @@ class ue_ngap_context { ...@@ -48,17 +48,20 @@ class ue_ngap_context {
public: public:
uint32_t ran_ue_ngap_id; // 32bits uint32_t ran_ue_ngap_id; // 32bits
long amf_ue_ngap_id : 40; // 40bits long amf_ue_ngap_id : 40; // 40bits
uint32_t target_ran_ue_ngap_id; // 32bits, for HO
sctp_stream_id_t sctp_stream_recv; // used to decide which ue in gNB sctp_stream_id_t sctp_stream_recv; // used to decide which ue in gNB
sctp_stream_id_t sctp_stream_send; // used to decide which ue in gNB sctp_stream_id_t sctp_stream_send; // used to decide which ue in gNB
sctp_assoc_id_t gnb_assoc_id; // to find which gnb this UE belongs to sctp_assoc_id_t gnb_assoc_id; // to find which gnb this UE belongs to
sctp_assoc_id_t target_gnb_assoc_id;
bool ueContextRequest; bool ueContextRequest;
uint32_t s_tmsi_5g; uint32_t s_tmsi_5g;
// state management, ue status over the air // state management, ue status over the air
ng_ue_state_t ng_ue_state; ng_ue_state_t ng_ue_state;
uint8_t ncc; // Next Hop Chaining Counter
}; };
#endif #endif
...@@ -78,7 +78,7 @@ typedef enum { ...@@ -78,7 +78,7 @@ typedef enum {
DOWNLINK_NAS_TRANSFER, DOWNLINK_NAS_TRANSFER,
NAS_SIG_ESTAB_REQ, // task amf_app NAS_SIG_ESTAB_REQ, // task amf_app
N1N2_MESSAGE_TRANSFER_REQ, N1N2_MESSAGE_TRANSFER_REQ,
SMF_SERVICES_CONSUMER, NSMF_PDU_SESSION_CREATE_SM_CTX,
NSMF_PDU_SESSION_UPDATE_SM_CTX, NSMF_PDU_SESSION_UPDATE_SM_CTX,
N11_REGISTER_NF_INSTANCE_REQUEST, N11_REGISTER_NF_INSTANCE_REQUEST,
N11_REGISTER_NF_INSTANCE_RESPONSE, N11_REGISTER_NF_INSTANCE_RESPONSE,
...@@ -88,12 +88,12 @@ typedef enum { ...@@ -88,12 +88,12 @@ typedef enum {
SBI_EVENT_EXPOSURE_REQUEST, SBI_EVENT_EXPOSURE_REQUEST,
SBI_NOTIFICATION_DATA, SBI_NOTIFICATION_DATA,
UE_CONTEXT_RELEASE_COMMAND, UE_CONTEXT_RELEASE_COMMAND,
NSMF_PDU_SESS_RELEASE_SMCTX, NSMF_PDU_SESSION_RELEASE_SM_CTX,
HANDOVER_REQUIRED, HANDOVER_REQUIRED,
HANDOVER_REQUEST_ACK, HANDOVER_REQUEST_ACK,
HANDOVER_NOTIFY, HANDOVER_NOTIFY,
UPLINKRANSTATUSTRANSFER, UPLINK_RAN_STATUS_TRANSFER,
PDU_SESS_RES_SET_RESP, PDU_SESSION_RESOURCE_SETUP_RESPONSE,
TIME_OUT, TIME_OUT,
HEALTH_PING, HEALTH_PING,
TERMINATE, TERMINATE,
......
...@@ -45,12 +45,13 @@ class itti_msg_n11 : public itti_msg { ...@@ -45,12 +45,13 @@ class itti_msg_n11 : public itti_msg {
uint32_t ran_ue_ngap_id; uint32_t ran_ue_ngap_id;
}; };
class itti_smf_services_consumer : public itti_msg_n11 { class itti_nsmf_pdusession_create_sm_context : public itti_msg_n11 {
public: public:
itti_smf_services_consumer( itti_nsmf_pdusession_create_sm_context(
const task_id_t origin, const task_id_t destination) const task_id_t origin, const task_id_t destination)
: itti_msg_n11(SMF_SERVICES_CONSUMER, origin, destination) {} : itti_msg_n11(NSMF_PDU_SESSION_CREATE_SM_CTX, origin, destination) {}
itti_smf_services_consumer(const itti_smf_services_consumer& i) itti_nsmf_pdusession_create_sm_context(
const itti_nsmf_pdusession_create_sm_context& i)
: itti_msg_n11(i) {} : itti_msg_n11(i) {}
public: public:
...@@ -66,7 +67,8 @@ class itti_pdu_session_resource_setup_response : public itti_msg_n11 { ...@@ -66,7 +67,8 @@ class itti_pdu_session_resource_setup_response : public itti_msg_n11 {
public: public:
itti_pdu_session_resource_setup_response( itti_pdu_session_resource_setup_response(
const task_id_t origin, const task_id_t destination) const task_id_t origin, const task_id_t destination)
: itti_msg_n11(PDU_SESS_RES_SET_RESP, origin, destination) {} : itti_msg_n11(PDU_SESSION_RESOURCE_SETUP_RESPONSE, origin, destination) {
}
itti_pdu_session_resource_setup_response( itti_pdu_session_resource_setup_response(
const itti_pdu_session_resource_setup_response& i) const itti_pdu_session_resource_setup_response& i)
: itti_msg_n11(i) {} : itti_msg_n11(i) {}
...@@ -82,6 +84,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 { ...@@ -82,6 +84,7 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
const task_id_t origin, const task_id_t destination) const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESSION_UPDATE_SM_CTX, origin, destination) { : itti_msg_n11(NSMF_PDU_SESSION_UPDATE_SM_CTX, origin, destination) {
is_n2sm_set = false; is_n2sm_set = false;
promise_id = 0;
} }
itti_nsmf_pdusession_update_sm_context( itti_nsmf_pdusession_update_sm_context(
const itti_nsmf_pdusession_update_sm_context& i) const itti_nsmf_pdusession_update_sm_context& i)
...@@ -90,6 +93,8 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 { ...@@ -90,6 +93,8 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
n2sm = i.n2sm; n2sm = i.n2sm;
is_n2sm_set = i.is_n2sm_set; is_n2sm_set = i.is_n2sm_set;
n2sm_info_type = i.n2sm_info_type; n2sm_info_type = i.n2sm_info_type;
promise_id = i.promise_id;
;
} }
public: public:
...@@ -100,13 +105,14 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 { ...@@ -100,13 +105,14 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
std::string n2sm_info_type; std::string n2sm_info_type;
uint32_t ran_ue_ngap_id; uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id; long amf_ue_ngap_id;
uint32_t promise_id;
}; };
class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 { class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
public: public:
itti_nsmf_pdusession_release_sm_context( itti_nsmf_pdusession_release_sm_context(
const task_id_t origin, const task_id_t destination) const task_id_t origin, const task_id_t destination)
: itti_msg_n11(NSMF_PDU_SESS_RELEASE_SMCTX, origin, destination) {} : itti_msg_n11(NSMF_PDU_SESSION_RELEASE_SM_CTX, origin, destination) {}
itti_nsmf_pdusession_release_sm_context( itti_nsmf_pdusession_release_sm_context(
const itti_nsmf_pdusession_update_sm_context& i) const itti_nsmf_pdusession_update_sm_context& i)
: itti_msg_n11(i) {} : itti_msg_n11(i) {}
......
...@@ -218,7 +218,7 @@ class itti_handover_required : public itti_msg_n2 { ...@@ -218,7 +218,7 @@ class itti_handover_required : public itti_msg_n2 {
itti_handover_required(const task_id_t origin, const task_id_t destination) itti_handover_required(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(HANDOVER_REQUIRED, origin, destination) {} : itti_msg_n2(HANDOVER_REQUIRED, origin, destination) {}
itti_handover_required(const itti_handover_required& i) : itti_msg_n2(i) {} itti_handover_required(const itti_handover_required& i) : itti_msg_n2(i) {}
HandoverRequiredMsg* handvoerRequ; HandoverRequiredMsg* handoverReq;
}; };
class itti_handover_request_Ack : public itti_msg_n2 { class itti_handover_request_Ack : public itti_msg_n2 {
...@@ -238,12 +238,12 @@ class itti_handover_notify : public itti_msg_n2 { ...@@ -238,12 +238,12 @@ class itti_handover_notify : public itti_msg_n2 {
HandoverNotifyMsg* handovernotify; HandoverNotifyMsg* handovernotify;
}; };
class itti_uplinkranstatsutransfer : public itti_msg_n2 { class itti_uplink_ran_status_transfer : public itti_msg_n2 {
public: public:
itti_uplinkranstatsutransfer( itti_uplink_ran_status_transfer(
const task_id_t origin, const task_id_t destination) const task_id_t origin, const task_id_t destination)
: itti_msg_n2(UPLINKRANSTATUSTRANSFER, origin, destination) {} : itti_msg_n2(UPLINK_RAN_STATUS_TRANSFER, origin, destination) {}
itti_uplinkranstatsutransfer(const itti_uplinkranstatsutransfer& i) itti_uplink_ran_status_transfer(const itti_uplink_ran_status_transfer& i)
: itti_msg_n2(i) {} : itti_msg_n2(i) {}
UplinkRANStatusTransfer* uplinkrantransfer; UplinkRANStatusTransfer* uplinkrantransfer;
}; };
......
...@@ -35,32 +35,32 @@ using namespace nas; ...@@ -35,32 +35,32 @@ using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
RegistrationRequest::RegistrationRequest() { RegistrationRequest::RegistrationRequest() {
plain_header = NULL; plain_header = nullptr;
ie_5gsregistrationtype = NULL; ie_5gsregistrationtype = nullptr;
ie_ngKSI = NULL; ie_ngKSI = nullptr;
ie_5gs_mobility_id = NULL; ie_5gs_mobility_id = nullptr;
ie_non_current_native_nas_ksi = NULL; ie_non_current_native_nas_ksi = nullptr;
ie_5g_mm_capability = NULL; ie_5g_mm_capability = nullptr;
ie_ue_security_capability = NULL; ie_ue_security_capability = nullptr;
ie_requested_NSSAI = NULL; ie_requested_NSSAI = nullptr;
ie_s1_ue_network_capability = NULL; ie_s1_ue_network_capability = nullptr;
ie_uplink_data_status = NULL; ie_uplink_data_status = nullptr;
ie_last_visited_registered_TAI = NULL; ie_last_visited_registered_TAI = nullptr;
ie_PDU_session_status = NULL; ie_PDU_session_status = nullptr;
ie_MICO_indicationl = NULL; ie_MICO_indicationl = nullptr;
ie_ue_status = NULL; ie_ue_status = nullptr;
ie_additional_guti = NULL; ie_additional_guti = nullptr;
ie_allowed_PDU_session_status = NULL; ie_allowed_PDU_session_status = nullptr;
ie_ues_usage_setting = NULL; ie_ues_usage_setting = nullptr;
ie_5gs_drx_parameters = NULL; ie_5gs_drx_parameters = nullptr;
ie_eps_nas_message_container = NULL; ie_eps_nas_message_container = nullptr;
ie_ladn_indication = NULL; ie_ladn_indication = nullptr;
ie_payload_container_type = NULL; ie_payload_container_type = nullptr;
ie_payload_container = NULL; ie_payload_container = nullptr;
ie_network_slicing_indication = NULL; ie_network_slicing_indication = nullptr;
ie_5gs_update_type = NULL; ie_5gs_update_type = nullptr;
ie_nas_message_container = NULL; ie_nas_message_container = nullptr;
ie_eps_bearer_context_status = NULL; ie_eps_bearer_context_status = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -94,11 +94,11 @@ void RegistrationRequest::setngKSI(uint8_t tsc, uint8_t key_set_id) { ...@@ -94,11 +94,11 @@ void RegistrationRequest::setngKSI(uint8_t tsc, uint8_t key_set_id) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t RegistrationRequest::getngKSI() { uint8_t RegistrationRequest::getngKSI() {
if (ie_ngKSI) { if (ie_ngKSI) {
uint8_t a = 0; return (
a = (ie_ngKSI->getTypeOfSecurityContext()) | ie_ngKSI->getasKeyIdentifier(); (ie_ngKSI->getTypeOfSecurityContext()) |
return a; ie_ngKSI->getasKeyIdentifier());
} else { } else {
return -1; return 0;
} }
} }
...@@ -122,7 +122,7 @@ uint8_t RegistrationRequest::getMobilityIdentityType() { ...@@ -122,7 +122,7 @@ uint8_t RegistrationRequest::getMobilityIdentityType() {
if (ie_5gs_mobility_id) { if (ie_5gs_mobility_id) {
return ie_5gs_mobility_id->gettypeOfIdentity(); return ie_5gs_mobility_id->gettypeOfIdentity();
} else { } else {
return -1; return 0;
} }
} }
...@@ -169,9 +169,9 @@ void RegistrationRequest::setAdditional_GUTI_SUCI_SUPI_format_IMSI( ...@@ -169,9 +169,9 @@ void RegistrationRequest::setAdditional_GUTI_SUCI_SUPI_format_IMSI(
bool RegistrationRequest::getAdditionalGuti(nas::_5G_GUTI_t& guti) { bool RegistrationRequest::getAdditionalGuti(nas::_5G_GUTI_t& guti) {
if (ie_additional_guti) { if (ie_additional_guti) {
ie_additional_guti->get5GGUTI(guti); ie_additional_guti->get5GGUTI(guti);
return 0; return true;
} else { } else {
return -1; return false;
} }
} }
...@@ -203,7 +203,7 @@ uint8_t RegistrationRequest::getNonCurrentNativeNasKSI() { ...@@ -203,7 +203,7 @@ uint8_t RegistrationRequest::getNonCurrentNativeNasKSI() {
(ie_non_current_native_nas_ksi->getasKeyIdentifier()); (ie_non_current_native_nas_ksi->getasKeyIdentifier());
return a; return a;
} else { } else {
return -1; return 0;
} }
} }
...@@ -217,7 +217,7 @@ uint8_t RegistrationRequest::get5GMMCapability() { ...@@ -217,7 +217,7 @@ uint8_t RegistrationRequest::get5GMMCapability() {
if (ie_5g_mm_capability) if (ie_5g_mm_capability)
return ie_5g_mm_capability->getValue(); return ie_5g_mm_capability->getValue();
else else
return -1; return 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -239,7 +239,7 @@ bool RegistrationRequest::getUeSecurityCapability(uint8_t& ea, uint8_t& ia) { ...@@ -239,7 +239,7 @@ bool RegistrationRequest::getUeSecurityCapability(uint8_t& ea, uint8_t& ia) {
ea = ie_ue_security_capability->getEASel(); ea = ie_ue_security_capability->getEASel();
ia = ie_ue_security_capability->getIASel(); ia = ie_ue_security_capability->getIASel();
} else { } else {
return -1; return false;
} }
return true; return true;
} }
...@@ -255,7 +255,7 @@ bool RegistrationRequest::getUeSecurityCapability( ...@@ -255,7 +255,7 @@ bool RegistrationRequest::getUeSecurityCapability(
eia = ie_ue_security_capability->getEIASel(); eia = ie_ue_security_capability->getEIASel();
} }
} else { } else {
return -1; return false;
} }
return true; return true;
} }
...@@ -272,7 +272,7 @@ bool RegistrationRequest::getRequestedNssai( ...@@ -272,7 +272,7 @@ bool RegistrationRequest::getRequestedNssai(
if (ie_requested_NSSAI) { if (ie_requested_NSSAI) {
ie_requested_NSSAI->getValue(nssai); ie_requested_NSSAI->getValue(nssai);
} else { } else {
return -1; return false;
} }
return true; return true;
} }
...@@ -297,7 +297,7 @@ bool RegistrationRequest::getS1UeNetworkCapability(uint8_t& eea, uint8_t& eia) { ...@@ -297,7 +297,7 @@ bool RegistrationRequest::getS1UeNetworkCapability(uint8_t& eea, uint8_t& eia) {
eea = ie_s1_ue_network_capability->getEEASel(); eea = ie_s1_ue_network_capability->getEEASel();
eia = ie_s1_ue_network_capability->getEIASel(); eia = ie_s1_ue_network_capability->getEIASel();
} else { } else {
return -1; return false;
} }
return true; return true;
} }
...@@ -312,7 +312,7 @@ uint16_t RegistrationRequest::getUplinkDataStatus() { ...@@ -312,7 +312,7 @@ uint16_t RegistrationRequest::getUplinkDataStatus() {
if (ie_uplink_data_status) { if (ie_uplink_data_status) {
return ie_uplink_data_status->getValue(); return ie_uplink_data_status->getValue();
} else { } else {
return -1; return 0;
} }
} }
...@@ -326,7 +326,7 @@ uint16_t RegistrationRequest::getPduSessionStatus() { ...@@ -326,7 +326,7 @@ uint16_t RegistrationRequest::getPduSessionStatus() {
if (ie_PDU_session_status) { if (ie_PDU_session_status) {
return ie_PDU_session_status->getValue(); return ie_PDU_session_status->getValue();
} else { } else {
return -1; return 0;
} }
} }
...@@ -340,9 +340,9 @@ bool RegistrationRequest::getMicoIndication(uint8_t& sprti, uint8_t& raai) { ...@@ -340,9 +340,9 @@ bool RegistrationRequest::getMicoIndication(uint8_t& sprti, uint8_t& raai) {
if (ie_PDU_session_status) { if (ie_PDU_session_status) {
sprti = ie_MICO_indicationl->getSPRTI(); sprti = ie_MICO_indicationl->getSPRTI();
raai = ie_MICO_indicationl->getRAAI(); raai = ie_MICO_indicationl->getRAAI();
return 0; return true;
} else { } else {
return -1; return false;
} }
} }
...@@ -356,9 +356,9 @@ bool RegistrationRequest::getUeStatus(uint8_t& n1ModeReg, uint8_t& s1ModeReg) { ...@@ -356,9 +356,9 @@ bool RegistrationRequest::getUeStatus(uint8_t& n1ModeReg, uint8_t& s1ModeReg) {
if (ie_ue_status) { if (ie_ue_status) {
n1ModeReg = ie_ue_status->getN1(); n1ModeReg = ie_ue_status->getN1();
s1ModeReg = ie_ue_status->getS1(); s1ModeReg = ie_ue_status->getS1();
return 0; return true;
} else { } else {
return -1; return false;
} }
} }
...@@ -372,7 +372,7 @@ uint16_t RegistrationRequest::getAllowedPduSessionStatus() { ...@@ -372,7 +372,7 @@ uint16_t RegistrationRequest::getAllowedPduSessionStatus() {
if (ie_allowed_PDU_session_status) { if (ie_allowed_PDU_session_status) {
return ie_allowed_PDU_session_status->getValue(); return ie_allowed_PDU_session_status->getValue();
} else { } else {
return -1; return 0;
} }
} }
...@@ -386,7 +386,7 @@ uint8_t RegistrationRequest::getUEsUsageSetting() { ...@@ -386,7 +386,7 @@ uint8_t RegistrationRequest::getUEsUsageSetting() {
if (ie_ues_usage_setting) { if (ie_ues_usage_setting) {
return ie_ues_usage_setting->getValue(); return ie_ues_usage_setting->getValue();
} else { } else {
return -1; return 0;
} }
} }
...@@ -400,7 +400,7 @@ uint8_t RegistrationRequest::get5GSDrxParameters() { ...@@ -400,7 +400,7 @@ uint8_t RegistrationRequest::get5GSDrxParameters() {
if (ie_5gs_drx_parameters) { if (ie_5gs_drx_parameters) {
return ie_5gs_drx_parameters->getValue(); return ie_5gs_drx_parameters->getValue();
} else { } else {
return -1; return 0;
} }
} }
...@@ -413,9 +413,9 @@ void RegistrationRequest::setEPS_NAS_Message_Container(bstring value) { ...@@ -413,9 +413,9 @@ void RegistrationRequest::setEPS_NAS_Message_Container(bstring value) {
bool RegistrationRequest::getEpsNasMessageContainer(bstring& epsNas) { bool RegistrationRequest::getEpsNasMessageContainer(bstring& epsNas) {
if (ie_eps_nas_message_container) { if (ie_eps_nas_message_container) {
ie_eps_nas_message_container->getValue(epsNas); ie_eps_nas_message_container->getValue(epsNas);
return 0; return true;
} else { } else {
return -1; return false;
} }
} }
...@@ -429,7 +429,7 @@ bool RegistrationRequest::getLadnIndication(std::vector<bstring>& ladnValue) { ...@@ -429,7 +429,7 @@ bool RegistrationRequest::getLadnIndication(std::vector<bstring>& ladnValue) {
if (ie_ladn_indication) { if (ie_ladn_indication) {
return ie_ladn_indication->getValue(ladnValue); return ie_ladn_indication->getValue(ladnValue);
} else { } else {
return -1; return 0;
} }
} }
...@@ -443,7 +443,7 @@ uint8_t RegistrationRequest::getPayloadContainerType() { ...@@ -443,7 +443,7 @@ uint8_t RegistrationRequest::getPayloadContainerType() {
if (ie_payload_container_type) { if (ie_payload_container_type) {
return ie_payload_container_type->getValue(); return ie_payload_container_type->getValue();
} else { } else {
return -1; return 0;
} }
} }
...@@ -458,9 +458,9 @@ bool RegistrationRequest::getPayloadContainer( ...@@ -458,9 +458,9 @@ bool RegistrationRequest::getPayloadContainer(
std::vector<PayloadContainerEntry>& content) { std::vector<PayloadContainerEntry>& content) {
if (ie_payload_container) { if (ie_payload_container) {
ie_payload_container->getValue(content); ie_payload_container->getValue(content);
return 0; return true;
} else { } else {
return -1; return false;
} }
} }
...@@ -476,9 +476,9 @@ bool RegistrationRequest::getNetworkSlicingIndication( ...@@ -476,9 +476,9 @@ bool RegistrationRequest::getNetworkSlicingIndication(
if (ie_network_slicing_indication) { if (ie_network_slicing_indication) {
dcni = ie_network_slicing_indication->getDCNI(); dcni = ie_network_slicing_indication->getDCNI();
nssci = ie_network_slicing_indication->getNSSCI(); nssci = ie_network_slicing_indication->getNSSCI();
return 0; return true;
} else { } else {
return -1; return false;
} }
} }
...@@ -498,9 +498,9 @@ bool RegistrationRequest::get5GSUpdateType( ...@@ -498,9 +498,9 @@ bool RegistrationRequest::get5GSUpdateType(
_5gs_pnb_ciot = ie_5gs_update_type->get_5GS_PNB_CIoT(); _5gs_pnb_ciot = ie_5gs_update_type->get_5GS_PNB_CIoT();
ng_ran_rcu = ie_5gs_update_type->getNG_RAN(); ng_ran_rcu = ie_5gs_update_type->getNG_RAN();
sms_requested = ie_5gs_update_type->getSMS(); sms_requested = ie_5gs_update_type->getSMS();
return 0; return true;
} else { } else {
return -1; return false;
} }
} }
...@@ -513,9 +513,9 @@ void RegistrationRequest::setNAS_Message_Container(bstring value) { ...@@ -513,9 +513,9 @@ void RegistrationRequest::setNAS_Message_Container(bstring value) {
bool RegistrationRequest::getNasMessageContainer(bstring& nas) { bool RegistrationRequest::getNasMessageContainer(bstring& nas) {
if (ie_nas_message_container) { if (ie_nas_message_container) {
ie_nas_message_container->getValue(nas); ie_nas_message_container->getValue(nas);
return 0; return true;
} else { } else {
return -1; return false;
} }
} }
...@@ -529,7 +529,7 @@ uint16_t RegistrationRequest::getEpsBearerContextStatus() { ...@@ -529,7 +529,7 @@ uint16_t RegistrationRequest::getEpsBearerContextStatus() {
if (ie_eps_bearer_context_status) { if (ie_eps_bearer_context_status) {
return ie_eps_bearer_context_status->getValue(); return ie_eps_bearer_context_status->getValue();
} else { } else {
return -1; return 0;
} }
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "DownLinkNasTransport.hpp" #include "DownLinkNasTransport.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -83,9 +84,8 @@ void DownLinkNasTransportMsg::setMessageType() { ...@@ -83,9 +84,8 @@ void DownLinkNasTransportMsg::setMessageType() {
&(downLinkNasTransportPdu->choice.initiatingMessage->value.choice &(downLinkNasTransportPdu->choice.initiatingMessage->value.choice
.DownlinkNASTransport); .DownlinkNASTransport);
} else { } else {
cout << "[warning] This information doesn't refer to DownlinkNASTransport " Logger::ngap().warn(
"Message!!!" "This information doesn't refer to DownlinkNASTransport Message");
<< endl;
} }
} }
...@@ -103,13 +103,13 @@ void DownLinkNasTransportMsg::setAmfUeNgapId(unsigned long id) { ...@@ -103,13 +103,13 @@ void DownLinkNasTransportMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -127,13 +127,13 @@ void DownLinkNasTransportMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -127,13 +127,13 @@ void DownLinkNasTransportMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -151,13 +151,13 @@ void DownLinkNasTransportMsg::setOldAmfName(const std::string name) { ...@@ -151,13 +151,13 @@ void DownLinkNasTransportMsg::setOldAmfName(const std::string name) {
int ret = oldAmfName->encode2AmfName(&ie->value.choice.AMFName); int ret = oldAmfName->encode2AmfName(&ie->value.choice.AMFName);
if (!ret) { if (!ret) {
cout << "encode oldAmfName IE error" << endl; Logger::ngap().error("Encode oldAmfName IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode oldAmfName IE error" << endl; if (ret != 0) Logger::ngap().error("Encode oldAmfName IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -176,7 +176,7 @@ void DownLinkNasTransportMsg::setRanPagingPriority(uint8_t pagingPriority) { ...@@ -176,7 +176,7 @@ void DownLinkNasTransportMsg::setRanPagingPriority(uint8_t pagingPriority) {
int ret = ranPagingPriority->encode2RANPagingPriority( int ret = ranPagingPriority->encode2RANPagingPriority(
ie->value.choice.RANPagingPriority); ie->value.choice.RANPagingPriority);
if (!ret) { if (!ret) {
cout << "encode RANPagingPriority IE error" << endl; Logger::ngap().error("Encode RANPagingPriority IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
...@@ -201,13 +201,13 @@ void DownLinkNasTransportMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) { ...@@ -201,13 +201,13 @@ void DownLinkNasTransportMsg::setNasPdu(uint8_t* nas, size_t sizeofnas) {
int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU); int ret = nasPdu->encode2octetstring(ie->value.choice.NAS_PDU);
if (!ret) { if (!ret) {
cout << "encode NAS_PDU IE error" << endl; Logger::ngap().error("Encode NAS_PDU IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode NAS_PDU IE error" << endl; if (ret != 0) Logger::ngap().error("Encode NAS_PDU IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -226,13 +226,13 @@ void DownLinkNasTransportMsg::setIndex2Rat_Frequency_SelectionPriority( ...@@ -226,13 +226,13 @@ void DownLinkNasTransportMsg::setIndex2Rat_Frequency_SelectionPriority(
int ret = indexToRFSP->encode2IndexToRFSP(ie->value.choice.IndexToRFSP); int ret = indexToRFSP->encode2IndexToRFSP(ie->value.choice.IndexToRFSP);
if (!ret) { if (!ret) {
cout << "encode IndexToRFSP IE error" << endl; Logger::ngap().error("Encode IndexToRFSP IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&downLinkNasTransportIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode IndexToRFSP IE error" << endl; if (ret != 0) Logger::ngap().error("Encode IndexToRFSP IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
......
...@@ -30,14 +30,17 @@ extern "C" { ...@@ -30,14 +30,17 @@ extern "C" {
using namespace std; using namespace std;
namespace ngap { namespace ngap {
DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() { DownlinkRANStatusTransfer::DownlinkRANStatusTransfer() {
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
ranStatusTransfer_TransparentContainer = NULL; ranStatusTransfer_TransparentContainer = nullptr;
DownlinkranstatustransferIEs = NULL; DownlinkranstatustransferIEs = nullptr;
DownlinkranstatustransferPDU = NULL; DownlinkranstatustransferPDU = nullptr;
} }
DownlinkRANStatusTransfer::~DownlinkRANStatusTransfer() {} DownlinkRANStatusTransfer::~DownlinkRANStatusTransfer() {}
void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) { void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID(); if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id); amfUeNgapId->setAMF_UE_NGAP_ID(id);
...@@ -61,6 +64,7 @@ void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) { ...@@ -61,6 +64,7 @@ void DownlinkRANStatusTransfer::setAmfUeNgapId(unsigned long id) {
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl;
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) { void DownlinkRANStatusTransfer::setRanUeNgapId(uint32_t id) {
if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID(); if (!ranUeNgapId) ranUeNgapId = new RAN_UE_NGAP_ID();
ranUeNgapId->setRanUeNgapId(id); ranUeNgapId->setRanUeNgapId(id);
...@@ -152,6 +156,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer( ...@@ -152,6 +156,7 @@ void DownlinkRANStatusTransfer::setRANStatusTransfer_TransparentContainer(
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
*/ */
} }
void DownlinkRANStatusTransfer::setmessagetype() { void DownlinkRANStatusTransfer::setmessagetype() {
if (!DownlinkranstatustransferPDU) { if (!DownlinkranstatustransferPDU) {
DownlinkranstatustransferPDU = DownlinkranstatustransferPDU =
...@@ -180,6 +185,7 @@ void DownlinkRANStatusTransfer::setmessagetype() { ...@@ -180,6 +185,7 @@ void DownlinkRANStatusTransfer::setmessagetype() {
<< endl; << endl;
} }
} }
int DownlinkRANStatusTransfer::encodetobuffer(uint8_t* buf, int buf_size) { int DownlinkRANStatusTransfer::encodetobuffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, DownlinkranstatustransferPDU); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, DownlinkranstatustransferPDU);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
*/ */
#include "HandoverCommandMsg.hpp" #include "HandoverCommandMsg.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "Ngap_NGAP-PDU.h" #include "Ngap_NGAP-PDU.h"
#include "Ngap_PDUSessionResourceHandoverItem.h" #include "Ngap_PDUSessionResourceHandoverItem.h"
...@@ -39,28 +41,35 @@ using namespace std; ...@@ -39,28 +41,35 @@ using namespace std;
namespace ngap { namespace ngap {
HandoverCommandMsg::HandoverCommandMsg() { HandoverCommandMsg::HandoverCommandMsg() {
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
ngap_handovertype = NULL; ngap_handovertype = nullptr;
NASSecurityParametersFromNGRAN = NULL; NASSecurityParametersFromNGRAN = nullptr;
PDUSessionResourceHandoverList = NULL; PDUSessionResourceHandoverList = nullptr;
PDUSessionResourceToReleaseListHOCmd = NULL; PDUSessionResourceToReleaseListHOCmd = nullptr;
TargetToSource_TransparentContainer = NULL; TargetToSource_TransparentContainer = nullptr;
CriticalityDiagnostics = NULL; CriticalityDiagnostics = nullptr;
handoverCommandPdu = NULL; handoverCommandPdu = nullptr;
handoverCommandIEs = NULL; handoverCommandIEs = nullptr;
} }
HandoverCommandMsg::~HandoverCommandMsg() {} HandoverCommandMsg::~HandoverCommandMsg() {}
unsigned long HandoverCommandMsg::getAmfUeNgapId() { unsigned long HandoverCommandMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
} }
uint32_t HandoverCommandMsg::getRanUeNgapId() { uint32_t HandoverCommandMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
else
return 0;
} }
bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverCommandPdu = ngap_msg_pdu; handoverCommandPdu = ngap_msg_pdu;
if (handoverCommandPdu->present == Ngap_NGAP_PDU_PR_successfulOutcome) { if (handoverCommandPdu->present == Ngap_NGAP_PDU_PR_successfulOutcome) {
...@@ -74,11 +83,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -74,11 +83,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs = &handoverCommandPdu->choice.successfulOutcome->value handoverCommandIEs = &handoverCommandPdu->choice.successfulOutcome->value
.choice.HandoverCommand; .choice.HandoverCommand;
} else { } else {
cout << "Check HandoverCommand message error!!!" << endl; Logger::ngap().error("Check HandoverCommand message error");
return false; return false;
} }
} else { } else {
cout << "HandoverRequired MessageType error!!!" << endl; Logger::ngap().error("HandoverRequired MessageType error");
return false; return false;
} }
for (int i = 0; i < handoverCommandIEs->protocolIEs.list.count; i++) { for (int i = 0; i < handoverCommandIEs->protocolIEs.list.count; i++) {
...@@ -92,11 +101,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -92,11 +101,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverCommandIEs->protocolIEs.list.array[i] handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -109,11 +118,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -109,11 +118,11 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverCommandIEs->protocolIEs.list.array[i] handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -126,7 +135,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -126,7 +135,7 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
*ngap_handovertype = handoverCommandIEs->protocolIEs.list.array[i] *ngap_handovertype = handoverCommandIEs->protocolIEs.list.array[i]
->value.choice.HandoverType; ->value.choice.HandoverType;
} else { } else {
cout << "decoded ngap Handover Type IE error" << endl; Logger::ngap().error("Decoded ngap Handover Type IE error");
return false; return false;
} }
} break; } break;
...@@ -136,8 +145,8 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -136,8 +145,8 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present == handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceHandoverList) { Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceHandoverList) {
} else { } else {
cout << "decoded ngap PDUSessionResourceHandoverList IE error" Logger::ngap().error(
<< endl; "Decoded ngap PDUSessionResourceHandoverList IE error");
return false; return false;
} }
} break; } break;
...@@ -147,8 +156,8 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -147,8 +156,8 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present == handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceToReleaseListHOCmd) { Ngap_HandoverCommandIEs__value_PR_PDUSessionResourceToReleaseListHOCmd) {
} else { } else {
cout << "decoded ngap PDUSessionResourceToReleaseListHOCmd IE error" Logger::ngap().error(
<< endl; "Decoded ngap PDUSessionResourceToReleaseListHOCmd IE error");
return false; return false;
} }
} break; } break;
...@@ -158,8 +167,8 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -158,8 +167,8 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present == handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_TargetToSource_TransparentContainer) { Ngap_HandoverCommandIEs__value_PR_TargetToSource_TransparentContainer) {
} else { } else {
cout << "decoded ngap TargetToSource_TransparentContainer IE error" Logger::ngap().error(
<< endl; "Decoded ngap TargetToSource_TransparentContainer IE error");
return false; return false;
} }
} break; } break;
...@@ -169,12 +178,12 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -169,12 +178,12 @@ bool HandoverCommandMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverCommandIEs->protocolIEs.list.array[i]->value.present == handoverCommandIEs->protocolIEs.list.array[i]->value.present ==
Ngap_HandoverCommandIEs__value_PR_CriticalityDiagnostics) { Ngap_HandoverCommandIEs__value_PR_CriticalityDiagnostics) {
} else { } else {
cout << "decoded ngap CriticalityDiagnostics IE error" << endl; Logger::ngap().error("Decoded ngap CriticalityDiagnostics IE error");
return false; return false;
} }
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded NGAP message PDU error");
return false; return false;
} }
} }
...@@ -212,9 +221,8 @@ void HandoverCommandMsg::setMessageType() { ...@@ -212,9 +221,8 @@ void HandoverCommandMsg::setMessageType() {
handoverCommandIEs = &(handoverCommandPdu->choice.successfulOutcome->value handoverCommandIEs = &(handoverCommandPdu->choice.successfulOutcome->value
.choice.HandoverCommand); .choice.HandoverCommand);
} else { } else {
cout << "[warning] This information doesn't refer to HandoverCommand " Logger::ngap().warn(
"Message!!!" "This information doesn't refer to HandoverCommand message");
<< endl;
} }
} }
...@@ -230,13 +238,13 @@ void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) { ...@@ -230,13 +238,13 @@ void HandoverCommandMsg::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -252,13 +260,14 @@ void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -252,13 +260,14 @@ void HandoverCommandMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID); int ret = ranUeNgapId->encode2RAN_UE_NGAP_ID(ie->value.choice.RAN_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode RAN_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode RAN_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -271,7 +280,8 @@ void HandoverCommandMsg::setHandoverType(long type) { ...@@ -271,7 +280,8 @@ void HandoverCommandMsg::setHandoverType(long type) {
ie->value.present = Ngap_HandoverCommandIEs__value_PR_HandoverType; ie->value.present = Ngap_HandoverCommandIEs__value_PR_HandoverType;
ie->value.choice.HandoverType = type; ie->value.choice.HandoverType = type;
int ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode HandoverType IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode HandoverType IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -290,8 +300,10 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList( ...@@ -290,8 +300,10 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
item->pDUSessionID = list[i].pduSessionId; item->pDUSessionID = list[i].pduSessionId;
item->handoverCommandTransfer = list[i].HandoverCommandTransfer; item->handoverCommandTransfer = list[i].HandoverCommandTransfer;
int ret = ASN_SEQUENCE_ADD(&PDUSessionResourceHandoverList->list, item); int ret = ASN_SEQUENCE_ADD(&PDUSessionResourceHandoverList->list, item);
if (ret != 0) if (ret != 0)
cout << "encode PDUSessionResourceHandoverListItem IE error" << endl; Logger::ngap().error(
"Encode PDUSessionResourceHandoverListItem IE error");
} }
ie->id = Ngap_ProtocolIE_ID_id_PDUSessionResourceHandoverList; ie->id = Ngap_ProtocolIE_ID_id_PDUSessionResourceHandoverList;
...@@ -302,7 +314,8 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList( ...@@ -302,7 +314,8 @@ void HandoverCommandMsg::setPduSessionResourceHandoverList(
*PDUSessionResourceHandoverList; *PDUSessionResourceHandoverList;
int ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode PDUSessionResourceHandoverList IE error" << endl; Logger::ngap().error("Encode PDUSessionResourceHandoverList IE error");
// free_wrapper((void**) &item); // free_wrapper((void**) &item);
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -321,7 +334,7 @@ void HandoverCommandMsg::setTargetToSource_TransparentContainer( ...@@ -321,7 +334,7 @@ void HandoverCommandMsg::setTargetToSource_TransparentContainer(
Ngap_HandoverCommandIEs__value_PR_TargetToSource_TransparentContainer; Ngap_HandoverCommandIEs__value_PR_TargetToSource_TransparentContainer;
ie->value.choice.TargetToSource_TransparentContainer = targetTosource; ie->value.choice.TargetToSource_TransparentContainer = targetTosource;
int ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverCommandIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode HandoverType IE error" << endl; if (ret != 0) Logger::ngap().error("Encode HandoverType IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
......
...@@ -60,8 +60,8 @@ class HandoverCommandMsg { ...@@ -60,8 +60,8 @@ class HandoverCommandMsg {
int encode2buffer(uint8_t* buf, int buf_size); int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu); bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;(不存在) unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;(不存在) uint32_t getRanUeNgapId(); // return -1;
/*void getHandoverType(Ngap_HandoverType_t &handovertype); /*void getHandoverType(Ngap_HandoverType_t &handovertype);
void getCause(Cause cause); void getCause(Cause cause);
void getTargetID(Ngap_TargetID_t targetID); void getTargetID(Ngap_TargetID_t targetID);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
\email: contact@openairinterface.org \email: contact@openairinterface.org
*/ */
#include "HandoverNotifyMsg.hpp" #include "HandoverNotifyMsg.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -51,8 +52,12 @@ HandoverNotifyMsg::HandoverNotifyMsg() { ...@@ -51,8 +52,12 @@ HandoverNotifyMsg::HandoverNotifyMsg() {
HandoverNotifyMsg::~HandoverNotifyMsg(){}; HandoverNotifyMsg::~HandoverNotifyMsg(){};
unsigned long HandoverNotifyMsg::getAmfUeNgapId() { unsigned long HandoverNotifyMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
} }
int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) { int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverNotifyPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverNotifyPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
...@@ -60,7 +65,9 @@ int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -60,7 +65,9 @@ int HandoverNotifyMsg::encode2buffer(uint8_t* buf, int buf_size) {
cout << "er.encoded(" << er.encoded << ")" << endl; cout << "er.encoded(" << er.encoded << ")" << endl;
return er.encoded; return er.encoded;
} }
bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverNotifyPdu = ngap_msg_pdu; handoverNotifyPdu = ngap_msg_pdu;
if (handoverNotifyPdu->present == Ngap_NGAP_PDU_PR_initiatingMessage) { if (handoverNotifyPdu->present == Ngap_NGAP_PDU_PR_initiatingMessage) {
...@@ -74,11 +81,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -74,11 +81,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverNotifyIEs = &handoverNotifyPdu->choice.initiatingMessage->value handoverNotifyIEs = &handoverNotifyPdu->choice.initiatingMessage->value
.choice.HandoverNotify; .choice.HandoverNotify;
} else { } else {
cout << "Check HandoverNotify message error!!!" << endl; Logger::ngap().error("Check HandoverNotify message error!");
return false; return false;
} }
} else { } else {
cout << "HandoverNotify MessageType error!!!" << endl; Logger::ngap().error("HandoverNotify MessageType error!");
return false; return false;
} }
for (int i = 0; i < handoverNotifyIEs->protocolIEs.list.count; i++) { for (int i = 0; i < handoverNotifyIEs->protocolIEs.list.count; i++) {
...@@ -92,11 +99,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -92,11 +99,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverNotifyIEs->protocolIEs.list.array[i] handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -109,11 +116,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -109,11 +116,11 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverNotifyIEs->protocolIEs.list.array[i] handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -126,16 +133,17 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -126,16 +133,17 @@ bool HandoverNotifyMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!userLocationInformation->decodefromUserLocationInformation( if (!userLocationInformation->decodefromUserLocationInformation(
&handoverNotifyIEs->protocolIEs.list.array[i] &handoverNotifyIEs->protocolIEs.list.array[i]
->value.choice.UserLocationInformation)) { ->value.choice.UserLocationInformation)) {
cout << "decoded ngap UserLocationInformation IE error" << endl; Logger::ngap().error(
"Decoded ngap UserLocationInformation IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap UserLocationInformation IE error" << endl; Logger::ngap().error("Decoded ngap UserLocationInformation IE error");
return false; return false;
} }
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded NGAP message PDU error");
return false; return false;
} }
} }
...@@ -175,20 +183,28 @@ void HandoverNotifyMsg::setUserLocationInfoNR( ...@@ -175,20 +183,28 @@ void HandoverNotifyMsg::setUserLocationInfoNR(
int ret = userLocationInformation->encodefromUserLocationInformation( int ret = userLocationInformation->encodefromUserLocationInformation(
&ie->value.choice.UserLocationInformation); &ie->value.choice.UserLocationInformation);
if (!ret) { if (!ret) {
cout << "encode UserLocationInformation IE error" << endl; Logger::ngap().error("Encode UserLocationInformation IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&handoverNotifyIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&handoverNotifyIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UserLocationInformation IE error" << endl; if (ret != 0) Logger::ngap().error("Encode UserLocationInformation IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
uint32_t HandoverNotifyMsg::getRanUeNgapId() { uint32_t HandoverNotifyMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
else
return 0;
} }
bool HandoverNotifyMsg::getUserLocationInfoNR( bool HandoverNotifyMsg::getUserLocationInfoNR(
struct NrCgi_s& cig, struct Tai_s& tai) { struct NrCgi_s& cig, struct Tai_s& tai) {
if (!userLocationInformation) return false;
UserLocationInformationNR* informationNR; UserLocationInformationNR* informationNR;
userLocationInformation->getInformation(informationNR); userLocationInformation->getInformation(informationNR);
if (userLocationInformation->getChoiceOfUserLocationInformation() != if (userLocationInformation->getChoiceOfUserLocationInformation() !=
......
...@@ -48,8 +48,8 @@ class HandoverNotifyMsg { ...@@ -48,8 +48,8 @@ class HandoverNotifyMsg {
int encode2buffer(uint8_t* buf, int buf_size); int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu); bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
void setUserLocationInfoNR(struct NrCgi_s cig, struct Tai_s tai); void setUserLocationInfoNR(struct NrCgi_s cig, struct Tai_s tai);
unsigned long getAmfUeNgapId(); // return -1; unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId(); // return -1; uint32_t getRanUeNgapId();
bool getUserLocationInfoNR(struct NrCgi_s& cig, struct Tai_s& tai); bool getUserLocationInfoNR(struct NrCgi_s& cig, struct Tai_s& tai);
private: private:
......
This diff is collapsed.
/*
* 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 _HANDOVER_PREPARATION_FAILURE_H_
#define _HANDOVER_PREPARATION_FAILURE_H_
#include "AMF-UE-NGAP-ID.hpp"
#include "Cause.hpp"
#include "MessageType.hpp"
#include "NgapIEsStruct.hpp"
#include "RAN-UE-NGAP-ID.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
}
namespace ngap {
class HandoverPreparationFailure {
public:
HandoverPreparationFailure();
virtual ~HandoverPreparationFailure();
void setMessageType(); // Initialize the PDU and populate the MessageType;
void setAmfUeNgapId(unsigned long id); // 40 bits
unsigned long getAmfUeNgapId() const;
void setRanUeNgapId(uint32_t id); // 32 bits
uint32_t getRanUeNgapId() const;
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
void getCause(Cause& cause) const;
void setCause(Ngap_Cause_PR m_causePresent, long value = 0);
Ngap_Cause_PR getChoiceOfCause() const;
private:
Ngap_NGAP_PDU_t* hoPreparationFailurePdu;
Ngap_HandoverPreparationFailure_t* hoPreparationFailureIEs;
AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId;
Cause* cause;
Ngap_CriticalityDiagnostics_t* CriticalityDiagnostics;
};
} // namespace ngap
#endif
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include "HandoverRequest.hpp" #include "HandoverRequest.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "Ngap_NGAP-PDU.h" #include "Ngap_NGAP-PDU.h"
...@@ -39,24 +40,27 @@ using namespace std; ...@@ -39,24 +40,27 @@ using namespace std;
namespace ngap { namespace ngap {
HandoverRequest::HandoverRequest() { HandoverRequest::HandoverRequest() {
amfUeNgapId = NULL; amfUeNgapId = nullptr;
handovertype = NULL; handovertype = nullptr;
cause = NULL; cause = nullptr;
ueAggregateMaximumBitRate = NULL; ueAggregateMaximumBitRate = nullptr;
ueSecurityCapabilities = NULL; ueSecurityCapabilities = nullptr;
SecurityContext = NULL; SecurityContext = nullptr;
PDUSessionResourceSetupList = NULL; PDUSessionResourceSetupList = nullptr;
allowedNSSAI = NULL; allowedNSSAI = nullptr;
SourceToTarget_TransparentContainer = NULL; SourceToTarget_TransparentContainer = nullptr;
mobilityrestrictionlist = NULL; mobilityrestrictionlist = nullptr;
guami = NULL; guami = nullptr;
handoverRequestPdu = NULL; handoverRequestPdu = nullptr;
handoverRequestIEs = NULL; handoverRequestIEs = nullptr;
} }
HandoverRequest::~HandoverRequest() {} HandoverRequest::~HandoverRequest() {}
unsigned long HandoverRequest::getAmfUeNgapId() { unsigned long HandoverRequest::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
} }
/*bool HandoverRequest::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu) /*bool HandoverRequest::decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu)
...@@ -244,11 +248,11 @@ void HandoverRequest::setMessageType() { ...@@ -244,11 +248,11 @@ void HandoverRequest::setMessageType() {
handoverRequestIEs = &(handoverRequestPdu->choice.initiatingMessage->value handoverRequestIEs = &(handoverRequestPdu->choice.initiatingMessage->value
.choice.HandoverRequest); .choice.HandoverRequest);
} else { } else {
cout << "[warning] This information doesn't refer to HandoverRequest " Logger::ngap().warn(
"Message!!!" "This information doesn't refer to HandoverRequest message!");
<< endl;
} }
} }
void HandoverRequest::setAmfUeNgapId(unsigned long id) { void HandoverRequest::setAmfUeNgapId(unsigned long id) {
if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID(); if (!amfUeNgapId) amfUeNgapId = new AMF_UE_NGAP_ID();
amfUeNgapId->setAMF_UE_NGAP_ID(id); amfUeNgapId->setAMF_UE_NGAP_ID(id);
...@@ -261,13 +265,14 @@ void HandoverRequest::setAmfUeNgapId(unsigned long id) { ...@@ -261,13 +265,14 @@ void HandoverRequest::setAmfUeNgapId(unsigned long id) {
int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID); int ret = amfUeNgapId->encode2AMF_UE_NGAP_ID(ie->value.choice.AMF_UE_NGAP_ID);
if (!ret) { if (!ret) {
cout << "encode AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AMF_UE_NGAP_ID IE error" << endl; if (ret != 0) Logger::ngap().error("Encode AMF_UE_NGAP_ID IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -281,7 +286,7 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs ...@@ -281,7 +286,7 @@ void HandoverRequest::setHandoverType(long type) // 0--intra5gs
ie->value.present = Ngap_HandoverRequestIEs__value_PR_HandoverType; ie->value.present = Ngap_HandoverRequestIEs__value_PR_HandoverType;
ie->value.choice.HandoverType = type; ie->value.choice.HandoverType = type;
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode HandoverType IE error" << endl; if (ret != 0) Logger::ngap().error("Encode HandoverType IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -298,7 +303,7 @@ void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) // ...@@ -298,7 +303,7 @@ void HandoverRequest::setCause(Ngap_Cause_PR m_causePresent, long value) //
cause->setValue(value); cause->setValue(value);
cause->encode2Cause(&(ie->value.choice.Cause)); cause->encode2Cause(&(ie->value.choice.Cause));
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode Cause IE error" << endl; if (ret != 0) Logger::ngap().error("Encode Cause IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -320,7 +325,8 @@ void HandoverRequest::setUEAggregateMaximumBitRate( ...@@ -320,7 +325,8 @@ void HandoverRequest::setUEAggregateMaximumBitRate(
ie->value.choice.UEAggregateMaximumBitRate); ie->value.choice.UEAggregateMaximumBitRate);
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UEAggregateMaximumBitRate IE error" << endl; if (ret != 0)
Logger::ngap().error("Encode UEAggregateMaximumBitRate IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
void HandoverRequest::setUESecurityCapabilities( void HandoverRequest::setUESecurityCapabilities(
...@@ -342,14 +348,14 @@ void HandoverRequest::setUESecurityCapabilities( ...@@ -342,14 +348,14 @@ void HandoverRequest::setUESecurityCapabilities(
(ie->value.choice.UESecurityCapabilities)); (ie->value.choice.UESecurityCapabilities));
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode UESecurityCapabilities IE error" << endl; if (ret != 0) Logger::ngap().error("Encode UESecurityCapabilities IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
void HandoverRequest::setGUAMI( void HandoverRequest::setGUAMI(
PlmnId* m_plmnId, AMFRegionID* m_aMFRegionID, AMFSetID* m_aMFSetID, PlmnId* m_plmnId, AMFRegionID* m_aMFRegionID, AMFSetID* m_aMFSetID,
AMFPointer* m_aMFPointer) { AMFPointer* m_aMFPointer) {
if (!guami) guami = new GUAMI; if (!guami) guami = new GUAMI();
Ngap_HandoverRequestIEs_t* ie = Ngap_HandoverRequestIEs_t* ie =
(Ngap_HandoverRequestIEs_t*) calloc(1, sizeof(Ngap_HandoverRequestIEs_t)); (Ngap_HandoverRequestIEs_t*) calloc(1, sizeof(Ngap_HandoverRequestIEs_t));
...@@ -360,7 +366,8 @@ void HandoverRequest::setGUAMI( ...@@ -360,7 +366,8 @@ void HandoverRequest::setGUAMI(
guami->encode2GUAMI(&(ie->value.choice.GUAMI)); guami->encode2GUAMI(&(ie->value.choice.GUAMI));
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode GUAMI IE error" << endl;
if (ret != 0) Logger::ngap().error("Encode GUAMI IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) { void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
...@@ -374,7 +381,8 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) { ...@@ -374,7 +381,8 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
list[i].encode2S_NSSAI(&item->s_NSSAI); list[i].encode2S_NSSAI(&item->s_NSSAI);
int ret = ASN_SEQUENCE_ADD(&allowedNSSAI->list, item); int ret = ASN_SEQUENCE_ADD(&allowedNSSAI->list, item);
if (ret != 0) if (ret != 0)
cout << "encode PDUSessionResourceHandoverListItem IE error" << endl; Logger::ngap().error(
"Encode PDUSessionResourceHandoverListItem IE error");
} }
asn_fprint(stderr, &asn_DEF_Ngap_AllowedNSSAI, allowedNSSAI); asn_fprint(stderr, &asn_DEF_Ngap_AllowedNSSAI, allowedNSSAI);
Ngap_HandoverRequestIEs_t* ie = Ngap_HandoverRequestIEs_t* ie =
...@@ -384,7 +392,7 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) { ...@@ -384,7 +392,7 @@ void HandoverRequest::setAllowedNSSAI(std::vector<S_NSSAI> list) {
ie->value.present = Ngap_HandoverRequestIEs__value_PR_AllowedNSSAI; ie->value.present = Ngap_HandoverRequestIEs__value_PR_AllowedNSSAI;
ie->value.choice.AllowedNSSAI = *allowedNSSAI; ie->value.choice.AllowedNSSAI = *allowedNSSAI;
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode AllowedNSSAI IE error" << endl; if (ret != 0) Logger::ngap().error("Encode AllowedNSSAI IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) { void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
...@@ -402,7 +410,7 @@ void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) { ...@@ -402,7 +410,7 @@ void HandoverRequest::setSecurityContext(long count, uint8_t* buffer) {
ie->value.present = Ngap_HandoverRequestIEs__value_PR_SecurityContext; ie->value.present = Ngap_HandoverRequestIEs__value_PR_SecurityContext;
ie->value.choice.SecurityContext = *SecurityContext; ie->value.choice.SecurityContext = *SecurityContext;
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode SecurityContext IE error" << endl; if (ret != 0) Logger::ngap().error("Encode SecurityContext IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -438,14 +446,14 @@ void HandoverRequest::setPduSessionResourceSetupList( ...@@ -438,14 +446,14 @@ void HandoverRequest::setPduSessionResourceSetupList(
PDUSessionResourceSetupList->encode2PDUSessionResourceSetupListHOReq( PDUSessionResourceSetupList->encode2PDUSessionResourceSetupListHOReq(
&ie->value.choice.PDUSessionResourceSetupListHOReq); &ie->value.choice.PDUSessionResourceSetupListHOReq);
if (!ret) { if (!ret) {
cout << "encode PDUSessionResourceSetupListSUReq IE error" << endl; Logger::ngap().error("Encode PDUSessionResourceSetupListSUReq IE error");
free_wrapper((void**) &ie); free_wrapper((void**) &ie);
return; return;
} }
ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode PDUSessionResourceSetupListSUReq IE error" << endl; Logger::ngap().error("Encode PDUSessionResourceSetupListSUReq IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
...@@ -464,7 +472,7 @@ void HandoverRequest::setSourceToTarget_TransparentContainer( ...@@ -464,7 +472,7 @@ void HandoverRequest::setSourceToTarget_TransparentContainer(
ie->value.choice.SourceToTarget_TransparentContainer = sourceTotarget; ie->value.choice.SourceToTarget_TransparentContainer = sourceTotarget;
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) if (ret != 0)
cout << "encode SourceToTarget_TransparentContainer IE error" << endl; Logger::ngap().error("Encode SourceToTarget_TransparentContainer IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) { void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) {
...@@ -480,7 +488,7 @@ void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) { ...@@ -480,7 +488,7 @@ void HandoverRequest::setMobilityRestrictionList(PlmnId* m_plmnId) {
mobilityrestrictionlist->encodeMobilityRestrictionList( mobilityrestrictionlist->encodeMobilityRestrictionList(
&(ie->value.choice.MobilityRestrictionList)); &(ie->value.choice.MobilityRestrictionList));
int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie); int ret = ASN_SEQUENCE_ADD(&handoverRequestIEs->protocolIEs.list, ie);
if (ret != 0) cout << "encode MobilityRestrictionList IE error" << endl; if (ret != 0) Logger::ngap().error("Encode MobilityRestrictionList IE error");
// free_wrapper((void**) &ie); // free_wrapper((void**) &ie);
} }
......
...@@ -81,7 +81,7 @@ class HandoverRequest { ...@@ -81,7 +81,7 @@ class HandoverRequest {
private: private:
Ngap_NGAP_PDU_t* handoverRequestPdu; Ngap_NGAP_PDU_t* handoverRequestPdu;
Ngap_HandoverRequest_t* handoverRequestIEs; Ngap_HandoverRequest_t* handoverRequestIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId; AMF_UE_NGAP_ID* amfUeNgapId;
Ngap_HandoverType_t* handovertype; Ngap_HandoverType_t* handovertype;
Cause* cause; Cause* cause;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
#include "HandoverRequestAck.hpp" #include "HandoverRequestAck.hpp"
#include "logger.hpp"
#include "GTP-TEID.hpp" #include "GTP-TEID.hpp"
#include "String2Value.hpp" #include "String2Value.hpp"
#include "TransportLayerAddress.hpp" #include "TransportLayerAddress.hpp"
...@@ -55,7 +55,10 @@ HandoverRequestAck::HandoverRequestAck() { ...@@ -55,7 +55,10 @@ HandoverRequestAck::HandoverRequestAck() {
HandoverRequestAck::~HandoverRequestAck() {} HandoverRequestAck::~HandoverRequestAck() {}
unsigned long HandoverRequestAck::getAmfUeNgapId() { unsigned long HandoverRequestAck::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
} }
void HandoverRequestAck::setMessageType() { void HandoverRequestAck::setMessageType() {
if (!handoverRequestAckPdu) if (!handoverRequestAckPdu)
...@@ -79,16 +82,21 @@ void HandoverRequestAck::setMessageType() { ...@@ -79,16 +82,21 @@ void HandoverRequestAck::setMessageType() {
handoverRequestAckIEs = &(handoverRequestAckPdu->choice.successfulOutcome handoverRequestAckIEs = &(handoverRequestAckPdu->choice.successfulOutcome
->value.choice.HandoverRequestAcknowledge); ->value.choice.HandoverRequestAcknowledge);
} else { } else {
cout << "[warning] This information doesn't refer to HandoverRequest " Logger::ngap().warn(
"Message!!!" "This information doesn't refer to HandoverRequest message");
<< endl;
} }
} }
uint32_t HandoverRequestAck::getRanUeNgapId() { uint32_t HandoverRequestAck::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
else
return 0;
} }
OCTET_STRING_t HandoverRequestAck::getTargetToSource_TransparentContainer() { OCTET_STRING_t HandoverRequestAck::getTargetToSource_TransparentContainer() {
if (TargetToSource_TransparentContainer)
return *TargetToSource_TransparentContainer; return *TargetToSource_TransparentContainer;
return OCTET_STRING_t();
} }
bool HandoverRequestAck::getPDUSessionResourceAdmittedList( bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
...@@ -114,6 +122,7 @@ bool HandoverRequestAck::getPDUSessionResourceAdmittedList( ...@@ -114,6 +122,7 @@ bool HandoverRequestAck::getPDUSessionResourceAdmittedList(
} }
bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ngap_msg_pdu) return false;
handoverRequestAckPdu = ngap_msg_pdu; handoverRequestAckPdu = ngap_msg_pdu;
if (handoverRequestAckPdu->present == Ngap_NGAP_PDU_PR_successfulOutcome) { if (handoverRequestAckPdu->present == Ngap_NGAP_PDU_PR_successfulOutcome) {
...@@ -127,11 +136,11 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -127,11 +136,11 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequestAckIEs = &handoverRequestAckPdu->choice.successfulOutcome handoverRequestAckIEs = &handoverRequestAckPdu->choice.successfulOutcome
->value.choice.HandoverRequestAcknowledge; ->value.choice.HandoverRequestAcknowledge;
} else { } else {
cout << "Check handoverRequestAck message error!!!" << endl; Logger::ngap().error("Check handoverRequestAck message error");
return false; return false;
} }
} else { } else {
cout << "handoverRequestAck MessageType error!!!" << endl; Logger::ngap().error("handoverRequestAck MessageType error");
return false; return false;
} }
for (int i = 0; i < handoverRequestAckIEs->protocolIEs.list.count; i++) { for (int i = 0; i < handoverRequestAckIEs->protocolIEs.list.count; i++) {
...@@ -145,11 +154,11 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -145,11 +154,11 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverRequestAckIEs->protocolIEs.list.array[i] handoverRequestAckIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -162,11 +171,11 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -162,11 +171,11 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverRequestAckIEs->protocolIEs.list.array[i] handoverRequestAckIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -180,13 +189,13 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -180,13 +189,13 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
->decodefromPDUSessionResourceAdmittedList( ->decodefromPDUSessionResourceAdmittedList(
&handoverRequestAckIEs->protocolIEs.list.array[i] &handoverRequestAckIEs->protocolIEs.list.array[i]
->value.choice.PDUSessionResourceAdmittedList)) { ->value.choice.PDUSessionResourceAdmittedList)) {
cout << "decoded ngap PDUSessionResourceAdmittedList IE error" Logger::ngap().error(
<< endl; "Decoded NGAP PDUSessionResourceAdmittedList IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap PDUSessionResourceAdmittedList Type IE error" Logger::ngap().error(
<< endl; "Decoded NGAP PDUSessionResourceAdmittedList IE error");
return false; return false;
} }
} break; } break;
...@@ -201,13 +210,14 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -201,13 +210,14 @@ bool HandoverRequestAck::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequestAckIEs->protocolIEs.list.array[i] handoverRequestAckIEs->protocolIEs.list.array[i]
->value.choice.TargetToSource_TransparentContainer; ->value.choice.TargetToSource_TransparentContainer;
} else { } else {
cout << "decoded ngap TargetToSource_TransparentContainer IE error" Logger::ngap().error(
<< endl; "Decoded NGAP TargetToSource_TransparentContainer IE error");
return false; return false;
} }
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded NGAP Message PDU error");
return false; return false;
} }
} }
......
...@@ -65,7 +65,6 @@ class HandoverRequestAck { ...@@ -65,7 +65,6 @@ class HandoverRequestAck {
private: private:
Ngap_NGAP_PDU_t* handoverRequestAckPdu; Ngap_NGAP_PDU_t* handoverRequestAckPdu;
Ngap_HandoverRequestAcknowledge_t* handoverRequestAckIEs; Ngap_HandoverRequestAcknowledge_t* handoverRequestAckIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId; AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId; RAN_UE_NGAP_ID* ranUeNgapId;
Ngap_HandoverType_t* handovertype; Ngap_HandoverType_t* handovertype;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include "HandoverRequiredMsg.hpp" #include "HandoverRequiredMsg.hpp"
#include "logger.hpp"
extern "C" { extern "C" {
#include "Ngap_NGAP-PDU.h" #include "Ngap_NGAP-PDU.h"
#include "asn_codecs.h" #include "asn_codecs.h"
...@@ -52,31 +53,55 @@ HandoverRequiredMsg::HandoverRequiredMsg() { ...@@ -52,31 +53,55 @@ HandoverRequiredMsg::HandoverRequiredMsg() {
HandoverRequiredMsg::~HandoverRequiredMsg() {} HandoverRequiredMsg::~HandoverRequiredMsg() {}
unsigned long HandoverRequiredMsg::getAmfUeNgapId() { unsigned long HandoverRequiredMsg::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
} }
uint32_t HandoverRequiredMsg::getRanUeNgapId() { uint32_t HandoverRequiredMsg::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
else
return 0;
} }
Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() { Ngap_HandoverType_t HandoverRequiredMsg::getHandoverType() {
if (handovertype)
return *handovertype; return *handovertype;
else
return Ngap_HandoverType_t();
} }
Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() { Ngap_Cause_PR HandoverRequiredMsg::getChoiceOfCause() {
if (cause)
return cause->getChoiceOfCause(); return cause->getChoiceOfCause();
else
return Ngap_Cause_PR();
} }
long HandoverRequiredMsg::getCauseValue() { long HandoverRequiredMsg::getCauseValue() {
if (cause)
return cause->getValue(); return cause->getValue();
else
return 0;
} }
void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) { void HandoverRequiredMsg::getGlobalRanNodeId(GlobalgNBId*& ptr) {
if (ptr)
ptr->decodefromGlobalgNBId( ptr->decodefromGlobalgNBId(
targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID); targetid->choice.targetRANNodeID->globalRANNodeID.choice.globalGNB_ID);
} }
void HandoverRequiredMsg::getTAI(TAI*& ptr) { void HandoverRequiredMsg::getTAI(TAI*& ptr) {
ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI)); if (ptr) ptr->decodefromTAI(&(targetid->choice.targetRANNodeID->selectedTAI));
} }
OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() { OCTET_STRING_t HandoverRequiredMsg::getSourceToTarget_TransparentContainer() {
if (SourceToTarget_TransparentContainer)
return *SourceToTarget_TransparentContainer; return *SourceToTarget_TransparentContainer;
else
return OCTET_STRING_t();
} }
bool HandoverRequiredMsg::getPDUSessionResourceList( bool HandoverRequiredMsg::getPDUSessionResourceList(
...@@ -103,7 +128,10 @@ bool HandoverRequiredMsg::getPDUSessionResourceList( ...@@ -103,7 +128,10 @@ bool HandoverRequiredMsg::getPDUSessionResourceList(
} }
long HandoverRequiredMsg::getDirectForwardingPathAvailability() { long HandoverRequiredMsg::getDirectForwardingPathAvailability() {
if (directforwardingPathAvailability)
return *directforwardingPathAvailability; return *directforwardingPathAvailability;
else
return 0;
} }
bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
...@@ -120,11 +148,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -120,11 +148,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredIEs = &handoverRequiredPdu->choice.initiatingMessage handoverRequiredIEs = &handoverRequiredPdu->choice.initiatingMessage
->value.choice.HandoverRequired; ->value.choice.HandoverRequired;
} else { } else {
cout << "Check HandoverRequired message error!!!" << endl; Logger::ngap().error("Check HandoverRequired message error!");
return false; return false;
} }
} else { } else {
cout << "HandoverRequired MessageType error!!!" << endl; Logger::ngap().error("HandoverRequired MessageType error!");
return false; return false;
} }
for (int i = 0; i < handoverRequiredIEs->protocolIEs.list.count; i++) { for (int i = 0; i < handoverRequiredIEs->protocolIEs.list.count; i++) {
...@@ -138,11 +166,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -138,11 +166,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID( if (!amfUeNgapId->decodefromAMF_UE_NGAP_ID(
handoverRequiredIEs->protocolIEs.list.array[i] handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.AMF_UE_NGAP_ID)) { ->value.choice.AMF_UE_NGAP_ID)) {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap AMF_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap AMF_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -155,11 +183,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -155,11 +183,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID( if (!ranUeNgapId->decodefromRAN_UE_NGAP_ID(
handoverRequiredIEs->protocolIEs.list.array[i] handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.RAN_UE_NGAP_ID)) { ->value.choice.RAN_UE_NGAP_ID)) {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap RAN_UE_NGAP_ID IE error" << endl; Logger::ngap().error("Decoded ngap RAN_UE_NGAP_ID IE error");
return false; return false;
} }
} break; } break;
...@@ -172,7 +200,7 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -172,7 +200,7 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
*handovertype = handoverRequiredIEs->protocolIEs.list.array[i] *handovertype = handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.HandoverType; ->value.choice.HandoverType;
} else { } else {
cout << "decoded ngap Handover Type IE error" << endl; Logger::ngap().error("Decoded ngap Handover Type error");
return false; return false;
} }
} break; } break;
...@@ -185,11 +213,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -185,11 +213,11 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!cause->decodefromCause( if (!cause->decodefromCause(
&handoverRequiredIEs->protocolIEs.list.array[i] &handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.Cause)) { ->value.choice.Cause)) {
cout << "decoded ngap Cause IE error" << endl; Logger::ngap().error("Decoded ngap Cause IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap Cause IE error" << endl; Logger::ngap().error("Decoded ngap Cause IE error");
return false; return false;
} }
} break; } break;
...@@ -202,7 +230,7 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -202,7 +230,7 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
*targetid = handoverRequiredIEs->protocolIEs.list.array[i] *targetid = handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.TargetID; ->value.choice.TargetID;
} else { } else {
cout << "decoded ngap TargetID IE error" << endl; Logger::ngap().error("Decoded ngap TargetID IE error");
return false; return false;
} }
} break; } break;
...@@ -217,8 +245,8 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -217,8 +245,8 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredIEs->protocolIEs.list.array[i] handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.DirectForwardingPathAvailability; ->value.choice.DirectForwardingPathAvailability;
} else { } else {
cout << "decoded ngap DirectForwardingPathAvailability IE error" Logger::ngap().error(
<< endl; "Decoded ngap DirectForwardingPathAvailability IE error");
return false; return false;
} }
} break; } break;
...@@ -231,12 +259,13 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -231,12 +259,13 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
if (!PDUSessionResourceList->decodefromPDUSessionResourceListHORqd( if (!PDUSessionResourceList->decodefromPDUSessionResourceListHORqd(
&handoverRequiredIEs->protocolIEs.list.array[i] &handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.PDUSessionResourceListHORqd)) { ->value.choice.PDUSessionResourceListHORqd)) {
cout << "decoded ngap PDUSessionResourceSetupListCxtRes IE error" Logger::ngap().error(
<< endl; "Decoded ngap PDUSessionResourceSetupListCxtRes IE error");
return false; return false;
} }
} else { } else {
cout << "decoded ngap PDUSessionResourceListHORqd IE error" << endl; Logger::ngap().error(
"Decoded ngap PDUSessionResourceSetupListCxtRes IE error");
return false; return false;
} }
} break; } break;
...@@ -251,13 +280,13 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) { ...@@ -251,13 +280,13 @@ bool HandoverRequiredMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
handoverRequiredIEs->protocolIEs.list.array[i] handoverRequiredIEs->protocolIEs.list.array[i]
->value.choice.SourceToTarget_TransparentContainer; ->value.choice.SourceToTarget_TransparentContainer;
} else { } else {
cout << "decoded ngap SourceToTarget_TransparentContainer IE error" Logger::ngap().error(
<< endl; "Decoded ngap SourceToTarget_TransparentContainer IE error");
return false; return false;
} }
} break; } break;
default: { default: {
cout << "decoded ngap message pdu error" << endl; Logger::ngap().error("Decoded ngap message PDU error");
return false; return false;
} }
} }
...@@ -270,7 +299,8 @@ int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) { ...@@ -270,7 +299,8 @@ int HandoverRequiredMsg::encode2buffer(uint8_t* buf, int buf_size) {
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequiredPdu); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, handoverRequiredPdu);
asn_enc_rval_t er = aper_encode_to_buffer( asn_enc_rval_t er = aper_encode_to_buffer(
&asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequiredPdu, buf, buf_size); &asn_DEF_Ngap_NGAP_PDU, NULL, handoverRequiredPdu, buf, buf_size);
cout << "er.encoded(" << er.encoded << ")" << endl; // cout << "er.encoded(" << er.encoded << ")" << endl;
Logger::ngap().error("er.encoded( %d )", er.encoded);
return er.encoded; return er.encoded;
} }
......
...@@ -48,9 +48,8 @@ class HandoverRequiredMsg { ...@@ -48,9 +48,8 @@ class HandoverRequiredMsg {
int encode2buffer(uint8_t* buf, int buf_size); int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu); bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;(不存在) unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId(); // return -1;(不存在) uint32_t getRanUeNgapId();
Ngap_HandoverType_t getHandoverType(); Ngap_HandoverType_t getHandoverType();
Ngap_Cause_PR getChoiceOfCause(); Ngap_Cause_PR getChoiceOfCause();
long getCauseValue(); long getCauseValue();
...@@ -63,7 +62,6 @@ class HandoverRequiredMsg { ...@@ -63,7 +62,6 @@ class HandoverRequiredMsg {
private: private:
Ngap_NGAP_PDU_t* handoverRequiredPdu; Ngap_NGAP_PDU_t* handoverRequiredPdu;
Ngap_HandoverRequired_t* handoverRequiredIEs; Ngap_HandoverRequired_t* handoverRequiredIEs;
/***************** for decoding ****************/
AMF_UE_NGAP_ID* amfUeNgapId; AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId; RAN_UE_NGAP_ID* ranUeNgapId;
Ngap_HandoverType_t* handovertype; Ngap_HandoverType_t* handovertype;
......
...@@ -32,27 +32,38 @@ ...@@ -32,27 +32,38 @@
using namespace std; using namespace std;
namespace ngap { namespace ngap {
UplinkRANStatusTransfer::UplinkRANStatusTransfer() { UplinkRANStatusTransfer::UplinkRANStatusTransfer() {
amfUeNgapId = NULL; amfUeNgapId = nullptr;
ranUeNgapId = NULL; ranUeNgapId = nullptr;
ranStatusTransfer_TransparentContainer = NULL; ranStatusTransfer_TransparentContainer = nullptr;
UplinkRANStatusTransferPDU = nullptr; UplinkRANStatusTransferPDU = nullptr;
UplinkRANStatusTransferIEs = nullptr; UplinkRANStatusTransferIEs = nullptr;
} }
UplinkRANStatusTransfer::~UplinkRANStatusTransfer() {} UplinkRANStatusTransfer::~UplinkRANStatusTransfer() {}
unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() { unsigned long UplinkRANStatusTransfer::getAmfUeNgapId() {
if (amfUeNgapId)
return amfUeNgapId->getAMF_UE_NGAP_ID(); return amfUeNgapId->getAMF_UE_NGAP_ID();
else
return 0;
} }
uint32_t UplinkRANStatusTransfer::getRanUeNgapId() { uint32_t UplinkRANStatusTransfer::getRanUeNgapId() {
if (ranUeNgapId)
return ranUeNgapId->getRanUeNgapId(); return ranUeNgapId->getRanUeNgapId();
else
return 0;
} }
void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer( void UplinkRANStatusTransfer::getRANStatusTransfer_TransparentContainer(
RANStatusTransferTransparentContainer*& RANStatusTransferTransparentContainer*&
ranstatustransfer_transparentcontainer) { ranstatustransfer_transparentcontainer) {
ranstatustransfer_transparentcontainer = ranstatustransfer_transparentcontainer =
ranStatusTransfer_TransparentContainer; ranStatusTransfer_TransparentContainer;
} }
bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) { bool UplinkRANStatusTransfer::defromPDU(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
UplinkRANStatusTransferPDU = ngap_msg_pdu; UplinkRANStatusTransferPDU = ngap_msg_pdu;
if (UplinkRANStatusTransferPDU->present == if (UplinkRANStatusTransferPDU->present ==
......
...@@ -52,7 +52,6 @@ using namespace amf_application; ...@@ -52,7 +52,6 @@ using namespace amf_application;
extern itti_mw* itti_inst; extern itti_mw* itti_inst;
extern amf_n1* amf_n1_inst; extern amf_n1* amf_n1_inst;
extern amf_n11* amf_n11_inst;
extern amf_app* amf_app_inst; extern amf_app* amf_app_inst;
typedef int (*ngap_message_decoded_callback)( typedef int (*ngap_message_decoded_callback)(
...@@ -158,7 +157,7 @@ int ngap_amf_handle_initial_context_setup_response( ...@@ -158,7 +157,7 @@ int ngap_amf_handle_initial_context_setup_response(
} }
std::vector<PDUSessionResourceSetupResponseItem_t> list; std::vector<PDUSessionResourceSetupResponseItem_t> list;
if (!initCtxResp->getPduSessionResourceSetupResponseList(list)) { if (!initCtxResp->getPduSessionResourceSetupResponseList(list)) {
Logger::ngap().error( 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; return 0;
...@@ -543,7 +542,7 @@ int downlink_ue_associated_nappa_transport( ...@@ -543,7 +542,7 @@ int downlink_ue_associated_nappa_transport(
int handover_cancel( int handover_cancel(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti handover cancel to TASK_AMF_N2"); Logger::ngap().debug("Sending ITTI Handover Cancel to TASK_AMF_N2");
return 0; return 0;
} }
...@@ -551,18 +550,18 @@ int handover_cancel( ...@@ -551,18 +550,18 @@ int handover_cancel(
int handover_preparation( int handover_preparation(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti handover preparation to TASK_AMF_N2"); Logger::ngap().debug("Sending ITTI Handover Preparation to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
HandoverRequiredMsg* handoverrequired = new HandoverRequiredMsg(); HandoverRequiredMsg* handover_required = new HandoverRequiredMsg();
if (!handoverrequired->decodefrompdu(message_p)) { if (!handover_required->decodefrompdu(message_p)) {
Logger::ngap().error("decoding HandoverRequired message error"); Logger::ngap().error("Decoding HandoverRequired message error");
return -1; return -1;
} }
itti_handover_required* itti_handover_requ = itti_handover_required* itti_handover_requ =
new itti_handover_required(TASK_NGAP, TASK_AMF_N2); new itti_handover_required(TASK_NGAP, TASK_AMF_N2);
itti_handover_requ->assoc_id = assoc_id; itti_handover_requ->assoc_id = assoc_id;
itti_handover_requ->stream = stream; itti_handover_requ->stream = stream;
itti_handover_requ->handvoerRequ = handoverrequired; itti_handover_requ->handoverReq = handover_required;
std::shared_ptr<itti_handover_required> i = std::shared_ptr<itti_handover_required> i =
std::shared_ptr<itti_handover_required>(itti_handover_requ); std::shared_ptr<itti_handover_required>(itti_handover_requ);
int ret = itti_inst->send_msg(i); int ret = itti_inst->send_msg(i);
...@@ -578,11 +577,11 @@ int handover_preparation( ...@@ -578,11 +577,11 @@ int handover_preparation(
int handover_notification( int handover_notification(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti handover Notification to TASK_AMF_N2"); Logger::ngap().debug("Sending ITTI Handover Notification to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
HandoverNotifyMsg* handoverNotify = new HandoverNotifyMsg(); HandoverNotifyMsg* handoverNotify = new HandoverNotifyMsg();
if (!handoverNotify->decodefrompdu(message_p)) { if (!handoverNotify->decodefrompdu(message_p)) {
Logger::ngap().error("decoding handoverNotify message error"); Logger::ngap().error("Decoding HandoverNotify message error");
return -1; return -1;
} }
itti_handover_notify* itti_handover_NOTIFY = itti_handover_notify* itti_handover_NOTIFY =
...@@ -606,12 +605,11 @@ int handover_resource_allocation( ...@@ -606,12 +605,11 @@ int handover_resource_allocation(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug( Logger::ngap().debug(
"Sending itti handover resource allocation to TASK_AMF_N2"); "Sending ITTI Handover Resource Allocation to TASK_AMF_N2");
/*receive handover request acknowedge*/
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
HandoverRequestAck* handoverRequestAck = new HandoverRequestAck(); HandoverRequestAck* handoverRequestAck = new HandoverRequestAck();
if (!handoverRequestAck->decodefrompdu(message_p)) { if (!handoverRequestAck->decodefrompdu(message_p)) {
Logger::ngap().error("decoding handoverRequestAck message error"); Logger::ngap().error("Decoding Handover Request Acknowledge message error");
return -1; return -1;
} }
itti_handover_request_Ack* itti_handover_requ_Ack = itti_handover_request_Ack* itti_handover_requ_Ack =
...@@ -873,22 +871,22 @@ int uplink_ran_status_transfer( ...@@ -873,22 +871,22 @@ int uplink_ran_status_transfer(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug( Logger::ngap().debug(
"Sending itti uplink ran status transfer to TASK_AMF_N2"); "Sending ITTI Uplink RAN Status Transfer to TASK_AMF_N2");
/*receive uplinkranstatustransfer*/
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
UplinkRANStatusTransfer* Uplinkranstatustransfer = UplinkRANStatusTransfer* Uplinkranstatustransfer =
new UplinkRANStatusTransfer(); new UplinkRANStatusTransfer();
if (!Uplinkranstatustransfer->defromPDU(message_p)) { if (!Uplinkranstatustransfer->defromPDU(message_p)) {
Logger::ngap().error("Decoding Uplinkranstatustransfer message error"); Logger::ngap().error("Decoding Uplink RAN Status Transfer message error");
return -1; return -1;
} }
itti_uplinkranstatsutransfer* itti_uplinkran_sta_tran = itti_uplink_ran_status_transfer* itti_uplinkran_sta_tran =
new itti_uplinkranstatsutransfer(TASK_NGAP, TASK_AMF_N2); new itti_uplink_ran_status_transfer(TASK_NGAP, TASK_AMF_N2);
itti_uplinkran_sta_tran->assoc_id = assoc_id; itti_uplinkran_sta_tran->assoc_id = assoc_id;
itti_uplinkran_sta_tran->stream = stream; itti_uplinkran_sta_tran->stream = stream;
itti_uplinkran_sta_tran->uplinkrantransfer = Uplinkranstatustransfer; itti_uplinkran_sta_tran->uplinkrantransfer = Uplinkranstatustransfer;
std::shared_ptr<itti_uplinkranstatsutransfer> i = std::shared_ptr<itti_uplink_ran_status_transfer> i =
std::shared_ptr<itti_uplinkranstatsutransfer>(itti_uplinkran_sta_tran); std::shared_ptr<itti_uplink_ran_status_transfer>(itti_uplinkran_sta_tran);
int ret = itti_inst->send_msg(i); int ret = itti_inst->send_msg(i);
if (0 != ret) { if (0 != ret) {
Logger::ngap().error( Logger::ngap().error(
...@@ -960,8 +958,7 @@ ngap_message_decoded_callback messages_callback[][3] = { ...@@ -960,8 +958,7 @@ ngap_message_decoded_callback messages_callback[][3] = {
{overload_stop, overload_stop, overload_stop}, /*OverloadStop*/ {overload_stop, overload_stop, overload_stop}, /*OverloadStop*/
{paging, paging, paging}, /*Paging*/ {paging, paging, paging}, /*Paging*/
{ngap_amf_handle_path_switch_request, ngap_amf_handle_path_switch_request, {ngap_amf_handle_path_switch_request, ngap_amf_handle_path_switch_request,
ngap_amf_handle_path_switch_request}, //{ngap_amf_handle_path_switch_request,0,0}, ngap_amf_handle_path_switch_request}, /*PathSwitchRequest*/
///*PathSwitchRequest*
{pdu_session_resource_modify, pdu_session_resource_modify, {pdu_session_resource_modify, pdu_session_resource_modify,
pdu_session_resource_modify}, /*PDUSessionResourceModify*/ pdu_session_resource_modify}, /*PDUSessionResourceModify*/
{pdu_session_resource_modify_indication, {pdu_session_resource_modify_indication,
......
...@@ -354,4 +354,4 @@ IF(STATIC_LINKING) ...@@ -354,4 +354,4 @@ IF(STATIC_LINKING)
ENDIF(STATIC_LINKING) ENDIF(STATIC_LINKING)
target_link_libraries(amf ${ASAN} target_link_libraries(amf ${ASAN}
-Wl,--start-group 3GPP_COMMON_TYPES AMF CONTEXTS AMF_SCTP AMF_SECU_5GAKA AMF_SECU_NAS AMF_UTILS AMF_SBI_CLIENT AMF_SBI_SERVER config++ sctp pthread ${NETTLE_LIBRARIES} ${MySQL_LIBRARY} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} boost_system ssl crypt cpprest gmp pistache curl) -Wl,--start-group 3GPP_COMMON_TYPES AMF CONTEXTS AMF_SCTP AMF_SECU_5GAKA AMF_SECU_NAS AMF_UTILS AMF_SBI_CLIENT AMF_SBI_SERVER config++ sctp pthread ${NETTLE_LIBRARIES} ${MySQL_LIBRARY} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} boost_system boost_thread boost_chrono ssl crypt cpprest gmp pistache curl)
...@@ -22,7 +22,6 @@ using namespace amf_application; ...@@ -22,7 +22,6 @@ using namespace amf_application;
extern void msg_str_2_msg_hex(std::string msg, bstring& b); extern void msg_str_2_msg_hex(std::string msg, bstring& b);
extern void convert_string_2_hex(std::string& input, std::string& output); extern void convert_string_2_hex(std::string& input, std::string& output);
extern itti_mw* itti_inst; extern itti_mw* itti_inst;
extern amf_n11* amf_n11_inst;
extern amf_app* amf_app_inst; extern amf_app* amf_app_inst;
extern void print_buffer( extern void print_buffer(
const std::string app, const std::string commit, uint8_t* buf, int len); const std::string app, const std::string commit, uint8_t* buf, int len);
......
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