diff --git a/ngap/ngap_ies/AmfSetId.cpp b/ngap/ngap_ies/AmfSetId.cpp index 1ed6b551f6733ea828027a54bd0eca09dd32570d..0ce9460e7c396b53ead50ed94dcfd2586603a156 100644 --- a/ngap/ngap_ies/AmfSetId.cpp +++ b/ngap/ngap_ies/AmfSetId.cpp @@ -76,7 +76,8 @@ bool AmfSetId::encode(Ngap_AMFSetID_t& amfSetId) const { //------------------------------------------------------------------------------ bool AmfSetId::decode(const Ngap_AMFSetID_t& amfSetId) { if (!amfSetId.buf) return false; - output_wrapper::print_buffer("ngap", "AMFSetID", amfSetId.buf, amfSetId.size); + oai::utils::output_wrapper::print_buffer( + "ngap", "AMFSetID", amfSetId.buf, amfSetId.size); uint16_t temp = 0; temp |= amfSetId.buf[0] << 8; diff --git a/ngap/ngap_ies/PduSessionResourceHandoverCommandTransfer.cpp b/ngap/ngap_ies/PduSessionResourceHandoverCommandTransfer.cpp index 0499e31aa58fc3b9e45300a5e9e898a56d276083..02942e4bbb05d9204d6842799e8bb9271295090f 100644 --- a/ngap/ngap_ies/PduSessionResourceHandoverCommandTransfer.cpp +++ b/ngap/ngap_ies/PduSessionResourceHandoverCommandTransfer.cpp @@ -24,7 +24,7 @@ #include <vector> #include "logger.hpp" -#include "output_wrapper.hpp" +#include "ngap_utils.hpp" namespace oai::ngap { @@ -104,7 +104,7 @@ void PduSessionResourceHandoverCommandTransfer::setUPTransportLayerInformation( //------------------------------------------------------------------------------ int PduSessionResourceHandoverCommandTransfer::encode( uint8_t* buf, int buf_size) const { - output_wrapper::print_asn_msg( + ngap_utils::print_asn_msg( &asn_DEF_Ngap_HandoverCommandTransfer, m_HandoverCommandTransferIe); asn_enc_rval_t er = aper_encode_to_buffer( &asn_DEF_Ngap_HandoverCommandTransfer, NULL, m_HandoverCommandTransferIe, diff --git a/ngap/ngap_ies/PduSessionResourceHandoverRequiredTransfer.cpp b/ngap/ngap_ies/PduSessionResourceHandoverRequiredTransfer.cpp index 21a6812ae11c25183e1a571d294d4512f17d4e33..f0c75b9af12d42649f5735be5d8097fb4311f87c 100644 --- a/ngap/ngap_ies/PduSessionResourceHandoverRequiredTransfer.cpp +++ b/ngap/ngap_ies/PduSessionResourceHandoverRequiredTransfer.cpp @@ -22,7 +22,7 @@ #include "PduSessionResourceHandoverRequiredTransfer.hpp" #include "logger.hpp" -#include "output_wrapper.hpp" +#include "ngap_utils.hpp" namespace oai::ngap { @@ -56,7 +56,7 @@ void PduSessionResourceHandoverRequiredTransfer:: //------------------------------------------------------------------------------ int PduSessionResourceHandoverRequiredTransfer::encode( uint8_t* buf, int buf_size) { - output_wrapper::print_asn_msg( + ngap_utils::print_asn_msg( &asn_DEF_Ngap_HandoverRequiredTransfer, m_HandoverRquiredTransferIe); asn_enc_rval_t er = aper_encode_to_buffer( &asn_DEF_Ngap_HandoverRequiredTransfer, NULL, m_HandoverRquiredTransferIe, diff --git a/ngap/ngap_ies/PduSessionResourceReleaseCommandTransfer.cpp b/ngap/ngap_ies/PduSessionResourceReleaseCommandTransfer.cpp index a6fba07140306f3ecfe7fd557b91b243edd0a2dd..5bd94e1957f242fd34b878b13f1acc5c215ef090 100644 --- a/ngap/ngap_ies/PduSessionResourceReleaseCommandTransfer.cpp +++ b/ngap/ngap_ies/PduSessionResourceReleaseCommandTransfer.cpp @@ -22,7 +22,7 @@ #include "PduSessionResourceReleaseCommandTransfer.hpp" #include "logger.hpp" -#include "output_wrapper.hpp" +#include "ngap_utils.hpp" namespace oai::ngap { @@ -116,7 +116,7 @@ void PduSessionResourceReleaseCommandTransfer::setCauseMisc( //------------------------------------------------------------------------------ int PduSessionResourceReleaseCommandTransfer::encode( uint8_t* buf, int buf_size) { - output_wrapper::print_asn_msg( + ngap_utils::print_asn_msg( &asn_DEF_Ngap_PDUSessionResourceReleaseCommandTransfer, m_PduSessionResourceReleaseCommandTransferIe); asn_enc_rval_t er = aper_encode_to_buffer( diff --git a/ngap/ngap_ies/PduSessionResourceSetupRequestTransfer.cpp b/ngap/ngap_ies/PduSessionResourceSetupRequestTransfer.cpp index 5672a2f9335f60bcb52240e906ffd465dbf8379f..f35eb63fcfd8e0fe3c494bdd2dbb341940921bc2 100644 --- a/ngap/ngap_ies/PduSessionResourceSetupRequestTransfer.cpp +++ b/ngap/ngap_ies/PduSessionResourceSetupRequestTransfer.cpp @@ -22,7 +22,7 @@ #include "PduSessionResourceSetupRequestTransfer.hpp" #include "logger.hpp" -#include "output_wrapper.hpp" +#include "ngap_utils.hpp" #include "utils.hpp" namespace oai::ngap { @@ -442,7 +442,7 @@ void PduSessionResourceSetupRequestTransferIE::setQosFlowSetupRequestList( //------------------------------------------------------------------------------ int PduSessionResourceSetupRequestTransferIE::encode( uint8_t* buf, int buf_size) { - output_wrapper::print_asn_msg( + ngap_utils::print_asn_msg( &asn_DEF_Ngap_PDUSessionResourceSetupRequestTransfer, m_PduSessionResourceSetupRequestTransferIe); asn_enc_rval_t er = aper_encode_to_buffer( diff --git a/ngap/ngap_ies/PduSessionResourceSetupResponseTransfer.cpp b/ngap/ngap_ies/PduSessionResourceSetupResponseTransfer.cpp index 3344c25d96e8f714e9f5ff9d356ac8d97377084b..cf6526feb688faa95df78f9b87eeea32c117bdb6 100644 --- a/ngap/ngap_ies/PduSessionResourceSetupResponseTransfer.cpp +++ b/ngap/ngap_ies/PduSessionResourceSetupResponseTransfer.cpp @@ -22,7 +22,7 @@ #include "PduSessionResourceSetupResponseTransfer.hpp" #include "logger.hpp" -#include "output_wrapper.hpp" +#include "ngap_utils.hpp" namespace oai::ngap { @@ -159,7 +159,7 @@ void PduSessionResourceSetupResponseTransferIE::setSecurityResult( //------------------------------------------------------------------------------ int PduSessionResourceSetupResponseTransferIE::encode( uint8_t* buf, int buf_size) { - output_wrapper::print_asn_msg( + ngap_utils::print_asn_msg( &asn_DEF_Ngap_PDUSessionResourceSetupResponseTransfer, m_PduSessionResourceSetupResponseTransferIe); asn_enc_rval_t er = aper_encode_to_buffer( diff --git a/ngap/ngap_ies/PduSessionResourceSetupUnsuccessfulTransfer.cpp b/ngap/ngap_ies/PduSessionResourceSetupUnsuccessfulTransfer.cpp index a13c02a593a7db1d2e6ffab98c7add7ac25fa953..5b4cec41cb90d5a69e99cd91cdd325e352c328ab 100644 --- a/ngap/ngap_ies/PduSessionResourceSetupUnsuccessfulTransfer.cpp +++ b/ngap/ngap_ies/PduSessionResourceSetupUnsuccessfulTransfer.cpp @@ -22,7 +22,7 @@ #include "PduSessionResourceSetupUnsuccessfulTransfer.hpp" #include "logger.hpp" -#include "output_wrapper.hpp" +#include "ngap_utils.hpp" namespace oai::ngap { @@ -111,7 +111,7 @@ void PduSessionResourceSetupUnSuccessfulTransferIE::setCauseMisc( //------------------------------------------------------------------------------ int PduSessionResourceSetupUnSuccessfulTransferIE::encode( uint8_t* buf, int buf_size) { - output_wrapper::output_wrapper::print_asn_msg( + ngap_utils::print_asn_msg( &asn_DEF_Ngap_PDUSessionResourceSetupUnsuccessfulTransfer, m_PduSessionResourceSetupUnsuccessfulTransferIe); asn_enc_rval_t er = aper_encode_to_buffer( diff --git a/ngap/ngap_msgs/HandoverRequest.cpp b/ngap/ngap_msgs/HandoverRequest.cpp index fd8105fbf6b1a04cebe5635dd9dcca26ccec65ea..cb2350bce68c7e48a0c2754a2082e754060a3524 100644 --- a/ngap/ngap_msgs/HandoverRequest.cpp +++ b/ngap/ngap_msgs/HandoverRequest.cpp @@ -23,7 +23,7 @@ #include "amf_conversions.hpp" #include "logger.hpp" -#include "output_wrapper.hpp" +#include "ngap_utils.hpp" #include "utils.hpp" namespace oai::ngap { @@ -290,7 +290,7 @@ void HandoverRequest::setAllowedNssai(const std::vector<SNssai>& list) { Logger::ngap().error( "Encode PDUSessionResourceHandoverListItem IE error"); } - output_wrapper::print_asn_msg(&asn_DEF_Ngap_AllowedNSSAI, &m_AllowedNssai); + ngap_utils::print_asn_msg(&asn_DEF_Ngap_AllowedNSSAI, &m_AllowedNssai); Ngap_HandoverRequestIEs_t* ie = (Ngap_HandoverRequestIEs_t*) calloc(1, sizeof(Ngap_HandoverRequestIEs_t)); ie->id = Ngap_ProtocolIE_ID_id_AllowedNSSAI; diff --git a/ngap/ngap_msgs/NgapMessage.cpp b/ngap/ngap_msgs/NgapMessage.cpp index 079200713f9769953239038b33f9c87256afd427..2cae3f27b63f769c86c2a86b158e00c603ce5b09 100644 --- a/ngap/ngap_msgs/NgapMessage.cpp +++ b/ngap/ngap_msgs/NgapMessage.cpp @@ -22,7 +22,7 @@ #include "NgapMessage.hpp" #include "logger.hpp" -#include "output_wrapper.hpp" +#include "ngap_utils.hpp" extern "C" { #include "asn_codecs.h" @@ -515,7 +515,7 @@ void NgapMessage::setMessageType(NgapMessageType messageType) { //------------------------------------------------------------------------------ int NgapMessage::Encode(uint8_t* buf, int bufSize) { - output_wrapper::print_asn_msg(&asn_DEF_Ngap_NGAP_PDU, ngapPdu); + ngap_utils::print_asn_msg(&asn_DEF_Ngap_NGAP_PDU, ngapPdu); asn_enc_rval_t er = aper_encode_to_buffer( &asn_DEF_Ngap_NGAP_PDU, NULL, ngapPdu, buf, bufSize); @@ -526,7 +526,7 @@ int NgapMessage::Encode(uint8_t* buf, int bufSize) { //------------------------------------------------------------------------------ void NgapMessage::encode2NewBuffer(uint8_t*& buf, int& encoded_size) { - output_wrapper::print_asn_msg(&asn_DEF_Ngap_NGAP_PDU, ngapPdu); + ngap_utils::print_asn_msg(&asn_DEF_Ngap_NGAP_PDU, ngapPdu); encoded_size = aper_encode_to_new_buffer( &asn_DEF_Ngap_NGAP_PDU, NULL, ngapPdu, (void**) &buf); Logger::ngap().debug("Encoded message size ( %d )", encoded_size); diff --git a/ngap/utils/ngap_utils.cpp b/ngap/utils/ngap_utils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c0d214227a87af4e6634f7d2a7b93566b3111c30 --- /dev/null +++ b/ngap/utils/ngap_utils.cpp @@ -0,0 +1,32 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the + * License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "ngap_utils.hpp" + +#include "logger.hpp" +namespace oai::ngap { +//------------------------------------------------------------------------------ +void ngap_utils::print_asn_msg( + const asn_TYPE_descriptor_t* td, const void* struct_ptr) { + if (Logger::should_log(spdlog::level::debug)) + asn_fprint(stdout, td, struct_ptr); +} +} // namespace oai::ngap diff --git a/ngap/utils/ngap_utils.hpp b/ngap/utils/ngap_utils.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f30f6bac26cef508c79dbf5f8987b3d05d3ecfc5 --- /dev/null +++ b/ngap/utils/ngap_utils.hpp @@ -0,0 +1,38 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the + * License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef FILE_NGAP_UTILS_HPP_SEEN +#define FILE_NGAP_UTILS_HPP_SEEN + +#include "logger.hpp" + +extern "C" { +#include "constr_TYPE.h" +} + +namespace oai::ngap { +class ngap_utils { + public: + static void print_asn_msg( + const asn_TYPE_descriptor_t* td, const void* struct_ptr); +}; +} // namespace oai::ngap +#endif /* FILE_NGAP_UTILS_HPP_SEEN */