Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-NRF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-NRF
Commits
fcbb4bde
Commit
fcbb4bde
authored
Dec 05, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first version for NRF
parent
cd82e5e8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
100 deletions
+90
-100
build/nrf/CMakeLists.txt
build/nrf/CMakeLists.txt
+3
-5
build/scripts/build_helper.nrf
build/scripts/build_helper.nrf
+4
-4
build/scripts/build_nrf
build/scripts/build_nrf
+24
-24
src/oai-nrf/CMakeLists.txt
src/oai-nrf/CMakeLists.txt
+35
-35
src/oai-nrf/main.cpp
src/oai-nrf/main.cpp
+23
-31
src/oai-nrf/options.cpp
src/oai-nrf/options.cpp
+1
-1
No files found.
build/
sm
f/CMakeLists.txt
→
build/
nr
f/CMakeLists.txt
View file @
fcbb4bde
...
@@ -21,8 +21,8 @@
...
@@ -21,8 +21,8 @@
cmake_minimum_required
(
VERSION 3.0.2
)
cmake_minimum_required
(
VERSION 3.0.2
)
project
(
oai-cn
)
project
(
oai-cn
)
# Override options for
SM
F
# Override options for
NR
F
set
(
PACKAGE_NAME
"
SM
F"
)
set
(
PACKAGE_NAME
"
NR
F"
)
set
(
STATIC_LINKING False
)
set
(
STATIC_LINKING False
)
#############################################
#############################################
# Base directories, compatible with legacy OAI building
# Base directories, compatible with legacy OAI building
...
@@ -31,6 +31,4 @@ set (OPENAIRCN_DIR $ENV{OPENAIRCN_DIR})
...
@@ -31,6 +31,4 @@ set (OPENAIRCN_DIR $ENV{OPENAIRCN_DIR})
set
(
BUILD_TOP_DIR
${
OPENAIRCN_DIR
}
/build
)
set
(
BUILD_TOP_DIR
${
OPENAIRCN_DIR
}
/build
)
set
(
SRC_TOP_DIR $ENV{OPENAIRCN_DIR}/src
)
set
(
SRC_TOP_DIR $ENV{OPENAIRCN_DIR}/src
)
include
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/oai_smf/CMakeLists.txt
)
include
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/oai-nrf/CMakeLists.txt
)
ADD_SUBDIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/smf_app
${
CMAKE_CURRENT_BINARY_DIR
}
/smf_app
)
build/scripts/build_helper.
sm
f
→
build/scripts/build_helper.
nr
f
View file @
fcbb4bde
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
# contact@openairinterface.org
# contact@openairinterface.org
################################################################################
################################################################################
# file build_helper.
sm
f
# file build_helper.
nr
f
# brief
# brief
# author Laurent Thomas, Lionel GAUTHIER
# author Laurent Thomas, Lionel GAUTHIER
#
#
...
@@ -99,7 +99,7 @@ install_spdlog_from_git() {
...
@@ -99,7 +99,7 @@ install_spdlog_from_git() {
git clone $GIT_URL
git clone $GIT_URL
cd spdlog && git checkout master
cd spdlog && git checkout master
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
# enable syslog, Useless (defined in
SM
F code)
# enable syslog, Useless (defined in
NR
F code)
sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h
sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h
popd
popd
fi
fi
...
@@ -268,7 +268,7 @@ install_nghttp2_from_git() {
...
@@ -268,7 +268,7 @@ install_nghttp2_from_git() {
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
#arg2 is debug (0 or 1) (install debug libraries)
check_install_
sm
f_deps() {
check_install_
nr
f_deps() {
if [ $1 -gt 0 ]; then
if [ $1 -gt 0 ]; then
OPTION="-y"
OPTION="-y"
...
@@ -408,7 +408,7 @@ check_install_smf_deps() {
...
@@ -408,7 +408,7 @@ check_install_smf_deps() {
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
#arg2 is debug (0 or 1) (install debug libraries)
check_install_
sm
f_min_deps() {
check_install_
nr
f_min_deps() {
if [ $1 -gt 0 ]; then
if [ $1 -gt 0 ]; then
OPTION="-y"
OPTION="-y"
...
...
build/scripts/build_
sm
f
→
build/scripts/build_
nr
f
View file @
fcbb4bde
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
# For more information about the OpenAirInterface (OAI) Software Alliance:
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
# contact@openairinterface.org
################################################################################
################################################################################
# file build_
sm
f
# file build_
nr
f
# brief
# brief
# author Lionel Gauthier
# author Lionel Gauthier
# company Eurecom
# company Eurecom
...
@@ -33,14 +33,14 @@ INSTALL_DIR=/usr/local/bin
...
@@ -33,14 +33,14 @@ INSTALL_DIR=/usr/local/bin
# include helper functions
# include helper functions
################################
################################
THIS_SCRIPT_PATH
=
$(
dirname
$(
readlink
-f
$0
))
THIS_SCRIPT_PATH
=
$(
dirname
$(
readlink
-f
$0
))
source
$THIS_SCRIPT_PATH
/build_helper.
sm
f
source
$THIS_SCRIPT_PATH
/build_helper.
nr
f
function
help
()
function
help
()
{
{
echo_error
" "
echo_error
" "
echo_error
"Usage: build_
sm
f [OPTION]..."
echo_error
"Usage: build_
nr
f [OPTION]..."
echo_error
"Build the
SM
F executable."
echo_error
"Build the
NR
F executable."
echo_error
" "
echo_error
" "
echo_error
"Options:"
echo_error
"Options:"
echo_error
"Mandatory arguments to long options are mandatory for short options too."
echo_error
"Mandatory arguments to long options are mandatory for short options too."
...
@@ -48,8 +48,8 @@ function help()
...
@@ -48,8 +48,8 @@ function help()
echo_error
" -c, --clean Clean the build generated files: config, object, executable files (build from scratch)"
echo_error
" -c, --clean Clean the build generated files: config, object, executable files (build from scratch)"
echo_error
" -f, --force No interactive script for installation of software packages."
echo_error
" -f, --force No interactive script for installation of software packages."
echo_error
" -h, --help Print this help."
echo_error
" -h, --help Print this help."
echo_error
" -I, --install-deps Check installed software necessary to build and run
SM
F (support
$SUPPORTED_DISTRO
)."
echo_error
" -I, --install-deps Check installed software necessary to build and run
NR
F (support
$SUPPORTED_DISTRO
)."
echo_error
" -i, --install-min-deps Check installed software necessary to run a statically linked
SM
F (support
$SUPPORTED_DISTRO
)."
echo_error
" -i, --install-min-deps Check installed software necessary to run a statically linked
NR
F (support
$SUPPORTED_DISTRO
)."
echo_error
" -j, --jobs Multiple jobs for compiling."
echo_error
" -j, --jobs Multiple jobs for compiling."
echo_error
" -v, --verbose Build process verbose."
echo_error
" -v, --verbose Build process verbose."
echo_error
" -V, --Verbose CMake only build process verbose, display compilation warnings and errors."
echo_error
" -V, --Verbose CMake only build process verbose, display compilation warnings and errors."
...
@@ -99,13 +99,13 @@ function main()
...
@@ -99,13 +99,13 @@ function main()
return
0
return
0
;;
;;
-I
|
--install-deps
)
-I
|
--install-deps
)
echo
"Check installed software necessary to build and run
SM
F (support
$SUPPORTED_DISTRO
):"
echo
"Check installed software necessary to build and run
NR
F (support
$SUPPORTED_DISTRO
):"
set_openair_env
set_openair_env
var_check_install_deps
=
1
var_check_install_deps
=
1
shift
;
shift
;
;;
;;
-i
|
--install-min-deps
)
-i
|
--install-min-deps
)
echo
"Check installed software necessary to run
SM
F (support
$SUPPORTED_DISTRO
):"
echo
"Check installed software necessary to run
NR
F (support
$SUPPORTED_DISTRO
):"
set_openair_env
set_openair_env
var_check_install_min_deps
=
1
var_check_install_min_deps
=
1
shift
;
shift
;
...
@@ -149,26 +149,26 @@ function main()
...
@@ -149,26 +149,26 @@ function main()
if
[
$var_check_install_min_deps
-gt
0
]
;
then
if
[
$var_check_install_min_deps
-gt
0
]
;
then
disable_ipv6
disable_ipv6
check_install_
sm
f_min_deps
$force
$debug
check_install_
nr
f_min_deps
$force
$debug
if
[[
$?
-ne
0
]]
;
then
if
[[
$?
-ne
0
]]
;
then
echo_error
"Error:
SM
F minimal deps installation failed"
echo_error
"Error:
NR
F minimal deps installation failed"
return
1
return
1
else
else
echo_success
"
SM
F minimal deps installation successful"
echo_success
"
NR
F minimal deps installation successful"
echo_warning
"
SMF not compiled, to compile it, re-run build_sm
f without -i option"
echo_warning
"
NRF not compiled, to compile it, re-run build_nr
f without -i option"
return
0
return
0
fi
fi
fi
fi
if
[
$var_check_install_deps
-gt
0
]
;
then
if
[
$var_check_install_deps
-gt
0
]
;
then
disable_ipv6
disable_ipv6
check_install_
sm
f_deps
$force
$debug
check_install_
nr
f_deps
$force
$debug
if
[[
$?
-ne
0
]]
;
then
if
[[
$?
-ne
0
]]
;
then
echo_error
"Error:
SM
F deps installation failed"
echo_error
"Error:
NR
F deps installation failed"
return
1
return
1
else
else
echo_success
"
SM
F deps installation successful"
echo_success
"
NR
F deps installation successful"
echo_warning
"
SMF not compiled, to compile it, re-run build_sm
f without -I option"
echo_warning
"
NRF not compiled, to compile it, re-run build_nr
f without -I option"
return
0
return
0
fi
fi
fi
fi
...
@@ -178,19 +178,19 @@ function main()
...
@@ -178,19 +178,19 @@ function main()
##############################################################################
##############################################################################
# Clean
# Clean
##############################################################################
##############################################################################
cd
$OPENAIRCN_DIR
/build/
sm
f
cd
$OPENAIRCN_DIR
/build/
nr
f
if
[
$clean
-ne
0
]
;
then
if
[
$clean
-ne
0
]
;
then
if
[[
$verbose
-eq
1
]]
;
then
if
[[
$verbose
-eq
1
]]
;
then
echo
"Cleaning
SM
F: generated configuration files, obj files, executable"
echo
"Cleaning
NR
F: generated configuration files, obj files, executable"
fi
fi
rm
-Rf
$OPENAIRCN_DIR
/build/
sm
f/build 2>&1
rm
-Rf
$OPENAIRCN_DIR
/build/
nr
f/build 2>&1
mkdir
-m
777
-p
-v
build
mkdir
-m
777
-p
-v
build
fi
fi
##############################################################################
##############################################################################
# Compile
SM
F
# Compile
NR
F
##############################################################################
##############################################################################
cd
$OPENAIRCN_DIR
/build/
sm
f
cd
$OPENAIRCN_DIR
/build/
nr
f
if
[
!
-d
./build
]
;
then
if
[
!
-d
./build
]
;
then
mkdir
-m
777
-p
-v
build
mkdir
-m
777
-p
-v
build
fi
fi
...
@@ -199,12 +199,12 @@ function main()
...
@@ -199,12 +199,12 @@ function main()
$CMAKE
$cmake_args
..
>
/dev/null
$CMAKE
$cmake_args
..
>
/dev/null
ret
=
$?
;
[[
$ret
-ne
0
]]
&&
return
$ret
ret
=
$?
;
[[
$ret
-ne
0
]]
&&
return
$ret
compilations
smf smf
$OPENAIRCN_DIR
/build/smf/build/sm
f
$verbose
compilations
nrf nrf
$OPENAIRCN_DIR
/build/nrf/build/nr
f
$verbose
ret
=
$?
;
[[
$ret
-ne
0
]]
&&
return
$ret
ret
=
$?
;
[[
$ret
-ne
0
]]
&&
return
$ret
# For daemon should not be group writable
# For daemon should not be group writable
$SUDO
chmod
755
$OPENAIRCN_DIR
/build/
smf/build/sm
f
$SUDO
chmod
755
$OPENAIRCN_DIR
/build/
nrf/build/nr
f
$SUDO
cp
-upv
$OPENAIRCN_DIR
/build/
smf/build/smf
$INSTALL_DIR
&&
$SUDO
chmod
755
$INSTALL_DIR
/smf
&&
echo_success
"sm
f installed"
$SUDO
cp
-upv
$OPENAIRCN_DIR
/build/
nrf/build/nrf
$INSTALL_DIR
&&
$SUDO
chmod
755
$INSTALL_DIR
/nrf
&&
echo_success
"nr
f installed"
return
0
return
0
}
}
...
...
src/oai-nrf/CMakeLists.txt
View file @
fcbb4bde
...
@@ -262,60 +262,60 @@ else(STATIC_LINKING)
...
@@ -262,60 +262,60 @@ else(STATIC_LINKING)
SET
(
BUILD_SHARED_LIBS ON
)
SET
(
BUILD_SHARED_LIBS ON
)
endif
(
STATIC_LINKING
)
endif
(
STATIC_LINKING
)
ADD_SUBDIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/common
${
CMAKE_CURRENT_BINARY_DIR
}
/common
)
#
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/common ${CMAKE_CURRENT_BINARY_DIR}/common)
ADD_SUBDIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/common/utils
${
CMAKE_CURRENT_BINARY_DIR
}
/utils
)
#
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/common/utils ${CMAKE_CURRENT_BINARY_DIR}/utils)
ADD_SUBDIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/pfcp
${
CMAKE_CURRENT_BINARY_DIR
}
/pfcp
)
#
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/pfcp ${CMAKE_CURRENT_BINARY_DIR}/pfcp)
ADD_SUBDIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/udp
${
CMAKE_CURRENT_BINARY_DIR
}
/udp
)
#
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/udp ${CMAKE_CURRENT_BINARY_DIR}/udp)
ADD_SUBDIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/api-server
${
CMAKE_CURRENT_BINARY_DIR
}
/api-server
)
ADD_SUBDIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/api-server
${
CMAKE_CURRENT_BINARY_DIR
}
/api-server
)
ADD_SUBDIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../src/nas
${
CMAKE_CURRENT_BINARY_DIR
}
/nas
)
#
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/nas ${CMAKE_CURRENT_BINARY_DIR}/nas)
#ENABLE_TESTING()
#ENABLE_TESTING()
#ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/test ${CMAKE_CURRENT_BINARY_DIR}/test)
#ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../../src/test ${CMAKE_CURRENT_BINARY_DIR}/test)
################################################################################
################################################################################
# Specific part for oai_
sm
f folder
# Specific part for oai_
nr
f folder
add_definitions
(
"-DPACKAGE_NAME=
\"
SMF
\"
"
)
add_definitions
(
"-DPACKAGE_NAME=
\"
SMF
\"
"
)
include_directories
(
${
SRC_TOP_DIR
}
/sm
f_app
)
#include_directories(${SRC_TOP_DIR}/nr
f_app)
include_directories
(
${
SRC_TOP_DIR
}
/oai_sm
f
)
#include_directories(${SRC_TOP_DIR}/oai_nr
f)
include_directories
(
${
SRC_TOP_DIR
}
/itti
)
#
include_directories(${SRC_TOP_DIR}/itti)
include_directories
(
${
SRC_TOP_DIR
}
/common
)
#
include_directories(${SRC_TOP_DIR}/common)
include_directories
(
${
SRC_TOP_DIR
}
/common/msg
)
#
include_directories(${SRC_TOP_DIR}/common/msg)
include_directories
(
${
SRC_TOP_DIR
}
/common/nas
)
#
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories
(
${
SRC_TOP_DIR
}
/common/utils
)
#
include_directories(${SRC_TOP_DIR}/common/utils)
include_directories
(
${
SRC_TOP_DIR
}
/common/utils/bstr
)
#
include_directories(${SRC_TOP_DIR}/common/utils/bstr)
include_directories
(
${
SRC_TOP_DIR
}
/pfcp
)
#
include_directories(${SRC_TOP_DIR}/pfcp)
include_directories
(
${
SRC_TOP_DIR
}
/udp
)
#
include_directories(${SRC_TOP_DIR}/udp)
include_directories
(
${
SRC_TOP_DIR
}
/../build/ext/spdlog/include
)
include_directories
(
${
SRC_TOP_DIR
}
/../build/ext/spdlog/include
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server/api
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server/api
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server/impl
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server/impl
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server/model
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server/model
)
include_directories
(
${
SRC_TOP_DIR
}
/nas
)
#
include_directories(${SRC_TOP_DIR}/nas)
include_directories
(
${
SRC_TOP_DIR
}
/nas/ies
)
#
include_directories(${SRC_TOP_DIR}/nas/ies)
include_directories
(
${
SRC_TOP_DIR
}
/nas/mm
)
#
include_directories(${SRC_TOP_DIR}/nas/mm)
include_directories
(
${
SRC_TOP_DIR
}
/nas/mm/msg
)
#
include_directories(${SRC_TOP_DIR}/nas/mm/msg)
include_directories
(
${
SRC_TOP_DIR
}
/nas/sm
)
#
include_directories(${SRC_TOP_DIR}/nas/sm)
include_directories
(
${
SRC_TOP_DIR
}
/nas/sm/msg
)
#
include_directories(${SRC_TOP_DIR}/nas/sm/msg)
include_directories
(
${
SRC_TOP_DIR
}
/nas/security
)
#
include_directories(${SRC_TOP_DIR}/nas/security)
include_directories
(
${
SRC_TOP_DIR
}
/ngap
)
#
include_directories(${SRC_TOP_DIR}/ngap)
include_directories
(
${
SRC_TOP_DIR
}
/ngap/asn1c
)
#
include_directories(${SRC_TOP_DIR}/ngap/asn1c)
include_directories
(
${
SRC_TOP_DIR
}
/ngap/ies
)
#
include_directories(${SRC_TOP_DIR}/ngap/ies)
add_executable
(
sm
f
add_executable
(
nr
f
${
SRC_TOP_DIR
}
/oai
_sm
f/main.cpp
${
SRC_TOP_DIR
}
/oai
-nr
f/main.cpp
${
SRC_TOP_DIR
}
/oai
_sm
f/options.cpp
${
SRC_TOP_DIR
}
/oai
-nr
f/options.cpp
${
SRC_TOP_DIR
}
/itti/itti.cpp
#
${SRC_TOP_DIR}/itti/itti.cpp
${
SRC_TOP_DIR
}
/itti/itti_msg.cpp
#
${SRC_TOP_DIR}/itti/itti_msg.cpp
)
)
IF
(
STATIC_LINKING
)
IF
(
STATIC_LINKING
)
SET
(
CMAKE_EXE_LINKER_FLAGS
"-static"
)
SET
(
CMAKE_EXE_LINKER_FLAGS
"-static"
)
SET_TARGET_PROPERTIES
(
sm
f PROPERTIES LINK_SEARCH_END_STATIC 1
)
SET_TARGET_PROPERTIES
(
nr
f PROPERTIES LINK_SEARCH_END_STATIC 1
)
# asan do not support static linking
# asan do not support static linking
SET
(
ASAN
)
SET
(
ASAN
)
ENDIF
(
STATIC_LINKING
)
ENDIF
(
STATIC_LINKING
)
target_link_libraries
(
sm
f
${
ASAN
}
target_link_libraries
(
nr
f
${
ASAN
}
-Wl,--start-group
CN_UTILS SMF UDP PFCP 3GPP_COMMON_TYPES SMF_API -lnettle
${
NETTLE_LIBRARIES
}
${
CRYPTO_LIBRARIES
}
-lnghttp2_asio -lboost_system -lboost_thread -lssl -lcrypto NAS
gflags glog dl double-conversion folly -Wl,--end-group pthread m rt config++ event boost_system pistache curl
)
-Wl,--start-group
-lnettle
${
NETTLE_LIBRARIES
}
${
CRYPTO_LIBRARIES
}
-lnghttp2_asio -lboost_system -lboost_thread -lssl -lcrypto
gflags glog dl double-conversion folly -Wl,--end-group pthread m rt config++ event boost_system pistache curl
)
\ No newline at end of file
src/oai-nrf/main.cpp
View file @
fcbb4bde
...
@@ -15,19 +15,14 @@
...
@@ -15,19 +15,14 @@
*/
*/
#include "async_shell_cmd.hpp"
#include "common_defs.h"
#include "itti.hpp"
#include "logger.hpp"
#include "options.hpp"
#include "options.hpp"
#include "pid_file.hpp"
#include "smf_app.hpp"
//#include "smf-api-server.h"
#include "smf_config.hpp"
#include "smf-api-server.h"
#include "pistache/endpoint.h"
#include "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/http.h"
#include "pistache/router.h"
#include "pistache/router.h"
#include "smf-http2-server.h"
//
#include "smf-http2-server.h"
#include <iostream>
#include <iostream>
#include <thread>
#include <thread>
...
@@ -36,17 +31,10 @@
...
@@ -36,17 +31,10 @@
#include <stdlib.h> // srand
#include <stdlib.h> // srand
#include <unistd.h> // get_pid(), pause()
#include <unistd.h> // get_pid(), pause()
using
namespace
smf
;
//
using namespace smf;
using
namespace
util
;
//
using namespace util;
using
namespace
std
;
using
namespace
std
;
using
namespace
oai
::
smf_server
::
api
;
//using namespace oai::smf_server::api;
itti_mw
*
itti_inst
=
nullptr
;
async_shell_cmd
*
async_shell_cmd_inst
=
nullptr
;
smf_app
*
smf_app_inst
=
nullptr
;
smf_config
smf_cfg
;
SMFApiServer
*
smf_api_server_1
=
nullptr
;
smf_http2_server
*
smf_api_server_2
=
nullptr
;
void
send_heartbeat_to_tasks
(
const
uint32_t
sequence
);
void
send_heartbeat_to_tasks
(
const
uint32_t
sequence
);
...
@@ -54,17 +42,19 @@ void send_heartbeat_to_tasks(const uint32_t sequence);
...
@@ -54,17 +42,19 @@ void send_heartbeat_to_tasks(const uint32_t sequence);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
send_heartbeat_to_tasks
(
const
uint32_t
sequence
)
void
send_heartbeat_to_tasks
(
const
uint32_t
sequence
)
{
{
itti_msg_ping
*
itti_msg
=
new
itti_msg_ping
(
TASK_SMF_APP
,
TASK_ALL
,
sequence
);
/*
itti_msg_ping *itti_msg = new itti_msg_ping(TASK_SMF_APP, TASK_ALL, sequence);
std::shared_ptr<itti_msg_ping> i = std::shared_ptr<itti_msg_ping>(itti_msg);
std::shared_ptr<itti_msg_ping> i = std::shared_ptr<itti_msg_ping>(itti_msg);
int ret = itti_inst->send_broadcast_msg(i);
int ret = itti_inst->send_broadcast_msg(i);
if (RETURNok != ret) {
if (RETURNok != ret) {
Logger::smf_app().error( "Could not send ITTI message %s to task TASK_ALL", i->get_msg_name());
Logger::smf_app().error( "Could not send ITTI message %s to task TASK_ALL", i->get_msg_name());
}
}
*/
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
my_app_signal_handler
(
int
s
)
void
my_app_signal_handler
(
int
s
)
{
{
/*
std::cout << "Caught signal " << s << std::endl;
std::cout << "Caught signal " << s << std::endl;
Logger::system().startup( "exiting" );
Logger::system().startup( "exiting" );
itti_inst->send_terminate_msg(TASK_SMF_APP);
itti_inst->send_terminate_msg(TASK_SMF_APP);
...
@@ -88,6 +78,7 @@ void my_app_signal_handler(int s)
...
@@ -88,6 +78,7 @@ void my_app_signal_handler(int s)
if (smf_app_inst) delete smf_app_inst; smf_app_inst = nullptr;
if (smf_app_inst) delete smf_app_inst; smf_app_inst = nullptr;
std::cout << "SMF APP memory done." << std::endl;
std::cout << "SMF APP memory done." << std::endl;
std::cout << "Freeing Allocated memory done" << std::endl;
std::cout << "Freeing Allocated memory done" << std::endl;
*/
exit
(
0
);
exit
(
0
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -103,9 +94,9 @@ int main(int argc, char **argv)
...
@@ -103,9 +94,9 @@ int main(int argc, char **argv)
}
}
// Logger
// Logger
Logger
::
init
(
"smf"
,
Options
::
getlogStdout
()
,
Options
::
getlogRotFilelog
());
//
Logger::init( "smf" , Options::getlogStdout() , Options::getlogRotFilelog());
Logger
::
smf_app
().
startup
(
"Options parsed"
);
//
Logger::smf_app().startup( "Options parsed" );
struct
sigaction
sigIntHandler
;
struct
sigaction
sigIntHandler
;
sigIntHandler
.
sa_handler
=
my_app_signal_handler
;
sigIntHandler
.
sa_handler
=
my_app_signal_handler
;
...
@@ -114,27 +105,28 @@ int main(int argc, char **argv)
...
@@ -114,27 +105,28 @@ int main(int argc, char **argv)
sigaction
(
SIGINT
,
&
sigIntHandler
,
NULL
);
sigaction
(
SIGINT
,
&
sigIntHandler
,
NULL
);
// Config
// Config
smf_cfg
.
load
(
Options
::
getlibconfigConfig
());
//
smf_cfg.load(Options::getlibconfigConfig());
smf_cfg
.
display
();
//
smf_cfg.display();
// Inter task Interface
// Inter task Interface
itti_inst
=
new
itti_mw
();
//
itti_inst = new itti_mw();
itti_inst
->
start
(
smf_cfg
.
itti
.
itti_timer_sched_params
);
//
itti_inst->start(smf_cfg.itti.itti_timer_sched_params);
// system command
// system command
async_shell_cmd_inst
=
new
async_shell_cmd
(
smf_cfg
.
itti
.
async_cmd_sched_params
);
//
async_shell_cmd_inst = new async_shell_cmd(smf_cfg.itti.async_cmd_sched_params);
// SMF application layer
// SMF application layer
smf_app_inst
=
new
smf_app
(
Options
::
getlibconfigConfig
());
//
smf_app_inst = new smf_app(Options::getlibconfigConfig());
// PID file
// PID file
// Currently hard-coded value. TODO: add as config option.
// Currently hard-coded value. TODO: add as config option.
string
pid_file_name
=
get_exe_absolute_path
(
"/var/run"
,
smf_cfg
.
instance
);
/*
string pid_file_name = get_exe_absolute_path("/var/run", smf_cfg.instance);
if (! is_pid_file_lock_success(pid_file_name.c_str())) {
if (! is_pid_file_lock_success(pid_file_name.c_str())) {
Logger::smf_app().error( "Lock PID file %s failed\n", pid_file_name.c_str());
Logger::smf_app().error( "Lock PID file %s failed\n", pid_file_name.c_str());
exit (-EDEADLK);
exit (-EDEADLK);
}
}
*/
/*
//SMF Pistache API server (HTTP1)
//SMF Pistache API server (HTTP1)
Pistache::Address addr(std::string(inet_ntoa (*((struct in_addr *)&smf_cfg.sbi.addr4))) , Pistache::Port(smf_cfg.sbi.port));
Pistache::Address addr(std::string(inet_ntoa (*((struct in_addr *)&smf_cfg.sbi.addr4))) , Pistache::Port(smf_cfg.sbi.port));
smf_api_server_1 = new SMFApiServer(addr, smf_app_inst);
smf_api_server_1 = new SMFApiServer(addr, smf_app_inst);
...
@@ -155,7 +147,7 @@ int main(int argc, char **argv)
...
@@ -155,7 +147,7 @@ int main(int argc, char **argv)
fprintf(fp, "STARTED\n");
fprintf(fp, "STARTED\n");
fflush(fp);
fflush(fp);
fclose(fp);
fclose(fp);
*/
pause
();
pause
();
return
0
;
return
0
;
}
}
src/oai-nrf/options.cpp
View file @
fcbb4bde
...
@@ -31,7 +31,7 @@ bool Options::m_log_stdout;
...
@@ -31,7 +31,7 @@ bool Options::m_log_stdout;
void
Options
::
help
()
void
Options
::
help
()
{
{
std
::
cout
<<
std
::
endl
std
::
cout
<<
std
::
endl
<<
"Usage:
sm
f [OPTIONS]..."
<<
std
::
endl
<<
"Usage:
nr
f [OPTIONS]..."
<<
std
::
endl
<<
" -h, --help Print help and exit"
<<
std
::
endl
<<
" -h, --help Print help and exit"
<<
std
::
endl
<<
" -c, --libconfigcfg filename Read the application configuration from this file."
<<
std
::
endl
<<
" -c, --libconfigcfg filename Read the application configuration from this file."
<<
std
::
endl
<<
" -o, --stdoutlog Send the application logs to STDOUT fd."
<<
std
::
endl
<<
" -o, --stdoutlog Send the application logs to STDOUT fd."
<<
std
::
endl
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment