Commit e6a7c6d8 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'fqdn_dns' into 'develop'

Fqdn dns

See merge request oai/cn5g/oai-cn5g-amf!28
parents 6071beb4 bfef8dcf
......@@ -128,6 +128,7 @@ check_supported_distribution() {
local distribution=$(get_distribution_release)
case "$distribution" in
"ubuntu18.04") return 0 ;;
"ubuntu20.04") return 0 ;;
"rhel8") return 0 ;;
"rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
......
......@@ -32,6 +32,45 @@ THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
source $THIS_SCRIPT_PATH/build_helper.fb_folly
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_boost_1_66() {
if [ $1 -eq 0 ]; then
read -p "Do you want to install Boost version 1.66.0 ? <y/N> " prompt
OPTION=""
else
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
if [[ $prompt =~ [yY](es)* ]]
then
BOOST_URL=https://boostorg.jfrog.io/artifactory/main/release/1.66.0/source/boost_1_66_0.tar.bz2
echo "Install Boost from $BOOST_URL"
pushd $OPENAIRCN_DIR/build/ext
echo "Downloading Boost 1.66.0"
if [[ $OPTION =~ -[yY](es)* ]]
then
$SUDO rm -rf boost
fi
#git clone $GIT_URL
wget $BOOST_URL
tar --bzip2 -xf boost_1_66_0.tar.bz2
cp -fR boost_1_66_0/boost /usr/include
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -259,6 +298,8 @@ install_nlohmann_from_git() {
#arg2 is debug (0 or 1) (install debug libraries)
check_install_amf_deps(){
var_ubuntu_18_04=0
if [ $1 -gt 0 ]; then
OPTION="-y"
else
......@@ -300,6 +341,7 @@ check_install_amf_deps(){
doxygen \
flex \
gdb \
wget \
git"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
......@@ -319,11 +361,24 @@ check_install_amf_deps(){
echo "Install build tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
# Libraries
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
# Currently Ubuntu18.04 has boost 1.65 as the latest
# We need at least 1.66
# PPA has 1.67
$SUDO add-apt-repository ppa:mhier/libboost-latest --yes
$SUDO $INSTALLER update
#var_ubuntu_18_04=1
if [ $IS_CONTAINER -eq 0 ]; then
specific_packages="libconfig++-dev libasio-dev libboost-all-dev mysql-server"
else
specific_packages="libconfig++-dev"
fi
;;
*)
if [ $IS_CONTAINER -eq 0 ]; then
specific_packages="libconfig++-dev libasio-dev libboost-all-dev mysql-server"
else
......@@ -334,10 +389,10 @@ check_install_amf_deps(){
# removed libspdlog-dev
PACKAGE_LIST="\
$specific_packages \
libboost1.67-dev \
mysql-server \
mysql-client \
libmysqlclient-dev \
libcpprest-dev \
guile-2.0-dev \
libcurl4-gnutls-dev \
libevent-dev \
......@@ -359,6 +414,7 @@ check_install_amf_deps(){
net-tools \
pkg-config \
ninja-build \
wget \
libasan2"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
......@@ -396,8 +452,8 @@ check_install_amf_deps(){
ret=$?;[[ $ret -ne 0 ]] && return $ret
# Use fmt lib included in spdlog
install_fmt $1
ret=$?;[[ $ret -ne 0 ]] && return $ret
# install_fmt $1
# ret=$?;[[ $ret -ne 0 ]] && return $ret
install_spdlog_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
......@@ -411,6 +467,11 @@ check_install_amf_deps(){
install_nlohmann_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
if [ $var_ubuntu_18_04 -ne 0 ]; then
install_boost_1_66 $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
fi
$SUDO ldconfig
return 0
......
......@@ -34,23 +34,30 @@ AMF_CONF[@SD_0@]='123'
AMF_CONF[@SST_1@]='1'
AMF_CONF[@SD_1@]='12'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_NGAP@]='enx0050b6f4ba5b'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_N11@]='enx0050b6f4ba5b'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_NGAP@]='wlo1'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_N11@]='wlo1'
AMF_CONF[@NF_REGISTRATION@]='no'
AMF_CONF[@SMF_SELECTION@]='no'
AMF_CONF[@SMF_INSTANCE_ID_0@]='1'
AMF_CONF[@SMF_IPV4_ADDR_0@]='192.168.122.1'
AMF_CONF[@SMF_HTTP_VERSION_0@]='v1'
AMF_CONF[@SMF_FQDN_0@]='localhost'
AMF_CONF[@SMF_INSTANCE_ID_1@]='2'
AMF_CONF[@SMF_IPV4_ADDR_1@]='192.168.122.2'
AMF_CONF[@SMF_HTTP_VERSION_1@]='v1'
AMF_CONF[@SMF_FQDN_1@]='localhost'
AMF_CONF[@NRF_IPV4_ADDRESS@]='192.168.1.23'
AMF_CONF[@NRF_PORT@]='80'
AMF_CONF[@NRF_API_VERSION@]='v1'
AMF_CONF[@NRF_FQDN@]='localhost'
AMF_CONF[@AUSF_IPV4_ADDRESS@]='192.168.1.23'
AMF_CONF[@AUSF_PORT@]='80'
AMF_CONF[@AUSF_API_VERSION@]='v1'
AMF_CONF[@AUSF_FQDN@]='localhost'
AMF_CONF[@MYSQL_SERVER@]='127.0.0.1'
AMF_CONF[@MYSQL_USER@]='root'
......
......@@ -51,6 +51,7 @@ RUN apt-get update && \
tzdata \
psmisc \
net-tools \
libconfig++-dev \
bc \
tshark \
libconfig++9v5 \
......@@ -65,8 +66,6 @@ COPY --from=oai-amf-builder /openair-amf/scripts/entrypoint.sh entrypoint.sh
WORKDIR /usr/lib/x86_64-linux-gnu
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcpprest.so.2.10 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libssl.so.1.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/librtmp.so.1 .
......@@ -87,6 +86,8 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libasan.so.4 .
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_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/local/lib/libpistache.so .
RUN ldconfig
......
......@@ -34,11 +34,13 @@ ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
vim \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
software-properties-common \
git \
vim \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration commands quite useful
......@@ -63,16 +65,18 @@ RUN ./build_amf --clean --Verbose --build-type Release --jobs
FROM ubuntu:bionic as oai-amf
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
tzdata \
psmisc \
net-tools \
bc \
tshark \
libconfig++9v5 \
libsctp1 \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
tzdata \
psmisc \
net-tools \
libconfig++-dev \
bc \
tshark \
libconfig++9v5 \
libsctp1 \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
......@@ -83,8 +87,6 @@ COPY --from=oai-amf-builder /openair-amf/scripts/entrypoint.sh entrypoint.sh
WORKDIR /usr/lib/x86_64-linux-gnu
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcpprest.so.2.10 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libssl.so.1.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/librtmp.so.1 .
......@@ -105,6 +107,8 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libasan.so.4 .
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_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/local/lib/libpistache.so .
RUN ldconfig
......@@ -119,5 +123,4 @@ WORKDIR /openair-amf
EXPOSE 80/tcp 9090/tcp 38412/sctp
ENTRYPOINT ["/bin/bash","/openair-amf/bin/entrypoint.sh"]
CMD ["/openair-amf/bin/oai_amf", "-c", "/openair-amf/etc/amf.conf", "-o"]
......@@ -72,27 +72,27 @@ AMF =
INTERFACE_NAME = "@AMF_INTERFACE_NAME_FOR_N11@"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
PORT = 80; # YOUR NETWORK CONFIG HERE
API_VERSION = "v1"; # YOUR AMF API VERSION CONFIG HERE
API_VERSION = "v1"; # YOUR AMF API VERSION CONFIG HERE
SMF_INSTANCES_POOL = (
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_0@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_0@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_0@"; SELECTED = "true"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_1@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_1@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_1@"; SELECTED = "false"} # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_0@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_0@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_0@"; FQDN = "@SMF_FQDN_0@", SELECTED = "true"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_1@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_1@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_1@"; FQDN = "@SMF_FQDN_1@", SELECTED = "false"} # YOUR SMF CONFIG HERE
);
};
NRF :
{
IPV4_ADDRESS = "@NRF_IPV4_ADDRESS@"; # YOUR NRF CONFIG HERE
PORT = @NRF_PORT@; # YOUR NRF CONFIG HERE (default: 80)
API_VERSION = "@NRF_API_VERSION@"; # YOUR NRF API VERSION FOR SBI CONFIG HERE
IPV4_ADDRESS = "@NRF_IPV4_ADDRESS@"; # YOUR NRF CONFIG HERE
PORT = @NRF_PORT@; # YOUR NRF CONFIG HERE (default: 80)
API_VERSION = "@NRF_API_VERSION@"; # YOUR NRF API VERSION FOR SBI CONFIG HERE
FQDN = "@NRF_FQDN@"
};
AUSF :
{
IPV4_ADDRESS = "@AUSF_IPV4_ADDRESS@"; # YOUR AUSF CONFIG HERE
PORT = @AUSF_PORT@; # YOUR AUSF CONFIG HERE (default: 80)
API_VERSION = "@AUSF_API_VERSION@"; # YOUR AUSF API VERSION FOR SBI CONFIG HERE
IPV4_ADDRESS = "@AUSF_IPV4_ADDRESS@"; # YOUR AUSF CONFIG HERE
PORT = @AUSF_PORT@; # YOUR AUSF CONFIG HERE (default: 80)
API_VERSION = "@AUSF_API_VERSION@"; # YOUR AUSF API VERSION FOR SBI CONFIG HERE
};
};
......@@ -101,9 +101,10 @@ AMF =
{
# STRING, {"yes", "no"},
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_UDM = "no"; # 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
}
AUTHENTICATION:
......
......@@ -404,13 +404,9 @@ void amf_app::generate_amf_profile() {
nf_service.nf_service_status = "REGISTERED";
// IP Endpoint
ip_endpoint_t endpoint = {};
std::vector<struct in_addr> addrs;
nf_instance_profile.get_nf_ipv4_addresses(addrs);
for (auto a : addrs) {
endpoint.ipv4_addresses.push_back(a);
}
endpoint.transport = "TCP";
endpoint.port = amf_cfg.n11.port;
endpoint.ipv4_address = amf_cfg.n11.addr4;
endpoint.transport = "TCP";
endpoint.port = amf_cfg.n11.port;
nf_service.ip_endpoints.push_back(endpoint);
nf_instance_profile.add_nf_service(nf_service);
......@@ -452,12 +448,17 @@ void amf_app::trigger_nf_registration_request() {
std::make_shared<itti_n11_register_nf_instance_request>(
TASK_AMF_APP, TASK_AMF_N11);
itti_msg->profile = nf_instance_profile;
amf_n11_inst->register_nf_instance(itti_msg);
/*
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::amf_app().error(
"Could not send ITTI message %s to task TASK_AMF_N11",
itti_msg->get_msg_name());
}
*/
}
//------------------------------------------------------------------------------
......
......@@ -40,6 +40,7 @@
#include "logger.hpp"
#include "string.hpp"
#include "thread_sched.hpp"
#include "fqdn.hpp"
extern "C" {
#include <arpa/inet.h>
......@@ -79,6 +80,7 @@ amf_config::amf_config() {
enable_smf_selection = false;
enable_external_ausf = false;
enable_external_udm = false;
use_fqdn_dns = false;
struct {
struct in_addr ipv4_addr;
......@@ -104,6 +106,8 @@ int amf_config::load(const std::string& config_file) {
"\nLoad AMF system configuration file(%s)", config_file.c_str());
Config cfg;
unsigned char buf_in6_addr[sizeof(struct in6_addr)];
// Config file
try {
cfg.readFile(config_file.c_str());
} catch (const FileIOException& fioex) {
......@@ -117,13 +121,18 @@ int amf_config::load(const std::string& config_file) {
pex.getError());
throw;
}
const Setting& root = cfg.getRoot();
// AMF config
try {
const Setting& amf_cfg = root[AMF_CONFIG_STRING_AMF_CONFIG];
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error("%s : %s", nfex.what(), nfex.getPath());
return -1;
}
// Instance
const Setting& amf_cfg = root[AMF_CONFIG_STRING_AMF_CONFIG];
try {
amf_cfg.lookupValue(AMF_CONFIG_STRING_INSTANCE_ID, instance);
......@@ -131,6 +140,8 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// Statistic Timer interval
try {
amf_cfg.lookupValue(
AMF_CONFIG_STRING_STATISTICS_TIMER_INTERVAL, statistics_interval);
......@@ -138,18 +149,24 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// PID Dir
try {
amf_cfg.lookupValue(AMF_CONFIG_STRING_PID_DIRECTORY, pid_dir);
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// AMF Name
try {
amf_cfg.lookupValue(AMF_CONFIG_STRING_AMF_NAME, AMF_Name);
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// GUAMI
try {
const Setting& guami_cfg = amf_cfg[AMF_CONFIG_STRING_GUAMI];
guami_cfg.lookupValue(AMF_CONFIG_STRING_MCC, guami.mcc);
......@@ -161,6 +178,8 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// GUAMI List
try {
const Setting& guami_list_cfg =
amf_cfg[AMF_CONFIG_STRING_SERVED_GUAMI_LIST];
......@@ -179,6 +198,8 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// AMF Capacity
try {
amf_cfg.lookupValue(
AMF_CONFIG_STRING_RELATIVE_AMF_CAPACITY, relativeAMFCapacity);
......@@ -186,6 +207,8 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// PLMN List
try {
const Setting& plmn_list_cfg = amf_cfg[AMF_CONFIG_STRING_PLMN_SUPPORT_LIST];
int count = plmn_list_cfg.getLength();
......@@ -211,13 +234,72 @@ int amf_config::load(const std::string& config_file) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
}
// Supported features
try {
const Setting& support_features =
amf_cfg[AMF_CONFIG_STRING_SUPPORT_FEATURES];
string opt;
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_NF_REGISTRATION, opt);
if (boost::iequals(opt, "yes")) {
enable_nf_registration = true;
} else {
enable_nf_registration = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_SMF_SELECTION, opt);
if (boost::iequals(opt, "yes")) {
enable_smf_selection = true;
} else {
enable_smf_selection = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_AUSF, opt);
if (boost::iequals(opt, "yes")) {
enable_external_ausf = true;
} else {
enable_external_ausf = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_UDM, opt);
if (boost::iequals(opt, "yes")) {
enable_external_udm = true;
} else {
enable_external_udm = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_USE_FQDN_DNS, opt);
if (boost::iequals(opt, "yes")) {
use_fqdn_dns = true;
} else {
use_fqdn_dns = false;
}
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
// Network interfaces
// TODO: should move SMF/NRF/AUSF out of this section
try {
const Setting& new_if_cfg = amf_cfg[AMF_CONFIG_STRING_INTERFACES];
// N2
const Setting& n2_amf_cfg =
new_if_cfg[AMF_CONFIG_STRING_INTERFACE_NGAP_AMF];
load_interface(n2_amf_cfg, n2);
// N11
const Setting& n11_cfg = new_if_cfg[AMF_CONFIG_STRING_INTERFACE_N11];
load_interface(n11_cfg, n11);
// SBI API VERSION
if (!(n11_cfg.lookupValue(
AMF_CONFIG_STRING_API_VERSION, sbi_api_version))) {
......@@ -225,22 +307,60 @@ int amf_config::load(const std::string& config_file) {
throw(AMF_CONFIG_STRING_API_VERSION "failed");
}
// SMF
const Setting& smf_addr_pool =
n11_cfg[AMF_CONFIG_STRING_SMF_INSTANCES_POOL];
int count = smf_addr_pool.getLength();
for (int i = 0; i < count; i++) {
const Setting& smf_addr_item = smf_addr_pool[i];
smf_inst_t smf_inst;
std::string selected;
smf_inst_t smf_inst = {};
struct in_addr smf_ipv4_addr = {};
unsigned int smf_port = {};
std::string smf_api_version = {};
std::string selected = {};
smf_addr_item.lookupValue(AMF_CONFIG_STRING_SMF_INSTANCE_ID, smf_inst.id);
smf_addr_item.lookupValue(AMF_CONFIG_STRING_IPV4_ADDRESS, smf_inst.ipv4);
smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_PORT, smf_inst.port);
smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_VERSION, smf_inst.version);
if (!use_fqdn_dns) {
smf_addr_item.lookupValue(
AMF_CONFIG_STRING_IPV4_ADDRESS, smf_inst.ipv4);
IPV4_STR_ADDR_TO_INADDR(
util::trim(smf_inst.ipv4).c_str(), smf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR SMF !");
if (!(smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_PORT, smf_inst.port))) {
Logger::amf_app().error(AMF_CONFIG_STRING_SMF_INSTANCE_PORT "failed");
throw(AMF_CONFIG_STRING_SMF_INSTANCE_PORT "failed");
}
smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_VERSION, smf_inst.version);
if (!(smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_VERSION, smf_inst.version))) {
Logger::amf_app().error(AMF_CONFIG_STRING_SMF_INSTANCE_VERSION
"failed");
throw(AMF_CONFIG_STRING_SMF_INSTANCE_VERSION "failed");
}
} else {
std::string smf_fqdn = {};
smf_addr_item.lookupValue(AMF_CONFIG_STRING_FQDN_DNS, smf_fqdn);
smf_inst.fqdn = smf_fqdn;
/*
uint8_t addr_type = 0;
fqdn::resolve(smf_fqdn, smf_inst.ipv4, smf_port, addr_type);
if (addr_type != 0) { // IPv6: TODO
throw("DO NOT SUPPORT IPV6 ADDR FOR SMF!");
} else { // IPv4
IPV4_STR_ADDR_TO_INADDR(
util::trim(smf_inst.ipv4).c_str(), smf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR SMF !");
smf_inst.port = std::to_string(smf_port);
smf_inst.version = "v1"; // TODO: get API version
}
*/
}
smf_addr_item.lookupValue(
AMF_CONFIG_STRING_SMF_INSTANCE_SELECTED, selected);
if (!selected.compare("true"))
if (boost::iequals(selected, "true"))
smf_inst.selected = true;
else
smf_inst.selected = false;
......@@ -248,35 +368,53 @@ int amf_config::load(const std::string& config_file) {
}
// NRF
const Setting& nrf_cfg = new_if_cfg[AMF_CONFIG_STRING_NRF];
struct in_addr nrf_ipv4_addr;
unsigned int nrf_port = 0;
std::string nrf_api_version;
string address;
nrf_cfg.lookupValue(AMF_CONFIG_STRING_NRF_IPV4_ADDRESS, address);
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), nrf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR NRF !");
nrf_addr.ipv4_addr = nrf_ipv4_addr;
if (!(nrf_cfg.lookupValue(AMF_CONFIG_STRING_NRF_PORT, nrf_port))) {
Logger::amf_app().error(AMF_CONFIG_STRING_NRF_PORT "failed");
throw(AMF_CONFIG_STRING_NRF_PORT "failed");
}
nrf_addr.port = nrf_port;
if (!(nrf_cfg.lookupValue(
AMF_CONFIG_STRING_API_VERSION, nrf_api_version))) {
Logger::amf_app().error(AMF_CONFIG_STRING_API_VERSION "failed");
throw(AMF_CONFIG_STRING_API_VERSION "failed");
const Setting& nrf_cfg = new_if_cfg[AMF_CONFIG_STRING_NRF];
struct in_addr nrf_ipv4_addr = {};
unsigned int nrf_port = 0;
std::string nrf_api_version = {};
string address = {};
if (!use_fqdn_dns) {
nrf_cfg.lookupValue(AMF_CONFIG_STRING_NRF_IPV4_ADDRESS, address);
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), nrf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR NRF !");
nrf_addr.ipv4_addr = nrf_ipv4_addr;
if (!(nrf_cfg.lookupValue(AMF_CONFIG_STRING_NRF_PORT, nrf_port))) {
Logger::amf_app().error(AMF_CONFIG_STRING_NRF_PORT "failed");
throw(AMF_CONFIG_STRING_NRF_PORT "failed");
}
nrf_addr.port = nrf_port;
if (!(nrf_cfg.lookupValue(
AMF_CONFIG_STRING_API_VERSION, nrf_api_version))) {
Logger::amf_app().error(AMF_CONFIG_STRING_API_VERSION "failed");
throw(AMF_CONFIG_STRING_API_VERSION "failed");
}
nrf_addr.api_version = nrf_api_version;
} else {
std::string nrf_fqdn = {};
nrf_cfg.lookupValue(AMF_CONFIG_STRING_FQDN_DNS, nrf_fqdn);
uint8_t addr_type = {};
fqdn::resolve(nrf_fqdn, address, nrf_port, addr_type);
if (addr_type != 0) { // IPv6: TODO
throw("DO NOT SUPPORT IPV6 ADDR FOR NRF!");
} else { // IPv4
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), nrf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR NRF !");
nrf_addr.ipv4_addr = nrf_ipv4_addr;
nrf_addr.port = nrf_port;
nrf_addr.api_version = "v1"; // TODO: get API version
}
}
nrf_addr.api_version = nrf_api_version;
// AUSF
const Setting& ausf_cfg = new_if_cfg[AMF_CONFIG_STRING_AUSF];
struct in_addr ausf_ipv4_addr;
unsigned int ausf_port = 0;
std::string ausf_api_version;
// string address;
// TODO: add FQDN option
const Setting& ausf_cfg = new_if_cfg[AMF_CONFIG_STRING_AUSF];
struct in_addr ausf_ipv4_addr = {};
unsigned int ausf_port = {};
std::string ausf_api_version = {};
ausf_cfg.lookupValue(AMF_CONFIG_STRING_IPV4_ADDRESS, address);
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), ausf_ipv4_addr,
......@@ -300,6 +438,8 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
// Emergency support
try {
const Setting& core_config = amf_cfg[AMF_CONFIG_STRING_CORE_CONFIGURATION];
core_config.lookupValue(
......@@ -309,6 +449,9 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
// Authentication Info
// TODO: remove operator_key, random
try {
const Setting& auth = amf_cfg[AMF_CONFIG_STRING_AUTHENTICATION];
auth.lookupValue(
......@@ -324,6 +467,8 @@ int amf_config::load(const std::string& config_file) {
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
// Integrity/Ciphering algorithms (NAS)
try {
const Setting& nas = amf_cfg[AMF_CONFIG_STRING_NAS];
const Setting& intAlg =
......@@ -364,47 +509,6 @@ int amf_config::load(const std::string& config_file) {
return -1;
}
try {
const Setting& support_features =
amf_cfg[AMF_CONFIG_STRING_SUPPORT_FEATURES];
string opt;
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_NF_REGISTRATION, opt);
if (boost::iequals(opt, "yes")) {
enable_nf_registration = true;
} else {
enable_nf_registration = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_SMF_SELECTION, opt);
if (boost::iequals(opt, "yes")) {
enable_smf_selection = true;
} else {
enable_smf_selection = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_AUSF, opt);
if (boost::iequals(opt, "yes")) {
enable_external_ausf = true;
} else {
enable_external_ausf = false;
}
support_features.lookupValue(
AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_UDM, opt);
if (boost::iequals(opt, "yes")) {
enable_external_udm = true;
} else {
enable_external_udm = false;
}
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
}
return 1;
}
......@@ -453,53 +557,55 @@ void amf_config::display() {
"- MySQL pass ..............: %s", auth_para.mysql_pass.c_str());
Logger::config().info(
"- MySQL DB ................: %s", auth_para.mysql_db.c_str());
Logger::config().info(
"- operator key ............: %s", auth_para.operator_key.c_str());
Logger::config().info(
"- random ..................: %s", auth_para.random.c_str());
/* Logger::config().info(
"- operator key ............: %s", auth_para.operator_key.c_str());
Logger::config().info(
"- random ..................: %s", auth_para.random.c_str());
*/
Logger::config().info("- N2 Networking:");
Logger::config().info(" iface .................: %s", n2.if_name.c_str());
Logger::config().info(" ip ....................: %s", inet_ntoa(n2.addr4));
Logger::config().info(" port ..................: %d", n2.port);
Logger::config().info(" Iface .................: %s", n2.if_name.c_str());
Logger::config().info(" IP Addr ...............: %s", inet_ntoa(n2.addr4));
Logger::config().info(" Port ..................: %d", n2.port);
Logger::config().info("- SBI Networking:");
Logger::config().info(" iface .................: %s", n11.if_name.c_str());
Logger::config().info(" Iface .................: %s", n11.if_name.c_str());
Logger::config().info(
" ip ....................: %s", inet_ntoa(n11.addr4));
Logger::config().info(" port ..................: %d", n11.port);
" IP Addr ...............: %s", inet_ntoa(n11.addr4));
Logger::config().info(" Port ..................: %d", n11.port);
Logger::config().info(
" API version............: %s", sbi_api_version.c_str());
if (enable_nf_registration or enable_smf_selection) {
Logger::config().info("- NRF:");
Logger::config().info(
" IP addr ...............: %s", inet_ntoa(nrf_addr.ipv4_addr));
" IP Addr ...............: %s", inet_ntoa(nrf_addr.ipv4_addr));
Logger::config().info(" Port ..................: %d", nrf_addr.port);
Logger::config().info(
" Api version ...........: %s", nrf_addr.api_version.c_str());
" API version ...........: %s", nrf_addr.api_version.c_str());
}
if (enable_external_ausf) {
Logger::config().info("- AUSF:");
Logger::config().info(
" IP addr ...............: %s", inet_ntoa(ausf_addr.ipv4_addr));
" IP Addr ...............: %s", inet_ntoa(ausf_addr.ipv4_addr));
Logger::config().info(" Port ..................: %d", ausf_addr.port);
Logger::config().info(
" Api version ...........: %s", ausf_addr.api_version.c_str());
" API version ...........: %s", ausf_addr.api_version.c_str());
}
Logger::config().info("- Remote SMF Pool.........: ");
for (int i = 0; i < smf_pool.size(); i++) {
std::string selected;
if (smf_pool[i].selected)
selected = "true";
else
selected = "false";
Logger::config().info(
" SMF_INSTANCE_ID %d (%s:%s, version %s) is selected: %s",
smf_pool[i].id, smf_pool[i].ipv4.c_str(), smf_pool[i].port.c_str(),
smf_pool[i].version.c_str(), selected.c_str());
if (!enable_smf_selection) {
Logger::config().info("- SMF Pool.........: ");
for (int i = 0; i < smf_pool.size(); i++) {
std::string selected = smf_pool[i].selected ? "true" : "false";
std::string smf_info =
use_fqdn_dns ? smf_pool[i].fqdn : smf_pool[i].ipv4.c_str();
Logger::config().info(
" SMF_INSTANCE_ID %d (%s:%s, version %s) is selected: %s",
smf_pool[i].id, smf_info.c_str(), smf_pool[i].port.c_str(),
smf_pool[i].version.c_str(), selected.c_str());
}
}
Logger::config().info("- Supported Features:");
......@@ -511,6 +617,8 @@ void amf_config::display() {
" External AUSF .........: %s", enable_external_ausf ? "Yes" : "No");
Logger::config().info(
" External UDM ..........: %s", enable_external_udm ? "Yes" : "No");
Logger::config().info(
" Use FQDN ..............: %s", use_fqdn_dns ? "Yes" : "No");
}
//------------------------------------------------------------------------------
......
......@@ -104,6 +104,8 @@
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_SMF_SELECTION "SMF_SELECTION"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_AUSF "EXTERNAL_AUSF"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_UDM "EXTERNAL_UDM"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_USE_FQDN_DNS "USE_FQDN_DNS"
#define AMF_CONFIG_STRING_FQDN_DNS "FQDN"
using namespace libconfig;
......@@ -166,6 +168,7 @@ typedef struct {
std::string port;
std::string version;
bool selected;
std::string fqdn;
} smf_inst_t;
class amf_config {
......@@ -196,6 +199,7 @@ class amf_config {
bool enable_smf_selection;
bool enable_external_ausf;
bool enable_external_udm;
bool use_fqdn_dns;
struct {
struct in_addr ipv4_addr;
......
......@@ -439,7 +439,7 @@ void amf_n1::nas_signalling_establishment_request_handle(
case SERVICE_REQUEST: {
Logger::amf_n1().debug("Received service request message, handling...");
nc.get()->security_ctx->ul_count.seq_num = ulCount;
if (nc.get()) nc.get()->security_ctx->ul_count.seq_num = ulCount;
service_request_handle(
true, nc, ran_ue_ngap_id, amf_ue_ngap_id, plain_msg);
} break;
......
......@@ -47,6 +47,7 @@
#include "SmContextCreateData.h"
#include "mime_parser.hpp"
#include "ue_context.hpp"
#include "fqdn.hpp"
extern "C" {
#include "dynamic_memory_check.h"
......@@ -127,6 +128,14 @@ void amf_n11_task(void*) {
dynamic_cast<itti_pdu_session_resource_setup_response*>(msg);
amf_n11_inst->handle_itti_message(ref(*m));
} break;
case N11_REGISTER_NF_INSTANCE_REQUEST: {
Logger::amf_n11().info(
"Receive Register NF Instance Request, handling ...");
itti_n11_register_nf_instance_request* m =
dynamic_cast<itti_n11_register_nf_instance_request*>(msg);
// TODO: Handle ITTI
} break;
default: {
Logger::amf_n11().info(
"Receive unknown message type %d", msg->msg_type);
......@@ -464,8 +473,26 @@ bool amf_n11::smf_selection_from_configuration(
std::string& smf_addr, std::string& smf_api_version) {
for (int i = 0; i < amf_cfg.smf_pool.size(); i++) {
if (amf_cfg.smf_pool[i].selected) {
smf_addr = amf_cfg.smf_pool[i].ipv4 + ":" + amf_cfg.smf_pool[i].port;
smf_api_version = amf_cfg.smf_pool[i].version;
if (!amf_cfg.use_fqdn_dns) {
smf_addr = amf_cfg.smf_pool[i].ipv4 + ":" + amf_cfg.smf_pool[i].port;
smf_api_version = amf_cfg.smf_pool[i].version;
return true;
} else {
// resolve IP addr from a FQDN/DNS name
uint8_t addr_type = 0;
uint32_t smf_port = 0;
fqdn::resolve(
amf_cfg.smf_pool[i].fqdn, amf_cfg.smf_pool[i].ipv4, smf_port,
addr_type);
if (addr_type != 0) { // IPv6: TODO
Logger::amf_n11().warn("Do not support IPv6 Addr for SMF");
return false;
} else { // IPv4
smf_addr = amf_cfg.smf_pool[i].ipv4 + ":" + std::to_string(smf_port);
smf_api_version = "v1"; // TODO: get API version
return true;
}
}
return true;
}
}
......@@ -816,6 +843,80 @@ bool amf_n11::discover_smf(
return result;
}
//-----------------------------------------------------------------------------------------------------
void amf_n11::register_nf_instance(
std::shared_ptr<itti_n11_register_nf_instance_request> msg) {
Logger::amf_n11().debug(
"Send NF Instance Registration to NRF (HTTP version %d)",
msg->http_version);
nlohmann::json json_data = {};
msg->profile.to_json(json_data);
std::string url =
std::string(inet_ntoa(*((struct in_addr*) &amf_cfg.nrf_addr.ipv4_addr))) +
":" + std::to_string(amf_cfg.nrf_addr.port) + "/nnrf-nfm/" +
amf_cfg.nrf_addr.api_version + "/nf-instances/" +
msg->profile.get_nf_instance_id();
Logger::amf_n11().debug(
"Send NF Instance Registration to NRF, NRF URL %s", url.c_str());
std::string body = json_data.dump();
Logger::amf_n11().debug(
"Send NF Instance Registration to NRF, msg body: \n %s", body.c_str());
curl_global_init(CURL_GLOBAL_ALL);
CURL* curl = curl = curl_easy_init();
if (curl) {
CURLcode res = {};
struct curl_slist* headers = nullptr;
// headers = curl_slist_append(headers, "charsets: utf-8");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS);
curl_easy_setopt(curl, CURLOPT_INTERFACE, amf_cfg.n11.if_name.c_str());
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
// Response information.
long httpCode = {0};
std::unique_ptr<std::string> httpData(new std::string());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData.get());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, body.length());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::amf_n11().debug(
"NFDiscovery, response from NRF, HTTP Code: %d", httpCode);
if (httpCode == 200) {
Logger::amf_n11().debug(
"NFRegistration, got successful response from NRF");
nlohmann::json response_data = {};
try {
response_data = nlohmann::json::parse(*httpData.get());
} catch (nlohmann::json::exception& e) {
Logger::amf_n11().warn(
"NFDiscovery, could not parse json from the NRF "
"response");
}
Logger::amf_n11().debug(
"NFDiscovery, response from NRF, json data: \n %s",
response_data.dump().c_str());
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
}
}
//-----------------------------------------------------------------------------------------------------
bool amf_n11::send_ue_authentication_request(
oai::amf::model::AuthenticationInfo& auth_info,
......
......@@ -75,7 +75,8 @@ class amf_n11 {
bool discover_smf(
std::string& smf_addr, std::string& smf_api_version,
const snssai_t snssai, const plmn_t plmn, const std::string dnn);
void register_nf_instance(
std::shared_ptr<itti_n11_register_nf_instance_request> msg);
bool send_ue_authentication_request(
oai::amf::model::AuthenticationInfo& auth_info,
oai::amf::model::UEAuthenticationCtx& ue_auth_ctx, uint8_t http_version);
......
......@@ -371,11 +371,9 @@ void amf_profile::to_json(nlohmann::json& data) const {
for (auto endpoint : service.ip_endpoints) {
nlohmann::json ep_tmp = {};
ep_tmp["ipv4Address"] = nlohmann::json::array();
for (auto address : endpoint.ipv4_addresses) {
ep_tmp["ipv4Address"].push_back(inet_ntoa(address));
}
ep_tmp["transport"] = endpoint.transport;
ep_tmp["port"] = endpoint.port;
ep_tmp["ipv4Address"] = inet_ntoa(endpoint.ipv4_address);
ep_tmp["transport"] = endpoint.transport;
ep_tmp["port"] = endpoint.port;
srv_tmp["ipEndPoints"].push_back(ep_tmp);
}
......
......@@ -276,16 +276,14 @@ typedef struct nf_service_version_s {
} nf_service_version_t;
typedef struct ip_endpoint_s {
std::vector<struct in_addr> ipv4_addresses;
// std::vector<struct in6_addr> ipv6_addresses;
struct in_addr ipv4_address;
// struct in6_addr ipv6_address;
std::string transport; // TCP
unsigned int port;
std::string to_string() const {
std::string s = {};
s.append("Ipv4 Addresses: ");
for (auto ipv4 : ipv4_addresses) {
s.append(inet_ntoa(ipv4));
}
s.append("Ipv4 Address: ");
s.append(inet_ntoa(ipv4_address));
s.append(", TransportProtocol: ");
s.append(transport);
s.append(", Port: ");
......
......@@ -35,5 +35,6 @@ add_library (AMF_UTILS STATIC
${CMAKE_CURRENT_SOURCE_DIR}/string.cpp
${CMAKE_CURRENT_SOURCE_DIR}/thread_sched.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mime_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fqdn.cpp
)
/*
* 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 "fqdn.hpp"
#include "logger.hpp"
#include <boost/asio.hpp>
#include <iostream>
bool fqdn::resolve(
const std::string& host_name, std::string& address, uint32_t& port,
uint8_t& addr_type, const std::string& protocol) {
try {
boost::asio::io_context io_context = {};
boost::asio::ip::tcp::resolver resolver{io_context};
boost::asio::ip::tcp::resolver::results_type endpoints =
resolver.resolve(host_name, protocol);
addr_type = 0; // IPv4 by default
for (auto it = endpoints.cbegin(); it != endpoints.cend(); it++) {
// get the first Endpoint
boost::asio::ip::tcp::endpoint endpoint = *it;
address = endpoint.address().to_string();
port = endpoint.port();
Logger::amf_app().debug(
"Resolve a DNS (name %s, protocol %s): Ip Addr %s, port %u",
host_name.c_str(), protocol.c_str(), address.c_str(), port);
if (endpoint.address().is_v4())
addr_type = 0;
else
addr_type = 1;
return true;
}
} catch (std::exception& e) {
throw std::runtime_error(
"Cannot resolve a DNS name " + std::string(e.what()));
return false;
}
return false;
}
/*
* 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
*/
/*! \file fqdn.hpp
\brief
\author
\company Eurecom
\email:
*/
#ifndef FILE_FQDN_HPP_SEEN
#define FILE_FQDN_HPP_SEEN
#include <string>
class fqdn {
public:
/*
* Resolve a DNS name to get host's IP Addr
* @param [const std::string &] host_name: host's name/url
* @param [const std::string &] protocol: protocol
* @param [uint8_t &] addr_type: addr_type (Ipv4/v6)
* @return void
*/
static bool resolve(
const std::string& host_name, std::string& address, uint32_t& port,
uint8_t& addr_type, const std::string& protocol = "http");
};
#endif /* FILE_FQDN_HPP_SEEN */
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