Commit 91343e3d authored by gauthier's avatar gauthier

air mouvement around namespaces continued, dynamic PAA, conversions , toString() member functions

parent 89d52393
......@@ -50,6 +50,7 @@ function help()
echo_error " -h, --help Print this help."
echo_error " -I, --install-deps Check installed software necessary to build and run S/P-GW-C (support $SUPPORTED_DISTRO)."
echo_error " -i, --install-min-deps Check installed software necessary to run a statically linked S/P-GW-C (support $SUPPORTED_DISTRO)."
echo_error " -j, --jobs Multiple jobs for compiling."
echo_error " -v, --verbose Build process verbose."
echo_error " -V, --Verbose CMake only build process verbose, display compilation warnings and errors."
echo_error " "
......@@ -64,7 +65,7 @@ function main()
local -i var_check_install_min_deps=0
local -i var_check_install_deps=0
local cmake_args=" "
export make_args="-j`nproc`"
export make_args=" "
until [ -z "$1" ]
......@@ -109,6 +110,10 @@ function main()
var_check_install_min_deps=1
shift;
;;
-j | --jobs)
make_args="$make_args -j`nproc`"
shift;
;;
-v | --verbose)
echo "Make build process verbose"
cmake_args="$cmake_args -DCMAKE_VERBOSE_MAKEFILE=ON"
......@@ -121,7 +126,7 @@ function main()
verbose=1
shift;
;;
*)
*)
echo "Unknown option $1"
help
return 1
......@@ -129,16 +134,16 @@ function main()
esac
done
if [ ! -d /usr/local/etc/oai ]; then
$SUDO mkdir -m 777 -p /usr/local/etc/oai
fi
set_openair_env
set_openair_env
local dlog=$OPENAIRCN_DIR/build/log
local dext=$OPENAIRCN_DIR/build/ext
mkdir -m 777 -p $dlog
mkdir -m 777 -p $dext
......@@ -154,7 +159,7 @@ function main()
return 0
fi
fi
if [ $var_check_install_deps -gt 0 ];then
disable_ipv6
check_install_spgwc_deps $force $debug
......@@ -167,7 +172,7 @@ function main()
return 0
fi
fi
cmake_args="$cmake_args -DBUILD_SHARED_LIBS=OFF"
##############################################################################
......@@ -189,7 +194,7 @@ function main()
if [ ! -d ./build ]; then
mkdir -m 777 -p -v build
fi
cd ./build
$CMAKE $cmake_args .. > /dev/null
ret=$?;[[ $ret -ne 0 ]] && return $ret
......
......@@ -3,9 +3,9 @@
# 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 OpenAirInterface Software Alliance licenses this file to You under
# the Apache License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License.
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
......@@ -50,6 +50,7 @@ function help()
echo_error " -h, --help Print this help."
echo_error " -I, --install-deps Check installed software necessary to build and run S/P-GW-U (support $SUPPORTED_DISTRO)."
echo_error " -i, --install-min-deps Check installed software necessary to run a statically linked S/P-GW-U (support $SUPPORTED_DISTRO)."
echo_error " -j, --jobs Multiple jobs for compiling."
echo_error " -v, --verbose Build process verbose."
echo_error " -V, --Verbose CMake only build process verbose, display compilation warnings and errors."
echo_error " "
......@@ -64,7 +65,7 @@ function main()
local -i var_check_install_min_deps=0
local -i var_check_install_deps=0
local cmake_args=" "
export make_args="-j`nproc`"
export make_args=" "
until [ -z "$1" ]
......@@ -105,6 +106,10 @@ function main()
var_check_install_min_deps=1
shift;
;;
-j | --jobs)
make_args="$make_args -j`nproc`"
shift;
;;
-v | --verbose)
echo "Make build process verbose"
cmake_args="$cmake_args -DCMAKE_VERBOSE_MAKEFILE=ON"
......@@ -117,7 +122,7 @@ function main()
verbose=1
shift;
;;
*)
*)
echo "Unknown option $1"
help
return 1
......@@ -130,11 +135,11 @@ function main()
$SUDO mkdir -m 777 -p /usr/local/etc/oai
fi
set_openair_env
set_openair_env
local dlog=$OPENAIRCN_DIR/build/log
local dext=$OPENAIRCN_DIR/build/ext
mkdir -m 777 -p $dlog
mkdir -m 777 -p $dext
......@@ -162,7 +167,7 @@ function main()
return 0
fi
fi
cmake_args="$cmake_args -DBUILD_SHARED_LIBS=OFF"
##############################################################################
# Clean
......@@ -183,7 +188,7 @@ function main()
if [ ! -d ./build ]; then
mkdir -m 777 -p -v build
fi
cd ./build
$CMAKE $cmake_args .. > /dev/null
ret=$?;[[ $ret -ne 0 ]] && return $ret
......
......@@ -18,12 +18,46 @@
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
S-GW =
S-GW =
{
INSTANCE = @INSTANCE@; # 0 is the default
PID_DIRECTORY = "@PID_DIRECTORY@"; # /var/run is the default
INTERFACES :
ITTI_TASKS :
{
ITTI_TIMER_SCHED_PARAMS :
{
CPU_ID = 1;
SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY = 85;
};
S11_SCHED_PARAMS :
{
CPU_ID = 1;
SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY = 84;
};
S5S8_SCHED_PARAMS :
{
CPU_ID = 1;
SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY = 84;
};
SX_SCHED_PARAMS :
{
CPU_ID = 1;
SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY = 84;
};
ASYNC_CMD_SCHED_PARAMS :
{
CPU_ID = 1;
SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY = 84;
};
};
INTERFACES :
{
S11_CP :
{
......@@ -31,6 +65,12 @@ S-GW =
INTERFACE_NAME = "@SGW_INTERFACE_NAME_FOR_S11@"; # STRING, interface name, YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read"; # STRING, CIDR or read to let app read interface configured IP address, YOUR NETWORK CONFIG HERE
PORT = 2123; # INTEGER, port number, PREFER NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING
SCHED_PARAMS : # SCHEADULING PARAMS OF THE LOOPING RECEIVER THREAD BOUND TO THIS INTERFACE/PROTOCOL
{
CPU_ID = 1;
SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY = 95;
};
};
S5_S8_CP :
{
......@@ -38,16 +78,22 @@ S-GW =
INTERFACE_NAME = "@SGW_INTERFACE_NAME_FOR_S5_S8_CP@"; # STRING, interface name
IPV4_ADDRESS = "read"; # STRING, CIDR or read to let app read interface configured IP address
PORT = 2123;
SCHED_PARAMS : # SCHEADULING PARAMS OF THE LOOPING RECEIVER THREAD BOUND TO THIS INTERFACE/PROTOCOL
{
CPU_ID = 1;
SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY = 95;
};
};
};
};
P-GW =
P-GW =
{
INSTANCE = @INSTANCE@; # 0 is the default
PID_DIRECTORY = "@PID_DIRECTORY@"; # /var/run is the default
INTERFACES :
INTERFACES :
{
S5_S8_CP :
{
......@@ -55,6 +101,12 @@ P-GW =
INTERFACE_NAME = "@PGW_INTERFACE_NAME_FOR_S5_S8_CP@"; # STRING, interface name
IPV4_ADDRESS = "read"; # STRING, CIDR or read to let app read interface configured IP address
PORT = 2123;
SCHED_PARAMS : # SCHEADULING PARAMS OF THE LOOPING RECEIVER THREAD BOUND TO THIS INTERFACE/PROTOCOL
{
CPU_ID = 1;
SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY = 95;
};
};
SX :
{
......@@ -62,10 +114,16 @@ P-GW =
INTERFACE_NAME = "@PGW_INTERFACE_NAME_FOR_SX@"; # STRING, interface name
IPV4_ADDRESS = "read"; # STRING, CIDR or read to let app read interface configured IP address
PORT = 8805;
SCHED_PARAMS : # SCHEADULING PARAMS OF THE LOOPING RECEIVER THREAD BOUND TO THIS INTERFACE/PROTOCOL
{
CPU_ID = 1;
SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY = 95;
};
};
};
# Pool of UE assigned IP addresses
# Do not make IP pools overlap
# first IPv4 address X.Y.Z.1 is reserved for GTP network device on SPGW
......@@ -88,16 +146,16 @@ P-GW =
{PREFIX = "4001:1:2::/64";} # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
);
};
APN_LIST = (
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDN_TYPE choice in {IPv4, IPv6, IPv4v6}
{APN_NI = "default"; PDN_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1; SNAT = "no"},
{APN_NI = "default"; PDN_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1; SNAT = "no"},
{APN_NI = "apn1"; PDN_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1; SNAT = "no"},
{APN_NI = "apn2"; PDN_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1; SNAT = "no"},
{APN_NI = "apn3"; PDN_TYPE = "IPv4"; IPV4_POOL = 3; IPV6_POOL = -1; SNAT = "no"},
{APN_NI = "apn2"; PDN_TYPE = "IPv4"; IPV4_POOL = 4; IPV6_POOL = -1; SNAT = "no"}
);
# DNS address communicated to UEs
DEFAULT_DNS_IPV4_ADDRESS = "@DEFAULT_DNS_IPV4_ADDRESS@"; # YOUR NETWORK CONFIG HERE
DEFAULT_DNS_SEC_IPV4_ADDRESS = "@DEFAULT_DNS_SEC_IPV4_ADDRESS@"; # YOUR NETWORK CONFIG HERE
......@@ -105,8 +163,8 @@ P-GW =
DEFAULT_DNS_SEC_IPV6_ADDRESS = "2001:4860:4860::8844"; # FFU
# Non standard feature, normally should be set to "no", but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling
FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # STRING, {"yes", "no"}.
FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # STRING, {"yes", "no"}.
PCEF :
{
# Waiting for HSS APN-AMBR IE ...
......
This diff is collapsed.
......@@ -31,8 +31,6 @@
#include <stdint.h>
#include <string>
namespace oai::cn::core {
//------------------------------------------------------------------------------
// 10.5.1.3 Location Area Identification
//------------------------------------------------------------------------------
......@@ -341,5 +339,5 @@ typedef struct traffic_flow_template_s {
#define TFT_ENCODE_IEI_FALSE false
#define TFT_ENCODE_LENGTH_TRUE true
#define TFT_ENCODE_LENGTH_FALSE false
}
#endif /* FILE_3GPP_24_008_SEEN */
This diff is collapsed.
......@@ -31,13 +31,16 @@
#include "common_root_types.h"
#include "3gpp_24.008.h"
#include "3gpp_commons.h"
#include "conversions.hpp"
#include "logger.hpp" // for fmt::format in spdlog
#include <arpa/inet.h>
#include <stdint.h>
#include <string>
namespace oai::cn::proto::gtpv2c {
extern const char* interface_type2char[];
namespace gtpv2c {
struct gtpc_exception : public std::exception {
gtpc_exception() throw() {
......@@ -361,17 +364,9 @@ public:
}
namespace oai::cn::core {
//TODO create util namespace
struct in_addr fromString(const std::string addr4);
std::string toString(const struct in_addr& inaddr);
std::string toString(const struct in6_addr& in6addr);
std::string mccToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3);
std::string mncToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3);
//------------------------------------------------------------------------------
// 8.3 International Mobile Subscriber Identity (IMSI)
typedef struct imsi_s {
struct imsi_s {
union {
struct {
uint8_t digit1:4;
......@@ -395,9 +390,49 @@ typedef struct imsi_s {
uint8_t b[IMSI_BCD8_SIZE];
} u1;
uint num_digits;
} imsi_t;
std::string toString(const oai::cn::core::imsi_t& imsi);
std::string toString() const
{
std::string s = {};
int l_i = 0;
int l_j = 0;
while(l_i < IMSI_BCD8_SIZE) {
if((u1.b[l_i] & 0xf) > 9)
break;
s.append(std::to_string(u1.b[l_i] & 0xf));
l_j++;
if(((u1.b[l_i] & 0xf0) >> 4) > 9)
break;
s.append(std::to_string((u1.b[l_i] & 0xf0) >> 4));
l_j++;
l_i++;
}
return s;
}
//------------------------------------------------------------------------------
imsi64_t to_imsi64() const
{
imsi64_t imsi64 = 0;
for (int i=0; i < IMSI_BCD8_SIZE; i++) {
uint8_t d2 = u1.b[i];
uint8_t d1 = (d2 & 0xf0) >> 4;
d2 = d2 & 0x0f;
if (10 > d1) {
imsi64 = imsi64*10 + d1;
if (10 > d2) {
imsi64 = imsi64*10 + d2;
} else {
break;
}
} else {
break;
}
}
return imsi64;
}
} ;
typedef struct imsi_s imsi_t;
//-------------------------------------
// 8.4 Cause
......@@ -667,13 +702,14 @@ enum pdn_type_e {
PDN_TYPE_E_IPV4V6 = 3,
PDN_TYPE_E_NON_IP = 4,
};
static const std::vector<std::string> pdn_type_e2str = {"Error", "IPV4", "IPV6", "IPV4V6", "NON_IP"};
typedef struct pdn_type_s {
uint8_t pdn_type;
//------------------------------------------------------------------------------
const std::string& toString() const {return pdn_type_e2str.at(pdn_type);}
} pdn_type_t;
const std::string& pdn_type_e2string(uint8_t pdn_type);
std::string toString(const oai::cn::core::pdn_type_t& pdn_type);
//-------------------------------------
// 8.14 PDN Address Allocation (PAA)
typedef struct paa_s {
......@@ -703,7 +739,7 @@ typedef struct bearer_qos_s {
uint64_t guaranted_bit_rate_for_uplink;
uint64_t guaranted_bit_rate_for_downlink;
bool is_arp_equals(const struct bearer_qos_s& q) {
bool is_arp_equals(const struct bearer_qos_s& q) const{
if ((q.label_qci == label_qci) &&
(q.pl == pl) &&
(q.pvi == pvi) &&
......@@ -712,9 +748,23 @@ typedef struct bearer_qos_s {
}
return false;
}
//------------------------------------------------------------------------------
std::string toString() const
{
std::string s = {};
s.append("MBR UL=").append(std::to_string(maximum_bit_rate_for_uplink));
s.append(", MBR DL=").append(std::to_string(maximum_bit_rate_for_downlink));
s.append(", GBR UL=").append(std::to_string(guaranted_bit_rate_for_uplink));
s.append(", GBR DL=").append(std::to_string(guaranted_bit_rate_for_downlink));
s.append(", PCI=").append(std::to_string(pci));
s.append(", PL=").append(std::to_string(pl));
s.append(", PVI=").append(std::to_string(pvi));
s.append(", QCI=").append(std::to_string(label_qci));
return s;
}
} bearer_qos_t;
std::string toString(const oai::cn::core::bearer_qos_t& bearer_qos);
//-------------------------------------
// 8.16 Flow Quality of Service (Flow QoS)
typedef struct flow_qos_s {
......@@ -816,9 +866,23 @@ typedef struct gtpc2c_ecgi_field_s {
uint8_t spare :4;
uint8_t eci :4;
uint8_t e_utran_cell_identifier[3];
//------------------------------------------------------------------------------
std::string toString() const
{
std::string s = {};
std::string mccs = conv::mccToString(mcc_digit_1, mcc_digit_2,mcc_digit_3);
std::string mncs = conv::mncToString(mnc_digit_1, mnc_digit_2,mnc_digit_3);
s.append("mcc=").append(mccs).append(", MNC=").append(mncs);
s.append(", ECI=").append(std::to_string(eci));
uint32_t we_utran_cell_identifier = static_cast<uint32_t>(e_utran_cell_identifier[0]) << 16;
we_utran_cell_identifier |= (static_cast<uint32_t>(e_utran_cell_identifier[1]) << 8);
we_utran_cell_identifier |= static_cast<uint32_t>(e_utran_cell_identifier[2]);
s.append(", EUCI=").append(std::to_string(we_utran_cell_identifier));
return s;
}
} ecgi_field_t;
std::string toString(const oai::cn::core::ecgi_field_t& ecgi_field);
//-------------------------------------
// 8.21.6 LAI field
......@@ -932,22 +996,71 @@ enum interface_type_e {
INTERFACE_TYPE_MAX = S11_SGW_GTP_U
};
std::string toString(const oai::cn::core::interface_type_e& interface_type);
struct interface_type_s {
interface_type_e interface_type;
typedef struct fully_qualified_tunnel_endpoint_identifier_s {
interface_type_s() : interface_type(INTERFACE_TYPE_MIN) {}
interface_type_s(interface_type_e t) : interface_type(t) {}
//------------------------------------------------------------------------------
std::string toString() const
{
if ((interface_type >= INTERFACE_TYPE_MIN) && (interface_type <= INTERFACE_TYPE_MAX)) {
return std::string(interface_type2char[interface_type]);
} else {
return std::to_string(interface_type);
}
}
};
typedef struct interface_type_s interface_type_t;
struct fully_qualified_tunnel_endpoint_identifier_s {
uint8_t v4 :1;
uint8_t v6 :1;
uint8_t interface_type :6;
uint32_t teid_gre_key;
struct in_addr ipv4_address;
struct in6_addr ipv6_address;
} fully_qualified_tunnel_endpoint_identifier_t;
typedef fully_qualified_tunnel_endpoint_identifier_t fteid_t;
bool operator==(const struct fully_qualified_tunnel_endpoint_identifier_s& f) const
{
return (teid_gre_key == f.teid_gre_key) and
(ipv4_address.s_addr == f.ipv4_address.s_addr) and
(interface_type == f.interface_type) and
(ipv6_address.s6_addr32[0] == f.ipv6_address.s6_addr32[0]) and
(ipv6_address.s6_addr32[1] == f.ipv6_address.s6_addr32[1]) and
(ipv6_address.s6_addr32[2] == f.ipv6_address.s6_addr32[2]) and
(ipv6_address.s6_addr32[3] == f.ipv6_address.s6_addr32[3]) and
(v4 == f.v4) and
(v6 == f.v6);
}
//------------------------------------------------------------------------------
std::string toString() const
{
std::string s = {};
interface_type_t iface_type((interface_type_e)interface_type);
if ((v4) || (v6)) {
s.append("Interface type=").append(iface_type.toString());
s.append(", TEID=").append(std::to_string(teid_gre_key));
if (v4) {
s.append(", IPv4=").append(conv::toString(ipv4_address));
}
if (v6) {
s.append(", IPv6=").append(conv::toString(ipv6_address));
}
} else {
s.append("null_fteid");
}
return s;
}
bool is_zero() const {return ((!v4) and(!v6));}
} ;
typedef struct fully_qualified_tunnel_endpoint_identifier_s fully_qualified_tunnel_endpoint_identifier_t;
typedef struct fully_qualified_tunnel_endpoint_identifier_s fteid_t;
bool is_fteid_zero(const fteid_t& f);
bool is_fteid_equal(const fteid_t& f1, const fteid_t& f2);
std::string toString(const oai::cn::core::fteid_t& fteid);
//-------------------------------------
// 8.24 Global CN-Id
......@@ -1779,5 +1892,4 @@ typedef struct maximum_packet_loss_rate_s {
// 8.135 APN Rate Control Status
// 8.136 Extended Trace Information
}
#endif /* FILE_3GPP_29_274_SEEN */
......@@ -38,7 +38,7 @@
#include <string>
#include <vector>
namespace oai::cn::proto::gtpv1u {
namespace gtpv1u {
struct gtpu_exception : public std::exception {
gtpu_exception() throw() {
......@@ -149,8 +149,6 @@ public:
} // namespace
namespace oai::cn::core {
// 8.2 Recovery
// 8.3 Tunnel Endpoint Identifier Data I
......@@ -178,5 +176,4 @@ typedef struct extension_header_type_list_s {
// std::string extension_value;
//} private_extension_t;
}
#endif /* FILE_3GPP_29_281_SEEN */
......@@ -28,22 +28,12 @@
#ifndef FILE_3GPP_COMMONS_SEEN
#define FILE_3GPP_COMMONS_SEEN
#include "common_root_types.h"
#include "logger.hpp" // for fmt::format in spdlog
#include <arpa/inet.h>
#include <stdint.h>
#include <string>
#include <vector>
namespace oai::cn::core {
// 8.2 Recovery
typedef struct recovery_s {
uint8_t restart_counter;
} recovery_t;
}
#endif /* FILE_3GPP_29_281_SEEN */
#endif /* FILE_3GPP_COMMONS_SEEN */
......@@ -26,7 +26,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
add_library(3GPP_COMMON_TYPES STATIC
${CMAKE_CURRENT_SOURCE_DIR}/common_root_types.c
${CMAKE_CURRENT_SOURCE_DIR}/logger.cpp
)
......
......@@ -30,60 +30,12 @@
#define FILE_COMMON_DEFS_SEEN
#include <arpa/inet.h>
#ifdef __cplusplus
extern "C" {
#endif
#define RETURNclear (int)2
#define RETURNerror (int)1
#define RETURNok (int)0
//------------------------------------------------------------------------------
#define DECODE_U8(bUFFER, vALUE, sIZE) \
vALUE = *(uint8_t*)(bUFFER); \
sIZE += sizeof(uint8_t)
#define DECODE_U16(bUFFER, vALUE, sIZE) \
vALUE = ntohs(*(uint16_t*)(bUFFER)); \
sIZE += sizeof(uint16_t)
#define DECODE_U24(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*)(bUFFER)) >> 8; \
sIZE += sizeof(uint8_t) + sizeof(uint16_t)
#define DECODE_U32(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*)(bUFFER)); \
sIZE += sizeof(uint32_t)
#if (BYTE_ORDER == LITTLE_ENDIAN)
# define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \
vALUE = ((*(bUFFER)) << 8) | (*((bUFFER) + 1)); \
sIZE += sizeof(uint16_t)
#else
# define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \
vALUE = (*(bUFFER)) | (*((bUFFER) + 1) << 8); \
sIZE += sizeof(uint16_t)
#endif
#define ENCODE_U8(buffer, value, size) \
*(uint8_t*)(buffer) = value; \
size += sizeof(uint8_t)
#define ENCODE_U16(buffer, value, size) \
*(uint16_t*)(buffer) = htons(value); \
size += sizeof(uint16_t)
#define ENCODE_U24(buffer, value, size) \
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint8_t) + sizeof(uint16_t)
#define ENCODE_U32(buffer, value, size) \
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint32_t)
#define IPV4_STR_ADDR_TO_INADDR(AdDr_StR,InAdDr,MeSsAgE ) do {\
if ( inet_aton(AdDr_StR, &InAdDr ) <= 0 ) {\
throw (MeSsAgE);\
......@@ -96,33 +48,8 @@ extern "C" {
(uint8_t)((addr & 0x00FF0000) >> 16), \
(uint8_t)((addr & 0xFF000000) >> 24)
#define HIPADDR(addr) \
(uint8_t)((addr & 0xFF000000) >> 24),\
(uint8_t)((addr & 0x00FF0000) >> 16),\
(uint8_t)((addr & 0x0000FF00) >> 8), \
(uint8_t)(addr & 0x000000FF)
#define NIP6ADDR(addr) \
ntohs((addr)->s6_addr16[0]), \
ntohs((addr)->s6_addr16[1]), \
ntohs((addr)->s6_addr16[2]), \
ntohs((addr)->s6_addr16[3]), \
ntohs((addr)->s6_addr16[4]), \
ntohs((addr)->s6_addr16[5]), \
ntohs((addr)->s6_addr16[6]), \
ntohs((addr)->s6_addr16[7])
#define IN6_ARE_ADDR_MASKED_EQUAL(a,b,m) \
(((((__const uint32_t *) (a))[0] & (((__const uint32_t *) (m))[0])) == (((__const uint32_t *) (b))[0] & (((__const uint32_t *) (m))[0]))) \
&& ((((__const uint32_t *) (a))[1] & (((__const uint32_t *) (m))[1])) == (((__const uint32_t *) (b))[1] & (((__const uint32_t *) (m))[1]))) \
&& ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2]))) \
&& ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3]))))
#ifndef UNUSED
#define UNUSED(x) (void)(x)
#endif
#ifdef __cplusplus
}
#endif
#endif /* FILE_COMMON_DEFS_SEEN */
......@@ -25,36 +25,4 @@
\email: lionel.gauthier@eurecom.fr
*/
#include "common_root_types.h"
#include "3gpp_23.003.h"
#ifdef __cplusplus
extern "C" {
#endif
//------------------------------------------------------------------------------
imsi64_t imsi_to_imsi64(imsi_t * const imsi)
{
imsi64_t imsi64 = INVALID_IMSI64;
if (imsi) {
imsi64 = 0;
for (int i=0; i < IMSI_BCD8_SIZE; i++) {
uint8_t d2 = imsi->u.value[i];
uint8_t d1 = (d2 & 0xf0) >> 4;
d2 = d2 & 0x0f;
if (10 > d1) {
imsi64 = imsi64*10 + d1;
if (10 > d2) {
imsi64 = imsi64*10 + d2;
} else {
break;
}
} else {
break;
}
}
}
return imsi64;
}
#ifdef __cplusplus
}
#endif
......@@ -32,9 +32,6 @@
#include <inttypes.h>
#include <arpa/inet.h>
#ifdef __cplusplus
extern "C" {
#endif
//------------------------------------------------------------------------------
#define PRIORITY_LEVEL_MAX (15)
#define PRIORITY_LEVEL_MIN (1)
......@@ -45,14 +42,14 @@ extern "C" {
// TEIDs
typedef uint32_t teid_t;
#define TEID_FMT "0x%" PRIx32
#define TEID_FMT "0x%" PRIx32
#define TEID_SCAN_FMT SCNx32
#define INVALID_TEID ((teid_t)0x00000000)
#define UNASSIGNED_TEID ((teid_t)0x00000000)
// SEIDs
typedef uint64_t seid_t;
#define SEID_FMT "0x%" PRIx64
#define SEID_FMT "0x%" PRIx64
#define SEID_SCAN_FMT SCNx64
#define INVALID_SEID ((seid_t)0x00000000)
#define UNASSIGNED_SEID ((seid_t)0x00000000)
......@@ -65,15 +62,11 @@ typedef uint64_t imsi64_t;
//------------------------------------------------------------------------------
typedef uint64_t bitrate_t;
#define PRIORITY_LEVEL_FMT "0x%" PRIu8
#define QCI_FMT "0x%" PRIu8
#define QCI_SCAN_FMT SCNu8
#define PRIORITY_LEVEL_FMT "0x%" PRIu8
#define QCI_FMT "0x%" PRIu8
#define QCI_SCAN_FMT SCNu8
#define PRE_EMPTION_CAPABILITY_FMT "0x%" PRIu8
#define PRE_EMPTION_VULNERABILITY_FMT "0x%" PRIu8
#define PRE_EMPTION_CAPABILITY_FMT "0x%" PRIu8
#define PRE_EMPTION_VULNERABILITY_FMT "0x%" PRIu8
#ifdef __cplusplus
}
#endif
#endif /* FILE_COMMON_ROOT_TYPES_SEEN */
......@@ -31,8 +31,6 @@
#include "itti_msg.hpp"
namespace oai::cn::core::itti {
class itti_async_shell_cmd : public itti_msg {
public:
itti_async_shell_cmd(const task_id_t origin, const task_id_t destination, const std::string& system_cmd, bool is_abort_on_error, const char * src_file, const int src_line):
......@@ -46,5 +44,5 @@ public:
std::string src_file;
int src_line;
} ;
}
#endif /* FILE_ITTI_ASYNC_SHELL_CMD_SEEN */
......@@ -32,9 +32,7 @@
#include "3gpp_29.274.hpp"
#include "itti_msg.hpp"
#include "msg_gtpv2c.hpp"
#include <boost/asio.hpp>
namespace oai::cn::core::itti {
#include <boost/asio/ip/udp.hpp>
class itti_s11_msg : public itti_msg {
public:
......@@ -76,7 +74,7 @@ public:
const char* get_msg_name() {return typeid(itti_s11_create_session_request).name();};
proto::gtpv2c::gtpv2c_create_session_request gtp_ies;
gtpv2c::gtpv2c_create_session_request gtp_ies;
};
//-----------------------------------------------------------------------------
......@@ -104,7 +102,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_create_session_response).name();};
proto::gtpv2c::gtpv2c_create_session_response gtp_ies;
gtpv2c::gtpv2c_create_session_response gtp_ies;
};
//-----------------------------------------------------------------------------
......@@ -133,7 +131,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_create_session_request).name();};
proto::gtpv2c::gtpv2c_create_bearer_request gtp_ies;
gtpv2c::gtpv2c_create_bearer_request gtp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -176,7 +174,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_create_bearer_response).name();};
proto::gtpv2c::gtpv2c_create_bearer_response gtp_ies;
gtpv2c::gtpv2c_create_bearer_response gtp_ies;
};
......@@ -206,7 +204,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_modify_bearer_request).name();};
proto::gtpv2c::gtpv2c_modify_bearer_request gtp_ies;
gtpv2c::gtpv2c_modify_bearer_request gtp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -235,7 +233,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_modify_bearer_response).name();};
proto::gtpv2c::gtpv2c_modify_bearer_response gtp_ies;
gtpv2c::gtpv2c_modify_bearer_response gtp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -252,7 +250,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_delete_session_request).name();};
proto::gtpv2c::gtpv2c_delete_session_request gtp_ies;
gtpv2c::gtpv2c_delete_session_request gtp_ies;
} ;
......@@ -283,7 +281,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_delete_session_response).name();};
proto::gtpv2c::gtpv2c_delete_session_response gtp_ies;
gtpv2c::gtpv2c_delete_session_response gtp_ies;
} ;
......@@ -312,7 +310,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_release_access_bearers_request).name();};
proto::gtpv2c::gtpv2c_release_access_bearers_request gtp_ies;
gtpv2c::gtpv2c_release_access_bearers_request gtp_ies;
} ;
......@@ -345,7 +343,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_release_access_bearers_response).name();};
proto::gtpv2c::gtpv2c_release_access_bearers_response gtp_ies;
gtpv2c::gtpv2c_release_access_bearers_response gtp_ies;
};
//-----------------------------------------------------------------------------
......@@ -372,7 +370,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_delete_bearer_command).name();};
proto::gtpv2c::gtpv2c_delete_bearer_command gtp_ies;
gtpv2c::gtpv2c_delete_bearer_command gtp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -395,7 +393,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_downlink_data_notification).name();};
proto::gtpv2c::gtpv2c_downlink_data_notification gtp_ies;
gtpv2c::gtpv2c_downlink_data_notification gtp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -418,7 +416,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_downlink_data_notification_acknowledge).name();};
proto::gtpv2c::gtpv2c_downlink_data_notification_acknowledge gtp_ies;
gtpv2c::gtpv2c_downlink_data_notification_acknowledge gtp_ies;
} ;
......@@ -441,8 +439,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_s11_downlink_data_notification_failure_indication).name();};
proto::gtpv2c::gtpv2c_downlink_data_notification_failure_indication gtp_ies;
gtpv2c::gtpv2c_downlink_data_notification_failure_indication gtp_ies;
} ;
} // namespace itti
#endif /* ITTI_MSG_S11_HPP_INCLUDED_ */
......@@ -35,8 +35,6 @@
#include <sys/socket.h>
namespace oai::cn::core::itti {
class itti_s1u_msg : public itti_msg {
public:
itti_s1u_msg(const itti_msg_type_t msg_type, const task_id_t orig, const task_id_t dest):
......@@ -76,7 +74,7 @@ public:
}
const char* get_msg_name() {return "S1U_ECHO_REQUEST";};
proto::gtpv1u::gtpv1u_echo_request gtp_ies;
gtpv1u::gtpv1u_echo_request gtp_ies;
};
//------------------------------------------------------------------------------
class itti_s1u_echo_response : public itti_s1u_msg {
......@@ -99,7 +97,7 @@ public:
}
const char* get_msg_name() {return "S1U_ECHO_RESPONSE";};
proto::gtpv1u::gtpv1u_echo_response gtp_ies;
gtpv1u::gtpv1u_echo_response gtp_ies;
};
//------------------------------------------------------------------------------
class itti_s1u_error_indication : public itti_s1u_msg {
......@@ -122,7 +120,7 @@ public:
}
const char* get_msg_name() {return "S1U_ERROR_INDICATION";};
proto::gtpv1u::gtpv1u_error_indication gtp_ies;
gtpv1u::gtpv1u_error_indication gtp_ies;
};
//------------------------------------------------------------------------------
class itti_s1u_supported_extension_headers_notification : public itti_s1u_msg {
......@@ -145,7 +143,7 @@ public:
}
const char* get_msg_name() {return "S1U_SUPPORTED_EXTENSION_HEADERS_NOTIFICATION";};
proto::gtpv1u::gtpv1u_supported_extension_headers_notification gtp_ies;
gtpv1u::gtpv1u_supported_extension_headers_notification gtp_ies;
};
//------------------------------------------------------------------------------
class itti_s1u_end_marker : public itti_s1u_msg {
......@@ -170,9 +168,7 @@ public:
}
const char* get_msg_name() {return "S1U_END_MARKER";};
proto::gtpv1u::gtpv1u_end_marker gtp_ies;
gtpv1u::gtpv1u_end_marker gtp_ies;
};
} // namespace itti
#endif /* ITTI_MSG_S1U_HPP_INCLUDED_ */
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
*/
/*
* itti_msg_sx_restore.hpp
*
* Created on: March 27, 2019
* Author: lionel.gauthier@eurecom.fr
*/
#ifndef ITTI_MSG_SX_RESTORE_HPP_INCLUDED_
#define ITTI_MSG_SX_RESTORE_HPP_INCLUDED_
#include "3gpp_29.244.h"
#include "itti_msg.hpp"
#include <set>
class itti_sx_restore : public itti_msg {
public:
itti_sx_restore(const task_id_t origin, const task_id_t destination):
itti_msg(RESTORE_SX_SESSIONS, origin, destination), sessions() {}
itti_sx_restore(const itti_sx_restore& i) : itti_msg(i), sessions(i.sessions) {}
itti_sx_restore(const itti_sx_restore& i, const task_id_t orig, const task_id_t dest) : itti_sx_restore(i) {
origin = orig;
destination = dest;
}
const char* get_msg_name() {return "SX_RESTORE";};
std::set<pfcp::fseid_t> sessions;
};
#endif /* ITTI_MSG_SX_RESTORE_HPP_INCLUDED_ */
......@@ -33,8 +33,6 @@
#include "msg_pfcp.hpp"
#include <boost/asio/ip/udp.hpp>
namespace oai::cn::core::itti {
class itti_sxab_msg : public itti_msg {
public:
itti_sxab_msg(const itti_msg_type_t msg_type, const task_id_t origin, const task_id_t destination):
......@@ -57,7 +55,7 @@ public:
boost::asio::ip::udp::endpoint l_endpoint;
boost::asio::ip::udp::endpoint r_endpoint;
seid_t seid;
seid_t seid;
uint64_t trxn_id;
};
......@@ -76,7 +74,7 @@ public:
const char* get_msg_name() {return typeid(itti_sxab_heartbeat_request).name();};
proto::pfcp::pfcp_heartbeat_request pfcp_ies;
pfcp::pfcp_heartbeat_request pfcp_ies;
};
//-----------------------------------------------------------------------------
......@@ -94,7 +92,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_heartbeat_response).name();};
proto::pfcp::pfcp_heartbeat_response pfcp_ies;
pfcp::pfcp_heartbeat_response pfcp_ies;
};
//-----------------------------------------------------------------------------
......@@ -111,7 +109,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_pfcp_pfd_management_request).name();};
proto::pfcp::pfcp_pfd_management_request pfcp_ies;
pfcp::pfcp_pfd_management_request pfcp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -128,7 +126,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_pfcp_pfd_management_response).name();};
proto::pfcp::pfcp_pfd_management_response pfcp_ies;
pfcp::pfcp_pfd_management_response pfcp_ies;
};
......@@ -146,7 +144,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_association_setup_request).name();};
proto::pfcp::pfcp_association_setup_request pfcp_ies;
pfcp::pfcp_association_setup_request pfcp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -163,7 +161,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_association_setup_response).name();};
proto::pfcp::pfcp_association_setup_response pfcp_ies;
pfcp::pfcp_association_setup_response pfcp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -180,7 +178,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_association_update_request).name();};
proto::pfcp::pfcp_association_update_request pfcp_ies;
pfcp::pfcp_association_update_request pfcp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -197,7 +195,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_association_update_response).name();};
proto::pfcp::pfcp_association_update_response pfcp_ies;
pfcp::pfcp_association_update_response pfcp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -214,7 +212,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_association_release_request).name();};
proto::pfcp::pfcp_association_release_request pfcp_ies;
pfcp::pfcp_association_release_request pfcp_ies;
} ;
......@@ -233,7 +231,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_association_release_response).name();};
proto::pfcp::pfcp_association_release_response pfcp_ies;
pfcp::pfcp_association_release_response pfcp_ies;
};
//-----------------------------------------------------------------------------
......@@ -251,7 +249,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_version_not_supported_response).name();};
proto::pfcp::pfcp_version_not_supported_response pfcp_ies;
pfcp::pfcp_version_not_supported_response pfcp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -269,7 +267,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_node_report_request).name();};
proto::pfcp::pfcp_node_report_request pfcp_ies;
pfcp::pfcp_node_report_request pfcp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -287,7 +285,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_node_report_response).name();};
proto::pfcp::pfcp_node_report_response pfcp_ies;
pfcp::pfcp_node_report_response pfcp_ies;
} ;
//-----------------------------------------------------------------------------
......@@ -305,7 +303,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_set_deletion_request).name();};
proto::pfcp::pfcp_session_set_deletion_request pfcp_ies;
pfcp::pfcp_session_set_deletion_request pfcp_ies;
} ;
//-----------------------------------------------------------------------------
class itti_sxab_session_set_deletion_response : public itti_sxab_msg {
......@@ -322,7 +320,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_set_deletion_response).name();};
proto::pfcp::pfcp_session_set_deletion_response pfcp_ies;
pfcp::pfcp_session_set_deletion_response pfcp_ies;
} ;
//-----------------------------------------------------------------------------
class itti_sxab_session_establishment_request : public itti_sxab_msg {
......@@ -339,7 +337,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_establishment_request).name();};
proto::pfcp::pfcp_session_establishment_request pfcp_ies;
pfcp::pfcp_session_establishment_request pfcp_ies;
} ;
//-----------------------------------------------------------------------------
class itti_sxab_session_establishment_response : public itti_sxab_msg {
......@@ -356,7 +354,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_establishment_response).name();};
proto::pfcp::pfcp_session_establishment_response pfcp_ies;
pfcp::pfcp_session_establishment_response pfcp_ies;
} ;
//-----------------------------------------------------------------------------
class itti_sxab_session_modification_request : public itti_sxab_msg {
......@@ -373,7 +371,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_modification_request).name();};
proto::pfcp::pfcp_session_modification_request pfcp_ies;
pfcp::pfcp_session_modification_request pfcp_ies;
} ;
//-----------------------------------------------------------------------------
class itti_sxab_session_modification_response : public itti_sxab_msg {
......@@ -390,7 +388,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_modification_response).name();};
proto::pfcp::pfcp_session_modification_response pfcp_ies;
pfcp::pfcp_session_modification_response pfcp_ies;
} ;
//-----------------------------------------------------------------------------
class itti_sxab_session_deletion_request : public itti_sxab_msg {
......@@ -407,7 +405,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_deletion_request).name();};
proto::pfcp::pfcp_session_deletion_request pfcp_ies;
pfcp::pfcp_session_deletion_request pfcp_ies;
} ;
//-----------------------------------------------------------------------------
class itti_sxab_session_deletion_response : public itti_sxab_msg {
......@@ -424,7 +422,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_deletion_response).name();};
proto::pfcp::pfcp_session_deletion_response pfcp_ies;
pfcp::pfcp_session_deletion_response pfcp_ies;
} ;
//-----------------------------------------------------------------------------
class itti_sxab_session_report_request : public itti_sxab_msg {
......@@ -441,7 +439,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_deletion_request).name();};
proto::pfcp::pfcp_session_report_request pfcp_ies;
pfcp::pfcp_session_report_request pfcp_ies;
} ;
//-----------------------------------------------------------------------------
class itti_sxab_session_report_response : public itti_sxab_msg {
......@@ -458,8 +456,7 @@ public:
}
const char* get_msg_name() {return typeid(itti_sxab_session_report_response).name();};
proto::pfcp::pfcp_session_report_response pfcp_ies;
pfcp::pfcp_session_report_response pfcp_ies;
} ;
} // namespace itti
#endif /* ITTI_MSG_SXAB_HPP_INCLUDED_ */
......@@ -32,8 +32,6 @@
#include <string>
#include <iostream>
namespace oai::cn {
class stream_serializable {
public:
virtual void dump_to(std::ostream& os) = 0;
......@@ -41,6 +39,4 @@ public:
//virtual ~serializable() = 0;
};
}
#endif /* FILE_SERIALIZABLE_HPP_SEEN */
/*
* 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 3gpp_conversions.cpp
* \brief
* \author Lionel Gauthier
* \company Eurecom
* \email: lionel.gauthier@eurecom.fr
*/
#include "3gpp_conversions.hpp"
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <ctype.h>
#include <inttypes.h>
//------------------------------------------------------------------------------
void xgpp_conv::paa_to_pfcp_ue_ip_address(const paa_t& paa, pfcp::ue_ip_address_t& ue_ip_address)
{
switch (paa.pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4:
ue_ip_address.v4 = 1;
ue_ip_address.ipv4_address = paa.ipv4_address;
break;
case PDN_TYPE_E_IPV6:
ue_ip_address.v6 = 1;
ue_ip_address.ipv6_address = paa.ipv6_address;
break;
case PDN_TYPE_E_IPV4V6:
ue_ip_address.v4 = 1;
ue_ip_address.v6 = 1;
ue_ip_address.ipv4_address = paa.ipv4_address;
ue_ip_address.ipv6_address = paa.ipv6_address;
break;
case PDN_TYPE_E_NON_IP:
default:
;
}
}
//------------------------------------------------------------------------------
void xgpp_conv::pdn_ip_to_pfcp_ue_ip_address(const pdn_type_t& pdn_type,
const struct in_addr& ipv4_address,
const struct in6_addr ipv6_address,
pfcp::ue_ip_address_t& ue_ip_address)
{
switch (pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4:
ue_ip_address.v4 = 1;
ue_ip_address.ipv4_address = ipv4_address;
break;
case PDN_TYPE_E_IPV6:
ue_ip_address.v6 = 1;
ue_ip_address.ipv6_address = ipv6_address;
break;
case PDN_TYPE_E_IPV4V6:
ue_ip_address.v4 = 1;
ue_ip_address.v6 = 1;
ue_ip_address.ipv4_address = ipv4_address;
ue_ip_address.ipv6_address = ipv6_address;
break;
case PDN_TYPE_E_NON_IP:
default:
;
}
}
//------------------------------------------------------------------------------
void xgpp_conv::pfcp_to_core_fteid(const pfcp::fteid_t& pfteid, fteid_t& fteid)
{
fteid.v4 = pfteid.v4;
fteid.v6 = pfteid.v6;
fteid.ipv4_address.s_addr = pfteid.ipv4_address.s_addr;
fteid.ipv6_address = pfteid.ipv6_address;
fteid.teid_gre_key = pfteid.teid;
}
//------------------------------------------------------------------------------
void xgpp_conv::pfcp_from_core_fteid(pfcp::fteid_t& pfteid, const fteid_t& fteid)
{
pfteid.chid = 0;
pfteid.ch = 0;
pfteid.choose_id = 0;
pfteid.v4 = fteid.v4;
pfteid.v6 = fteid.v6;
pfteid.ipv4_address.s_addr = fteid.ipv4_address.s_addr;
pfteid.ipv6_address = fteid.ipv6_address;
pfteid.teid = fteid.teid_gre_key;
}
//------------------------------------------------------------------------------
void xgpp_conv::pfcp_cause_to_core_cause(const pfcp::cause_t& pc, cause_t& c)
{
switch (pc.cause_value) {
case pfcp::CAUSE_VALUE_REQUEST_ACCEPTED:
c.cause_value = REQUEST_ACCEPTED;
break;
case pfcp::CAUSE_VALUE_REQUEST_REJECTED:
c.cause_value = REQUEST_REJECTED;
break;
case pfcp::CAUSE_VALUE_SESSION_CONTEXT_NOT_FOUND:
case pfcp::CAUSE_VALUE_MANDATORY_IE_MISSING:
case pfcp::CAUSE_VALUE_CONDITIONAL_IE_MISSING:
case pfcp::CAUSE_VALUE_INVALID_LENGTH:
case pfcp::CAUSE_VALUE_MANDATORY_IE_INCORRECT:
case pfcp::CAUSE_VALUE_INVALID_FORWARDING_POLICY:
case pfcp::CAUSE_VALUE_INVALID_FTEID_ALLOCATION_OPTION:
case pfcp::CAUSE_VALUE_NO_ESTABLISHED_PFCP_ASSOCIATION:
case pfcp::CAUSE_VALUE_RULE_CREATION_MODIFICATION_FAILURE:
c.cause_value = SYSTEM_FAILURE; // ?
break;
case pfcp::CAUSE_VALUE_PFCP_ENTITY_IN_CONGESTION:
c.cause_value = APN_CONGESTION; // ? ...
break;
case pfcp::CAUSE_VALUE_NO_RESOURCES_AVAILABLE:
case pfcp::CAUSE_VALUE_SERVICE_NOT_SUPPORTED:
case pfcp::CAUSE_VALUE_SYSTEM_FAILURE:
default:
c.cause_value = SYSTEM_FAILURE; // ? ...
}
}
//------------------------------------------------------------------------------
bool xgpp_conv::sockaddr_storage_to_gtp_u_peer_address(const struct sockaddr_storage& peer_sockaddr, gtp_u_peer_address_t& peer_address)
{
switch (peer_sockaddr.ss_family) {
case AF_INET: {
const struct sockaddr_in * const sin = reinterpret_cast<const sockaddr_in* const>(&peer_sockaddr);
peer_address.ipv4_address.s_addr = sin->sin_addr.s_addr;
peer_address.is_v4 = true;
return true;
}
break;
case AF_INET6: {
const struct sockaddr_in6 * const sin6 = reinterpret_cast<const sockaddr_in6* const>(&peer_sockaddr);
peer_address.ipv6_address = sin6->sin6_addr;
peer_address.is_v4 = false;
return true;
}
break;
default:
return false;
}
}
......@@ -19,47 +19,31 @@
* contact@openairinterface.org
*/
/*! \file conversions.h
/*! \file 3gpp_conversions.hpp
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_EPC_CONVERSIONS_HPP_SEEN
#define FILE_EPC_CONVERSIONS_HPP_SEEN
#include "common_types.h"
#include "3gpp_23.003.h"
#include "3gpp_24.008.h"
#ifndef FILE_3GPP_CONVERSIONS_HPP_SEEN
#define FILE_3GPP_CONVERSIONS_HPP_SEEN
#include "3gpp_29.274.h"
#include "EpsQualityOfService.h"
#include "3gpp_29.244.h"
#include "3gpp_29.281.h"
namespace oai {
namespace cn {
namespace util {
namespace xgpp_conv {
inline void build_fteid(core::fteid_t& fteid, const core::ip_address_t ip,const teid_t teid) {
void paa_to_pfcp_ue_ip_address(const paa_t& paa, pfcp::ue_ip_address_t& ue_ip_address);
void pdn_ip_to_pfcp_ue_ip_address(const pdn_type_t& pdn_type,
const struct in_addr& ipv4_address,
const struct in6_addr ipv6_address,
pfcp::ue_ip_address_t& ue_ip_address);
void pfcp_to_core_fteid(const pfcp::fteid_t& pfteid, fteid_t& fteid);
void pfcp_from_core_fteid(pfcp::fteid_t& pfteid, const fteid_t& fteid);
void pfcp_cause_to_core_cause(const pfcp::cause_t& pc, cause_t& c);
bool sockaddr_storage_to_gtp_u_peer_address(const struct sockaddr_storage& peer_sockaddr, gtp_u_peer_address_t& peer_address);
fteid.teid = teid;
fteid.ipv4 = ip.ipv4;
fteid.ipv4_address = ip.address;
}
#define FTEID_T_2_IP_ADDRESS_T(fte_p,ip_p) \
do { \
(ip_p)->ipv4 = false; \
(ip_p)->ipv6 = false; \
if ((fte_p)->ipv4) { \
(ip_p)->ipv4 = true; \
(ip_p)->address.ipv4_address.s_addr = (fte_p)->ipv4_address.s_addr; \
} \
else if ((fte_p)->ipv6) { \
(ip_p)->ipv6 = true; \
memcpy(&(ip_p)->address.ipv6_address, &(fte_p)->ipv6_address, sizeof((fte_p)->ipv6_address)); \
} \
} while (0)
}
}
}
#endif /* FILE_CONVERSIONS_SEEN */
#endif /* FILE_3GPP_CONVERSIONS_HPP_SEEN */
......@@ -26,12 +26,12 @@ include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
set(CN_UTILS_SRC STATIC
${CMAKE_CURRENT_SOURCE_DIR}/3gpp_conversions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/async_shell_cmd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/conversions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/epc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/get_gateway_netlink.cpp
${CMAKE_CURRENT_SOURCE_DIR}/if.cpp
#${CMAKE_CURRENT_SOURCE_DIR}/mcc_mnc_itu.c
${CMAKE_CURRENT_SOURCE_DIR}/pid_file.cpp
${CMAKE_CURRENT_SOURCE_DIR}/string.cpp
${CMAKE_CURRENT_SOURCE_DIR}/thread_sched.cpp
......
......@@ -45,9 +45,7 @@
#include <stdexcept>
using namespace oai::cn::core::itti;
using namespace oai::cn::util;
;
using namespace util;
extern itti_mw *itti_inst;
void async_cmd_task (void*);
......@@ -57,7 +55,7 @@ void async_cmd_task (void* args_p)
{
const task_id_t task_id = TASK_ASYNC_SHELL_CMD;
const thread_sched_params* const sched_params = (const oai::cn::util::thread_sched_params* const)args_p;
const thread_sched_params* const sched_params = (const util::thread_sched_params* const)args_p;
sched_params->apply(task_id, Logger::async_cmd());
itti_inst->notify_task_ready(task_id);
......@@ -99,7 +97,7 @@ void async_cmd_task (void* args_p)
}
//------------------------------------------------------------------------------
async_shell_cmd::async_shell_cmd (oai::cn::util::thread_sched_params& sched_params)
async_shell_cmd::async_shell_cmd (util::thread_sched_params& sched_params)
{
Logger::async_cmd().startup( "Starting..." );
......
......@@ -36,7 +36,7 @@
#include <string>
#include <thread>
namespace oai::cn::util {
namespace util {
class async_shell_cmd {
private:
......@@ -49,7 +49,7 @@ public:
async_shell_cmd(async_shell_cmd const&) = delete;
void operator=(async_shell_cmd const&) = delete;
int run_command (const core::itti::task_id_t sender_itti_task, const bool is_abort_on_error, const char* src_file, const int src_line, const std::string& cmd_str);
int run_command (const task_id_t sender_itti_task, const bool is_abort_on_error, const char* src_file, const int src_line, const std::string& cmd_str);
};
......
......@@ -31,6 +31,7 @@
#include <stdbool.h>
#include <ctype.h>
#include <inttypes.h>
#include <arpa/inet.h>
static const char hex_to_ascii_table[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
......@@ -55,7 +56,7 @@ static const signed char ascii_to_hex_table[0x100] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
void oai::cn::util::hexa_to_ascii (
void conv::hexa_to_ascii (
uint8_t * from,
char *to,
size_t length)
......@@ -71,7 +72,7 @@ void oai::cn::util::hexa_to_ascii (
}
}
int oai::cn::util::ascii_to_hex (
int conv::ascii_to_hex (
uint8_t * dst,
const char *h)
{
......@@ -107,100 +108,62 @@ int oai::cn::util::ascii_to_hex (
dst[i++] = (high << 4) | low;
}
}
//------------------------------------------------------------------------------
std::string conv::mccToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3)
{
std::string s = {};
uint16_t mcc16 = digit1*100+digit2*10+digit3;
//s.append(std::to_string(digit1)).append(std::to_string(digit2)).append(std::to_string(digit3));
s.append(std::to_string(mcc16));
return s;
}
//------------------------------------------------------------------------------
imsi64_t oai::cn::util::imsi_to_imsi64(oai::cn::core::imsi_t * const imsi)
std::string conv::mncToString(const uint8_t digit1, const uint8_t digit2, const uint8_t digit3)
{
imsi64_t imsi64 = INVALID_IMSI64;
if (imsi) {
imsi64 = 0;
for (int i=0; i < IMSI_BCD8_SIZE; i++) {
uint8_t d2 = imsi->u1.b[i];
uint8_t d1 = (d2 & 0xf0) >> 4;
d2 = d2 & 0x0f;
if (10 > d1) {
imsi64 = imsi64*10 + d1;
if (10 > d2) {
imsi64 = imsi64*10 + d2;
} else {
break;
}
} else {
break;
}
}
std::string s = {};
uint16_t mcc16 = 0;
if (digit3 == 0x0F) {
mcc16 = digit1*10+digit2;
} else {
mcc16 = digit1*100+digit2*10+digit3;
}
return imsi64;
s.append(std::to_string(mcc16));
return s;
}
//------------------------------------------------------------------------------
void oai::cn::util::paa_to_pfcp_ue_ip_address(const core::paa_t& paa, core::pfcp::ue_ip_address_t& ue_ip_address)
struct in_addr conv::fromString(const std::string addr4)
{
switch (paa.pdn_type.pdn_type) {
case core::PDN_TYPE_E_IPV4:
ue_ip_address.v4 = 1;
ue_ip_address.ipv4_address = paa.ipv4_address;
break;
case core::PDN_TYPE_E_IPV6:
ue_ip_address.v6 = 1;
ue_ip_address.ipv6_address = paa.ipv6_address;
break;
case core::PDN_TYPE_E_IPV4V6:
ue_ip_address.v4 = 1;
ue_ip_address.v6 = 1;
ue_ip_address.ipv4_address = paa.ipv4_address;
ue_ip_address.ipv6_address = paa.ipv6_address;
break;
case core::PDN_TYPE_E_NON_IP:
default:
;
}
unsigned char buf[sizeof(struct in6_addr)] = {};
int s = inet_pton(AF_INET, addr4.c_str(), buf);
struct in_addr * ia = (struct in_addr *)buf;
return *ia;
}
//------------------------------------------------------------------------------
void oai::cn::util::pdn_ip_to_pfcp_ue_ip_address(const core::pdn_type_t& pdn_type,
const struct in_addr& ipv4_address,
const struct in6_addr ipv6_address,
core::pfcp::ue_ip_address_t& ue_ip_address)
std::string conv::toString(const struct in_addr& inaddr)
{
switch (pdn_type.pdn_type) {
case core::PDN_TYPE_E_IPV4:
ue_ip_address.v4 = 1;
ue_ip_address.ipv4_address = ipv4_address;
break;
case core::PDN_TYPE_E_IPV6:
ue_ip_address.v6 = 1;
ue_ip_address.ipv6_address = ipv6_address;
break;
case core::PDN_TYPE_E_IPV4V6:
ue_ip_address.v4 = 1;
ue_ip_address.v6 = 1;
ue_ip_address.ipv4_address = ipv4_address;
ue_ip_address.ipv6_address = ipv6_address;
break;
case core::PDN_TYPE_E_NON_IP:
default:
;
std::string s = {};
char str[INET6_ADDRSTRLEN] = {};
if (inet_ntop(AF_INET, (const void *)&inaddr, str, INET6_ADDRSTRLEN) == NULL) {
s.append("Error in_addr");
} else {
s.append(str);
}
return s;
}
//------------------------------------------------------------------------------
bool oai::cn::util::sockaddr_storage_to_gtp_u_peer_address(const struct sockaddr_storage& peer_sockaddr, core::gtp_u_peer_address_t& peer_address)
std::string conv::toString(const struct in6_addr& in6addr)
{
switch (peer_sockaddr.ss_family) {
case AF_INET: {
const struct sockaddr_in * const sin = reinterpret_cast<const sockaddr_in* const>(&peer_sockaddr);
peer_address.ipv4_address.s_addr = sin->sin_addr.s_addr;
peer_address.is_v4 = true;
return true;
}
break;
case AF_INET6: {
const struct sockaddr_in6 * const sin6 = reinterpret_cast<const sockaddr_in6* const>(&peer_sockaddr);
peer_address.ipv6_address = sin6->sin6_addr;
peer_address.is_v4 = false;
return true;
}
break;
default:
return false;
std::string s = {};
char str[INET6_ADDRSTRLEN] = {};
if (inet_ntop(AF_INET6, (const void *)&in6addr, str, INET6_ADDRSTRLEN) == nullptr) {
s.append("Error in6_addr");
} else {
s.append(str);
}
return s;
}
This diff is collapsed.
......@@ -36,7 +36,7 @@
using namespace std;
//------------------------------------------------------------------------------
bool oai::cn::util::get_iface_l2_addr(const std::string& iface, std::string& mac)
bool util::get_iface_l2_addr(const std::string& iface, std::string& mac)
{
std::string mac_address_path = fmt::format("/sys/class/net/{}/address", iface);
std::ifstream mac_address_in(mac_address_path.c_str(), ios_base::in | ios_base::binary );
......@@ -58,7 +58,7 @@ bool oai::cn::util::get_iface_l2_addr(const std::string& iface, std::string& mac
}
//------------------------------------------------------------------------------
bool oai::cn::util::get_gateway_and_iface(std::string& gw, std::string& iface)
bool util::get_gateway_and_iface(std::string& gw, std::string& iface)
{
int received_bytes = 0, msg_len = 0, route_attribute_len = 0;
int sock = -1, msgseq = 0;
......
......@@ -30,7 +30,7 @@
#include <string>
namespace oai::cn::util {
namespace util {
bool get_iface_l2_addr(const std::string& iface, std::string& mac);
bool get_gateway_and_iface(std::string& gw, std::string& iface);
}
......
......@@ -138,9 +138,9 @@ int get_gateway_and_iface(std::string *gw, std::string *iface)
}
if ((*gateway_address) && (*interface)) {
*gw = string(gateway_address);
*gw = std::string(gateway_address);
if (iface) {
*iface = string(interface);
*iface = std::string(interface);
}
break;
} else {
......@@ -153,7 +153,7 @@ int get_gateway_and_iface(std::string *gw, std::string *iface)
//------------------------------------------------------------------------------
int get_inet_addr_from_iface(const string& if_name, struct in_addr& inet_addr) {
int get_inet_addr_from_iface(const std::string& if_name, struct in_addr& inet_addr) {
struct ifreq ifr;
char str[INET_ADDRSTRLEN];
......@@ -177,7 +177,7 @@ int get_inet_addr_from_iface(const string& if_name, struct in_addr& inet_addr) {
}
//------------------------------------------------------------------------------
int get_mtu_from_iface(const string& if_name, uint32_t& mtu) {
int get_mtu_from_iface(const std::string& if_name, uint32_t& mtu) {
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
int fd = socket(AF_INET, SOCK_DGRAM, 0);
......@@ -194,7 +194,7 @@ int get_mtu_from_iface(const string& if_name, uint32_t& mtu) {
}
//------------------------------------------------------------------------------
int get_inet_addr_infos_from_iface(const string& if_name, struct in_addr& inet_addr, struct in_addr& inet_network, unsigned int& mtu) {
int get_inet_addr_infos_from_iface(const std::string& if_name, struct in_addr& inet_addr, struct in_addr& inet_network, unsigned int& mtu) {
struct ifreq ifr;
char str[INET_ADDRSTRLEN];
......
......@@ -29,11 +29,9 @@
#define FILE_IF_HPP_SEEN
# include <string>
using namespace std;
int get_gateway_and_iface(string *gw /*OUT*/, string *iface /*OUT*/);
int get_inet_addr_from_iface(const string& if_name, struct in_addr& inet_addr);
int get_mtu_from_iface(const string& if_name, uint32_t& mtu);
int get_inet_addr_infos_from_iface(const string& if_name, struct in_addr& inet_addr, struct in_addr& inet_netmask, unsigned int& mtu);
int get_gateway_and_iface(std::string *gw /*OUT*/, std::string *iface /*OUT*/);
int get_inet_addr_from_iface(const std::string& if_name, struct in_addr& inet_addr);
int get_mtu_from_iface(const std::string& if_name, uint32_t& mtu);
int get_inet_addr_infos_from_iface(const std::string& if_name, struct in_addr& inet_addr, struct in_addr& inet_netmask, unsigned int& mtu);
#endif /* FILE_IF_HPP_SEEN */
......@@ -43,7 +43,7 @@
int g_fd_pid_file = -1;
__pid_t g_pid = -1;
//------------------------------------------------------------------------------
std::string oai::cn::util::get_exe_absolute_path(const std::string &basepath, const unsigned int instance)
std::string util::get_exe_absolute_path(const std::string &basepath, const unsigned int instance)
{
#define MAX_FILE_PATH_LENGTH 255
char pid_file_name[MAX_FILE_PATH_LENGTH+1] = {0};
......@@ -69,14 +69,14 @@ std::string oai::cn::util::get_exe_absolute_path(const std::string &basepath, co
}
//------------------------------------------------------------------------------
int oai::cn::util::lockfile(int fd, int lock_type)
int util::lockfile(int fd, int lock_type)
{
// lock on fd only, not on file on disk (do not prevent another process from modifying the file)
return lockf(fd, F_TLOCK, 0);
}
//------------------------------------------------------------------------------
bool oai::cn::util::is_pid_file_lock_success(const char * pid_file_name)
bool util::is_pid_file_lock_success(const char * pid_file_name)
{
char pid_dec[64] = {0};
......@@ -112,9 +112,9 @@ bool oai::cn::util::is_pid_file_lock_success(const char * pid_file_name)
}
//------------------------------------------------------------------------------
void oai::cn::util::pid_file_unlock(void)
void util::pid_file_unlock(void)
{
oai::cn::util::lockfile(g_fd_pid_file, F_ULOCK);
util::lockfile(g_fd_pid_file, F_ULOCK);
close(g_fd_pid_file);
g_fd_pid_file = -1;
}
......
......@@ -29,7 +29,7 @@
#define FILE_PID_FILE_SEEN
#include <string>
namespace oai::cn::util {
namespace util {
/*
* Generate the exe absolute path using a specified base_path.
......
......@@ -39,7 +39,7 @@ private:
T *mbuf;
};
std::string oai::cn::util::string_format( const char *format, ... )
std::string util::string_format( const char *format, ... )
{
va_list args;
......@@ -60,21 +60,21 @@ std::string oai::cn::util::string_format( const char *format, ... )
//https://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring#217605
// trim from start
std::string &oai::cn::util::ltrim(std::string &s) {
std::string &util::ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(),
std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
// trim from end
std::string &oai::cn::util::rtrim(std::string &s) {
std::string &util::rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(),
std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
return s;
}
// trim from both ends
std::string &oai::cn::util::trim(std::string &s) {
std::string &util::trim(std::string &s) {
return util::ltrim(util::rtrim(s));
}
......@@ -30,7 +30,7 @@
#include <string>
namespace oai::cn::util {
namespace util {
std::string string_format( const char *format, ... );
......
......@@ -29,7 +29,7 @@
#include "thread_sched.hpp"
//------------------------------------------------------------------------------
void oai::cn::util::thread_sched_params::apply(const int task_id, _Logger& logger) const
void util::thread_sched_params::apply(const int task_id, _Logger& logger) const
{
if (cpu_id >= 0) {
cpu_set_t cpuset;
......
......@@ -31,7 +31,7 @@
#include <sched.h>
#include "logger.hpp"
namespace oai::cn::util {
namespace util {
class thread_sched_params {
public:
......
......@@ -31,7 +31,7 @@
#include <mutex>
#include <set>
namespace oai::cn::util {
namespace util {
template <class UINT> class uint_generator {
private:
......
......@@ -32,8 +32,7 @@
#include <string>
#include <string.h>
using namespace oai::cn::proto::gtpv1u;
using namespace oai::cn::core;
using namespace gtpv1u;
//------------------------------------------------------------------------------
gtpv1u_ie * gtpv1u_ie::new_gtpv1u_ie_from_stream(std::istream& is) {
gtpv1u_tlv tlv;
......
This diff is collapsed.
......@@ -26,14 +26,14 @@
*/
#include "common_root_types.h"
#include "conversions.hpp"
#include "gtpu.h"
#include "gtpv1u.hpp"
#include <cstdlib>
#include <sched.h>
using namespace oai::cn::proto::gtpv1u;
using namespace oai::cn::core::itti;
using namespace gtpv1u;
using namespace std;
extern itti_mw *itti_inst;
......@@ -93,7 +93,7 @@ int udp_server::create_socket (const struct in_addr &address, const uint16_t por
addr.sin_port = htons (port);
addr.sin_addr.s_addr = address.s_addr;
std::string ipv4 = core::toString(address);
std::string ipv4 = conv::toString(address);
Logger::udp().debug("Creating new listen socket on address %s and port %" PRIu16 "\n", ipv4.c_str(), port);
if (bind (sd, (struct sockaddr *)&addr, sizeof (struct sockaddr_in)) < 0) {
......@@ -127,7 +127,7 @@ int udp_server::create_socket (const struct in6_addr &address, const uint16_t po
addr.sin6_port = htons (port);
addr.sin6_addr = address;
std::string ipv6 = core::toString(address);
std::string ipv6 = conv::toString(address);
Logger::udp().debug("Creating new listen socket on address %s and port %" PRIu16 "\n", ipv6.c_str(), port);
if (bind (sd, (struct sockaddr *)&addr, sizeof (struct sockaddr_in6)) < 0) {
......@@ -189,7 +189,7 @@ void udp_server::start_receive(gtpu_l4_stack * gtp_stack, const util::thread_sch
gtpu_l4_stack::gtpu_l4_stack(const struct in_addr& address, const uint16_t port_num, const util::thread_sched_params& sched_params) :
udp_s(udp_server(address, port_num))
{
Logger::gtpv1_u().info( "gtpu_l4_stack created listening to %s:%d", core::toString(address).c_str(), port_num);
Logger::gtpv1_u().info( "gtpu_l4_stack created listening to %s:%d", conv::toString(address).c_str(), port_num);
id = 0;
srand (time(NULL));
......@@ -201,7 +201,7 @@ gtpu_l4_stack::gtpu_l4_stack(const struct in_addr& address, const uint16_t port_
gtpu_l4_stack::gtpu_l4_stack(const struct in6_addr& address, const uint16_t port_num, const util::thread_sched_params& sched_params) :
udp_s(udp_server(address, port_num))
{
Logger::gtpv1_u().info( "gtpu_l4_stack created listening to %s:%d", core::toString(address).c_str(), port_num);
Logger::gtpv1_u().info( "gtpu_l4_stack created listening to %s:%d", conv::toString(address).c_str(), port_num);
id = 0;
srand (time(NULL));
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -34,8 +34,6 @@
#include <algorithm>
#include <csignal>
using namespace oai::cn::core::itti;
extern itti_mw *itti_inst;
static itti_timer null_timer(ITTI_INVALID_TIMER_ID, TASK_NONE, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0);
......
This diff is collapsed.
......@@ -28,8 +28,6 @@
#include "itti_msg.hpp"
#include "itti.hpp"
using namespace oai::cn::core::itti;
extern itti_mw *itti_inst;
itti_msg::itti_msg() :
......
......@@ -30,8 +30,6 @@
#include <stdint.h>
#include <utility>
namespace oai::cn::core::itti {
typedef enum {
TASK_FIRST = 0,
TASK_ITTI_TIMER = TASK_FIRST,
......@@ -192,5 +190,5 @@ public:
itti_msg_terminate(const itti_msg_terminate& i) : itti_msg(i) {}
static const char* get_msg_name() {return "TERMINATE";};
};
}
#endif /* SRC_ITTI_ITTI_MSG_HPP_INCLUDED_ */
This diff is collapsed.
......@@ -33,9 +33,8 @@
#include <unistd.h> // get_pid(), pause()
#include <vector>
using namespace oai::cn::core::itti;
using namespace oai::cn::nf::spgwu;
using namespace oai::cn::util;
using namespace spgwu;
using namespace util;
using namespace std;
itti_mw *itti_inst = nullptr;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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