Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-SMF
Commits
89d52393
Commit
89d52393
authored
Mar 28, 2019
by
gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPGWU: air mouvement around namespaces
parent
69caeef6
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
1125 additions
and
175 deletions
+1125
-175
src/common/msg/itti_msg_sxab.hpp
src/common/msg/itti_msg_sxab.hpp
+465
-0
src/common/utils/async_shell_cmd.hpp
src/common/utils/async_shell_cmd.hpp
+1
-1
src/common/utils/conversions.cpp
src/common/utils/conversions.cpp
+17
-18
src/common/utils/conversions.hpp
src/common/utils/conversions.hpp
+11
-9
src/common/utils/pid_file.cpp
src/common/utils/pid_file.cpp
+1
-1
src/common/utils/string.cpp
src/common/utils/string.cpp
+1
-1
src/common/utils/thread_sched.cpp
src/common/utils/thread_sched.cpp
+1
-1
src/gtpv1u/gtpv1u.cpp
src/gtpv1u/gtpv1u.cpp
+9
-9
src/gtpv1u/gtpv1u.hpp
src/gtpv1u/gtpv1u.hpp
+10
-10
src/gtpv1u/msg_gtpv1u.hpp
src/gtpv1u/msg_gtpv1u.hpp
+1
-0
src/itti/itti.cpp
src/itti/itti.cpp
+8
-9
src/itti/itti.hpp
src/itti/itti.hpp
+3
-3
src/itti/itti_msg.hpp
src/itti/itti_msg.hpp
+6
-14
src/spgwu/simpleswitch/pfcp_session.cpp
src/spgwu/simpleswitch/pfcp_session.cpp
+492
-0
src/spgwu/simpleswitch/pfcp_switch.cpp
src/spgwu/simpleswitch/pfcp_switch.cpp
+9
-9
src/spgwu/simpleswitch/pfcp_switch.hpp
src/spgwu/simpleswitch/pfcp_switch.hpp
+6
-6
src/spgwu/simpleswitch/spgwu_s1u.cpp
src/spgwu/simpleswitch/spgwu_s1u.cpp
+1
-1
src/spgwu/simpleswitch/spgwu_s1u.hpp
src/spgwu/simpleswitch/spgwu_s1u.hpp
+11
-11
src/spgwu/spgwu_app.hpp
src/spgwu/spgwu_app.hpp
+4
-4
src/spgwu/spgwu_config.cpp
src/spgwu/spgwu_config.cpp
+9
-9
src/spgwu/spgwu_config.hpp
src/spgwu/spgwu_config.hpp
+10
-10
src/spgwu/spgwu_pfcp_association.cpp
src/spgwu/spgwu_pfcp_association.cpp
+14
-14
src/spgwu/spgwu_pfcp_association.hpp
src/spgwu/spgwu_pfcp_association.hpp
+27
-27
src/spgwu/spgwu_sx.cpp
src/spgwu/spgwu_sx.cpp
+6
-6
src/spgwu/spgwu_sx.hpp
src/spgwu/spgwu_sx.hpp
+2
-2
No files found.
src/common/msg/itti_msg_sxab.hpp
0 → 100644
View file @
89d52393
This diff is collapsed.
Click to expand it.
src/common/utils/async_shell_cmd.hpp
View file @
89d52393
...
...
@@ -44,7 +44,7 @@ private:
std
::
thread
thread
;
public:
explicit
async_shell_cmd
(
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
explicit
async_shell_cmd
(
util
::
thread_sched_params
&
sched_params
);
~
async_shell_cmd
()
{}
async_shell_cmd
(
async_shell_cmd
const
&
)
=
delete
;
void
operator
=
(
async_shell_cmd
const
&
)
=
delete
;
...
...
src/common/utils/conversions.cpp
View file @
89d52393
...
...
@@ -55,8 +55,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
hexa_to_ascii
(
void
oai
::
cn
::
util
::
hexa_to_ascii
(
uint8_t
*
from
,
char
*
to
,
size_t
length
)
...
...
@@ -72,8 +71,7 @@ hexa_to_ascii (
}
}
int
ascii_to_hex
(
int
oai
::
cn
::
util
::
ascii_to_hex
(
uint8_t
*
dst
,
const
char
*
h
)
{
...
...
@@ -110,13 +108,13 @@ ascii_to_hex (
}
}
//------------------------------------------------------------------------------
imsi64_t
imsi_to_imsi64
(
imsi_t
*
const
imsi
)
imsi64_t
oai
::
cn
::
util
::
imsi_to_imsi64
(
oai
::
cn
::
core
::
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
d2
=
imsi
->
u
1
.
b
[
i
];
uint8_t
d1
=
(
d2
&
0xf0
)
>>
4
;
d2
=
d2
&
0x0f
;
if
(
10
>
d1
)
{
...
...
@@ -135,56 +133,57 @@ imsi64_t imsi_to_imsi64(imsi_t * const imsi)
}
//------------------------------------------------------------------------------
void
paa_to_pfcp_ue_ip_address
(
const
oai
::
cn
::
core
::
paa_t
&
paa
,
oai
::
cn
::
core
::
pfcp
::
ue_ip_address_t
&
ue_ip_address
)
void
oai
::
cn
::
util
::
paa_to_pfcp_ue_ip_address
(
const
core
::
paa_t
&
paa
,
core
::
pfcp
::
ue_ip_address_t
&
ue_ip_address
)
{
switch
(
paa
.
pdn_type
.
pdn_type
)
{
case
oai
:
:
cn
::
core
::
PDN_TYPE_E_IPV4
:
case
core
:
:
PDN_TYPE_E_IPV4
:
ue_ip_address
.
v4
=
1
;
ue_ip_address
.
ipv4_address
=
paa
.
ipv4_address
;
break
;
case
oai
:
:
cn
::
core
::
PDN_TYPE_E_IPV6
:
case
core
:
:
PDN_TYPE_E_IPV6
:
ue_ip_address
.
v6
=
1
;
ue_ip_address
.
ipv6_address
=
paa
.
ipv6_address
;
break
;
case
oai
:
:
cn
::
core
::
PDN_TYPE_E_IPV4V6
:
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
oai
:
:
cn
::
core
::
PDN_TYPE_E_NON_IP
:
case
core
:
:
PDN_TYPE_E_NON_IP
:
default:
;
}
}
//------------------------------------------------------------------------------
void
pdn_ip_to_pfcp_ue_ip_address
(
const
oai
::
cn
::
core
::
pdn_type_t
&
pdn_type
,
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
,
oai
::
cn
::
core
::
pfcp
::
ue_ip_address_t
&
ue_ip_address
)
core
::
pfcp
::
ue_ip_address_t
&
ue_ip_address
)
{
switch
(
pdn_type
.
pdn_type
)
{
case
oai
:
:
cn
::
core
::
PDN_TYPE_E_IPV4
:
case
core
:
:
PDN_TYPE_E_IPV4
:
ue_ip_address
.
v4
=
1
;
ue_ip_address
.
ipv4_address
=
ipv4_address
;
break
;
case
oai
:
:
cn
::
core
::
PDN_TYPE_E_IPV6
:
case
core
:
:
PDN_TYPE_E_IPV6
:
ue_ip_address
.
v6
=
1
;
ue_ip_address
.
ipv6_address
=
ipv6_address
;
break
;
case
oai
:
:
cn
::
core
::
PDN_TYPE_E_IPV4V6
:
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
oai
:
:
cn
::
core
::
PDN_TYPE_E_NON_IP
:
case
core
:
:
PDN_TYPE_E_NON_IP
:
default:
;
}
}
bool
sockaddr_storage_to_gtp_u_peer_address
(
const
struct
sockaddr_storage
&
peer_sockaddr
,
oai
::
cn
::
core
::
gtp_u_peer_address_t
&
peer_address
)
//------------------------------------------------------------------------------
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
)
{
switch
(
peer_sockaddr
.
ss_family
)
{
case
AF_INET
:
{
...
...
src/common/utils/conversions.hpp
View file @
89d52393
...
...
@@ -344,7 +344,6 @@ do { \
/* Convert the IMSI contained by a char string NULL terminated to uint64_t */
#define IMSI_STRING_TO_IMSI64(sTRING, iMSI64_pTr) sscanf(sTRING, IMSI_64_FMT, iMSI64_pTr)
#define IMSI64_TO_STRING(iMSI64, sTRING) snprintf(sTRING, IMSI_BCD_DIGITS_MAX+1, IMSI_64_FMT, iMSI64)
imsi64_t
imsi_to_imsi64
(
oai
::
cn
::
core
::
imsi_t
*
const
imsi
);
#define IMSI_TO_STRING(iMsI_t_PtR,iMsI_sTr, MaXlEn) \
do { \
...
...
@@ -388,9 +387,6 @@ imsi64_t imsi_to_imsi64(oai::cn::core::imsi_t * const imsi);
}
void
hexa_to_ascii
(
uint8_t
*
from
,
char
*
to
,
size_t
length
);
int
ascii_to_hex
(
uint8_t
*
dst
,
const
char
*
h
);
#define UINT8_TO_BINARY_FMT "%c%c%c%c%c%c%c%c"
#define UINT8_TO_BINARY_ARG(bYtE) \
((bYtE) & 0x80 ? '1':'0'),\
...
...
@@ -421,11 +417,17 @@ do { \
}
#endif
void
paa_to_pfcp_ue_ip_address
(
const
oai
::
cn
::
core
::
paa_t
&
paa
,
oai
::
cn
::
core
::
pfcp
::
ue_ip_address_t
&
ue_ip_address
);
void
pdn_ip_to_pfcp_ue_ip_address
(
const
oai
::
cn
::
core
::
pdn_type_t
&
pdn_type
,
namespace
oai
::
cn
::
util
{
void
hexa_to_ascii
(
uint8_t
*
from
,
char
*
to
,
size_t
length
);
int
ascii_to_hex
(
uint8_t
*
dst
,
const
char
*
h
);
imsi64_t
imsi_to_imsi64
(
core
::
imsi_t
*
const
imsi
);
void
paa_to_pfcp_ue_ip_address
(
const
core
::
paa_t
&
paa
,
core
::
pfcp
::
ue_ip_address_t
&
ue_ip_address
);
void
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
,
oai
::
cn
::
core
::
pfcp
::
ue_ip_address_t
&
ue_ip_address
);
bool
sockaddr_storage_to_gtp_u_peer_address
(
const
struct
sockaddr_storage
&
peer_sockaddr
,
oai
::
cn
::
core
::
gtp_u_peer_address_t
&
peer_address
);
core
::
pfcp
::
ue_ip_address_t
&
ue_ip_address
);
bool
sockaddr_storage_to_gtp_u_peer_address
(
const
struct
sockaddr_storage
&
peer_sockaddr
,
core
::
gtp_u_peer_address_t
&
peer_address
);
}
#endif
/* FILE_CONVERSIONS_HPP_SEEN */
src/common/utils/pid_file.cpp
View file @
89d52393
...
...
@@ -88,7 +88,7 @@ bool oai::cn::util::is_pid_file_lock_success(const char * pid_file_name)
return
false
;
}
if
(
0
>
oai
::
cn
::
util
::
lockfile
(
g_fd_pid_file
,
F_TLOCK
))
{
if
(
0
>
util
::
lockfile
(
g_fd_pid_file
,
F_TLOCK
))
{
Logger
::
sgwc_app
().
error
(
"lockfile filename %s failed %d:%s
\n
"
,
pid_file_name
,
errno
,
strerror
(
errno
));
if
(
EACCES
==
errno
||
EAGAIN
==
errno
)
{
close
(
g_fd_pid_file
);
...
...
src/common/utils/string.cpp
View file @
89d52393
...
...
@@ -75,6 +75,6 @@ std::string &oai::cn::util::rtrim(std::string &s) {
// trim from both ends
std
::
string
&
oai
::
cn
::
util
::
trim
(
std
::
string
&
s
)
{
return
oai
::
cn
::
util
::
ltrim
(
oai
::
cn
::
util
::
rtrim
(
s
));
return
util
::
ltrim
(
util
::
rtrim
(
s
));
}
src/common/utils/thread_sched.cpp
View file @
89d52393
...
...
@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file thread_sched.c
/*! \file thread_sched.c
pp
\brief
\company Eurecom
\email: lionel.gauthier@eurecom.fr
...
...
src/gtpv1u/gtpv1u.cpp
View file @
89d52393
...
...
@@ -55,7 +55,7 @@ static std::string string_to_hex(const std::string& input)
return
output
;
}
//------------------------------------------------------------------------------
void
udp_server
::
udp_read_loop
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
void
udp_server
::
udp_read_loop
(
const
util
::
thread_sched_params
&
sched_params
)
{
socklen_t
r_endpoint_addr_len
=
0
;
struct
sockaddr_storage
r_endpoint
=
{};
...
...
@@ -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
=
oai
::
cn
::
core
::
toString
(
address
);
std
::
string
ipv4
=
core
::
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
=
oai
::
cn
::
core
::
toString
(
address
);
std
::
string
ipv6
=
core
::
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
)
{
...
...
@@ -159,7 +159,7 @@ int udp_server::create_socket (char * address, const uint16_t port_num)
}
}
//------------------------------------------------------------------------------
void
udp_server
::
start_receive
(
gtpu_l4_stack
*
gtp_stack
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
void
udp_server
::
start_receive
(
gtpu_l4_stack
*
gtp_stack
,
const
util
::
thread_sched_params
&
sched_params
)
{
app_
=
gtp_stack
;
Logger
::
udp
().
trace
(
"udp_server::start_receive"
);
...
...
@@ -186,10 +186,10 @@ void udp_server::start_receive(gtpu_l4_stack * gtp_stack, const oai::cn::util::t
//}
//------------------------------------------------------------------------------
gtpu_l4_stack
::
gtpu_l4_stack
(
const
struct
in_addr
&
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
:
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"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_num
);
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
core
::
toString
(
address
).
c_str
(),
port_num
);
id
=
0
;
srand
(
time
(
NULL
));
...
...
@@ -198,10 +198,10 @@ gtpu_l4_stack::gtpu_l4_stack(const struct in_addr& address, const uint16_t port_
udp_s
.
start_receive
(
this
,
sched_params
);
}
//------------------------------------------------------------------------------
gtpu_l4_stack
::
gtpu_l4_stack
(
const
struct
in6_addr
&
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
:
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"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_num
);
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
core
::
toString
(
address
).
c_str
(),
port_num
);
id
=
0
;
srand
(
time
(
NULL
));
...
...
@@ -210,7 +210,7 @@ gtpu_l4_stack::gtpu_l4_stack(const struct in6_addr& address, const uint16_t port
udp_s
.
start_receive
(
this
,
sched_params
);
}
//------------------------------------------------------------------------------
gtpu_l4_stack
::
gtpu_l4_stack
(
char
*
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
:
gtpu_l4_stack
::
gtpu_l4_stack
(
char
*
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"
,
address
,
port_num
);
...
...
src/gtpv1u/gtpv1u.hpp
View file @
89d52393
...
...
@@ -55,9 +55,9 @@ public:
{
socket_
=
create_socket
(
address
,
port_
);
if
(
socket_
>
0
)
{
Logger
::
udp
().
debug
(
"udp_server::udp_server(%s:%d)"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_
);
Logger
::
udp
().
debug
(
"udp_server::udp_server(%s:%d)"
,
core
::
toString
(
address
).
c_str
(),
port_
);
}
else
{
Logger
::
udp
().
error
(
"udp_server::udp_server(%s:%d)"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_
);
Logger
::
udp
().
error
(
"udp_server::udp_server(%s:%d)"
,
core
::
toString
(
address
).
c_str
(),
port_
);
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
500
));
throw
std
::
system_error
(
socket_
,
std
::
generic_category
(),
"GTPV1-U socket creation failed!"
);
}
...
...
@@ -68,9 +68,9 @@ public:
{
socket_
=
create_socket
(
address
,
port_
);
if
(
socket_
>
0
)
{
Logger
::
udp
().
debug
(
"udp_server::udp_server(%s:%d)"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_
);
Logger
::
udp
().
debug
(
"udp_server::udp_server(%s:%d)"
,
core
::
toString
(
address
).
c_str
(),
port_
);
}
else
{
Logger
::
udp
().
error
(
"udp_server::udp_server(%s:%d)"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_
);
Logger
::
udp
().
error
(
"udp_server::udp_server(%s:%d)"
,
core
::
toString
(
address
).
c_str
(),
port_
);
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
500
));
throw
std
::
system_error
(
socket_
,
std
::
generic_category
(),
"GTPV1-U socket creation failed!"
);
}
...
...
@@ -94,11 +94,11 @@ public:
close
(
socket_
);
}
void
udp_read_loop
(
const
oai
::
cn
::
util
::
thread_sched_params
&
thread_sched_params
);
void
udp_read_loop
(
const
util
::
thread_sched_params
&
thread_sched_params
);
void
async_send_to
(
const
char
*
send_buffer
,
const
ssize_t
num_bytes
,
const
struct
sockaddr_in
&
peer_addr
)
{
//Logger::udp().trace( "udp_server::async_send_to(%s:%d) %d bytes",
oai::cn::
core::toString(peer_addr.sin_addr).c_str(), peer_addr.sin_port, num_bytes);
//Logger::udp().trace( "udp_server::async_send_to(%s:%d) %d bytes", core::toString(peer_addr.sin_addr).c_str(), peer_addr.sin_port, num_bytes);
ssize_t
bytes_written
=
sendto
(
socket_
,
send_buffer
,
num_bytes
,
0
,
(
struct
sockaddr
*
)
&
peer_addr
,
sizeof
(
struct
sockaddr_in
));
if
(
bytes_written
!=
num_bytes
)
{
Logger
::
udp
().
error
(
"sendto failed(%d:%s)
\n
"
,
errno
,
strerror
(
errno
));
...
...
@@ -114,7 +114,7 @@ public:
}
void
start_receive
(
gtpu_l4_stack
*
gtp_stack
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
void
start_receive
(
gtpu_l4_stack
*
gtp_stack
,
const
util
::
thread_sched_params
&
sched_params
);
protected:
int
create_socket
(
const
struct
in_addr
&
address
,
const
uint16_t
port
);
...
...
@@ -162,9 +162,9 @@ protected:
public:
static
const
uint8_t
version
=
1
;
gtpu_l4_stack
(
const
struct
in_addr
&
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
gtpu_l4_stack
(
const
struct
in6_addr
&
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
gtpu_l4_stack
(
char
*
ip_address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
gtpu_l4_stack
(
const
struct
in_addr
&
address
,
const
uint16_t
port_num
,
const
util
::
thread_sched_params
&
sched_params
);
gtpu_l4_stack
(
const
struct
in6_addr
&
address
,
const
uint16_t
port_num
,
const
util
::
thread_sched_params
&
sched_params
);
gtpu_l4_stack
(
char
*
ip_address
,
const
uint16_t
port_num
,
const
util
::
thread_sched_params
&
sched_params
);
virtual
void
handle_receive
(
char
*
recv_buffer
,
const
std
::
size_t
bytes_transferred
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
);
void
handle_receive_message_cb
(
const
gtpv1u_msg
&
msg
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
,
const
core
::
itti
::
task_id_t
&
task_id
,
bool
&
error
,
uint64_t
&
gtpc_tx_id
);
...
...
src/gtpv1u/msg_gtpv1u.hpp
View file @
89d52393
...
...
@@ -34,6 +34,7 @@
#include "3gpp_29.281.h"
#include "common_defs.h"
#include <utility>
#include <vector>
#include <sys/socket.h>
...
...
src/itti/itti.cpp
View file @
89d52393
...
...
@@ -35,14 +35,13 @@
#include <csignal>
using
namespace
oai
::
cn
::
core
::
itti
;
using
namespace
std
;
extern
itti_mw
*
itti_inst
;
static
itti_timer
null_timer
(
ITTI_INVALID_TIMER_ID
,
TASK_NONE
,
0xFFFFFFFF
,
0xFFFFFFFF
,
0
,
0
);
//------------------------------------------------------------------------------
void
itti_mw
::
timer_manager_task
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
void
itti_mw
::
timer_manager_task
(
const
util
::
thread_sched_params
&
sched_params
)
{
Logger
::
itti
().
info
(
"Starting timer_manager_task"
);
sched_params
.
apply
(
TASK_ITTI_TIMER
,
Logger
::
itti
());
...
...
@@ -54,17 +53,17 @@ void itti_mw::timer_manager_task(const oai::cn::util::thread_sched_params& sched
itti_inst
->
c_timers
.
wait
(
lx
);
}
std
::
set
<
itti_timer
>::
iterator
it
=
itti_inst
->
timers
.
begin
();
itti_inst
->
current_timer
=
ref
(
*
it
);
itti_inst
->
current_timer
=
std
::
ref
(
*
it
);
itti_inst
->
timers
.
erase
(
it
);
lx
.
unlock
();
// check time-out
if
(
itti_inst
->
current_timer
.
time_out
>
chrono
::
system_clock
::
now
())
{
if
(
itti_inst
->
current_timer
.
time_out
>
std
::
chrono
::
system_clock
::
now
())
{
std
::
unique_lock
<
std
::
mutex
>
lto
(
itti_inst
->
m_timeout
);
auto
diff
=
itti_inst
->
current_timer
.
time_out
-
chrono
::
system_clock
::
now
();
auto
diff
=
itti_inst
->
current_timer
.
time_out
-
std
::
chrono
::
system_clock
::
now
();
auto
rc
=
itti_inst
->
c_timeout
.
wait_for
(
lto
,
diff
);
lto
.
unlock
();
if
(
cv_status
::
timeout
==
rc
)
{
if
(
std
::
cv_status
::
timeout
==
rc
)
{
// signal time-out
itti_msg_timeout
mto
(
TASK_ITTI_TIMER
,
itti_inst
->
current_timer
.
task_id
,
itti_inst
->
current_timer
.
id
,
itti_inst
->
current_timer
.
arg1_user
,
itti_inst
->
current_timer
.
arg2_user
);
std
::
shared_ptr
<
itti_msg_timeout
>
msgsh
=
std
::
make_shared
<
itti_msg_timeout
>
(
mto
);
...
...
@@ -110,9 +109,9 @@ itti_mw::~itti_mw() {
}
//------------------------------------------------------------------------------
void
itti_mw
::
start
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
{
void
itti_mw
::
start
(
const
util
::
thread_sched_params
&
sched_params
)
{
Logger
::
itti
().
startup
(
"Starting..."
);
timer_thread
=
thread
(
timer_manager_task
,
sched_params
);
timer_thread
=
std
::
thread
(
timer_manager_task
,
sched_params
);
Logger
::
itti
().
startup
(
"Started"
);
}
//------------------------------------------------------------------------------
...
...
@@ -145,7 +144,7 @@ int itti_mw::create_task (const task_id_t task_id,
created_tasks
++
;
lk
.
unlock
();
}
itti_task_ctxts
[
task_id
]
->
thread
=
thread
(
start_routine
,
args_p
);
itti_task_ctxts
[
task_id
]
->
thread
=
std
::
thread
(
start_routine
,
args_p
);
while
((
itti_task_ctxts
[
task_id
]
->
task_state
!=
TASK_STATE_READY
)
&&
(
itti_task_ctxts
[
task_id
]
->
task_state
!=
TASK_STATE_ENDED
))
usleep
(
1000
);
return
0
;
...
...
src/itti/itti.hpp
View file @
89d52393
...
...
@@ -123,7 +123,7 @@ private:
std
::
atomic
<
int
>
ready_tasks
;
std
::
set
<
itti_timer
,
timer_comparator
>
timers
;
oai
::
cn
::
core
::
itti
::
itti_timer
current_timer
;
core
::
itti
::
itti_timer
current_timer
;
std
::
mutex
m_timers
;
std
::
condition_variable
c_timers
;
...
...
@@ -132,7 +132,7 @@ private:
bool
terminate
;
static
void
timer_manager_task
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
static
void
timer_manager_task
(
const
util
::
thread_sched_params
&
sched_params
);
public:
itti_mw
();
...
...
@@ -140,7 +140,7 @@ public:
void
operator
=
(
itti_mw
const
&
)
=
delete
;
~
itti_mw
();
void
start
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
void
start
(
const
util
::
thread_sched_params
&
sched_params
);
timer_id_t
increment_timer_id
();
unsigned
int
increment_message_number
();
...
...
src/itti/itti_msg.hpp
View file @
89d52393
...
...
@@ -24,12 +24,11 @@
\date 2018
\email: lionel.gauthier@eurecom.fr
*/
#ifndef SRC_ITTI_ITTI_MSG_H_INCLUDED_
#define SRC_ITTI_ITTI_MSG_H_INCLUDED_
#ifndef SRC_ITTI_ITTI_MSG_H
PP
_INCLUDED_
#define SRC_ITTI_ITTI_MSG_H
PP
_INCLUDED_
#include <stdint.h>
#include <typeinfo>
#include <iostream>
#include <utility>
namespace
oai
::
cn
::
core
::
itti
{
...
...
@@ -75,15 +74,7 @@ typedef enum {
ITTI_MSG_TYPE_NONE
=
-
1
,
ITTI_MSG_TYPE_FIRST
=
0
,
ASYNC_SHELL_CMD
=
ITTI_MSG_TYPE_FIRST
,
GTPV1U_CREATE_TUNNEL_REQ
,
GTPV1U_CREATE_TUNNEL_RESP
,
GTPV1U_UPDATE_TUNNEL_REQ
,
GTPV1U_UPDATE_TUNNEL_RESP
,
GTPV1U_DELETE_TUNNEL_REQ
,
GTPV1U_DELETE_TUNNEL_RESP
,
GTPV1U_TUNNEL_DATA_IND
,
GTPV1U_TUNNEL_DATA_REQ
,
GTPV1U_DOWNLINK_DATA_NOTIFICATION
,
RESTORE_SX_SESSIONS
,
S11_CREATE_SESSION_REQUEST
,
S11_CREATE_SESSION_RESPONSE
,
S11_CREATE_BEARER_REQUEST
,
...
...
@@ -193,6 +184,7 @@ public:
static
const
char
*
get_msg_name
()
{
return
"HEALTH_PING"
;};
uint32_t
seq
;
};
class
itti_msg_terminate
:
public
itti_msg
{
public:
itti_msg_terminate
(
const
task_id_t
origin
,
const
task_id_t
destination
)
:
...
...
@@ -201,4 +193,4 @@ public:
static
const
char
*
get_msg_name
()
{
return
"TERMINATE"
;};
};
}
#endif
/* SRC_ITTI_ITTI_MSG_H_INCLUDED_ */
#endif
/* SRC_ITTI_ITTI_MSG_H
PP
_INCLUDED_ */
src/spgwu/simpleswitch/pfcp_session.cpp
0 → 100644
View file @
89d52393
This diff is collapsed.
Click to expand it.
src/spgwu/simpleswitch/pfcp_switch.cpp
View file @
89d52393
...
...
@@ -124,7 +124,7 @@ void pfcp_switch::commit_changes()
}
//------------------------------------------------------------------------------
void
pfcp_switch
::
pdn_read_loop
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
void
pfcp_switch
::
pdn_read_loop
(
const
util
::
thread_sched_params
&
sched_params
)
{
int
bytes_received
=
0
;
...
...
@@ -266,14 +266,14 @@ void pfcp_switch::setup_pdn_interfaces()
struct
in_addr
address4
=
{};
address4
.
s_addr
=
it
.
network_ipv4
.
s_addr
+
be32toh
(
1
);
std
::
string
cmd
=
fmt
::
format
(
"ip -4 addr add {}/{} dev {}"
,
oai
::
cn
::
core
::
toString
(
address4
).
c_str
(),
it
.
prefix_ipv4
,
PDN_INTERFACE_NAME
);
std
::
string
cmd
=
fmt
::
format
(
"ip -4 addr add {}/{} dev {}"
,
core
::
toString
(
address4
).
c_str
(),
it
.
prefix_ipv4
,
PDN_INTERFACE_NAME
);
rc
=
system
((
const
char
*
)
cmd
.
c_str
());
if
(
it
.
snat
)
{
cmd
=
fmt
::
format
(
"iptables -t nat -A POSTROUTING -s {}/{} -j SNAT --to-source {}"
,
oai
::
cn
::
core
::
toString
(
address4
).
c_str
(),
core
::
toString
(
address4
).
c_str
(),
it
.
prefix_ipv4
,
oai
::
cn
::
core
::
toString
(
spgwu_cfg
.
sgi
.
addr4
).
c_str
());
core
::
toString
(
spgwu_cfg
.
sgi
.
addr4
).
c_str
());
rc
=
system
((
const
char
*
)
cmd
.
c_str
());
}
}
...
...
@@ -283,10 +283,10 @@ void pfcp_switch::setup_pdn_interfaces()
struct
in6_addr
addr6
=
it
.
network_ipv6
;
addr6
.
s6_addr
[
15
]
=
1
;
cmd
=
fmt
::
format
(
"ip -6 addr add {}/{} dev {}"
,
oai
::
cn
::
core
::
toString
(
addr6
).
c_str
(),
it
.
prefix_ipv6
,
PDN_INTERFACE_NAME
);
cmd
=
fmt
::
format
(
"ip -6 addr add {}/{} dev {}"
,
core
::
toString
(
addr6
).
c_str
(),
it
.
prefix_ipv6
,
PDN_INTERFACE_NAME
);
rc
=
system
((
const
char
*
)
cmd
.
c_str
());
// if ((it.snat) && (/* SGI has IPv6 address*/)){
// cmd = fmt::format("ip6tables -t nat -A POSTROUTING -s {}/{} -o {} -j SNAT --to-source {}",
oai::cn::
core::toString(addr6).c_str(), it.prefix_ipv6, xxx);
// cmd = fmt::format("ip6tables -t nat -A POSTROUTING -s {}/{} -o {} -j SNAT --to-source {}", core::toString(addr6).c_str(), it.prefix_ipv6, xxx);
// rc = system ((const char*)cmd.c_str());
// }
}
...
...
@@ -321,7 +321,7 @@ void pfcp_switch::setup_pdn_interfaces()
//------------------------------------------------------------------------------
oai
::
cn
::
core
::
pfcp
::
fteid_t
pfcp_switch
::
generate_fteid_s1u
()
{
oai
::
cn
::
core
::
pfcp
::
fteid_t
fteid
=
{};
core
::
pfcp
::
fteid_t
fteid
=
{};
fteid
.
teid
=
generate_teid_s1u
();
if
(
spgwu_cfg
.
s1_up
.
addr4
.
s_addr
)
{
fteid
.
v4
=
1
;
...
...
@@ -414,7 +414,7 @@ void pfcp_switch::remove_pfcp_session(std::shared_ptr<core::pfcp::pfcp_session>&
up_seid2pfcp_sessions
.
erase
(
session
->
seid
);
}
//------------------------------------------------------------------------------
void
pfcp_switch
::
remove_pfcp_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
)
void
pfcp_switch
::
remove_pfcp_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
)
{
std
::
shared_ptr
<
core
::
pfcp
::
pfcp_session
>
session
=
{};
if
(
get_pfcp_session_by_cp_fseid
(
cp_fseid
,
session
))
{
...
...
@@ -565,7 +565,7 @@ void pfcp_switch::handle_pfcp_session_establishment_request(std::shared_ptr<core
resp
->
pfcp_ies
.
set
(
up_fseid
);
// Register session
oai
::
cn
::
core
::
pfcp
::
node_id_t
node_id
=
{};
core
::
pfcp
::
node_id_t
node_id
=
{};
req
->
pfcp_ies
.
get
(
node_id
);
pfcp_associations
::
get_instance
().
notify_add_session
(
node_id
,
fseid
);
}
...
...
src/spgwu/simpleswitch/pfcp_switch.hpp
View file @
89d52393
...
...
@@ -91,8 +91,8 @@ private:
int
pdn_if_index
;
oai
::
cn
::
util
::
uint_generator
<
uint64_t
>
seid_generator_
;
oai
::
cn
::
util
::
uint_generator
<
teid_t
>
teid_s1u_generator_
;
util
::
uint_generator
<
uint64_t
>
seid_generator_
;
util
::
uint_generator
<
teid_t
>
teid_s1u_generator_
;
#define TASK_SPGWU_PFCP_SWITCH_MAX_COMMIT_INTERVAL (0)
#define TASK_SPGWU_PFCP_SWITCH_MIN_COMMIT_INTERVAL (1)
...
...
@@ -109,13 +109,13 @@ private:
//moodycamel::ConcurrentQueue<core::pfcp::pfcp_session*> create_session_q;
void
pdn_read_loop
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
void
pdn_read_loop
(
const
util
::
thread_sched_params
&
sched_params
);
int
create_pdn_socket
(
const
char
*
const
ifname
,
const
bool
promisc
,
int
&
if_index
);
int
create_pdn_socket
(
const
char
*
const
ifname
);
void
setup_pdn_interfaces
();
oai
::
cn
::
core
::
itti
::
timer_id_t
timer_max_commit_interval_id
;
oai
::
cn
::
core
::
itti
::
timer_id_t
timer_min_commit_interval_id
;
core
::
itti
::
timer_id_t
timer_max_commit_interval_id
;
core
::
itti
::
timer_id_t
timer_min_commit_interval_id
;
void
stop_timer_min_commit_interval
();
void
start_timer_min_commit_interval
();
...
...
@@ -169,7 +169,7 @@ public:
void
time_out_min_commit_interval
(
const
uint32_t
timer_id
);
void
time_out_max_commit_interval
(
const
uint32_t
timer_id
);
void
remove_pfcp_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
);
void
remove_pfcp_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
);
void
remove_pfcp_ul_pdrs_by_up_teid
(
const
teid_t
)
{};
void
remove_pfcp_dl_pdrs_by_ue_ip
(
const
uint32_t
)
{};
...
...
src/spgwu/simpleswitch/spgwu_s1u.cpp
View file @
89d52393
...
...
@@ -238,7 +238,7 @@ void spgwu_s1u::report_error_indication(const struct sockaddr_storage& r_endpoin
error_ind
->
gtp_ies
.
set
(
tun_data
);
core
::
gtp_u_peer_address_t
peer_address
=
{};
if
(
sockaddr_storage_to_gtp_u_peer_address
(
r_endpoint
,
peer_address
))
{
if
(
oai
::
cn
::
util
::
sockaddr_storage_to_gtp_u_peer_address
(
r_endpoint
,
peer_address
))
{
error_ind
->
gtp_ies
.
set
(
peer_address
);
}
else
{
// mandatory ie
...
...
src/spgwu/simpleswitch/spgwu_s1u.hpp
View file @
89d52393
...
...
@@ -39,7 +39,7 @@
namespace
oai
::
cn
::
nf
::
spgwu
{
class
spgwu_s1u
:
public
oai
::
cn
::
proto
::
gtpv1u
::
gtpu_l4_stack
{
class
spgwu_s1u
:
public
proto
::
gtpv1u
::
gtpu_l4_stack
{
private:
std
::
thread
::
id
thread_id
;
std
::
thread
thread
;
...
...
@@ -52,17 +52,17 @@ public:
spgwu_s1u
(
spgwu_s1u
const
&
)
=
delete
;
void
operator
=
(
spgwu_s1u
const
&
)
=
delete
;
//void handle_itti_msg (
oai::cn::
core::itti::itti_s1u_echo_request& s) {};
void
handle_itti_msg
(
std
::
shared_ptr
<
oai
::
cn
::
core
::
itti
::
itti_s1u_echo_response
>
m
);
void
handle_itti_msg
(
std
::
shared_ptr
<
oai
::
cn
::
core
::
itti
::
itti_s1u_error_indication
>
m
);
//void handle_itti_msg (
oai::cn::
core::itti::itti_s1u_supported_extension_headers_notification& s) {};
//void handle_itti_msg (
oai::cn::
core::itti::itti_s1u_end_marker& s) {};
//void handle_itti_msg (core::itti::itti_s1u_echo_request& s) {};
void
handle_itti_msg
(
std
::
shared_ptr
<
core
::
itti
::
itti_s1u_echo_response
>
m
);
void
handle_itti_msg
(
std
::
shared_ptr
<
core
::
itti
::
itti_s1u_error_indication
>
m
);
//void handle_itti_msg (core::itti::itti_s1u_supported_extension_headers_notification& s) {};
//void handle_itti_msg (core::itti::itti_s1u_end_marker& s) {};
//void send_msg (
oai::cn::
core::itti::itti_s1u_echo_request& s) {};
//void send_msg (
oai::cn::
core::itti::itti_s1u_echo_response& s);
//void send_msg (
oai::cn::
core::itti::itti_s1u_error_indication& s) {};
//void send_msg (
oai::cn::
core::itti::itti_s1u_supported_extension_headers_notification& s) {};
//void send_msg (
oai::cn::
core::itti::itti_s1u_end_marker& s) {};
//void send_msg (core::itti::itti_s1u_echo_request& s) {};
//void send_msg (core::itti::itti_s1u_echo_response& s);
//void send_msg (core::itti::itti_s1u_error_indication& s) {};
//void send_msg (core::itti::itti_s1u_supported_extension_headers_notification& s) {};
//void send_msg (core::itti::itti_s1u_end_marker& s) {};
void
handle_receive_s1u_msg
(
proto
::
gtpv1u
::
gtpv1u_msg
&
msg
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
);
void
handle_receive
(
char
*
recv_buffer
,
const
std
::
size_t
bytes_transferred
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
);
...
...
src/spgwu/spgwu_app.hpp
View file @
89d52393
...
...
@@ -58,7 +58,7 @@ public:
teid_t
generate_s5s8_up_teid
();
void
handle_itti_msg
(
std
::
shared_ptr
<
oai
::
cn
::
core
::
itti
::
itti_s1u_echo_request
>
m
);
void
handle_itti_msg
(
std
::
shared_ptr
<
core
::
itti
::
itti_s1u_echo_request
>
m
);
// void handle_itti_msg core::(itti::itti_sxab_heartbeat_request& m);
...
...
@@ -74,9 +74,9 @@ public:
// void handle_itti_msg (core::itti::itti_sxab_pfcp_version_not_supported_response& m);
// void handle_itti_msg (core::itti::itti_sxab_pfcp_node_report_request& m);
// void handle_itti_msg (core::itti::itti_sxab_pfcp_node_report_response& m);
void
handle_itti_msg
(
std
::
shared_ptr
<
oai
::
cn
::
core
::
itti
::
itti_sxab_session_establishment_request
>
m
);
void
handle_itti_msg
(
std
::
shared_ptr
<
oai
::
cn
::
core
::
itti
::
itti_sxab_session_modification_request
>
m
);
void
handle_itti_msg
(
std
::
shared_ptr
<
oai
::
cn
::
core
::
itti
::
itti_sxab_session_deletion_request
>
m
);
void
handle_itti_msg
(
std
::
shared_ptr
<
core
::
itti
::
itti_sxab_session_establishment_request
>
m
);
void
handle_itti_msg
(
std
::
shared_ptr
<
core
::
itti
::
itti_sxab_session_modification_request
>
m
);
void
handle_itti_msg
(
std
::
shared_ptr
<
core
::
itti
::
itti_sxab_session_deletion_request
>
m
);
// void handle_itti_msg (core::itti::itti_sxab_session_deletion_response& m);
// void handle_itti_msg (core::itti::itti_sxab_session_report_request& m);
// void handle_itti_msg (core::itti::itti_sxab_session_report_response& m);
...
...
src/spgwu/spgwu_config.cpp
View file @
89d52393
...
...
@@ -63,23 +63,23 @@ int spgwu_config::execute ()
}
//------------------------------------------------------------------------------
int
spgwu_config
::
get_pfcp_node_id
(
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
)
int
spgwu_config
::
get_pfcp_node_id
(
core
::
pfcp
::
node_id_t
&
node_id
)
{
node_id
=
{};
if
(
sx
.
addr4
.
s_addr
)
{
node_id
.
node_id_type
=
oai
::
cn
::
core
::
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
;
node_id
.
node_id_type
=
core
::
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
;
node_id
.
u1
.
ipv4_address
=
sx
.
addr4
;
return
RETURNok
;
}
if
(
sx
.
addr6
.
s6_addr32
[
0
]
|
sx
.
addr6
.
s6_addr32
[
1
]
|
sx
.
addr6
.
s6_addr32
[
2
]
|
sx
.
addr6
.
s6_addr32
[
3
])
{
node_id
.
node_id_type
=
oai
::
cn
::
core
::
pfcp
::
NODE_ID_TYPE_IPV6_ADDRESS
;
node_id
.
node_id_type
=
core
::
pfcp
::
NODE_ID_TYPE_IPV6_ADDRESS
;
node_id
.
u1
.
ipv6_address
=
sx
.
addr6
;
return
RETURNok
;
}
return
RETURNerror
;
}
//------------------------------------------------------------------------------
int
spgwu_config
::
get_pfcp_fseid
(
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
fseid
)
int
spgwu_config
::
get_pfcp_fseid
(
core
::
pfcp
::
fseid_t
&
fseid
)
{
int
rc
=
RETURNerror
;
fseid
=
{};
...
...
@@ -96,7 +96,7 @@ int spgwu_config::get_pfcp_fseid(oai::cn::core::pfcp::fseid_t& fseid)
return
rc
;
}
//------------------------------------------------------------------------------
int
spgwu_config
::
load_thread_sched_params
(
const
Setting
&
thread_sched_params_cfg
,
oai
::
cn
::
util
::
thread_sched_params
&
cfg
)
int
spgwu_config
::
load_thread_sched_params
(
const
Setting
&
thread_sched_params_cfg
,
util
::
thread_sched_params
&
cfg
)
{
thread_sched_params_cfg
.
lookupValue
(
SPGWU_CONFIG_STRING_THREAD_RD_CPU_ID
,
cfg
.
cpu_id
);
...
...
@@ -282,7 +282,7 @@ int spgwu_config::load(const string& config_file)
throw
(
"CONFIG: BAD IPV6 NETWORK ADDRESS in "
SPGWU_CONFIG_STRING_PDN_NETWORK_LIST
);
}
pdn_cfg
.
prefix_ipv6
=
std
::
stoul
(
ips
.
at
(
1
),
nullptr
,
0
);
Logger
::
spgwu_app
().
info
(
" %s......: %s/%d"
,
ips
.
at
(
0
).
c_str
(),
oai
::
cn
::
core
::
toString
(
pdn_cfg
.
network_ipv6
).
c_str
(),
pdn_cfg
.
prefix_ipv6
);
Logger
::
spgwu_app
().
info
(
" %s......: %s/%d"
,
ips
.
at
(
0
).
c_str
(),
core
::
toString
(
pdn_cfg
.
network_ipv6
).
c_str
(),
pdn_cfg
.
prefix_ipv6
);
}
pdn_cfg
.
snat
=
false
;
std
::
string
astring
=
{};
...
...
@@ -303,7 +303,7 @@ int spgwu_config::load(const string& config_file)
string
address
=
{};
if
(
spgwc_cfg
.
lookupValue
(
SPGWU_CONFIG_STRING_IPV4_ADDRESS
,
address
))
{
core
::
pfcp
::
node_id_t
n
=
{};
n
.
node_id_type
=
oai
::
cn
::
core
::
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
;
// actually
n
.
node_id_type
=
core
::
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
;
// actually
if
(
inet_pton
(
AF_INET
,
util
::
trim
(
address
).
c_str
(),
buf_in_addr
)
==
1
)
{
memcpy
(
&
n
.
u1
.
ipv4_address
,
buf_in_addr
,
sizeof
(
struct
in_addr
));
}
else
{
...
...
@@ -388,10 +388,10 @@ void spgwu_config::display ()
for
(
auto
it
:
pdns
)
{
Logger
::
spgwu_app
().
info
(
" PDN %d ............: snat %s"
,
i
,
(
it
.
snat
)
?
"yes"
:
"no"
);
if
(
it
.
prefix_ipv4
)
{
Logger
::
spgwu_app
().
info
(
" NW .............: %s/%d"
,
oai
::
cn
::
core
::
toString
(
it
.
network_ipv4
).
c_str
(),
it
.
prefix_ipv4
);
Logger
::
spgwu_app
().
info
(
" NW .............: %s/%d"
,
core
::
toString
(
it
.
network_ipv4
).
c_str
(),
it
.
prefix_ipv4
);
}
if
(
it
.
prefix_ipv6
)
{
Logger
::
spgwu_app
().
info
(
" NW .............: %s/%d"
,
oai
::
cn
::
core
::
toString
(
it
.
network_ipv6
).
c_str
(),
it
.
prefix_ipv6
);
Logger
::
spgwu_app
().
info
(
" NW .............: %s/%d"
,
core
::
toString
(
it
.
network_ipv6
).
c_str
(),
it
.
prefix_ipv6
);
}
i
++
;
}
...
...
src/spgwu/spgwu_config.hpp
View file @
89d52393
...
...
@@ -80,7 +80,7 @@ typedef struct interface_cfg_s {
struct
in6_addr
addr6
;
unsigned
int
mtu
;
unsigned
int
port
;
oai
::
cn
::
util
::
thread_sched_params
thread_rd_sched_params
;
util
::
thread_sched_params
thread_rd_sched_params
;
}
interface_cfg_t
;
typedef
struct
pdn_cfg_s
{
...
...
@@ -92,11 +92,11 @@ typedef struct pdn_cfg_s {
}
pdn_cfg_t
;
typedef
struct
itti_cfg_s
{
oai
::
cn
::
util
::
thread_sched_params
itti_timer_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
s1u_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
sx_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
spgwu_app_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
async_cmd_sched_params
;
util
::
thread_sched_params
itti_timer_sched_params
;
util
::
thread_sched_params
s1u_sched_params
;
util
::
thread_sched_params
sx_sched_params
;
util
::
thread_sched_params
spgwu_app_sched_params
;
util
::
thread_sched_params
async_cmd_sched_params
;
}
itti_cfg_t
;
class
spgwu_config
{
...
...
@@ -105,7 +105,7 @@ private:
int
load_itti
(
const
libconfig
::
Setting
&
itti_cfg
,
itti_cfg_t
&
cfg
);
int
load_interface
(
const
libconfig
::
Setting
&
if_cfg
,
interface_cfg_t
&
cfg
);
int
load_thread_sched_params
(
const
libconfig
::
Setting
&
thread_sched_params_cfg
,
oai
::
cn
::
util
::
thread_sched_params
&
cfg
);
int
load_thread_sched_params
(
const
libconfig
::
Setting
&
thread_sched_params_cfg
,
util
::
thread_sched_params
&
cfg
);
public:
...
...
@@ -123,7 +123,7 @@ public:
uint32_t
max_pfcp_sessions
;
std
::
vector
<
pdn_cfg_t
>
pdns
;
std
::
vector
<
oai
::
cn
::
core
::
pfcp
::
node_id_t
>
spgwcs
;
std
::
vector
<
core
::
pfcp
::
node_id_t
>
spgwcs
;
spgwu_config
()
:
m_rw_lock
(),
pid_dir
(),
instance
(
0
),
s1_up
(),
sgi
(),
gateway
(),
sx
(),
itti
(),
pdns
(),
spgwcs
(),
max_pfcp_sessions
(
100
)
{};
...
...
@@ -132,8 +132,8 @@ public:
int
load
(
const
std
::
string
&
config_file
);
int
execute
();
void
display
();
int
get_pfcp_node_id
(
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
);
int
get_pfcp_fseid
(
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
fseid
);
int
get_pfcp_node_id
(
core
::
pfcp
::
node_id_t
&
node_id
);
int
get_pfcp_fseid
(
core
::
pfcp
::
fseid_t
&
fseid
);
};
}
// namespace spgwu
...
...
src/spgwu/spgwu_pfcp_association.cpp
View file @
89d52393
...
...
@@ -41,13 +41,13 @@ extern pfcp_switch *pfcp_switch_inst;
extern
spgwu_sx
*
spgwu_sx_inst
;
//------------------------------------------------------------------------------
void
pfcp_association
::
notify_add_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
)
void
pfcp_association
::
notify_add_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
)
{
std
::
unique_lock
<
std
::
mutex
>
l
(
m_sessions
);
sessions
.
insert
(
cp_fseid
);
}
//------------------------------------------------------------------------------
bool
pfcp_association
::
has_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
)
bool
pfcp_association
::
has_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
)
{
std
::
unique_lock
<
std
::
mutex
>
l
(
m_sessions
);
auto
it
=
sessions
.
find
(
cp_fseid
);
...
...
@@ -58,7 +58,7 @@ bool pfcp_association::has_session(const oai::cn::core::pfcp::fseid_t& cp_fseid)
}
}
//------------------------------------------------------------------------------
void
pfcp_association
::
notify_del_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
)
void
pfcp_association
::
notify_del_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
)
{
std
::
unique_lock
<
std
::
mutex
>
l
(
m_sessions
);
sessions
.
erase
(
cp_fseid
);
...
...
@@ -73,13 +73,13 @@ void pfcp_association::del_sessions()
}
}
//------------------------------------------------------------------------------
bool
pfcp_associations
::
add_association
(
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
oai
::
cn
::
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
)
bool
pfcp_associations
::
add_association
(
core
::
pfcp
::
node_id_t
&
node_id
,
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
)
{
std
::
shared_ptr
<
pfcp_association
>
sa
=
{};
if
(
remove_peer_candidate_node
(
node_id
,
sa
))
{
sa
->
recovery_time_stamp
=
recovery_time_stamp
;
sa
->
function_features
=
{};
std
::
size_t
hash_node_id
=
std
::
hash
<
oai
::
cn
::
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
std
::
size_t
hash_node_id
=
std
::
hash
<
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
associations
.
insert
((
int32_t
)
hash_node_id
,
sa
);
trigger_heartbeat_request_procedure
(
sa
);
return
true
;
...
...
@@ -87,14 +87,14 @@ bool pfcp_associations::add_association(oai::cn::core::pfcp::node_id_t& node_id,
return
false
;
}
//------------------------------------------------------------------------------
bool
pfcp_associations
::
add_association
(
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
oai
::
cn
::
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
,
oai
::
cn
::
core
::
pfcp
::
cp_function_features_s
&
bool
pfcp_associations
::
add_association
(
core
::
pfcp
::
node_id_t
&
node_id
,
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
,
core
::
pfcp
::
cp_function_features_s
&
function_features
)
{
std
::
shared_ptr
<
pfcp_association
>
sa
=
{};
if
(
remove_peer_candidate_node
(
node_id
,
sa
))
{
sa
->
recovery_time_stamp
=
recovery_time_stamp
;
sa
->
set
(
function_features
);
std
::
size_t
hash_node_id
=
std
::
hash
<
oai
::
cn
::
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
std
::
size_t
hash_node_id
=
std
::
hash
<
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
associations
.
insert
((
int32_t
)
hash_node_id
,
sa
);
trigger_heartbeat_request_procedure
(
sa
);
return
true
;
...
...
@@ -102,9 +102,9 @@ function_features)
return
false
;
}
//------------------------------------------------------------------------------
bool
pfcp_associations
::
get_association
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
bool
pfcp_associations
::
get_association
(
const
core
::
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
{
std
::
size_t
hash_node_id
=
std
::
hash
<
oai
::
cn
::
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
std
::
size_t
hash_node_id
=
std
::
hash
<
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
auto
pit
=
associations
.
find
((
int32_t
)
hash_node_id
);
if
(
pit
==
associations
.
end
()
)
return
false
;
...
...
@@ -114,7 +114,7 @@ bool pfcp_associations::get_association(const oai::cn::core::pfcp::node_id_t& no
}
}
//------------------------------------------------------------------------------
bool
pfcp_associations
::
get_association
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
bool
pfcp_associations
::
get_association
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
{
folly
::
AtomicHashMap
<
int32_t
,
std
::
shared_ptr
<
pfcp_association
>>::
iterator
it
;
...
...
@@ -128,7 +128,7 @@ bool pfcp_associations::get_association(const oai::cn::core::pfcp::fseid_t& cp_f
return
false
;
}
//------------------------------------------------------------------------------
bool
pfcp_associations
::
remove_peer_candidate_node
(
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
s
)
bool
pfcp_associations
::
remove_peer_candidate_node
(
core
::
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
s
)
{
for
(
std
::
vector
<
std
::
shared_ptr
<
pfcp_association
>>::
iterator
it
=
pending_associations
.
begin
();
it
<
pending_associations
.
end
();
++
it
)
{
if
((
*
it
)
->
node_id
==
node_id
)
{
...
...
@@ -140,7 +140,7 @@ bool pfcp_associations::remove_peer_candidate_node(oai::cn::core::pfcp::node_id_
return
false
;
}
//------------------------------------------------------------------------------
bool
pfcp_associations
::
add_peer_candidate_node
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
)
bool
pfcp_associations
::
add_peer_candidate_node
(
const
core
::
pfcp
::
node_id_t
&
node_id
)
{
for
(
std
::
vector
<
std
::
shared_ptr
<
pfcp_association
>>::
iterator
it
=
pending_associations
.
begin
();
it
<
pending_associations
.
end
();
++
it
)
{
if
((
*
it
)
->
node_id
==
node_id
)
{
...
...
@@ -208,7 +208,7 @@ void pfcp_associations::handle_receive_heartbeat_response(const uint64_t trxn_id
}
//------------------------------------------------------------------------------
void
pfcp_associations
::
notify_add_session
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
)
void
pfcp_associations
::
notify_add_session
(
const
core
::
pfcp
::
node_id_t
&
node_id
,
const
core
::
pfcp
::
fseid_t
&
cp_fseid
)
{
std
::
shared_ptr
<
pfcp_association
>
sa
=
{};
if
(
get_association
(
node_id
,
sa
))
{
...
...
@@ -216,7 +216,7 @@ void pfcp_associations::notify_add_session(const oai::cn::core::pfcp::node_id_t&
}
}
//------------------------------------------------------------------------------
void
pfcp_associations
::
notify_del_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
)
void
pfcp_associations
::
notify_del_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
)
{
std
::
shared_ptr
<
pfcp_association
>
sa
=
{};
if
(
get_association
(
cp_fseid
,
sa
))
{
...
...
src/spgwu/spgwu_pfcp_association.hpp
View file @
89d52393
...
...
@@ -41,37 +41,37 @@ namespace oai::cn::nf::spgwu {
#define PFCP_ASSOCIATION_HEARTBEAT_MAX_RETRIES 5
class
pfcp_association
{
public:
oai
::
cn
::
core
::
pfcp
::
node_id_t
node_id
;
core
::
pfcp
::
node_id_t
node_id
;
std
::
size_t
hash_node_id
;
oai
::
cn
::
core
::
pfcp
::
recovery_time_stamp_t
recovery_time_stamp
;
std
::
pair
<
bool
,
oai
::
cn
::
core
::
pfcp
::
cp_function_features_s
>
function_features
;
core
::
pfcp
::
recovery_time_stamp_t
recovery_time_stamp
;
std
::
pair
<
bool
,
core
::
pfcp
::
cp_function_features_s
>
function_features
;
//
mutable
std
::
mutex
m_sessions
;
std
::
set
<
oai
::
cn
::
core
::
pfcp
::
fseid_t
>
sessions
;
std
::
set
<
core
::
pfcp
::
fseid_t
>
sessions
;
//
oai
::
cn
::
core
::
itti
::
timer_id_t
timer_heartbeat
;
core
::
itti
::
timer_id_t
timer_heartbeat
;
int
num_retries_timer_heartbeat
;
uint64_t
trxn_id_heartbeat
;
oai
::
cn
::
core
::
itti
::
timer_id_t
timer_association
;
core
::
itti
::
timer_id_t
timer_association
;
explicit
pfcp_association
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
)
:
explicit
pfcp_association
(
const
core
::
pfcp
::
node_id_t
&
node_id
)
:
node_id
(
node_id
),
recovery_time_stamp
(),
function_features
(),
m_sessions
(),
sessions
()
{
hash_node_id
=
std
::
hash
<
oai
::
cn
::
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
hash_node_id
=
std
::
hash
<
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
timer_heartbeat
=
ITTI_INVALID_TIMER_ID
;
num_retries_timer_heartbeat
=
0
;
trxn_id_heartbeat
=
0
;
}
pfcp_association
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
oai
::
cn
::
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
)
:
pfcp_association
(
const
core
::
pfcp
::
node_id_t
&
node_id
,
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
)
:
node_id
(
node_id
),
recovery_time_stamp
(
recovery_time_stamp
),
function_features
(),
m_sessions
(),
sessions
()
{
hash_node_id
=
std
::
hash
<
oai
::
cn
::
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
hash_node_id
=
std
::
hash
<
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
timer_heartbeat
=
ITTI_INVALID_TIMER_ID
;
num_retries_timer_heartbeat
=
0
;
trxn_id_heartbeat
=
0
;
}
pfcp_association
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
ni
,
oai
::
cn
::
core
::
pfcp
::
recovery_time_stamp_t
&
rts
,
oai
::
cn
::
core
::
pfcp
::
cp_function_features_s
&
uff
)
:
pfcp_association
(
const
core
::
pfcp
::
node_id_t
&
ni
,
core
::
pfcp
::
recovery_time_stamp_t
&
rts
,
core
::
pfcp
::
cp_function_features_s
&
uff
)
:
node_id
(
ni
),
recovery_time_stamp
(
rts
),
m_sessions
(),
sessions
()
{
hash_node_id
=
std
::
hash
<
oai
::
cn
::
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
hash_node_id
=
std
::
hash
<
core
::
pfcp
::
node_id_t
>
{}(
node_id
);
function_features
.
first
=
true
;
function_features
.
second
=
uff
;
timer_heartbeat
=
ITTI_INVALID_TIMER_ID
;
...
...
@@ -91,11 +91,11 @@ namespace oai::cn::nf::spgwu {
// num_retries_timer_heartbeat = p.num_retries_timer_heartbeat;
// trxn_id_heartbeat = p.trxn_id_heartbeat;
// }
void
notify_add_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
);
bool
has_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
);
void
notify_del_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
);
void
notify_add_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
);
bool
has_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
);
void
notify_del_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
);
void
del_sessions
();
void
set
(
const
oai
::
cn
::
core
::
pfcp
::
cp_function_features_s
&
ff
)
{
function_features
.
first
=
true
;
function_features
.
second
=
ff
;};
void
set
(
const
core
::
pfcp
::
cp_function_features_s
&
ff
)
{
function_features
.
first
=
true
;
function_features
.
second
=
ff
;};
};
#define PFCP_MAX_ASSOCIATIONS 16
...
...
@@ -107,7 +107,7 @@ namespace oai::cn::nf::spgwu {
pfcp_associations
()
:
associations
(
PFCP_MAX_ASSOCIATIONS
),
pending_associations
()
{};
void
trigger_heartbeat_request_procedure
(
std
::
shared_ptr
<
pfcp_association
>&
s
);
bool
remove_peer_candidate_node
(
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
s
);
bool
remove_peer_candidate_node
(
core
::
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
s
);
public:
static
pfcp_associations
&
get_instance
()
...
...
@@ -119,20 +119,20 @@ namespace oai::cn::nf::spgwu {
pfcp_associations
(
pfcp_associations
const
&
)
=
delete
;
void
operator
=
(
pfcp_associations
const
&
)
=
delete
;
bool
add_association
(
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
oai
::
cn
::
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
);
bool
add_association
(
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
oai
::
cn
::
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
,
oai
::
cn
::
core
::
pfcp
::
cp_function_features_s
&
function_features
);
bool
get_association
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
;
bool
get_association
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
;
bool
add_association
(
core
::
pfcp
::
node_id_t
&
node_id
,
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
);
bool
add_association
(
core
::
pfcp
::
node_id_t
&
node_id
,
core
::
pfcp
::
recovery_time_stamp_t
&
recovery_time_stamp
,
core
::
pfcp
::
cp_function_features_s
&
function_features
);
bool
get_association
(
const
core
::
pfcp
::
node_id_t
&
node_id
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
;
bool
get_association
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
,
std
::
shared_ptr
<
pfcp_association
>&
sa
)
const
;
void
notify_add_session
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
,
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
);
void
notify_del_session
(
const
oai
::
cn
::
core
::
pfcp
::
fseid_t
&
cp_fseid
);
void
notify_add_session
(
const
core
::
pfcp
::
node_id_t
&
node_id
,
const
core
::
pfcp
::
fseid_t
&
cp_fseid
);
void
notify_del_session
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
);
bool
add_peer_candidate_node
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
);
bool
add_peer_candidate_node
(
const
core
::
pfcp
::
node_id_t
&
node_id
);
void
restore_sx_sessions
(
const
oai
::
cn
::
core
::
pfcp
::
node_id_t
&
node_id
);
void
restore_sx_sessions
(
const
core
::
pfcp
::
node_id_t
&
node_id
);
void
initiate_heartbeat_request
(
oai
::
cn
::
core
::
itti
::
timer_id_t
timer_id
,
uint64_t
arg2_user
);
void
timeout_heartbeat_request
(
oai
::
cn
::
core
::
itti
::
timer_id_t
timer_id
,
uint64_t
arg2_user
);
void
initiate_heartbeat_request
(
core
::
itti
::
timer_id_t
timer_id
,
uint64_t
arg2_user
);
void
timeout_heartbeat_request
(
core
::
itti
::
timer_id_t
timer_id
,
uint64_t
arg2_user
);
void
handle_receive_heartbeat_response
(
const
uint64_t
trxn_id
);
};
...
...
src/spgwu/spgwu_sx.cpp
View file @
89d52393
...
...
@@ -225,7 +225,7 @@ spgwu_sx::spgwu_sx () : pfcp_l4_stack(std::string(inet_ntoa(spgwu_cfg.sx.addr4))
throw
std
::
runtime_error
(
"Cannot create task TASK_SPGWU_SX"
);
}
for
(
std
::
vector
<
oai
::
cn
::
core
::
pfcp
::
node_id_t
>::
const_iterator
it
=
spgwu_cfg
.
spgwcs
.
begin
();
it
!=
spgwu_cfg
.
spgwcs
.
end
();
++
it
)
{
for
(
std
::
vector
<
core
::
pfcp
::
node_id_t
>::
const_iterator
it
=
spgwu_cfg
.
spgwcs
.
begin
();
it
!=
spgwu_cfg
.
spgwcs
.
end
();
++
it
)
{
start_association
(
*
it
);
}
Logger
::
spgwu_sx
().
startup
(
"Started"
);
...
...
@@ -461,7 +461,7 @@ void spgwu_sx::start_association(const core::pfcp::node_id_t& node_id)
itti_sxab_association_setup_request
a
(
TASK_SPGWU_SX
,
TASK_SPGWU_SX
);
a
.
trxn_id
=
generate_trxn_id
();
oai
::
cn
::
core
::
pfcp
::
node_id_t
this_node_id
=
{};
core
::
pfcp
::
node_id_t
this_node_id
=
{};
if
(
spgwu_cfg
.
get_pfcp_node_id
(
this_node_id
)
==
RETURNok
)
{
a
.
pfcp_ies
.
set
(
this_node_id
);
core
::
pfcp
::
recovery_time_stamp_t
r
=
{.
recovery_time_stamp
=
(
uint32_t
)
recovery_time_stamp
};
...
...
@@ -482,13 +482,13 @@ void spgwu_sx::send_sx_msg(itti_sxab_association_setup_request& i)
send_request
(
i
.
r_endpoint
,
i
.
pfcp_ies
,
TASK_SPGWU_SX
,
i
.
trxn_id
);
}
//------------------------------------------------------------------------------
void
spgwu_sx
::
send_sx_msg
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
,
const
oai
::
cn
::
proto
::
pfcp
::
pfcp_session_report_request
&
s
)
void
spgwu_sx
::
send_sx_msg
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
,
const
proto
::
pfcp
::
pfcp_session_report_request
&
s
)
{
itti_sxab_session_report_request
isrr
(
TASK_SPGWU_SX
,
TASK_SPGWU_SX
);
isrr
.
trxn_id
=
generate_trxn_id
();
isrr
.
pfcp_ies
=
s
;
oai
::
cn
::
core
::
pfcp
::
node_id_t
this_node_id
=
{};
core
::
pfcp
::
node_id_t
this_node_id
=
{};
if
(
spgwu_cfg
.
get_pfcp_node_id
(
this_node_id
)
==
RETURNok
)
{
if
(
this_node_id
.
node_id_type
==
core
::
pfcp
::
NODE_ID_TYPE_IPV4_ADDRESS
)
{
//a.l_endpoint = boost::asio::ip::udp::endpoint(boost::asio::ip::address_v4(spgwu_cfg.sx.addr4), 0);
...
...
@@ -502,7 +502,7 @@ void spgwu_sx::send_sx_msg(const core::pfcp::fseid_t& cp_fseid, const oai::cn::p
//------------------------------------------------------------------------------
void
spgwu_sx
::
send_heartbeat_request
(
std
::
shared_ptr
<
pfcp_association
>&
a
)
{
oai
::
cn
::
proto
::
pfcp
::
pfcp_heartbeat_request
h
=
{};
proto
::
pfcp
::
pfcp_heartbeat_request
h
=
{};
core
::
pfcp
::
recovery_time_stamp_t
r
=
{.
recovery_time_stamp
=
(
uint32_t
)
recovery_time_stamp
};
h
.
set
(
r
);
...
...
@@ -521,7 +521,7 @@ void spgwu_sx::send_heartbeat_request(std::shared_ptr<pfcp_association>& a)
//------------------------------------------------------------------------------
void
spgwu_sx
::
send_heartbeat_response
(
const
boost
::
asio
::
ip
::
udp
::
endpoint
&
r_endpoint
,
const
uint64_t
trxn_id
)
{
oai
::
cn
::
proto
::
pfcp
::
pfcp_heartbeat_response
h
=
{};
proto
::
pfcp
::
pfcp_heartbeat_response
h
=
{};
core
::
pfcp
::
recovery_time_stamp_t
r
=
{.
recovery_time_stamp
=
(
uint32_t
)
recovery_time_stamp
};
h
.
set
(
r
);
send_response
(
r_endpoint
,
h
,
trxn_id
);
...
...
src/spgwu/spgwu_sx.hpp
View file @
89d52393
...
...
@@ -44,7 +44,7 @@ namespace oai::cn::nf::spgwu {
#define TASK_SPGWU_SX_TIMEOUT_ASSOCIATION_REQUEST (2)
class
spgwu_sx
:
public
oai
::
cn
::
proto
::
pfcp
::
pfcp_l4_stack
{
class
spgwu_sx
:
public
proto
::
pfcp
::
pfcp_l4_stack
{
private:
std
::
thread
::
id
thread_id
;
std
::
thread
thread
;
...
...
@@ -91,7 +91,7 @@ public:
void
send_sx_msg
(
core
::
itti
::
itti_sxab_session_deletion_response
&
s
);
void
send_sx_msg
(
core
::
itti
::
itti_sxab_session_report_request
&
s
)
{};
void
send_sx_msg
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
,
const
oai
::
cn
::
proto
::
pfcp
::
pfcp_session_report_request
&
s
);
void
send_sx_msg
(
const
core
::
pfcp
::
fseid_t
&
cp_fseid
,
const
proto
::
pfcp
::
pfcp_session_report_request
&
s
);
void
send_heartbeat_request
(
std
::
shared_ptr
<
pfcp_association
>&
a
);
void
send_heartbeat_response
(
const
boost
::
asio
::
ip
::
udp
::
endpoint
&
r_endpoint
,
const
uint64_t
trxn_id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment