diff --git a/src/amf-app/amf_module_from_config.cpp b/src/amf-app/amf_module_from_config.cpp index b2a0cfbc35f18715cd0c5f412c89b25848177fbd..e6a056e9e67751583098b9e784f90f98bad55b43 100644 --- a/src/amf-app/amf_module_from_config.cpp +++ b/src/amf-app/amf_module_from_config.cpp @@ -37,7 +37,7 @@ namespace config { //------------------------------------------------------------------------------ int amf_modules::load(const std::string &config_file) { cout << endl; - Logger::amf_app().debug("Load amf module configuration file(%s)", config_file.c_str()); + Logger::amf_app().debug("Load AMF module configuration file(%s)", config_file.c_str()); Config cfg; try { cfg.readFile(config_file.c_str()); diff --git a/src/amf-app/amf_n1.cpp b/src/amf-app/amf_n1.cpp index 667fa55d4196c9639b7ad203b17bd162e0475fd0..688d519c979f872d848fbe206aa8efa9f942fdb2 100644 --- a/src/amf-app/amf_n1.cpp +++ b/src/amf-app/amf_n1.cpp @@ -1063,7 +1063,7 @@ void amf_n1::authentication_response_handle(uint32_t ran_ue_ngap_id, long amf_ue return; } else { Logger::amf_n1().debug("Authenticated successfully by network!!!"); - if (!nc.get()->is_current_security_avaliable) { + if (!nc.get()->is_current_security_available) { if (!start_security_mode_control_procedure(nc)) { Logger::amf_n1().error("Start SMC procedure failure"); } else { diff --git a/src/amf-app/mysql_db.cpp b/src/amf-app/mysql_db.cpp index 2f906551cd9b5a0f34ba0800d2b9f2cd0dd40d26..99a7305ee7f41f8131d8b7b8018c9e581b606710 100644 --- a/src/amf-app/mysql_db.cpp +++ b/src/amf-app/mysql_db.cpp @@ -83,7 +83,7 @@ bool amf_n1::connect_to_mysql() { const int mysql_reconnect_val = 1; db_desc = (database_t*) calloc(1, sizeof(database_t)); if (!db_desc) { - Logger::amf_n1().error("An error occurs when allocate memory for DB_DESC"); + Logger::amf_n1().error("An error occurs when allocating memory for DB_DESC"); return false; } pthread_mutex_init(&db_desc->db_cs_mutex, NULL); diff --git a/src/itti/CMakeLists.txt b/src/itti/CMakeLists.txt index 0b2794faf9ad7af993c6a4b0a29968fc6c31b29f..630fe6ba391d751db02f593d2c0ec28f6d013ba0 100644 --- a/src/itti/CMakeLists.txt +++ b/src/itti/CMakeLists.txt @@ -1,139 +1,6 @@ -cmake_minimum_required (VERSION 3.0.2) - -project(OpenAirInterface) - -macro(add_list_string_option name val helpstr) - if(DEFINED ${name}) - set(value ${${name}}) - else(DEFINED ${name}) - set(value ${val}) - endif() - set(${name} ${value} CACHE STRING "${helpstr}") - set_property(CACHE ${name} PROPERTY STRINGS ${ARGN}) - if(NOT "${value}" STREQUAL "False") - add_definitions("-D${name}=\"${value}\"") - endif() -endmacro(add_list_string_option) - -SET(STATIC_LINKING FALSE CACHE BOOL "Build a static binary?") - -IF(STATIC_LINKING) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -ENDIF(STATIC_LINKING) - -add_list_string_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." Debug Release - RelWithDebInfo MinSizeRel) -Message("Build type is ${CMAKE_BUILD_TYPE}") -if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - add_boolean_option(LOG_OAI True "Thread safe logging API") - add_boolean_option(LOG_OAI_MINIMAL True "Thread safe logging API, log only levels above NOTICE") - SET(ASAN asan) -endif() -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - add_boolean_option(LOG_OAI True "Thread safe logging API") - SET(ASAN asan) -endif() -if (CMAKE_BUILD_TYPE STREQUAL "") - set(CMAKE_BUILD_TYPE "MinSizeRel") -endif() -Message("Build type is ${CMAKE_BUILD_TYPE}") - -Message("Architecture is ${CMAKE_SYSTEM_PROCESSOR}") -if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") - set(C_FLAGS_PROCESSOR "-gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt") -else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") - set(C_FLAGS_PROCESSOR "-msse4.2") -endif() - -set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ") - # add autoTOOLS definitions that were maybe used! -set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP") - -add_definitions(-DCMAKER) -add_definitions(-DBSTRLIB_CAN_USE_STL=1 -DBSTRLIB_CAN_USE_IOSTREAM=1 -DBSTRLIB_THROWS_EXCEPTIONS=1) - -if(STATIC_LINKING) - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer") -else (STATIC_LINKING) - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer") -endif(STATIC_LINKING) -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1 ") -set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -O2 -DINFO_IS_ON=1 ") -set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS} -Os -s -DTRACE_IS_ON=1 -DDEBUG_IS_ON=1 -DINFO_IS_ON=1") - -if(STATIC_LINKING) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fno-omit-frame-pointer -DBUPT=1 -DEURECOM=0") -else(STATIC_LINKING) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -std=c++17 -g -fstack-protector-all -DMALLOC_CHECK_=3 -DINFO_IS_ON=1 -DDEBUG_IS_ON=1 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fno-omit-frame-pointer -DBUPT=1 -DEURECOM=0") -endif(STATIC_LINKING) -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -std=c++17 -O2 -fno-omit-frame-pointer -s -DINFO_IS_ON=1 -DBUPT=1 -DEURECOM=0") -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -std=c++17 -g -O2 -DINFO_IS_ON=1 -DBUPT=1 -DEURECOM=0") -set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -std=c++17 -Os -s -DTRACE_IS_ON=1 -DDEBUG_IS_ON=1 -DINFO_IS_ON=1") - -set(CMAKE_MODULE_PATH "${OPENAIRCN_DIR}/build/cmake_modules" "${CMAKE_MODULE_PATH}") -include(FindPkgConfig) -message("${OPENAIRCN_DIR}/build/cmake_modules") - - -include_directories(${SRC_TOP_DIR}/oai-amf) -include_directories(${SRC_TOP_DIR}/amf-app) -include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include) - -### for common -include_directories(${SRC_TOP_DIR}/common) -file(GLOB COMMON_SRC ${SRC_TOP_DIR}/common/conversions.cpp) -### end for common - -### for utils/bstr -include_directories(${SRC_TOP_DIR}/utils/bstr) -include_directories(${SRC_TOP_DIR}/utils) -file(GLOB BSTR_SRC - ${SRC_TOP_DIR}/utils/bstr/bstrlib.c - ${SRC_TOP_DIR}/utils/thread_sched.cpp -) -##end for utils/bstr - -### for sctp -include_directories(${SRC_TOP_DIR}/sctp) -file(GLOB SCTP_SRC ${SRC_TOP_DIR}/sctp/sctp_server.cpp) -#end for sctp - -### for ngap -include_directories(${SRC_TOP_DIR}/ngap/ngap_app) -file(GLOB NGAP_SRC ${SRC_TOP_DIR}/ngap/ngap_app/ngap_app.cpp) -###end for ngap - -### for itti include_directories(${SRC_TOP_DIR}/itti) +include_directories(${SRC_TOP_DIR}/itti/msgs) file(GLOB ITTI_SRC ${SRC_TOP_DIR}/itti/itti.cpp ${SRC_TOP_DIR}/itti/itti_msg.cpp ) -###end for itti - -### for log -add_library( LOG STATIC - ${SRC_TOP_DIR}/common/logger.cpp) -add_library( OPTIONS STATIC - ${SRC_TOP_DIR}/oai-amf/options.cpp) -###end for log - -### for config -add_library( CONFIGS STATIC - ${SRC_TOP_DIR}/amf-app/amf_config.cpp) - -pkg_search_module(CONFIG REQUIRED libconfig++) -include_directories(${CONFIG_INCLUDE_DIRS}) -### end for config - -add_executable(amf - #${SRC_TOP_DIR}/oai-amf/main.cpp - #${SRC_TOP_DIR}/ngap/main.cpp - ${SRC_TOP_DIR}/itti/main.cpp - ${COMMON_SRC} ${BSTR_SRC} ${SCTP_SRC} ${NGAP_SRC} ${ITTI_SRC} - ) - -# LOG from oai-amf/CMakeLists.txt -target_link_libraries(amf -Wl,--start-group LOG OPTIONS CONFIGS config++ sctp pthread) diff --git a/src/oai-amf/CMakeLists.txt b/src/oai-amf/CMakeLists.txt index efb72a4cbba82c74ded639a733715c276750ba33..cca615abb43b57ff76816764427a38030919f819 100644 --- a/src/oai-amf/CMakeLists.txt +++ b/src/oai-amf/CMakeLists.txt @@ -94,10 +94,16 @@ message("${OPENAIRCN_DIR}/build/cmake_modules") include_directories(${SRC_TOP_DIR}/oai-amf) include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include) +#include_directories(${SRC_TOP_DIR}/itti) -### for itti msg +### for itti +include_directories(${SRC_TOP_DIR}/itti) include_directories(${SRC_TOP_DIR}/itti/msgs) -###end for itti msg +file(GLOB ITTI_SRC + ${SRC_TOP_DIR}/itti/itti.cpp + ${SRC_TOP_DIR}/itti/itti_msg.cpp +) +###end for itti ### for amf nas include_directories(${SRC_TOP_DIR}/nas) @@ -182,14 +188,6 @@ file(GLOB NGAP_MSGS_IES_SRC ) ### end for -### for itti -include_directories(${SRC_TOP_DIR}/itti) -file(GLOB ITTI_SRC - ${SRC_TOP_DIR}/itti/itti.cpp - ${SRC_TOP_DIR}/itti/itti_msg.cpp -) -###end for itti - ### for authentication include_directories(${SRC_TOP_DIR}/secu_algorithms/5gaka) include_directories(${SRC_TOP_DIR}/secu_algorithms/5gaka/test) diff --git a/src/oai-amf/main.cpp b/src/oai-amf/main.cpp index 056d38b30b4d14ec75ecc85d6e1d8e9f07bba240..99b7652b6612e6d4f0f5ae0246d2ebaa5f9a6e56 100644 --- a/src/oai-amf/main.cpp +++ b/src/oai-amf/main.cpp @@ -33,12 +33,10 @@ extern void ue_gnb_simulator(); using namespace std; using namespace config; -//using namespace ngap; using namespace amf_application; amf_config amf_cfg; amf_modules modules; -//ngap_app * ngap_inst = NULL; itti_mw *itti_inst = nullptr; amf_app *amf_app_inst = nullptr; statistics stacs; diff --git a/src/sctp/sctp_server.cpp b/src/sctp/sctp_server.cpp index 5c6972b5e3db376146060c01b7fa4e95cde5b2ba..d0a3df5d663c31c9e83802e555b01e7daf7063ef 100644 --- a/src/sctp/sctp_server.cpp +++ b/src/sctp/sctp_server.cpp @@ -50,11 +50,6 @@ extern "C" { using namespace std; namespace sctp { -/* - uint32_t sctp_application::getPpid(){ - return ppid_; - } - */ //------------------------------------------------------------------------------ sctp_server::sctp_server(const char *address, const uint16_t port_num) { @@ -135,7 +130,6 @@ void* sctp_server::sctp_receiver_thread(void *arg) { fdmax -= 1; } } - } } } @@ -255,28 +249,6 @@ sctp_association_t* sctp_server::add_new_association(int sd, uint32_t ppid, stru app_->handle_sctp_new_association(new_association->assoc_id, new_association->instreams, new_association->outstreams); return new_association; } -/* - sctp_association_t* sctp_server::sctp_add_new_peer (void){ - sctp_association_t *new_sctp_descriptor = (sctp_association_t*)calloc (1, sizeof (sctp_association_t)); - if (new_sctp_descriptor == NULL) { - Logger::sctp().error("Failed to allocate memory for new peer (%s:%d)",__FILE__,__LINE__); - return NULL; - } - new_sctp_descriptor->next_assoc = NULL; - new_sctp_descriptor->previous_assoc = NULL; - if (sctp_desc.available_connections_tail == NULL) { - sctp_desc.available_connections_head = new_sctp_descriptor; - sctp_desc.available_connections_tail = sctp_desc.available_connections_head; - } else { - new_sctp_descriptor->previous_assoc = sctp_desc.available_connections_tail; - sctp_desc.available_connections_tail->next_assoc = new_sctp_descriptor; - sctp_desc.available_connections_tail = new_sctp_descriptor; - } - sctp_desc.number_of_connections++; - //sctp_dump_list (); - return new_sctp_descriptor; - } - */ //------------------------------------------------------------------------------ sctp_association_t* sctp_server::sctp_is_assoc_in_list(sctp_assoc_id_t assoc_id) { diff --git a/src/sctp/sctp_server.hpp b/src/sctp/sctp_server.hpp index 0e5870424667c09573df501d7e74ba1ac32b3091..c366ce1e6f5083ebd1a3b892ca98d0c506100b66 100644 --- a/src/sctp/sctp_server.hpp +++ b/src/sctp/sctp_server.hpp @@ -79,10 +79,6 @@ class sctp_application { virtual void handle_receive(bstring payload, sctp_assoc_id_t assoc_id, sctp_stream_id_t stream, sctp_stream_id_t instreams, sctp_stream_id_t outstreams) = 0; virtual void handle_sctp_new_association(sctp_assoc_id_t assoc_id, sctp_stream_id_t instreams, sctp_stream_id_t outstreams) = 0; virtual uint32_t getPpid() = 0; -//protected: - //uint32_t ppid_; - //uint32_t getPpid(); - }; class sctp_server { @@ -100,7 +96,6 @@ class sctp_server { int sctp_handle_com_down(sctp_assoc_id_t assoc_id); int sctp_handle_reset(const sctp_assoc_id_t assoc_id); sctp_association_t* add_new_association(int sd, uint32_t ppid, struct sctp_assoc_change *sctp_assoc_changed); - sctp_association_t* sctp_add_new_peer(void); int sctp_get_localaddresses(int sock, struct sockaddr **local_addr, int *nb_local_addresses); int sctp_get_peeraddresses(int sock, struct sockaddr **remote_addr, int *nb_remote_addresses); sctp_association_t* sctp_is_assoc_in_list(sctp_assoc_id_t assoc_id);