Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • limx1980/oai-cn5g-common-src
  • oai/cn5g/oai-cn5g-common-src
2 results
Show changes
Showing
with 1121 additions and 35 deletions
......@@ -82,8 +82,7 @@ void DeregistrationRequest::GetDeregistrationType(
//------------------------------------------------------------------------------
bool DeregistrationRequest::GetNgKsi(uint8_t& ng_ksi) const {
ng_ksi = (ie_ng_ksi_.GetTypeOfSecurityContext()) |
ie_ng_ksi_.GetNasKeyIdentifier();
ng_ksi = ie_ng_ksi_.GetNgKsi();
return true;
}
......
......@@ -140,8 +140,7 @@ void RegistrationRequest::SetNgKsi(uint8_t tsc, uint8_t key_set_id) {
//------------------------------------------------------------------------------
bool RegistrationRequest::GetNgKsi(uint8_t& ng_ksi) const {
ng_ksi = (ie_ng_ksi_.GetTypeOfSecurityContext()) |
ie_ng_ksi_.GetNasKeyIdentifier();
ng_ksi = ie_ng_ksi_.GetNgKsi();
return true;
}
......@@ -243,9 +242,7 @@ void RegistrationRequest::SetNonCurrentNativeNasKSI(
//------------------------------------------------------------------------------
bool RegistrationRequest::GetNonCurrentNativeNasKSI(uint8_t& value) const {
if (ie_non_current_native_nas_ksi_.has_value()) {
value |=
(ie_non_current_native_nas_ksi_.value().GetTypeOfSecurityContext()) |
(ie_non_current_native_nas_ksi_.value().GetNasKeyIdentifier());
value |= ie_non_current_native_nas_ksi_.value().GetNgKsi();
return true;
} else {
return false;
......
......@@ -72,8 +72,7 @@ void ServiceRequest::SetNgKsi(uint8_t tsc, uint8_t key_set_id) {
//------------------------------------------------------------------------------
void ServiceRequest::GetNgKsi(uint8_t& ng_ksi) const {
ng_ksi = (ie_ng_ksi_.GetTypeOfSecurityContext()) |
ie_ng_ksi_.GetNasKeyIdentifier();
ng_ksi = ie_ng_ksi_.GetNgKsi();
}
//------------------------------------------------------------------------------
......
################################################################################
#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
################################################################################
cmake_minimum_required (VERSION 3.22.1)
project( NAS )
include_directories(${3GPP_DIR})
include_directories(${COMMON_DIR})
include_directories(${LOGGER_DIR})
include_directories(${MODEL_DIR}/common_model)
include_directories(${NAS_DIR}/5gmm-msgs)
include_directories(${NAS_DIR}/common)
include_directories(${NAS_DIR}/ies)
include_directories(${NAS_DIR}/utils)
include_directories(${UTILS_DIR})
include_directories(${UTILS_DIR}/bstr)
file(GLOB NAS_src_files
${NAS_DIR}/5gmm-msgs/*.cpp
${NAS_DIR}/ies/*.cpp
${NAS_DIR}/utils/*.cpp
${NAS_DIR}/utils/*.c
)
add_library(NAS STATIC ${NAS_src_files})
target_link_libraries( NAS -Wl,--start-group LOGGER COMMON -lfmt -lspdlog -Wl,--end-group )
......@@ -72,13 +72,13 @@ void NasKeySetIdentifier::GetValue() {
//------------------------------------------------------------------------------
void NasKeySetIdentifier::SetTypeOfSecurityContext(bool type) {
tsc_ = type;
NasKeySetIdentifier::SetValue(); // Update value
SetValue(); // Update value
}
//------------------------------------------------------------------------------
void NasKeySetIdentifier::SetNasKeyIdentifier(uint8_t id) {
key_id_ = 0x07 & id;
NasKeySetIdentifier::SetValue(); // Update value
SetValue(); // Update value
}
//------------------------------------------------------------------------------
......@@ -90,3 +90,11 @@ bool NasKeySetIdentifier::GetTypeOfSecurityContext() const {
uint8_t NasKeySetIdentifier::GetNasKeyIdentifier() const {
return key_id_;
}
//------------------------------------------------------------------------------
uint8_t NasKeySetIdentifier::GetNgKsi() const {
if (tsc_)
return 0b1000 | (0x07 & key_id_);
else
return 0x07 & key_id_;
}
......@@ -49,6 +49,8 @@ class NasKeySetIdentifier : public Type1NasIe {
void SetNasKeyIdentifier(uint8_t id);
uint8_t GetNasKeyIdentifier() const;
uint8_t GetNgKsi() const;
private:
void SetValue() override;
void GetValue() override;
......
......@@ -152,6 +152,7 @@ int Type1NasIe::Decode(
}
}
GetValue(); // Update value in the derived classes
if (is_iei) {
return decoded_size; // 1 octet
} else {
......
......@@ -46,9 +46,8 @@ class Type1NasIe : public NasIe {
void Set(bool high_pos, uint8_t value);
void Set(bool high_pos);
void SetValue(uint8_t value);
protected:
void SetValue(uint8_t value);
virtual void SetValue() = 0;
virtual void GetValue() = 0;
......
################################################################################
#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
################################################################################
cmake_minimum_required (VERSION 3.22.1)
enable_testing()
include(GoogleTest)
include_directories(${3GPP_DIR})
include_directories(${COMMON_DIR})
include_directories(${LOGGER_DIR})
include_directories(${MODEL_DIR}/common_model)
include_directories(${NAS_DIR}/5gmm-msgs)
include_directories(${NAS_DIR}/common)
include_directories(${NAS_DIR}/ies)
include_directories(${NAS_DIR}/utils)
include_directories(${UTILS_DIR})
include_directories(${UTILS_DIR}/bstr)
file(GLOB NAS_TEST_src_files
${NAS_TEST_DIR}/*.cpp
)
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
################################################################################
cmake_minimum_required (VERSION 3.22.1)
enable_testing()
include(GoogleTest)
include_directories(${3GPP_DIR})
include_directories(${COMMON_DIR})
include_directories(${LOGGER_DIR})
include_directories(${MODEL_DIR}/common_model)
include_directories(${NGAP_DIR}/libngap)
include_directories(${NGAP_DIR}/libngap_ies)
include_directories(${NGAP_DIR}/ngap_ies)
include_directories(${NGAP_DIR}/ngap_msgs)
include_directories(${NGAP_DIR}/utils)
include_directories(${UTILS_DIR})
include_directories(${UTILS_DIR}/bstr)
file(GLOB NGAP_src_files
${NGAP_DIR}/libngap/*.c
${NGAP_DIR}/libngap_ies/*.c
${NGAP_DIR}/ngap_ies/*.cpp
${NGAP_DIR}/ngap_msgs/*.cpp
${NGAP_DIR}/utils/*.cpp
)
add_library(NGAP STATIC ${NGAP_src_files})
target_link_libraries( NGAP -Wl,--start-group LOGGER COMMON -lfmt -lspdlog -Wl,--end-group )
......@@ -20,7 +20,6 @@
*/
#include "AmfUeNgapId.hpp"
#include "logger.hpp"
namespace oai::ngap {
......
......@@ -21,7 +21,7 @@
#include "Cause.hpp"
#include "logger.hpp"
#include "logger_base.hpp"
namespace oai::ngap {
......@@ -69,7 +69,8 @@ bool Cause::encode(Ngap_Cause_t& cause) const {
break;
}
default: {
Logger::ngap().warn("Cause Present error!");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.warn("Cause Present error!");
return false;
break;
}
......@@ -97,7 +98,8 @@ bool Cause::decode(const Ngap_Cause_t& cause) {
m_CauseValue = cause.choice.misc;
} break;
default: {
Logger::ngap().warn("Cause Present error!");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.warn("Cause Present error!");
return false;
}
}
......
......@@ -21,7 +21,7 @@
#include "CriticalityDiagnostics.hpp"
#include "logger.hpp"
#include "logger_base.hpp"
namespace oai::ngap {
......@@ -118,7 +118,9 @@ int CriticalityDiagnostics::encode(
return 1;
}
int ret = ASN_SEQUENCE_ADD(&ngSetupFailure.protocolIEs.list, ie);
if (ret != 0) Logger::ngap().error("Encode CriticalityDiagnostics IE error");
if (ret != 0)
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Encode CriticalityDiagnostics IE error");
return ret;
}
......
......@@ -20,7 +20,7 @@
*/
#include "DrbStatusDl.hpp"
#include "logger.hpp"
#include "logger_base.hpp"
namespace oai::ngap {
......@@ -62,7 +62,8 @@ bool DrbStatusDl::encode(Ngap_DRBStatusDL_t& dl) const {
dl.choice.dRBStatusDL18 =
(Ngap_DRBStatusDL18_t*) calloc(1, sizeof(Ngap_DRBStatusDL18_t));
if (!m_Dl18.value().encode(*dl.choice.dRBStatusDL18)) {
Logger::ngap().error("Encode DRBStatusDL18 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Encode DRBStatusDL18 IE error");
return false;
}
} else if (m_Dl12.has_value()) {
......@@ -70,7 +71,8 @@ bool DrbStatusDl::encode(Ngap_DRBStatusDL_t& dl) const {
dl.choice.dRBStatusDL12 =
(Ngap_DRBStatusDL12_t*) calloc(1, sizeof(Ngap_DRBStatusDL12_t));
if (!m_Dl12.value().encode(*dl.choice.dRBStatusDL12)) {
Logger::ngap().error("Encode DRBStatusDL12 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Encode DRBStatusDL12 IE error");
return false;
}
}
......@@ -82,14 +84,16 @@ bool DrbStatusDl::decode(const Ngap_DRBStatusDL_t& dl) {
if (dl.present == Ngap_DRBStatusDL_PR_dRBStatusDL18) {
DrbStatusDl18 dl18 = {};
if (!dl18.decode(*dl.choice.dRBStatusDL18)) {
Logger::ngap().error("Decode DRBStatusDL18 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Decode DRBStatusDL18 IE error");
return false;
}
m_Dl18 = std::make_optional<DrbStatusDl18>(dl18);
} else if (dl.present == Ngap_DRBStatusDL_PR_dRBStatusDL12) {
DrbStatusDl12 dl12 = {};
if (!dl12.decode(*dl.choice.dRBStatusDL12)) {
Logger::ngap().error("Decode DRBStatusDL12 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Decode DRBStatusDL12 IE error");
return false;
}
m_Dl12 = std::make_optional<DrbStatusDl12>(dl12);
......
......@@ -20,6 +20,7 @@
*/
#include "DrbStatusDl12.hpp"
#include "logger_base.hpp"
namespace oai::ngap {
......@@ -42,7 +43,8 @@ void DrbStatusDl12::set(const CountValueForPdcpSn12& value) {
//------------------------------------------------------------------------------
bool DrbStatusDl12::encode(Ngap_DRBStatusDL12_t& dl12) const {
if (!m_DlCountValue.encode(dl12.dL_COUNTValue)) {
Logger::ngap().error("Encode DrbStatusDl12 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Encode DrbStatusDl12 IE error");
return false;
}
return true;
......@@ -51,7 +53,8 @@ bool DrbStatusDl12::encode(Ngap_DRBStatusDL12_t& dl12) const {
//------------------------------------------------------------------------------
bool DrbStatusDl12::decode(const Ngap_DRBStatusDL12_t& dl12) {
if (!m_DlCountValue.decode(dl12.dL_COUNTValue)) {
Logger::ngap().error("Decode DrbStatusDl12 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Decode DrbStatusDl12 IE error");
return false;
}
return true;
......
......@@ -23,7 +23,6 @@
#define _DRB_STATUS_DL12_H_
#include "CountValueForPdcpSn12.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_DRBStatusDL12.h"
......
......@@ -20,6 +20,7 @@
*/
#include "DrbStatusDl18.hpp"
#include "logger_base.hpp"
namespace oai::ngap {
......@@ -42,7 +43,8 @@ void DrbStatusDl18::set(const CountValueForPdcpSn18& value) {
//------------------------------------------------------------------------------
bool DrbStatusDl18::encode(Ngap_DRBStatusDL18_t& dl18) const {
if (!m_DlCountValue.encode(dl18.dL_COUNTValue)) {
Logger::ngap().error("Encode DRBStatusDL18 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Encode DRBStatusDL18 IE error");
return false;
}
return true;
......@@ -51,7 +53,8 @@ bool DrbStatusDl18::encode(Ngap_DRBStatusDL18_t& dl18) const {
//------------------------------------------------------------------------------
bool DrbStatusDl18::decode(const Ngap_DRBStatusDL18_t& dl18) {
if (!m_DlCountValue.decode(dl18.dL_COUNTValue)) {
Logger::ngap().error("Decode DRBStatusDL18 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Decode DRBStatusDL18 IE error");
return false;
}
return true;
......
......@@ -23,7 +23,6 @@
#define _DRB_STATUS_DL18_H_
#include "CountValueForPdcpSn18.hpp"
#include "logger.hpp"
extern "C" {
#include "Ngap_DRBStatusDL18.h"
......
......@@ -21,7 +21,7 @@
#include "DrbStatusUl.hpp"
#include "logger.hpp"
#include "logger_base.hpp"
namespace oai::ngap {
......@@ -63,7 +63,8 @@ bool DrbStatusUl::encode(Ngap_DRBStatusUL_t& ul) const {
ul.choice.dRBStatusUL18 =
(Ngap_DRBStatusUL18_t*) calloc(1, sizeof(Ngap_DRBStatusUL18_t));
if (!m_Ul18.value().encode(*ul.choice.dRBStatusUL18)) {
Logger::ngap().error("Encode DRBStatusUL18 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Encode DRBStatusUL18 IE error");
return false;
}
} else if (m_Ul12.has_value()) {
......@@ -71,7 +72,8 @@ bool DrbStatusUl::encode(Ngap_DRBStatusUL_t& ul) const {
ul.choice.dRBStatusUL12 =
(Ngap_DRBStatusUL12_t*) calloc(1, sizeof(Ngap_DRBStatusUL12_t));
if (!m_Ul12.value().encode(*ul.choice.dRBStatusUL12)) {
Logger::ngap().error("Encode DRBStatusUL18 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Encode DRBStatusUL18 IE error");
return false;
}
}
......@@ -84,14 +86,16 @@ bool DrbStatusUl::decode(const Ngap_DRBStatusUL_t& ul) {
if (ul.present == Ngap_DRBStatusUL_PR_dRBStatusUL18) {
DrbStatusUl18 item = {};
if (!item.decode(*ul.choice.dRBStatusUL18)) {
Logger::ngap().error("Decode DRBStatusUL18 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Decode DRBStatusUL18 IE error");
return false;
}
m_Ul18 = std::make_optional<DrbStatusUl18>(item);
} else if (ul.present == Ngap_DRBStatusUL_PR_dRBStatusUL12) {
DrbStatusUl12 item = {};
if (!item.decode(*ul.choice.dRBStatusUL12)) {
Logger::ngap().error("Decode DRBStatusUL12 IE error");
oai::logger::logger_registry::get_logger(LOGGER_COMMON)
.error("Decode DRBStatusUL12 IE error");
return false;
}
m_Ul12 = std::make_optional<DrbStatusUl12>(item);
......